All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Netpoll support for Sibyte MAC
@ 2007-03-19 22:43 Deepak Saxena
  2007-03-20  1:22 ` Atsushi Nemoto
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Deepak Saxena @ 2007-03-19 22:43 UTC (permalink / raw)
  To: netdev; +Cc: ralf, jeff, linux-mips, Manish Lachwani


NETPOLL support for Sibyte MAC

Signed-off-by: Manish Lachwani <mlachwani@mvista.com>
Signed-off-by: Deepak Saxena <dsaxena@mvista.com>

---

 Applies cleanly to 2.6.21-rc4

 drivers/net/sb1250-mac.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+)

Index: linux-2.6.18/drivers/net/sb1250-mac.c
===================================================================
--- linux-2.6.18.orig/drivers/net/sb1250-mac.c
+++ linux-2.6.18/drivers/net/sb1250-mac.c
@@ -1128,6 +1128,26 @@ static void sbdma_fillring(sbmacdma_t *d
 	}
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void sbmac_netpoll(struct net_device *netdev)
+{
+	struct sbmac_softc *sc = netdev_priv(netdev);
+	int irq = sc->sbm_dev->irq;
+
+	__raw_writeq(0, sc->sbm_imr);
+
+	sbmac_intr(irq, netdev, NULL);
+
+#ifdef CONFIG_SBMAC_COALESCE
+	__raw_writeq(((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) |
+	((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0),
+	sc->sbm_imr);
+#else
+	__raw_writeq((M_MAC_INT_CHANNEL << S_MAC_TX_CH0) | 
+	(M_MAC_INT_CHANNEL << S_MAC_RX_CH0), sc->sbm_imr);
+#endif
+}
+#endif
 
 /**********************************************************************
  *  SBDMA_RX_PROCESS(sc,d)
@@ -2402,6 +2422,9 @@ static int sbmac_init(struct net_device 
 	dev->watchdog_timeo     = TX_TIMEOUT;
 
 	dev->change_mtu         = sb1250_change_mtu;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	dev->poll_controller = sbmac_netpoll;
+#endif
 
 	/* This is needed for PASS2 for Rx H/W checksum feature */
 	sbmac_set_iphdr_offset(sc);

-- 
Deepak Saxena - dsaxena@plexity.net - http://www.plexity.net

In the end, they will not say, "those were dark times,"  they will ask
"why were their poets silent?" - Bertolt Brecht

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Netpoll support for Sibyte MAC
  2007-03-19 22:43 [PATCH] Netpoll support for Sibyte MAC Deepak Saxena
@ 2007-03-20  1:22 ` Atsushi Nemoto
  2007-03-20 18:35   ` Sergei Shtylyov
  2007-03-20 13:38 ` Ralf Baechle
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Atsushi Nemoto @ 2007-03-20  1:22 UTC (permalink / raw)
  To: dsaxena; +Cc: netdev, ralf, jeff, linux-mips, mlachwani

On Mon, 19 Mar 2007 15:43:11 -0700, Deepak Saxena <dsaxena@plexity.net> wrote:
> NETPOLL support for Sibyte MAC
> 
> Signed-off-by: Manish Lachwani <mlachwani@mvista.com>
> Signed-off-by: Deepak Saxena <dsaxena@mvista.com>

If you added NETPOLL support, do not forget to ensure hard_start_xmit
routine callable from interrupt context (or irq disabled).
See commit bce305f4fe779f29d99d414685243f5da0803254 for example.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Netpoll support for Sibyte MAC
  2007-03-19 22:43 [PATCH] Netpoll support for Sibyte MAC Deepak Saxena
  2007-03-20  1:22 ` Atsushi Nemoto
@ 2007-03-20 13:38 ` Ralf Baechle
  2007-03-20 14:34 ` Sergei Shtylyov
  2007-03-23  5:58 ` Jeff Garzik
  3 siblings, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2007-03-20 13:38 UTC (permalink / raw)
  To: Deepak Saxena; +Cc: netdev, jeff, linux-mips, Manish Lachwani

On Mon, Mar 19, 2007 at 03:43:11PM -0700, Deepak Saxena wrote:

> +#ifdef CONFIG_SBMAC_COALESCE

