b44: add 47xx support
Subsystems (3)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
this patch adds support for the BCM47xx device to the b44 driver. Please apply.
BTW what happened to the 1GB DMA fix? The SiliconBackplane cores _are_ limited to a 1GB DMA window so we need to take that into account. Any reason why those patches where dropped?
Regards,
Florian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBAYSlXRF2vHoIlBsRAu+YAKCGzT01hW+yW5SMCbFGOCqx89uIxwCguwZT zeDLpFVyILUSnaYNJe2A4YU=
=6269
-----END PGP SIGNATURE-----
Index: include/linux/pci_ids.h
===================================================================
RCS file: /home/cvs/linux/include/linux/pci_ids.h,v retrieving revision 1.124
include/linux/pci_ids.h +1 -0
@@ -1913,6 +1913,7 @@#define PCI_DEVICE_ID_BCM4401 0x4401#define PCI_DEVICE_ID_BCM4401B0 0x4402#define PCI_DEVICE_ID_BCM4401B1 0x170c +#define PCI_DEVICE_ID_BCM4713 0x4713#define PCI_VENDOR_ID_ENE 0x1524#define PCI_DEVICE_ID_ENE_1211 0x1211
Index: drivers/net/b44.c
===================================================================
RCS file: /home/cvs/linux/drivers/net/b44.c,v
retrieving revision 1.14
drivers/net/b44.c +78 -58
223 lines not on this page · raw message
Index: drivers/net/b44.h
===================================================================
RCS file: /home/cvs/linux/drivers/net/b44.h,v
retrieving revision 1.5
drivers/net/b44.h +1 -10
@@ -356,16 +356,6 @@#define SBIDHIGH_VC_MASK 0xffff0000/* Vendor Code */ #define SBIDHIGH_VC_SHIFT 16 -#define CORE_CODE_ILINE20 0x801 -#define CORE_CODE_SDRAM 0x803 -#define CORE_CODE_PCI 0x804 -#define CORE_CODE_MIPS 0x805 -#define CORE_CODE_ENET 0x806 -#define CORE_CODE_CODEC 0x807 -#define CORE_CODE_USB 0x808 -#define CORE_CODE_ILINE100 0x80a -#define CORE_CODE_EXTIF 0x811 -/* SSB PCI config space registers. */ #define SSB_BAR0_WIN 0x80#define SSB_BAR1_WIN 0x84
@@ -520,6 +510,7 @@ struct b44 {#define B44_FLAG_ADV_100HALF 0x04000000#define B44_FLAG_ADV_100FULL 0x08000000#define B44_FLAG_INTERNAL_PHY 0x10000000 +#define B44_FLAG_NO_PHY 0x20000000u32 rx_offset;
Quoted 11 lines · Florian Schirmer
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Hi,
this patch adds support for the BCM47xx device to the b44 driver. Please apply.
BTW what happened to the 1GB DMA fix? The SiliconBackplane cores _are_ limited to a 1GB DMA window so we need to take that into account. Any reason why those patches where dropped?
Hiya
Looks good (well, won't be able to test that it doesn't break 4401 until next week :-) ).
As for the 1GB patch going in, I sure hope they would (perhaps in a cleaned up state, it might be more pretty if I just unconditionally enabled the workaround and had a b44_alloc_skb() that tries a normal dev_alloc_skb and if that gives something over 1GB retry with GFP_DMA...
A situation where it breaks even without 4g4g would help in getting the patch in :-)
PATCH 1/1 b44 1GB DMA workaround (was: b44: add 47xx support)
Quoted 2 lines · Pekka Pietikainen
Looks good (well, won't be able to test that it doesn't break 4401 until next week :-) ).
The 47xx patch didn't break anything for 4401 so I'm all for merging.
Quoted 4 lines
As for the 1GB patch going in, I sure hope they would (perhaps in a cleaned up state, it might be more pretty if I just unconditionally enabled the workaround and had a
b44_alloc_skb()that tries a normaldev_alloc_skband if that gives something over 1GB retry withGFP_DMA...
I just did that, apart from possibly reducing the default ring sizes to reduce GFP_DMA usage from the ~= 1.6MB worst-case it is now, it's just about as good as it'll ever get. Would be nice to get this merged, it seems to be hitting quite a few people out there.
drivers/net/b44.h renamed from drivers/net/b44.h.bb +2 -1
@@ -493,6 +493,7 @@struct ring_info *rx_buffers;struct ring_info *tx_buffers; +unsigned char *tx_bufs;u32 dma_offset;u32 flags;
@@ -525,7 +526,7 @@struct pci_dev *pdev;struct net_device *dev; -dma_addr_t rx_ring_dma, tx_ring_dma; +dma_addr_t rx_ring_dma, tx_ring_dma,tx_bufs_dma;u32 rx_pending;u32 tx_pending;
drivers/net/b44.c renamed from drivers/net/b44.c.bb +51 -4
111 lines not on this page · raw message
Re: [PATCH] b44 1GB DMA workaround (was: b44: add 47xx support)
drivers/net/b44.c line 943
Quoted 7 lines · On Wed, 4 Aug 2004 03:31:08 +0300 Pekka Pietikainen <[email protected]> wrote:
drivers/net/b44.c renamed from drivers/net/b44.c.bb +7
-0+if (mapping+len >B44_DMA_MASK ) { +/* Chip can't handle DMA to/from >1GB, use bounce buffer */ +pci_unmap_single (bp->pdev, mapping, len,PCI_DMA_TODEVICE ); +memcpy (bp->tx_bufs+entry*TX_PKT_BUF_SZ ,skb->data,skb->len); + skb->data=bp->tx_bufs+entry*TX_PKT_BUF_SZ ; + mapping =pci_map_single (bp->pdev, skb->data, len,PCI_DMA_TODEVICE ); + }
Changing skb->data is not legal. Please implement this in such a way that skb->data does not get modified. By modifying skb->data you will break things such as packet sniffers and netfilter, and that's just the tip of the iceberg. :-)
I would suggest merely freeing up this TX skb, and marking the entry in the b44 software state with some dummy skb pointer such as (void *) 0x1UL or something like that to indicate this case.
Re: [PATCH] b44 1GB DMA workaround (was: b44: add 47xx support)
Quoted 5 lines · David S. Miller
Changing
skb->datais not legal. Please implement this in such a way thatskb->datadoes not get modified. By modifyingskb->datayou will break things such as packet sniffers and netfilter, and that's just the tip of the iceberg. :-)
Haven't noticed any breakage (tm) but I'm just a x86 weenie :-)
Current approach is:
if(1 (just for testing ;) ) || mapping+len > B44_DMA_MASK) {
/* Chip can't handle DMA to/from >1GB, use bounce buffer */
pci_unmap_single(bp->pdev, mapping, len,PCI_DMA_TODEVICE);
memcpy(bp->tx_bufs+entry*TX_PKT_BUF_SZ,skb->data,skb->len);
mapping = pci_map_single(bp->pdev,bp->tx_bufs+entry*TX_PKT_BUF_SZ, len, PCI_DMA_TODEVICE);
}Which also works (tm). Setting the skb to a special value seems a bit tricky as skb->len is used in b44_tx for that nop^H^H^Hpci_unmap_single. It looks to me as the right things when the code gets changed as above (even for archs where the unmapping is not a nop) get done, but I could easily be missing something.
Signature · 1 line
Pekka Pietikainen
Re: [PATCH] b44 1GB DMA workaround (was: b44: add 47xx support)
Quoted 7 lines · On Sun, 8 Aug 2004 01:40:19 +0300 Pekka Pietikainen <[email protected]> wrote:
Quoted 5 lines · David S. Miller
Changing
skb->datais not legal. Please implement this in such a way thatskb->datadoes not get modified. By modifyingskb->datayou will break things such as packet sniffers and netfilter, and that's just the tip of the iceberg. :-)Haven't noticed any breakage (tm) but I'm just a x86 weenie :-)
Not an x86 specific problem :-) Just run tcpdump in a shell when one of these TX bounce cases happen, your skb->data modification could will make tcpdump see a corrupt packet.
Quoted 8 lines
Current approach is:
if(1 (just for testing ;) ) || mapping+len > B44_DMA_MASK) { /* Chip can't handle DMA to/from >1GB, use bounce buffer */ pci_unmap_single(bp->pdev, mapping, len,PCI_DMA_TODEVICE); memcpy(bp->tx_bufs+entry*TX_PKT_BUF_SZ,skb->data,skb->len); mapping = pci_map_single(bp->pdev,bp->tx_bufs+entry*TX_PKT_BUF_SZ, len, PCI_DMA_TODEVICE); }
This looks a bit better.
Re: [PATCH] b44 1GB DMA workaround
Quoted 8 lines · David S. Miller
Quoted 6 lines
if(1 (just for testing ;) ) || mapping+len > B44_DMA_MASK) { /* Chip can't handle DMA to/from >1GB, use bounce buffer */ pci_unmap_single(bp->pdev, mapping, len,PCI_DMA_TODEVICE); memcpy(bp->tx_bufs+entry*TX_PKT_BUF_SZ,skb->data,skb->len); mapping = pci_map_single(bp->pdev,bp->tx_bufs+entry*TX_PKT_BUF_SZ, len, PCI_DMA_TODEVICE); }This looks a bit better.
Excellent, here's the full patch:
drivers/net/b44.h renamed from drivers/net/b44.h.4g4g +2 -1
@@ -493,6 +493,7 @@struct ring_info *rx_buffers;struct ring_info *tx_buffers; +unsigned char *tx_bufs;u32 dma_offset;u32 flags;
@@ -525,7 +526,7 @@struct pci_dev *pdev;struct net_device *dev; -dma_addr_t rx_ring_dma, tx_ring_dma; +dma_addr_t rx_ring_dma, tx_ring_dma,tx_bufs_dma;u32 rx_pending;u32 tx_pending;
drivers/net/b44.c renamed from drivers/net/b44.c.4g4g +50 -4
110 lines not on this page · raw message