linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* REQ: BCM4400 network driver for 2.4.22
@ 2003-07-09 21:34 Bas Mevissen
  2003-07-09 22:05 ` Jeff Garzik
  0 siblings, 1 reply; 7+ messages in thread
From: Bas Mevissen @ 2003-07-09 21:34 UTC (permalink / raw)
  To: torvalds, alan; +Cc: linux-kernel


Hi Linus, Alan, all,

Is the BCM4400 network driver planned for 2.4.22? It is in 2.4.22-pre3-ac1, 
but not in 2.4.22-pre3.

As far as I can tell, it works fine. If needed, I can do some more testing.

I hope it can be included in the mainstream 2.4. It saves me (and a lot of 
other people) the trouble of using an external driver.

Regards,

Bas.
(Dell Inspiron 8500 with 2.4.22-pre3)


(Note: I'm not on the list, so please always CC me)



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

* Re: REQ: BCM4400 network driver for 2.4.22
  2003-07-09 21:34 REQ: BCM4400 network driver for 2.4.22 Bas Mevissen
@ 2003-07-09 22:05 ` Jeff Garzik
  2003-07-11 16:33   ` Pekka Pietikainen
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2003-07-09 22:05 UTC (permalink / raw)
  To: Bas Mevissen; +Cc: torvalds, alan, linux-kernel

Bas Mevissen wrote:
> Hi Linus, Alan, all,
> 
> Is the BCM4400 network driver planned for 2.4.22? It is in 2.4.22-pre3-ac1, 
> but not in 2.4.22-pre3.
> 
> As far as I can tell, it works fine. If needed, I can do some more testing.
> 
> I hope it can be included in the mainstream 2.4. It saves me (and a lot of 
> other people) the trouble of using an external driver.


b44 in 2.5 supports this, and it will be backported to 2.4.

Pekka Pietikainen just identified several bugs, so those will get fixed 
in the next day or so, then b44 will be sent to Marcelo.

	Jeff




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

* Re: REQ: BCM4400 network driver for 2.4.22
  2003-07-09 22:05 ` Jeff Garzik
@ 2003-07-11 16:33   ` Pekka Pietikainen
  2003-07-11 16:58     ` Jeff Garzik
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Pekka Pietikainen @ 2003-07-11 16:33 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Bas Mevissen, torvalds, alan, linux-kernel

On Wed, Jul 09, 2003 at 06:05:08PM -0400, Jeff Garzik wrote:
> b44 in 2.5 supports this, and it will be backported to 2.4.
> 
> Pekka Pietikainen just identified several bugs, so those will get fixed 
> in the next day or so, then b44 will be sent to Marcelo.
Hi

Here's a patch against the driver version in 2.5.73 for testing/comments,
which fixes all the issues I know of in the driver. I'm writing this mail
through the driver running on 2.4.x, so obviously at least basic 
functionality is working.

I'm not too sure about the pointer tricks I do with skb->data
in b44_rx(), but they seem to do the trick just fine ;)

--- /stuff/src/linux-2.5.73/drivers/net/b44.c	2003-06-22 21:32:43.000000000 +0300
+++ b44.c	2003-07-11 19:17:06.000000000 +0300
@@ -1,6 +1,7 @@
 /* b44.c: Broadcom 4400 device driver.
  *
  * Copyright (C) 2002 David S. Miller (davem@redhat.com)
+ * Fixed by Pekka Pietikainen (pp@netppl.fi)
  */
 
 #include <linux/kernel.h>
