[PATCH] Broadcom Sibyte SB1xxx NAPI ethernet support

2006-03-19 Thread Tom Rix

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





--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/diff -rup a/drivers/net/Kconfig b/drivers/net/Kconfig
--- a/drivers/net/Kconfig   2006-03-09 04:25:38.0 -0600
+++ b/drivers/net/Kconfig   2006-03-09 05:30:48.0 -0600
@@ -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  for more
+ information.
+
+ If in doubt, say y.
+
 config SIS190
tristate "SiS190/SiS191 gigabit ethernet support"
depends on PCI
diff -rup a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
--- a/drivers/net/sb1250-mac.c  2006-03-09 04:25:41.0 -0600
+++ b/drivers/net/sb1250-mac.c  2006-03-09 05:30:52.0 -0600
@@ -209,6 +209,7 @@ typedef struct sbmacdma_s {
 * This stuff is for maintenance of the ring
 */
 
+   sbdmadscr_t *sbdma_dscrtable_unaligned; 
sbdmadscr_t *sbdma_dscrtable;   /* base of descriptor table */
sbdmadscr_t *sbdma_dscrtable_end; /* end of descriptor table */
 
@@ -291,8 +292,8 @@ static int sbdma_add_rcvbuffer(sbmacdma_
 static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *m);
 static void sbdma_emptyring(sbmacdma_t *d);
 static void sbdma_fillring(sbmacdma_t *d);
-static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d);
-static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d);
+static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll);
+static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll);
 static int sbmac_initctx(struct sbmac_softc *s);
 static void sbmac_channel_start(struct sbmac_softc *s);
 static void sbmac_channel_stop(struct sbmac_softc *s);
@@ -313,6 +314,10 @@ static struct net_device_stats *sbmac_ge
 static void sbmac_set_rx_mode(struct net_device *dev);
 static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static int sbmac_close(struct net_device *dev);
+#if defined (CONFIG_SBMAC_NAPI)
+static int sbmac_poll(struct net_device *poll_dev, int *budget);
+#endif
+
 static int sbmac_mii_poll(struct sbmac_softc *s,int noisy);
 static int sbmac_mii_probe(struct net_device *dev);
 
@@ -740,7 +745,7 @@ static void sbdma_initctx(sbmacdma_t *d,
 
d->sbdma_maxdescr = maxdescr;
 
-   d->sbdma_dscrtable = (sbdmadscr_t *)
+   d->sbdma_dscrtable_unaligned = d->sbdma_dscrtable = (sbdmadscr_t *)
kmalloc((d->sbdma_maxdescr+1)*sizeof(sbdmadscr_t), GFP_KERNEL);
 
/*
@@ -782,7 +787,6 @@ static void sbdma_initctx(sbmacdma_t *d,
d->sbdma_int_timeout = 0;
}
 #endif
-
 }
 
 /**
@@ -1150,13 +1154,14 @@ static void sbdma_fillring(sbmacdma_t *d
  *nothing
  * */
 
-static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d)
+static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll)
 {
int curidx;
int hwidx;
sbdmadscr_t *dsc;
struct sk_buff *sb;
int len;
+   int work_done = 0;
 
for (;;) {
/*
@@ -1234,8 +1239,15 @@ static void sbdma_rx_process(struct sbma
sb->ip_summed = CHECKSUM_NONE;
  

Re: [PATCH] Broadcom Sibyte SB1xxx NAPI ethernet support

2006-03-19 Thread Lennert Buytenhek
On Sun, Mar 19, 2006 at 05:12:32PM -0600, Tom Rix wrote:

> 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.

Can you submit that as a separate patch?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Broadcom Sibyte SB1xxx NAPI ethernet support

2006-03-21 Thread Tom Rix

Yes.
They are soon to follow.
Tom

On Sun, 19 Mar 2006 17:08:23 -0600, Lennert Buytenhek  
<[EMAIL PROTECTED]> wrote:



On Sun, Mar 19, 2006 at 05:12:32PM -0600, Tom Rix wrote:

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.


Can you submit that as a separate patch?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Broadcom Sibyte SB1xxx NAPI ethernet support

2006-03-21 Thread Tom Rix

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.

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

On Sun, 19 Mar 2006 17:08:23 -0600, Lennert Buytenhek  
<[EMAIL PROTECTED]> wrote:



On Sun, Mar 19, 2006 at 05:12:32PM -0600, Tom Rix wrote:

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.


Can you submit that as a separate patch?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

mips-sb1250-mac-NAPI-4.patch
Description: Binary data