diff options
-rw-r--r-- | drivers/net/bnx2.c | 19 | ||||
-rw-r--r-- | drivers/net/bnx2.h | 2 |
2 files changed, 10 insertions, 11 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 2589b99a8597..2180922550eb 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -2624,7 +2624,7 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct bnx2_napi *bnapi, struct sk_buff *skb, | |||
2624 | 2624 | ||
2625 | pci_dma_sync_single_for_device(bp->pdev, | 2625 | pci_dma_sync_single_for_device(bp->pdev, |
2626 | pci_unmap_addr(cons_rx_buf, mapping), | 2626 | pci_unmap_addr(cons_rx_buf, mapping), |
2627 | bp->rx_offset + RX_COPY_THRESH, PCI_DMA_FROMDEVICE); | 2627 | BNX2_RX_OFFSET + RX_COPY_THRESH, PCI_DMA_FROMDEVICE); |
2628 | 2628 | ||
2629 | bnapi->rx_prod_bseq += bp->rx_buf_use_size; | 2629 | bnapi->rx_prod_bseq += bp->rx_buf_use_size; |
2630 | 2630 | ||
@@ -2662,7 +2662,7 @@ bnx2_rx_skb(struct bnx2 *bp, struct bnx2_napi *bnapi, struct sk_buff *skb, | |||
2662 | return err; | 2662 | return err; |
2663 | } | 2663 | } |
2664 | 2664 | ||
2665 | skb_reserve(skb, bp->rx_offset); | 2665 | skb_reserve(skb, BNX2_RX_OFFSET); |
2666 | pci_unmap_single(bp->pdev, dma_addr, bp->rx_buf_use_size, | 2666 | pci_unmap_single(bp->pdev, dma_addr, bp->rx_buf_use_size, |
2667 | PCI_DMA_FROMDEVICE); | 2667 | PCI_DMA_FROMDEVICE); |
2668 | 2668 | ||
@@ -2777,7 +2777,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
2777 | dma_addr = pci_unmap_addr(rx_buf, mapping); | 2777 | dma_addr = pci_unmap_addr(rx_buf, mapping); |
2778 | 2778 | ||
2779 | pci_dma_sync_single_for_cpu(bp->pdev, dma_addr, | 2779 | pci_dma_sync_single_for_cpu(bp->pdev, dma_addr, |
2780 | bp->rx_offset + RX_COPY_THRESH, PCI_DMA_FROMDEVICE); | 2780 | BNX2_RX_OFFSET + RX_COPY_THRESH, PCI_DMA_FROMDEVICE); |
2781 | 2781 | ||
2782 | rx_hdr = (struct l2_fhdr *) skb->data; | 2782 | rx_hdr = (struct l2_fhdr *) skb->data; |
2783 | len = rx_hdr->l2_fhdr_pkt_len; | 2783 | len = rx_hdr->l2_fhdr_pkt_len; |
@@ -2815,7 +2815,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
2815 | } | 2815 | } |
2816 | 2816 | ||
2817 | /* aligned copy */ | 2817 | /* aligned copy */ |
2818 | skb_copy_from_linear_data_offset(skb, bp->rx_offset - 2, | 2818 | skb_copy_from_linear_data_offset(skb, |
2819 | BNX2_RX_OFFSET - 2, | ||
2819 | new_skb->data, len + 2); | 2820 | new_skb->data, len + 2); |
2820 | skb_reserve(new_skb, 2); | 2821 | skb_reserve(new_skb, 2); |
2821 | skb_put(new_skb, len); | 2822 | skb_put(new_skb, len); |
@@ -4754,7 +4755,7 @@ bnx2_set_rx_ring_size(struct bnx2 *bp, u32 size) | |||
4754 | u32 rx_size, rx_space, jumbo_size; | 4755 | u32 rx_size, rx_space, jumbo_size; |
4755 | 4756 | ||
4756 | /* 8 for CRC and VLAN */ | 4757 | /* 8 for CRC and VLAN */ |
4757 | rx_size = bp->dev->mtu + ETH_HLEN + bp->rx_offset + 8; | 4758 | rx_size = bp->dev->mtu + ETH_HLEN + BNX2_RX_OFFSET + 8; |
4758 | 4759 | ||
4759 | rx_space = SKB_DATA_ALIGN(rx_size + BNX2_RX_ALIGN) + NET_SKB_PAD + | 4760 | rx_space = SKB_DATA_ALIGN(rx_size + BNX2_RX_ALIGN) + NET_SKB_PAD + |
4760 | sizeof(struct skb_shared_info); | 4761 | sizeof(struct skb_shared_info); |
@@ -4774,14 +4775,14 @@ bnx2_set_rx_ring_size(struct bnx2 *bp, u32 size) | |||
4774 | bp->rx_max_pg_ring = bnx2_find_max_ring(jumbo_size, | 4775 | bp->rx_max_pg_ring = bnx2_find_max_ring(jumbo_size, |
4775 | MAX_RX_PG_RINGS); | 4776 | MAX_RX_PG_RINGS); |
4776 | bp->rx_max_pg_ring_idx = (bp->rx_max_pg_ring * RX_DESC_CNT) - 1; | 4777 | bp->rx_max_pg_ring_idx = (bp->rx_max_pg_ring * RX_DESC_CNT) - 1; |
4777 | rx_size = RX_COPY_THRESH + bp->rx_offset; | 4778 | rx_size = RX_COPY_THRESH + BNX2_RX_OFFSET; |
4778 | bp->rx_copy_thresh = 0; | 4779 | bp->rx_copy_thresh = 0; |
4779 | } | 4780 | } |
4780 | 4781 | ||
4781 | bp->rx_buf_use_size = rx_size; | 4782 | bp->rx_buf_use_size = rx_size; |
4782 | /* hw alignment */ | 4783 | /* hw alignment */ |
4783 | bp->rx_buf_size = bp->rx_buf_use_size + BNX2_RX_ALIGN; | 4784 | bp->rx_buf_size = bp->rx_buf_use_size + BNX2_RX_ALIGN; |
4784 | bp->rx_jumbo_thresh = rx_size - bp->rx_offset; | 4785 | bp->rx_jumbo_thresh = rx_size - BNX2_RX_OFFSET; |
4785 | bp->rx_ring_size = size; | 4786 | bp->rx_ring_size = size; |
4786 | bp->rx_max_ring = bnx2_find_max_ring(size, MAX_RX_RINGS); | 4787 | bp->rx_max_ring = bnx2_find_max_ring(size, MAX_RX_RINGS); |
4787 | bp->rx_max_ring_idx = (bp->rx_max_ring * RX_DESC_CNT) - 1; | 4788 | bp->rx_max_ring_idx = (bp->rx_max_ring * RX_DESC_CNT) - 1; |
@@ -5225,7 +5226,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode) | |||
5225 | rx_skb = rx_buf->skb; | 5226 | rx_skb = rx_buf->skb; |
5226 | 5227 | ||
5227 | rx_hdr = (struct l2_fhdr *) rx_skb->data; | 5228 | rx_hdr = (struct l2_fhdr *) rx_skb->data; |
5228 | skb_reserve(rx_skb, bp->rx_offset); | 5229 | skb_reserve(rx_skb, BNX2_RX_OFFSET); |
5229 | 5230 | ||
5230 | pci_dma_sync_single_for_cpu(bp->pdev, | 5231 | pci_dma_sync_single_for_cpu(bp->pdev, |
5231 | pci_unmap_addr(rx_buf, mapping), | 5232 | pci_unmap_addr(rx_buf, mapping), |
@@ -7306,8 +7307,6 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
7306 | bp->mac_addr[4] = (u8) (reg >> 8); | 7307 | bp->mac_addr[4] = (u8) (reg >> 8); |
7307 | bp->mac_addr[5] = (u8) reg; | 7308 | bp->mac_addr[5] = (u8) reg; |
7308 | 7309 | ||
7309 | bp->rx_offset = sizeof(struct l2_fhdr) + 2; | ||
7310 | |||
7311 | bp->tx_ring_size = MAX_TX_DESC_CNT; | 7310 | bp->tx_ring_size = MAX_TX_DESC_CNT; |
7312 | bnx2_set_rx_ring_size(bp, 255); | 7311 | bnx2_set_rx_ring_size(bp, 255); |
7313 | 7312 | ||
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 1eaf5bb3d9c2..601bafffe8ba 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -309,6 +309,7 @@ struct l2_fhdr { | |||
309 | #endif | 309 | #endif |
310 | }; | 310 | }; |
311 | 311 | ||
312 | #define BNX2_RX_OFFSET (sizeof(struct l2_fhdr) + 2) | ||
312 | 313 | ||
313 | /* | 314 | /* |
314 | * l2_context definition | 315 | * l2_context definition |
@@ -6627,7 +6628,6 @@ struct bnx2 { | |||
6627 | struct vlan_group *vlgrp; | 6628 | struct vlan_group *vlgrp; |
6628 | #endif | 6629 | #endif |
6629 | 6630 | ||
6630 | u32 rx_offset; | ||
6631 | u32 rx_buf_use_size; /* useable size */ | 6631 | u32 rx_buf_use_size; /* useable size */ |
6632 | u32 rx_buf_size; /* with alignment */ | 6632 | u32 rx_buf_size; /* with alignment */ |
6633 | u32 rx_copy_thresh; | 6633 | u32 rx_copy_thresh; |