@@ -23,8 +24,8 @@
 
 #define DRV_MODULE_NAME		"b44"
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"0.6"
-#define DRV_MODULE_RELDATE	"Nov 11, 2002"
+#define DRV_MODULE_VERSION	"0.6-pp"
+#define DRV_MODULE_RELDATE	"Jul 11, 2003"
 
 #define B44_DEF_MSG_ENABLE	  \
 	(NETIF_MSG_DRV		| \
@@ -78,6 +79,16 @@
 
 static int b44_debug = -1;	/* -1 == use B44_DEF_MSG_ENABLE as value */
 
+#ifndef PCI_DEVICE_ID_BCM4401
+#define PCI_DEVICE_ID_BCM4401      0x4401
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#ifndef IRQ_RETVAL
+#define IRQ_RETVAL(x) 
+#define irqreturn_t void
+#endif
+
 static struct pci_device_id b44_pci_tbl[] __devinitdata = {
 	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
@@ -521,7 +532,7 @@
 			/* Link now up */
 			netif_carrier_on(bp->dev);
 			b44_link_report(bp);
-		} else if (netif_carrier_ok(bp->dev)) {
+		} else if (netif_carrier_ok(bp->dev) && !(bmsr & BMSR_LSTATUS)) {
 			/* Link now down */
 			netif_carrier_off(bp->dev);
 			b44_link_report(bp);
@@ -660,9 +671,12 @@
 	ctrl = src_desc->ctrl;
 	if (dest_idx == (B44_RX_RING_SIZE - 1))
 		ctrl |= cpu_to_le32(DESC_CTRL_EOT);
+	else
+		ctrl &= ~DESC_CTRL_EOT;
 
 	dest_desc->ctrl = ctrl;
 	dest_desc->addr = src_desc->addr;
+	src_map->skb = NULL;
 }
 
 static int b44_rx(struct b44 *bp, int budget)
@@ -685,8 +699,10 @@
 		pci_dma_sync_single(bp->pdev, map,
 				    RX_PKT_BUF_SZ,
 				    PCI_DMA_FROMDEVICE);
-		rh = (struct rx_header *) (skb->data - bp->rx_offset);
+		rh = (struct rx_header *) (skb->data);
 		len = cpu_to_le16(rh->len);
+		skb->data+=bp->rx_offset;
+
 		if ((len > (RX_PKT_BUF_SZ - bp->rx_offset)) ||
 		    (rh->flags & cpu_to_le16(RX_FLAG_ERRORS))) {
 		drop_it:
@@ -733,6 +749,7 @@
 			/* DMA sync done above */
 			memcpy(copy_skb->data, skb->data, len);
 
+			skb->data-=bp->rx_offset;
 			skb = copy_skb;
 		}
 		skb->ip_summed = CHECKSUM_NONE;
@@ -748,6 +765,7 @@
 	}
 
 	bp->rx_cons = cons;
+	bw32(B44_DMARX_PTR, cons * sizeof(struct dma_desc));
 
 	return received;
 }
@@ -885,7 +903,7 @@
 		ctrl |= DESC_CTRL_EOT;
 
 	bp->tx_ring[entry].ctrl = cpu_to_le32(ctrl);
-	bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping);
+	bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping+bp->dma_offset);
 
 	entry = NEXT_TX(entry);
 
@@ -1173,8 +1191,8 @@
 	__b44_set_rx_mode(bp->dev);
 
 	/* MTU + eth header + possible VLAN tag + struct rx_header */
-	bw32(B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + 24);
-	bw32(B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + 24);
+	bw32(B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
+	bw32(B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
 
 	bw32(B44_TX_WMARK, 56); /* XXX magic */
 	bw32(B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
@@ -1184,6 +1202,7 @@
 	bw32(B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
 
 	bw32(B44_DMARX_PTR, bp->rx_pending);
+	bp->rx_prod = bp->rx_pending;	
 
 	bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
 
@@ -1345,6 +1364,8 @@
 			__b44_load_mcast(bp, dev);
 
 		bw32(B44_RXCONFIG, val);
+		val = br32(B44_CAM_CTRL);
+		bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
 	}
 }
 
@@ -1678,8 +1699,9 @@
 	bp->core_unit = ssb_core_unit(bp);
 	bp->dma_offset = ssb_get_addr(bp, SBID_PCI_DMA, 0);
 
-	bp->flags |= B44_FLAG_BUGGY_TXPTR;
-
+	/* XXX - really required? 
+	   bp->flags |= B44_FLAG_BUGGY_TXPTR;
+         */
 out:
 	return err;
 }
--- /stuff/src/linux-2.5.73/drivers/net/b44.h	2003-06-22 21:32:57.000000000 +0300
+++ b44.h	2003-07-09 18:28:15.000000000 +0300
@@ -142,7 +142,7 @@
 #define  MDIO_OP_READ		2
 #define  MDIO_DATA_SB_MASK	0xc0000000 /* Start Bits */
 #define  MDIO_DATA_SB_SHIFT	30
-#define  MDIO_DATA_SB_START	0x10000000 /* Start Of Frame */
+#define  MDIO_DATA_SB_START	0x40000000 /* Start Of Frame */
 #define B44_EMAC_IMASK	0x0418UL /* EMAC Interrupt Mask */
 #define B44_EMAC_ISTAT	0x041CUL /* EMAC Interrupt Status */
 #define  EMAC_INT_MII		0x00000001 /* MII MDIO Interrupt */


-- 
Pekka Pietikainen





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

* Re: REQ: BCM4400 network driver for 2.4.22
  2003-07-11 16:33   ` Pekka Pietikainen
@ 2003-07-11 16:58     ` Jeff Garzik
  2003-07-11 20:04     ` Pekka Pietikainen
  2003-07-12  3:24     ` David S. Miller
  2 siblings, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2003-07-11 16:58 UTC (permalink / raw)
  To: Pekka Pietikainen; +Cc: Bas Mevissen, torvalds, alan, linux-kernel

On Fri, Jul 11, 2003 at 07:33:45PM +0300, Pekka Pietikainen wrote:
> On Wed, Jul 09, 2003 at 06:05:08PM -0400, Jeff Garzik wrote:
> > b44 in 2.5 supports this, and it will be backported to 2.4.
> > 
> > Pekka Pietikainen just identified several bugs, so those will get fixed 
> > in the next day or so, then b44 will be sent to Marcelo.
> Hi
> 
> Here's a patch against the driver version in 2.5.73 for testing/comments,
> which fixes all the issues I know of in the driver. I'm writing this mail
> through the driver running on 2.4.x, so obviously at least basic 
> functionality is working.
> 
> I'm not too sure about the pointer tricks I do with skb->data
> in b44_rx(), but they seem to do the trick just fine ;)

