Skip to contentSkip to conversation

natsemi.c NAPI

PATCH In review Harald Welte 3 participants 4 messages Sep 20, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 natsemi.c NAPI

Hi!

As announced before, here is the NAPI-patch for natsemi.c

My 266 MHz National Geode SC1100 (http://www.pcengines.ch/wrap.htm) with two natsemi chips can now forward 32kpps at (64bytes, 148kpps, single flow UDP input).

Any comments welcome, just like inclusion of this patch :)

drivers/net/Kconfig +16 -0
diff -Nru linux-2.6.9-rc1-plain/drivers/net/Kconfig linux-2.6.9-rc1-natsemi-napi/drivers/net/Kconfig
@@ -1534,6 +1534,22 @@
 	  and others, including the 83815 chip.
 	  More specific information and updates are available from
 	  <http://www.scyld.com/network/natsemi.html>.
+config NATSEMI_NAPI
+	bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
+	depends on NATSEMI && 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 N.
 
 config NE2K_PCI
 	tristate "PCI NE2000 and clones support (see help)"
drivers/net/natsemi.c +136 -51

287 lines not on this page · raw message

Signature · 3 lines
- Harald Welte <[email protected]>               http://www.gnumonks.org/
============================================================================
Programming is like sex: One mistake and you have to support it your lifetime
maintainer
#1 lore raw

drivers/net/natsemi.c line 786

Quoted 13 lines · On Mon, 20 Sep 2004 16:10:30 +0200 Harald Welte <[email protected]> wrote:
drivers/net/natsemi.c +13 -0
+static inline void natsemi_irq_enable(struct netdev_private *np)
+{
+	/* Enable interrupts by setting the interrupt mask. */
+	writel(DEFAULT_INTR, np->base_addr + IntrMask);
+	writel(1, np->base_addr + IntrEnable);
+	mb();
+}
+
+static inline void natsemi_irq_disable(struct netdev_private *np)
+{
+	writel(0, np->base_addr + IntrEnable);
+	mb();
+}

Kill the mb(), try using:

	readl(np->base_addr + IntrEnable);

in it's place.

This driver (before the NAPI patch) is a bit buggy, it does no RX processing SMP locking. So if one one cpu you're doing RX interrupt processing, and on another cpu tx_timeout() runs we're totally screwed.

This is not caused by Harald's patch, but there are implications for his NAPI patch once it is fixed.

#2 lore raw
Quoted 4 lines · David S. Miller

This driver (before the NAPI patch) is a bit buggy, it does no RX processing SMP locking. So if one one cpu you're doing RX interrupt processing, and on another cpu tx_timeout() runs we're totally screwed.

RX processing in current natsemi only happens in irq, and the natsemi driver properly disables irqs when it needs to, AFAICS, using enable/disable_irq().

Jeff

maintainer
#3 lore raw
Quoted 9 lines · On Mon, 20 Sep 2004 15:07:46 -0400 Jeff Garzik <[email protected]> wrote:
Quoted 4 lines · David S. Miller

This driver (before the NAPI patch) is a bit buggy, it does no RX processing SMP locking. So if one one cpu you're doing RX interrupt processing, and on another cpu tx_timeout() runs we're totally screwed.

RX processing in current natsemi only happens in irq, and the natsemi driver properly disables irqs when it needs to, AFAICS, using enable/disable_irq().

Aha, ok that works.