aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-06-04 16:25:39 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-08 22:16:40 -0400
commit72f4861ef9b1c1ca6e4abb49854698e80d3b684d (patch)
treebe1db44035fabe59f907ca583be3c2605658d67f /drivers/net
parentf65a71775cc3eb5d5d8ac4c349c8f48a7d5c7759 (diff)
b44: packet offset is constant
The receive buffer offset is constant in this driver. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/b44.c30
-rw-r--r--drivers/net/b44.h2
2 files changed, 13 insertions, 19 deletions
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index d10d31cd12d7..8fdcb698d611 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -15,6 +15,7 @@
15#include <linux/ethtool.h> 15#include <linux/ethtool.h>
16#include <linux/mii.h> 16#include <linux/mii.h>
17#include <linux/if_ether.h> 17#include <linux/if_ether.h>
18#include <linux/if_vlan.h>
18#include <linux/etherdevice.h> 19#include <linux/etherdevice.h>
19#include <linux/pci.h> 20#include <linux/pci.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
@@ -68,7 +69,8 @@
68 (BP)->tx_cons - (BP)->tx_prod - TX_RING_GAP(BP)) 69 (BP)->tx_cons - (BP)->tx_prod - TX_RING_GAP(BP))
69#define NEXT_TX(N) (((N) + 1) & (B44_TX_RING_SIZE - 1)) 70#define NEXT_TX(N) (((N) + 1) & (B44_TX_RING_SIZE - 1))
70 71
71#define RX_PKT_BUF_SZ (1536 + bp->rx_offset + 64) 72#define RX_PKT_OFFSET 30
73#define RX_PKT_BUF_SZ (1536 + RX_PKT_OFFSET + 64)
72 74
73/* minimum number of free TX descriptors required to wake up TX process */ 75/* minimum number of free TX descriptors required to wake up TX process */
74#define B44_TX_WAKEUP_THRESH (B44_TX_RING_SIZE / 4) 76#define B44_TX_WAKEUP_THRESH (B44_TX_RING_SIZE / 4)
@@ -683,10 +685,9 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
683 } 685 }
684 686
685 skb->dev = bp->dev; 687 skb->dev = bp->dev;
686 skb_reserve(skb, bp->rx_offset); 688 rh = (struct rx_header *) skb->data;
689 skb_reserve(skb, RX_PKT_OFFSET);
687 690
688 rh = (struct rx_header *)
689 (skb->data - bp->rx_offset);
690 rh->len = 0; 691 rh->len = 0;
691 rh->flags = 0; 692 rh->flags = 0;
692 693
@@ -696,13 +697,13 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
696 if (src_map != NULL) 697 if (src_map != NULL)
697 src_map->skb = NULL; 698 src_map->skb = NULL;
698 699
699 ctrl = (DESC_CTRL_LEN & (RX_PKT_BUF_SZ - bp->rx_offset)); 700 ctrl = (DESC_CTRL_LEN & (RX_PKT_BUF_SZ - RX_PKT_OFFSET));
700 if (dest_idx == (B44_RX_RING_SIZE - 1)) 701 if (dest_idx == (B44_RX_RING_SIZE - 1))
701 ctrl |= DESC_CTRL_EOT; 702 ctrl |= DESC_CTRL_EOT;
702 703
703 dp = &bp->rx_ring[dest_idx]; 704 dp = &bp->rx_ring[dest_idx];
704 dp->ctrl = cpu_to_le32(ctrl); 705 dp->ctrl = cpu_to_le32(ctrl);
705 dp->addr = cpu_to_le32((u32) mapping + bp->rx_offset + bp->dma_offset); 706 dp->addr = cpu_to_le32((u32) mapping + RX_PKT_OFFSET + bp->dma_offset);
706 707
707 if (bp->flags & B44_FLAG_RX_RING_HACK) 708 if (bp->flags & B44_FLAG_RX_RING_HACK)
708 b44_sync_dma_desc_for_device(bp->pdev, bp->rx_ring_dma, 709 b44_sync_dma_desc_for_device(bp->pdev, bp->rx_ring_dma,
@@ -781,7 +782,7 @@ static int b44_rx(struct b44 *bp, int budget)
781 PCI_DMA_FROMDEVICE); 782 PCI_DMA_FROMDEVICE);
782 rh = (struct rx_header *) skb->data; 783 rh = (struct rx_header *) skb->data;
783 len = le16_to_cpu(rh->len); 784 len = le16_to_cpu(rh->len);
784 if ((len > (RX_PKT_BUF_SZ - bp->rx_offset)) || 785 if ((len > (RX_PKT_BUF_SZ - RX_PKT_OFFSET)) ||
785 (rh->flags & cpu_to_le16(RX_FLAG_ERRORS))) { 786 (rh->flags & cpu_to_le16(RX_FLAG_ERRORS))) {
786 drop_it: 787 drop_it:
787 b44_recycle_rx(bp, cons, bp->rx_prod); 788 b44_recycle_rx(bp, cons, bp->rx_prod);
@@ -813,8 +814,8 @@ static int b44_rx(struct b44 *bp, int budget)
813 pci_unmap_single(bp->pdev, map, 814 pci_unmap_single(bp->pdev, map,
814 skb_size, PCI_DMA_FROMDEVICE); 815 skb_size, PCI_DMA_FROMDEVICE);
815 /* Leave out rx_header */ 816 /* Leave out rx_header */
816 skb_put(skb, len+bp->rx_offset); 817 skb_put(skb, len + RX_PKT_OFFSET);
817 skb_pull(skb,bp->rx_offset); 818 skb_pull(skb, RX_PKT_OFFSET);
818 } else { 819 } else {
819 struct sk_buff *copy_skb; 820 struct sk_buff *copy_skb;
820 821
@@ -826,7 +827,7 @@ static int b44_rx(struct b44 *bp, int budget)
826 skb_reserve(copy_skb, 2); 827 skb_reserve(copy_skb, 2);
827 skb_put(copy_skb, len); 828 skb_put(copy_skb, len);
828 /* DMA sync done above, copy just the actual packet */ 829 /* DMA sync done above, copy just the actual packet */
829 skb_copy_from_linear_data_offset(skb, bp->rx_offset, 830 skb_copy_from_linear_data_offset(skb, RX_PKT_OFFSET,
830 copy_skb->data, len); 831 copy_skb->data, len);
831 skb = copy_skb; 832 skb = copy_skb;
832 } 833 }
@@ -1393,12 +1394,12 @@ static void b44_init_hw(struct b44 *bp, int reset_kind)
1393 bw32(bp, B44_TX_WMARK, 56); /* XXX magic */ 1394 bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
1394 if (reset_kind == B44_PARTIAL_RESET) { 1395 if (reset_kind == B44_PARTIAL_RESET) {
1395 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE | 1396 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
1396 (bp->rx_offset << DMARX_CTRL_ROSHIFT))); 1397 (RX_PKT_OFFSET << DMARX_CTRL_ROSHIFT)));
1397 } else { 1398 } else {
1398 bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE); 1399 bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
1399 bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset); 1400 bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
1400 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE | 1401 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
1401 (bp->rx_offset << DMARX_CTRL_ROSHIFT))); 1402 (RX_PKT_OFFSET << DMARX_CTRL_ROSHIFT)));
1402 bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset); 1403 bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
1403 1404
1404 bw32(bp, B44_DMARX_PTR, bp->rx_pending); 1405 bw32(bp, B44_DMARX_PTR, bp->rx_pending);
@@ -2090,11 +2091,6 @@ static int __devinit b44_get_invariants(struct b44 *bp)
2090 2091
2091 bp->phy_addr = eeprom[90] & 0x1f; 2092 bp->phy_addr = eeprom[90] & 0x1f;
2092 2093
2093 /* With this, plus the rx_header prepended to the data by the
2094 * hardware, we'll land the ethernet header on a 2-byte boundary.
2095 */
2096 bp->rx_offset = 30;
2097
2098 bp->imask = IMASK_DEF; 2094 bp->imask = IMASK_DEF;
2099 2095
2100 bp->core_unit = ssb_core_unit(bp); 2096 bp->core_unit = ssb_core_unit(bp);
diff --git a/drivers/net/b44.h b/drivers/net/b44.h
index 18fc13336628..e537e63f292e 100644
--- a/drivers/net/b44.h
+++ b/drivers/net/b44.h
@@ -443,8 +443,6 @@ struct b44 {
443#define B44_FLAG_TX_RING_HACK 0x40000000 443#define B44_FLAG_TX_RING_HACK 0x40000000
444#define B44_FLAG_WOL_ENABLE 0x80000000 444#define B44_FLAG_WOL_ENABLE 0x80000000
445 445
446 u32 rx_offset;
447
448 u32 msg_enable; 446 u32 msg_enable;
449 447
450 struct timer_list timer; 448 struct timer_list timer;