You rule, dude.  I'll give it a test here, too.

I've already merged a couple of your fixes locally, I'll suck the rest
of this patch into my queue ASAP.

If others could test this, that is much appreciated too.

	Jeff




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

* Re: REQ: BCM4400 network driver for 2.4.22
  2003-07-11 16:33   ` Pekka Pietikainen
  2003-07-11 16:58     ` Jeff Garzik
@ 2003-07-11 20:04     ` Pekka Pietikainen
  2003-07-12  3:24     ` David S. Miller
  2 siblings, 0 replies; 7+ messages in thread
From: Pekka Pietikainen @ 2003-07-11 20:04 UTC (permalink / raw)
  To: linux-kernel

On Fri, Jul 11, 2003 at 07:33:45PM +0300, Pekka Pietikainen wrote:
> Here's a patch against the driver version in 2.5.73 for testing/comments,
> which fixes all the issues I know of in the driver. I'm writing this mail
> through the driver running on 2.4.x, so obviously at least basic 
> functionality is working.
> 
> I'm not too sure about the pointer tricks I do with skb->data
> in b44_rx(), but they seem to do the trick just fine ;)
Two kinds of oopses uncovered in a bit heavier
testing, one doesn't mention b44 anywhere but it's very likely caused by 
something in the driver:

kernel BUG at slab.c:1228!
invalid operand: 0000
b44 ipt_TCPMSS ipt_tcpmss ipt_MASQUERADE iptable_nat ip_conntrack
parport_pc lp
parport iptable_filter ip_tables
autofs ppp_synctty ppp_async ppp_generic slhc
CPU:    0
EIP:    0060:[<c0137eb4>]    Not tainted
EFLAGS: 00010046
 
EIP is at kmem_extra_free_checks [kernel] 0x64 (2.4.20-20.1.2013.nptl)
eax: 00000000   ebx: 00000000   ecx: 00000800   edx: 00000000
esi: dbe3f14c   edi: dbe3e000   ebp: dbe3e000   esp: d9811dac
ds: 0068   es: 0068   ss: 0068
Process pppoe (pid: 6437, stackpage=d9811000)
Stack: dbe3e000 dbe3e000 dbe3e800 dbe3f14c c0138913 dffc56f0
dbe3f14c dbe3e000
       0053aba0 dbe3e000 00000286 dbeb47c0 c013803b dffc56f0
dbe3e000 dbeef7e8
       c01e9150 d9811ec8 c01ea263 dbe3e000 dbeef7e8 dbeef7e8
