aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/tg3.c32
-rw-r--r--drivers/net/tg3.h5
2 files changed, 27 insertions, 10 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 3e893231fef3..57914050b098 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -144,6 +144,24 @@
144 144
145#define TG3_RSS_MIN_NUM_MSIX_VECS 2 145#define TG3_RSS_MIN_NUM_MSIX_VECS 2
146 146
147/* Due to a hardware bug, the 5701 can only DMA to memory addresses
148 * that are at least dword aligned when used in PCIX mode. The driver
149 * works around this bug by double copying the packet. This workaround
150 * is built into the normal double copy length check for efficiency.
151 *
152 * However, the double copy is only necessary on those architectures
153 * where unaligned memory accesses are inefficient. For those architectures
154 * where unaligned memory accesses incur little penalty, we can reintegrate
155 * the 5701 in the normal rx path. Doing so saves a device structure
156 * dereference by hardcoding the double copy threshold in place.
157 */
158#define TG3_RX_COPY_THRESHOLD 256
159#if NET_IP_ALIGN == 0 || defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
160 #define TG3_RX_COPY_THRESH(tp) TG3_RX_COPY_THRESHOLD
161#else
162 #define TG3_RX_COPY_THRESH(tp) ((tp)->rx_copy_thresh)
163#endif
164
147/* minimum number of free TX descriptors required to wake up TX process */ 165/* minimum number of free TX descriptors required to wake up TX process */
148#define TG3_TX_WAKEUP_THRESH(tnapi) ((tnapi)->tx_pending / 4) 166#define TG3_TX_WAKEUP_THRESH(tnapi) ((tnapi)->tx_pending / 4)
149 167
@@ -4639,12 +4657,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
4639 len = ((desc->idx_len & RXD_LEN_MASK) >> RXD_LEN_SHIFT) - 4657 len = ((desc->idx_len & RXD_LEN_MASK) >> RXD_LEN_SHIFT) -
4640 ETH_FCS_LEN; 4658 ETH_FCS_LEN;
4641 4659
4642 if (len > RX_COPY_THRESHOLD && 4660 if (len > TG3_RX_COPY_THRESH(tp)) {
4643 tp->rx_offset == NET_IP_ALIGN) {
4644 /* rx_offset will likely not equal NET_IP_ALIGN
4645 * if this is a 5701 card running in PCI-X mode
4646 * [see tg3_get_invariants()]
4647 */
4648 int skb_size; 4661 int skb_size;
4649 4662
4650 skb_size = tg3_alloc_rx_skb(tp, tpr, opaque_key, 4663 skb_size = tg3_alloc_rx_skb(tp, tpr, opaque_key,
@@ -13469,9 +13482,14 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13469 tp->tg3_flags &= ~TG3_FLAG_POLL_SERDES; 13482 tp->tg3_flags &= ~TG3_FLAG_POLL_SERDES;
13470 13483
13471 tp->rx_offset = NET_IP_ALIGN; 13484 tp->rx_offset = NET_IP_ALIGN;
13485 tp->rx_copy_thresh = TG3_RX_COPY_THRESHOLD;
13472 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 && 13486 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 &&
13473 (tp->tg3_flags & TG3_FLAG_PCIX_MODE) != 0) 13487 (tp->tg3_flags & TG3_FLAG_PCIX_MODE) != 0) {
13474 tp->rx_offset = 0; 13488 tp->rx_offset = 0;
13489#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
13490 tp->rx_copy_thresh = ~0;
13491#endif
13492 }
13475 13493
13476 tp->rx_std_max_post = TG3_RX_RING_SIZE; 13494 tp->rx_std_max_post = TG3_RX_RING_SIZE;
13477 13495
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 9e7fe0e7cdb8..43dd1d26243c 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -23,8 +23,6 @@
23#define TG3_BDINFO_NIC_ADDR 0xcUL /* 32-bit */ 23#define TG3_BDINFO_NIC_ADDR 0xcUL /* 32-bit */
24#define TG3_BDINFO_SIZE 0x10UL 24#define TG3_BDINFO_SIZE 0x10UL
25 25
26#define RX_COPY_THRESHOLD 256
27
28#define TG3_RX_INTERNAL_RING_SZ_5906 32 26#define TG3_RX_INTERNAL_RING_SZ_5906 32
29 27
30#define RX_STD_MAX_SIZE 1536 28#define RX_STD_MAX_SIZE 1536
@@ -2754,9 +2752,11 @@ struct tg3 {
2754 struct tg3_napi napi[TG3_IRQ_MAX_VECS]; 2752 struct tg3_napi napi[TG3_IRQ_MAX_VECS];
2755 void (*write32_rx_mbox) (struct tg3 *, u32, 2753 void (*write32_rx_mbox) (struct tg3 *, u32,
2756 u32); 2754 u32);
2755 u32 rx_copy_thresh;
2757 u32 rx_pending; 2756 u32 rx_pending;
2758 u32 rx_jumbo_pending; 2757 u32 rx_jumbo_pending;
2759 u32 rx_std_max_post; 2758 u32 rx_std_max_post;
2759 u32 rx_offset;
2760 u32 rx_pkt_map_sz; 2760 u32 rx_pkt_map_sz;
2761#if TG3_VLAN_TAG_USED 2761#if TG3_VLAN_TAG_USED
2762 struct vlan_group *vlgrp; 2762 struct vlan_group *vlgrp;
@@ -2776,7 +2776,6 @@ struct tg3 {
2776 unsigned long last_event_jiffies; 2776 unsigned long last_event_jiffies;
2777 }; 2777 };
2778 2778
2779 u32 rx_offset;
2780 u32 tg3_flags; 2779 u32 tg3_flags;
2781#define TG3_FLAG_TAGGED_STATUS 0x00000001 2780#define TG3_FLAG_TAGGED_STATUS 0x00000001
2782#define TG3_FLAG_TXD_MBOX_HWBUG 0x00000002 2781#define TG3_FLAG_TXD_MBOX_HWBUG 0x00000002