Skip to contentSkip to conversation

PATCH SB1250 NAPI support

PATCH Tom Rix 3 participants 4 messages Jun 4, 2006 – Jul 1, 2006 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Tom Rix

author
#3 lore raw
In reply to a message not in the archive

A while ago I submitted this patch for NAPI support for SB1250 / SB1480. I have tested it again on the recent (6/3/06) linux-mips kernel. Tom

Below is the original posting.

This patch adds NAPI support for the Broadcom Sibyte SB1xxx family. The changes are limited to adding a new config key SBMAC_NAPI to the drivers/ net/Kconfig and by adding the poll op and interrupt support to drivers/ net/sb1250-mac.c.

This patch also has a fix to drivers/net/sb1250-mac.c, the dma descriptor table ptr is allocated, aligned and the aligned ptr is freed. If the ptr was not already aligned (usually is) then the free would not work of what was returned by the kmalloc. A variable was added to store the unaligned pointer so that it could be properly freed.

I have tested this patch on a BCM91250A-SWARM Pass 2 / An.

Mark Mason from Broadcom was very helpful and tested this patch on at least a 1480.

Tom

Quoted 12 lines · Martin Michlmayr
Quoted 3 lines · Tom Rix

I am busy now but will get to it sometime.
It will require retesting with the latest kernel source. Is there a particular maintainer(s) that I should cc on this patch?

[email protected]

He just reminded people that the merge window for 2.6.18 will open soon (and that he's collecting patches for that already) so now would be an excellent time.

Thanks.

Signature · 1 line
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
drivers/net/Kconfig +21 -4
diff -rup a/drivers/net/Kconfig b/drivers/net/Kconfig
@@ -2008,10 +2008,6 @@ config R8169_NAPI
 
 	  If in doubt, say N.
 
-config NET_SB1250_MAC
-	tristate "SB1250 Ethernet support"
-	depends on SIBYTE_SB1xxx_SOC
-
 config R8169_VLAN
 	bool "VLAN support"
 	depends on R8169 && VLAN_8021Q
@@ -2021,6 +2017,27 @@ config R8169_VLAN
 	  
 	  If in doubt, say Y.
 
+config NET_SB1250_MAC
+	tristate "SB1250 Ethernet support"
+	depends on SIBYTE_SB1xxx_SOC
+
+config SBMAC_NAPI
+	bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
+	depends on NET_SB1250_MAC && EXPERIMENTAL
+	help
+	  NAPI is a new driver API designed to reduce CPU and interrupt load
+	  when the driver is receiving lots of packets from the card. It is
+	  still somewhat experimental and thus not yet enabled by default.
+
+	  If your estimated Rx load is 10kpps or more, or if the card will be
+	  deployed on potentially unfriendly networks (e.g. in a firewall),
+	  then say Y here.
+
+	  See <file:Documentation/networking/NAPI_HOWTO.txt> for more
+	  information.
+
+	  If in doubt, say y.
+
 config SIS190
 	tristate "SiS190/SiS191 gigabit ethernet support"
 	depends on PCI
drivers/net/sb1250-mac.c +98 -30

297 lines not on this page · raw message

#4 lore raw
Quoted 2 lines · Tom Rix

A while ago I submitted this patch for NAPI support for SB1250 / SB1480. I have tested it again on the recent (6/3/06) linux-mips kernel.

Are there any comments regarding this patch (apart from the fact that Tom forgot to include a Signed-off-by line). Can it go in when it's resent with a Signed-off-by line or does the patch have any other problems?

Signature · 2 lines
Martin Michlmayr
[email protected]
#5 lore raw
In reply to Tom Rix

Tom Rix <[email protected]> :
[...]

drivers/net/sb1250-mac.c +0 -0
diff -rup a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c

[...]
@@ -2079,13 +2095,31 @@ static irqreturn_t sbmac_intr(int irq,vo
* Transmits on channel 0
*/

+#if defined(CONFIG_SBMAC_NAPI)
if (isr & (M_MAC_INT_CHANNEL << S_MAC_TX_CH0)) {
- sbdma_tx_process(sc,&(sc->sbm_txdma));
+ sbdma_tx_process(sc,&(sc->sbm_txdma), 0);
}

/*
* Receives on channel 0
*/
+ if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) {
+ if (netif_rx_schedule_prep(dev))
+ {

An irq could appear here. I am skeptical that it is safe to write the irq mask register so late.

One should probably consider a break in the enclosing "for" loop too.

+ __raw_writeq(0, sc->sbm_imr);
+ __netif_rx_schedule(dev);
+ }
+ else
+ {

} else {, please.

Signature · 1 line
Ueimor
author
#6 lore raw

Here is a revised patch that does the interupt masking earlier. Since resetting the mask is done now in 3 places, I created a macro to handle it. This patch has been tested on the linux-mips kernel from 6/29/06 on a sb1250. Tom

Quoted 35 lines · Francois Romieu

Tom Rix <[email protected]> :
[...]
diff -rup a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c

drivers/net/sb1250-mac.c +5 -1
[...]
@@ -2079,13 +2095,31 @@ static irqreturn_t sbmac_intr(int irq,vo
 		 * Transmits on channel 0
 		 */
+#if defined(CONFIG_SBMAC_NAPI)
 		if (isr & (M_MAC_INT_CHANNEL << S_MAC_TX_CH0)) {
-			sbdma_tx_process(sc,&(sc->sbm_txdma));
+			sbdma_tx_process(sc,&(sc->sbm_txdma), 0);
 		}
 		/*
 		 * Receives on channel 0
 		 */
+		if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) {
+			if (netif_rx_schedule_prep(dev))
+			{
 

An irq could appear here. I am skeptical that it is safe to write the irq mask register so late.

One should probably consider a break in the enclosing "for" loop too.

drivers/net/sb1250-mac.c +5 -0
+				__raw_writeq(0, sc->sbm_imr);
+				__netif_rx_schedule(dev);
+			}
+			else
+			{

} else {, please.

Signature · 1 line
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
drivers/net/Kconfig +21 -4
@@ -2013,10 +2013,6 @@ config R8169_NAPI
 
 	  If in doubt, say N.
 
-config NET_SB1250_MAC
-	tristate "SB1250 Ethernet support"
-	depends on SIBYTE_SB1xxx_SOC
-
 config R8169_VLAN
 	bool "VLAN support"
 	depends on R8169 && VLAN_8021Q
@@ -2026,6 +2022,27 @@ config R8169_VLAN
 	  
 	  If in doubt, say Y.
 
+config NET_SB1250_MAC
+	tristate "SB1250 Ethernet support"
+	depends on SIBYTE_SB1xxx_SOC
+
+config SBMAC_NAPI
+	bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
+	depends on NET_SB1250_MAC && EXPERIMENTAL
+	help
+	  NAPI is a new driver API designed to reduce CPU and interrupt load
+	  when the driver is receiving lots of packets from the card. It is
+	  still somewhat experimental and thus not yet enabled by default.
+
+	  If your estimated Rx load is 10kpps or more, or if the card will be
+	  deployed on potentially unfriendly networks (e.g. in a firewall),
+	  then say Y here.
+
+	  See <file:Documentation/networking/NAPI_HOWTO.txt> for more
+	  information.
+
+	  If in doubt, say y.
+
 config SIS190
 	tristate "SiS190/SiS191 gigabit ethernet support"
 	depends on PCI
drivers/net/sb1250-mac.c +109 -41

316 lines not on this page · raw message