b44: fix misalignment and space-saving in rx packet handling (significant throughput...
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-2.6.25 / 212-b44_alignment_fix.patch
1 --- a/drivers/net/b44.c
2 +++ b/drivers/net/b44.c
3 @@ -73,8 +73,8 @@
4 (BP)->tx_cons - (BP)->tx_prod - TX_RING_GAP(BP))
5 #define NEXT_TX(N) (((N) + 1) & (B44_TX_RING_SIZE - 1))
6
7 -#define RX_PKT_OFFSET 30
8 -#define RX_PKT_BUF_SZ (1536 + RX_PKT_OFFSET + 64)
9 +#define RX_PKT_OFFSET (RX_HEADER_LEN + 2)
10 +#define RX_PKT_BUF_SZ (1536 + RX_PKT_OFFSET)
11
12 /* minimum number of free TX descriptors required to wake up TX process */
13 #define B44_TX_WAKEUP_THRESH (B44_TX_RING_SIZE / 4)
14 @@ -682,7 +682,6 @@ static int b44_alloc_rx_skb(struct b44 *
15 }
16
17 rh = (struct rx_header *) skb->data;
18 - skb_reserve(skb, RX_PKT_OFFSET);
19
20 rh->len = 0;
21 rh->flags = 0;
22 @@ -693,13 +692,13 @@ static int b44_alloc_rx_skb(struct b44 *
23 if (src_map != NULL)
24 src_map->skb = NULL;
25
26 - ctrl = (DESC_CTRL_LEN & (RX_PKT_BUF_SZ - RX_PKT_OFFSET));
27 + ctrl = (DESC_CTRL_LEN & RX_PKT_BUF_SZ);
28 if (dest_idx == (B44_RX_RING_SIZE - 1))
29 ctrl |= DESC_CTRL_EOT;
30
31 dp = &bp->rx_ring[dest_idx];
32 dp->ctrl = cpu_to_le32(ctrl);
33 - dp->addr = cpu_to_le32((u32) mapping + RX_PKT_OFFSET + bp->dma_offset);
34 + dp->addr = cpu_to_le32((u32) mapping + bp->dma_offset);
35
36 if (bp->flags & B44_FLAG_RX_RING_HACK)
37 b44_sync_dma_desc_for_device(bp->sdev, bp->rx_ring_dma,
38 @@ -809,8 +808,8 @@ static int b44_rx(struct b44 *bp, int bu
39 dma_unmap_single(bp->sdev->dma_dev, map,
40 skb_size, DMA_FROM_DEVICE);
41 /* Leave out rx_header */
42 - skb_put(skb, len + RX_PKT_OFFSET);
43 - skb_pull(skb, RX_PKT_OFFSET);
44 + skb_put(skb, len + RX_PKT_OFFSET);
45 + skb_pull(skb, RX_PKT_OFFSET);
46 } else {
47 struct sk_buff *copy_skb;
48