Not your patch's fault but ...  CONFIG_SBMAC_COALESCE is being defined
in sb1250-mac.c but the CONFIG_* namespace is reserved for kconfig.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Netpoll support for Sibyte MAC
  2007-03-19 22:43 [PATCH] Netpoll support for Sibyte MAC Deepak Saxena
  2007-03-20  1:22 ` Atsushi Nemoto
  2007-03-20 13:38 ` Ralf Baechle
@ 2007-03-20 14:34 ` Sergei Shtylyov
  2007-03-23  5:58 ` Jeff Garzik
  3 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2007-03-20 14:34 UTC (permalink / raw)
  To: dsaxena; +Cc: netdev, ralf, jeff, linux-mips, Manish Lachwani

Hello.

Deepak Saxena wrote:

> NETPOLL support for Sibyte MAC

> Index: linux-2.6.18/drivers/net/sb1250-mac.c
> ===================================================================
> --- linux-2.6.18.orig/drivers/net/sb1250-mac.c
> +++ linux-2.6.18/drivers/net/sb1250-mac.c
> @@ -1128,6 +1128,26 @@ static void sbdma_fillring(sbmacdma_t *d
>  	}
>  }
>  
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> +static void sbmac_netpoll(struct net_device *netdev)
> +{
> +	struct sbmac_softc *sc = netdev_priv(netdev);
> +	int irq = sc->sbm_dev->irq;
> +
> +	__raw_writeq(0, sc->sbm_imr);
> +

    Thinking about it again, I'm not sure that blindly writing to the chip 
reg. to mask interrupts is SMP-safe enough (versus disable_irq()).  I know why 
it was done this way -- to quell the BUG emitted in the realtime mode on SMP 
-- because of scheduling with disabled interrupts in synchoronize_irq(), but 
after having spent much time on netpoll, I'm no longer sure that anything but 
disable_irq() is safe enough for SMP since -- otherwise there's no warranty 
that sbmac_intr() is not running on another CPU...

> +	sbmac_intr(irq, netdev, NULL);
> +
> +#ifdef CONFIG_SBMAC_COALESCE
> +	__raw_writeq(((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) |
> +	((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0),
> +	sc->sbm_imr);
> +#else
> +	__raw_writeq((M_MAC_INT_CHANNEL << S_MAC_TX_CH0) | 
> +	(M_MAC_INT_CHANNEL << S_MAC_RX_CH0), sc->sbm_imr);
> +#endif
> +}
> +#endif

WBR, Sergei

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Netpoll support for Sibyte MAC
  2007-03-20  1:22 ` Atsushi Nemoto
@ 2007-03-20 18:35   ` Sergei Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2007-03-20 18:35 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: dsaxena, netdev, ralf, jeff, linux-mips, mlachwani

Hello.

Atsushi Nemoto wrote:

>>NETPOLL support for Sibyte MAC

>>Signed-off-by: Manish Lachwani <mlachwani@mvista.com>
>>Signed-off-by: Deepak Saxena <dsaxena@mvista.com>

> If you added NETPOLL support, do not forget to ensure hard_start_xmit
> routine callable from interrupt context (or irq disabled).
> See commit bce305f4fe779f29d99d414685243f5da0803254 for example.

    You're absolutely right: this driver is very likely to blow up the caller 
when called with interrupts disabled -- it uses spin_unlock_irq() there! This 
*must* be fixed.

> ---
> Atsushi Nemoto

WBR, Sergei

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Netpoll support for Sibyte MAC
  2007-03-19 22:43 [PATCH] Netpoll support for Sibyte MAC Deepak Saxena
                   ` (2 preceding siblings ...)
  2007-03-20 14:34 ` Sergei Shtylyov
@ 2007-03-23  5:58 ` Jeff Garzik
  3 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2007-03-23  5:58 UTC (permalink / raw)
  To: dsaxena; +Cc: netdev, ralf, linux-mips, Manish Lachwani

Deepak Saxena wrote:
> NETPOLL support for Sibyte MAC
> 
> Signed-off-by: Manish Lachwani <mlachwani@mvista.com>
> Signed-off-by: Deepak Saxena <dsaxena@mvista.com>

applied



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-03-23  5:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-19 22:43 [PATCH] Netpoll support for Sibyte MAC Deepak Saxena
2007-03-20  1:22 ` Atsushi Nemoto
2007-03-20 18:35   ` Sergei Shtylyov
2007-03-20 13:38 ` Ralf Baechle
2007-03-20 14:34 ` Sergei Shtylyov
2007-03-23  5:58 ` Jeff Garzik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.