c01ea3ed dbeef7e8
Call Trace:   [<c0138913>] kmem_cache_free_one [kernel] 0xf3 (0xd9811dbc)
[<c013803b>] kfree [kernel] 0x5b (0xd9811ddc)
[<c01e9150>] sock_rfree [kernel] 0x0 (0xd9811dec)
[<c01ea263>] kfree_skbmem [kernel] 0x13 (0xd9811df4)
[<c01ea3ed>] __kfree_skb [kernel] 0x12d (0xd9811e04)
[<c0243507>] packet_recvmsg [kernel] 0x127 (0xd9811e1c)
[<c01e6a08>] sock_recvmsg [kernel] 0x58 (0xd9811e4c)
[<c01e678c>] sockfd_lookup [kernel] 0x1c (0xd9811e80)
[<c01e7af4>] sys_recvfrom [kernel] 0xb4 (0xd9811e94)
[<c0182046>] normal_poll [kernel] 0x106 (0xd9811ee8)
[<c015197a>] poll_freewait [kernel] 0x3a (0xd9811f10)
[<c0138913>] kmem_cache_free_one [kernel] 0xf3 (0xd9811f24)
[<c01e7b97>] sys_recv [kernel] 0x37 (0xd9811f64)
[<c01e831a>] sys_socketcall [kernel] 0x15a (0xd9811f80)
[<c01097ff>] system_call [kernel] 0x33 (0xd9811fc0)

and also something that looked like an assertion failure in skb handling
in b44_rx, but couldn't see fully due to having a 80x25 terminal and
scrolling not working either... 

That and 2.5.75 complains that irq are disabled in local_bh_enable(),
looks like the locking in b44_poll will need to be adjusted a bit.

Oh well, we're getting there ;)
-- 
Pekka Pietikainen





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

* Re: REQ: BCM4400 network driver for 2.4.22
  2003-07-11 16:33   ` Pekka Pietikainen
  2003-07-11 16:58     ` Jeff Garzik
  2003-07-11 20:04     ` Pekka Pietikainen
@ 2003-07-12  3:24     ` David S. Miller
  2003-07-14 20:12       ` Pekka Pietikainen
  2 siblings, 1 reply; 7+ messages in thread
From: David S. Miller @ 2003-07-12  3:24 UTC (permalink / raw)
  To: Pekka Pietikainen; +Cc: linux-kernel, jgarzik

On Fri, 11 Jul 2003 19:33:45 +0300
Pekka Pietikainen <pp@netppl.fi> wrote:

> @@ -660,9 +671,12 @@
>  	ctrl = src_desc->ctrl;
>  	if (dest_idx == (B44_RX_RING_SIZE - 1))
>  		ctrl |= cpu_to_le32(DESC_CTRL_EOT);
> +	else
> +		ctrl &= ~DESC_CTRL_EOT;

Please be kind to us underprivileged big-endian users
out here :-)

-		ctrl &= ~DESC_CTRL_EOT;
+		ctrl &= cpu_to_le32(~DESC_CTRL_EOT);

> @@ -733,6 +749,7 @@
>  			/* DMA sync done above */
>  			memcpy(copy_skb->data, skb->data, len);
>  
> +			skb->data-=bp->rx_offset;
>  			skb = copy_skb;
>  		}
>  		skb->ip_summed = CHECKSUM_NONE;

You can't modify skb->data without doing something sane
with skb->len and friends too, this is why we have skb_*()
interfaces to do these kinds of operations which do all
the necessary book-keeping :-)

Otherwise looks good.

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

* Re: REQ: BCM4400 network driver for 2.4.22
  2003-07-12  3:24     ` David S. Miller
