diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2009-09-14 06:12:55 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-15 02:49:57 -0700 |
commit | 07e316377458484d95f7624f7af7af99d9bd18cb (patch) | |
tree | 0059cfd77ec983ded585a8cadc9f7d410893d581 /drivers/net | |
parent | 99455153d0670ba110e6a3b855b8369bcbd11120 (diff) | |
download | linux-stable-07e316377458484d95f7624f7af7af99d9bd18cb.tar.gz linux-stable-07e316377458484d95f7624f7af7af99d9bd18cb.tar.bz2 linux-stable-07e316377458484d95f7624f7af7af99d9bd18cb.zip |
sky2: transmit ring accounting
Be more accurate about number of transmit list elements required.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/sky2.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 00bc65a0aac9..fc3803316970 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -65,8 +65,8 @@ #define RX_DEF_PENDING RX_MAX_PENDING /* This is the worst case number of transmit list elements for a single skb: - VLAN + TSO + CKSUM + Data + skb_frags * DMA */ -#define MAX_SKB_TX_LE (4 + (sizeof(dma_addr_t)/sizeof(u32))*MAX_SKB_FRAGS) + VLAN:GSO + CKSUM + Data + skb_frags * DMA */ +#define MAX_SKB_TX_LE (2 + (sizeof(dma_addr_t)/sizeof(u32))*(MAX_SKB_FRAGS+1)) #define TX_MIN_PENDING (MAX_SKB_TX_LE+1) #define TX_MAX_PENDING 4096 #define TX_DEF_PENDING 127 @@ -1567,11 +1567,13 @@ static unsigned tx_le_req(const struct sk_buff *skb) { unsigned count; - count = sizeof(dma_addr_t) / sizeof(u32); - count += skb_shinfo(skb)->nr_frags * count; + count = (skb_shinfo(skb)->nr_frags + 1) + * (sizeof(dma_addr_t) / sizeof(u32)); if (skb_is_gso(skb)) ++count; + else if (sizeof(dma_addr_t) == sizeof(u32)) + ++count; /* possible vlan */ if (skb->ip_summed == CHECKSUM_PARTIAL) ++count; |