NAPI support for Sibyte MAC
Subsystems (3)
PATCH 1/1 NAPI support for Sibyte MAC
[ This is a re-post, but the patch still applies and works fine against the linux-mips.org tip. We'd really like to get this in. -Mark]
This patch completes the NAPI functionality for SB1250 MAC, including making NAPI a kernel option that can be turned on or off and adds the "sbmac_poll" routine.
Signed off by: Mark Mason ([email protected]) Signed off by: Dan Krejsa ([email protected]) Signed off by: Steve Yang ([email protected])
drivers/net/Kconfig +19 -0
@@ -2031,6 +2031,23 @@ tristate "SB1250 Ethernet support" depends on SIBYTE_SB1xxx_SOC +config SBMAC_NAPI + bool "SBMAC: 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 R8169_VLAN bool "VLAN support" depends on R8169 && VLAN_8021Q
@@ -2826,3 +2843,5 @@ def_bool NETPOLL endmenu + +
drivers/net/sb1250-mac.c +207 -65
532 lines not on this page · raw message
arch/mips/sibyte/bcm1480/irq.c +2 -2
@@ -144,11 +144,11 @@unsigned long flags;unsigned int irq_dirty; - i =first_cpu (mask); -if (next_cpu (i, mask) <=NR_CPUS ) { +if (cpus_weight (mask) !=1 ) {printk ("attempted to set irq affinity for irq %d to multiple CPUs\n" , irq);return ; } + i =first_cpu (mask);/* Convert logical CPU to physical CPU */ cpu =cpu_logical_map (i);
Quoted 8 lines · you
This patch completes the NAPI functionality for SB1250 MAC, including making NAPI a kernel option that can be turned on or off and adds the "
sbmac_poll" routine.Index: linux-2.6.14-cgl/drivers/net/Kconfig
===================================================================drivers/net/Kconfig +0
-0
[...]
drivers/net/Kconfig line 2153
Quoted 13 lines
drivers/net/Kconfig +7
-1@@ -2075,12 +2143,52 @@ */ 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); +#ifdef CONFIG_NETPOLL_TRAP + if (netpoll_trap()) { + if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state)) + __netif_schedule(dev); + } +#endif }
This just doesn't make sense. That option is enabled to *prevent* calls to__netif_schedule() -- you can't override it that way. (Well, how it works currently, doesn't make much sense either since it totally breaks the TX queue control -- I was going to post a patch).
Quoted 28 lines
drivers/net/Kconfig +25
-1+ if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) { + if (netif_rx_schedule_prep(dev)) { + __raw_writeq(0, sc->sbm_imr); + __netif_rx_schedule(dev); + /* Depend on the exit from poll to reenable intr */ + } + else { + /* may leave some packets behind */ + sbdma_rx_process(sc,&(sc->sbm_rxdma), + SBMAC_MAX_RXDESCR * 2, 0); + } + } +#else + /* Non NAPI */ + for (;;) { + /* - * Receives on channel 0 + * Read the ISR (this clears the bits in the real + * register, except for counter addr) */ + isr = __raw_readq(sc->sbm_isr) & ~M_MAC_COUNTER_ADDR; + + if (isr == 0) + break; + + handled = 1; +
drivers/net/Kconfig line 2190
Quoted 10 lines
drivers/net/Kconfig +10
-0+ if (isr & (M_MAC_INT_CHANNEL << S_MAC_TX_CH0)) { + sbdma_tx_process(sc,&(sc->sbm_txdma), + SBMAC_MAX_RXDESCR * 2); +#ifdef CONFIG_NETPOLL_TRAP + if (netpoll_trap()) { + if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state)) + __netif_schedule(dev); + } +#endif + }
Same here.
WBR, Sergei
Hello,
Quoted 6 lines
-----Original Message-----
From: Sergei Shtylyov [mailto:[email protected]]
Sent: Saturday, March 24, 2007 12:49 PM
To: Mark E Mason
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] NAPI support for Sibyte MAC
[snip]
Quoted 10 lines
drivers/net/sb1250-mac.c line 2149
Quoted 9 lines
drivers/net/sb1250-mac.c +4
-1@@ -2075,12 +2143,52 @@*/ 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 ); +#ifdef CONFIG_NETPOLL_TRAP +if (netpoll_trap ()) { + if(
test_and_clear_bit(__LINK_STATE_XOFF, &dev->state))
Quoted 12 lines
drivers/net/sb1250-mac.c line 2153
Quoted 4 lines
drivers/net/sb1250-mac.c +3
-0+ __netif_schedule(dev); + } +#endif }This just doesn't make sense. That option is enabled to
*prevent* calls to__netif_schedule()-- you can't override it that way. (Well, how it works
currently, doesn't make much sense either since it totally breaks the TX queue
control -- I was going to post a patch).
I'll admit - this was just copied over from the non-NAPI version we started with ;-).
Are you saying that the #ifdef test should simply be an #ifndef here?
[I'm working on a revised patch based on feedback from Ralf and others which removes the Kconfig option for NAPI - it'll just be on, all the time.]
Thanks,
Mark