@ 2003-07-14 20:12       ` Pekka Pietikainen
  0 siblings, 0 replies; 7+ messages in thread
From: Pekka Pietikainen @ 2003-07-14 20:12 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel, jgarzik

On Fri, Jul 11, 2003 at 08:24:26PM -0700, David S. Miller wrote:
> Please be kind to us underprivileged big-endian users
> out here :-)
Whoops :-)
> You can't modify skb->data without doing something sane
> with skb->len and friends too, this is why we have skb_*()
> interfaces to do these kinds of operations which do all
> the necessary book-keeping :-)
Indeed, it did seem a bit suspicious when I did it ;) 

I've attached my current version, which fixes all the bugs I've noticed
in the previous one (including "it doesn't work unless I run tcpdump" and
"it crashes randomly"), tested with rawhide-2.4 and 2.6.0-test1. I adjusted
the b44_poll locking a bit in this version and have a almost-as-bad-a-feeling
about it as I did with the skb handling. However, it works my uniprocessor
box and doesn't spew out a screenful of backtraces for every 
packet on 2.6.0-test1 so for some definition of "improvement" it
is one... Might easily blow up on SMP, but I have no way 
of testing that ;) 

--- /stuff/src/linux-2.6.0-test1/drivers/net/b44.c.orig	2003-07-14 06:33:45.000000000 +0300
+++ /stuff/src/linux-2.6.0-test1/drivers/net/b44.c	2003-07-14 22:45:18.146899367 +0300
@@ -1,6 +1,7 @@
 /* b44.c: Broadcom 4400 device driver.
  *
  * Copyright (C) 2002 David S. Miller (davem@redhat.com)
+ * Fixed by Pekka Pietikainen (pp@ee.oulu.fi)
  */
 
 #include <linux/kernel.h>
@@ -14,6 +15,7 @@
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/version.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -23,8 +25,8 @@
 
 #define DRV_MODULE_NAME		"b44"
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"0.6"
-#define DRV_MODULE_RELDATE	"Nov 11, 2002"
+#define DRV_MODULE_VERSION	"0.6-pp2"
+#define DRV_MODULE_RELDATE	"Jul 14, 2003"
 
 #define B44_DEF_MSG_ENABLE	  \
 	(NETIF_MSG_DRV		| \
@@ -78,6 +80,15 @@
 
 static int b44_debug = -1;	/* -1 == use B44_DEF_MSG_ENABLE as value */
 
+#ifndef PCI_DEVICE_ID_BCM4401
+#define PCI_DEVICE_ID_BCM4401      0x4401
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#define IRQ_RETVAL(x) 
+#define irqreturn_t void
+#endif
+
 static struct pci_device_id b44_pci_tbl[] __devinitdata = {
 	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
@@ -259,7 +270,7 @@
 		== SBTMSLOW_CLOCK);
 }
 
-static void __b44_cam_write(struct b44 *bp, char *data, int index)
+static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
 {
 	u32 val;
 
@@ -521,7 +532,7 @@
 			/* Link now up */
 			netif_carrier_on(bp->dev);
 			b44_link_report(bp);
-		} else if (netif_carrier_ok(bp->dev)) {
+		} else if (netif_carrier_ok(bp->dev) && !(bmsr & BMSR_LSTATUS)) {
 			/* Link now down */
 			netif_carrier_off(bp->dev);
 			b44_link_report(bp);
@@ -650,8 +661,7 @@
 	src_map = &bp->rx_buffers[src_idx];
 
 	dest_map->skb = src_map->skb;
-	rh = (struct rx_header *)
-		(src_map->skb->data - bp->rx_offset);
+	rh = (struct rx_header *) src_map->skb->data;
 	rh->len = 0;
 	rh->flags = 0;
 	pci_unmap_addr_set(dest_map, mapping,
@@ -660,9 +670,12 @@
 	ctrl = src_desc->ctrl;
 	if (dest_idx == (B44_RX_RING_SIZE - 1))
 		ctrl |= cpu_to_le32(DESC_CTRL_EOT);
+	else
+		ctrl &= cpu_to_le32(~DESC_CTRL_EOT);
 
 	dest_desc->ctrl = ctrl;
 	dest_desc->addr = src_desc->addr;
+	src_map->skb = NULL;
 }
 
 static int b44_rx(struct b44 *bp, int budget)
@@ -685,7 +698,7 @@
 		pci_dma_sync_single(bp->pdev, map,
 				    RX_PKT_BUF_SZ,
 				    PCI_DMA_FROMDEVICE);
-		rh = (struct rx_header *) (skb->data - bp->rx_offset);
+		rh = (struct rx_header *) skb->data;
 		len = cpu_to_le16(rh->len);
 		if ((len > (RX_PKT_BUF_SZ - bp->rx_offset)) ||
 		    (rh->flags & cpu_to_le16(RX_FLAG_ERRORS))) {
@@ -718,7 +731,9 @@
 				goto drop_it;
 			pci_unmap_single(bp->pdev, map,
 					 skb_size, PCI_DMA_FROMDEVICE);
-			skb_put(skb, len);
+			/* Leave out rx_header */
+                	skb_put(skb, len+bp->rx_offset);
+            	        skb_pull(skb,bp->rx_offset);
 		} else {
 			struct sk_buff *copy_skb;
 
@@ -730,8 +745,8 @@
 			copy_skb->dev = bp->dev;
 			skb_reserve(copy_skb, 2);
 			skb_put(copy_skb, len);
-			/* DMA sync done above */
-			memcpy(copy_skb->data, skb->data, len);
+			/* DMA sync done above, copy just the actual packet */
+			memcpy(copy_skb->data, skb->data+bp->rx_offset, len);
 
 			skb = copy_skb;
 		}
@@ -748,6 +763,7 @@
 	}
 
 	bp->rx_cons = cons;
+	bw32(B44_DMARX_PTR, cons * sizeof(struct dma_desc));
 
 	return received;
 }
@@ -764,6 +780,7 @@
 		b44_tx(bp);
 		/* spin_unlock(&bp->tx_lock); */
 	}
+	spin_unlock_irq(&bp->lock);
 
 	done = 1;
 	if (bp->istat & ISTAT_RX) {
@@ -783,10 +800,12 @@
 	}
 
 	if (bp->istat & ISTAT_ERRORS) {
+		spin_lock_irq(&bp->lock);
 		b44_halt(bp);
 		b44_init_rings(bp);
 		b44_init_hw(bp);
 		netif_wake_queue(bp->dev);
+		spin_unlock_irq(&bp->lock);
 		done = 1;
 	}
 
@@ -794,7 +813,6 @@
 		netif_rx_complete(netdev);
 		b44_enable_ints(bp);
 	}
-	spin_unlock_irq(&bp->lock);
 
 	return (done ? 0 : 1);
 }
@@ -885,7 +903,7 @@
 		ctrl |= DESC_CTRL_EOT;
 
 	bp->tx_ring[entry].ctrl = cpu_to_le32(ctrl);
-	bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping);
+	bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping+bp->dma_offset);
 
 	entry = NEXT_TX(entry);
 
@@ -1173,8 +1191,8 @@
 	__b44_set_rx_mode(bp->dev);
 
 	/* MTU + eth header + possible VLAN tag + struct rx_header */
-	bw32(B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + 24);
-	bw32(B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + 24);
+	bw32(B44_RXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
+	bw32(B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
 
 	bw32(B44_TX_WMARK, 56); /* XXX magic */
 	bw32(B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
@@ -1184,6 +1202,7 @@
 	bw32(B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
 
 	bw32(B44_DMARX_PTR, bp->rx_pending);
+	bp->rx_prod = bp->rx_pending;	
 
 	bw32(B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
 
@@ -1345,6 +1364,8 @@
 			__b44_load_mcast(bp, dev);
 
 		bw32(B44_RXCONFIG, val);
+        	val = br32(B44_CAM_CTRL);
+	        bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
 	}
 }
 
@@ -1678,8 +1699,9 @@
 	bp->core_unit = ssb_core_unit(bp);
 	bp->dma_offset = ssb_get_addr(bp, SBID_PCI_DMA, 0);
 
-	bp->flags |= B44_FLAG_BUGGY_TXPTR;
-
+	/* XXX - really required? 
+	   bp->flags |= B44_FLAG_BUGGY_TXPTR;
+         */
 out:
 	return err;
 }
--- /stuff/src/linux-2.6.0-test1/drivers/net/b44.h~	2003-07-09 18:28:09.000000000 +0300
+++ /stuff/src/linux-2.6.0-test1/drivers/net/b44.h	2003-07-09 18:28:15.000000000 +0300
@@ -142,7 +142,7 @@
 #define  MDIO_OP_READ		2
 #define  MDIO_DATA_SB_MASK	0xc0000000 /* Start Bits */
 #define  MDIO_DATA_SB_SHIFT	30
-#define  MDIO_DATA_SB_START	0x10000000 /* Start Of Frame */
+#define  MDIO_DATA_SB_START	0x40000000 /* Start Of Frame */
 #define B44_EMAC_IMASK	0x0418UL /* EMAC Interrupt Mask */
 #define B44_EMAC_ISTAT	0x041CUL /* EMAC Interrupt Status */
 #define  EMAC_INT_MII		0x00000001 /* MII MDIO Interrupt */

-- 
Pekka Pietikainen

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

end of thread, other threads:[~2003-07-14 20:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-09 21:34 REQ: BCM4400 network driver for 2.4.22 Bas Mevissen
2003-07-09 22:05 ` Jeff Garzik
2003-07-11 16:33   ` Pekka Pietikainen
2003-07-11 16:58     ` Jeff Garzik
2003-07-11 20:04     ` Pekka Pietikainen
2003-07-12  3:24     ` David S. Miller
2003-07-14 20:12       ` Pekka Pietikainen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).