[PATCH] sky2: Account for VLAN tag in tx_le_req

Subsystems: networking drivers, the rest

STALE6172d

2 messages, 2 authors, 2009-09-12 · open the first message on its own page

[PATCH] sky2: Account for VLAN tag in tx_le_req

From: Mike McCormack <hidden>
Date: 2009-09-12 03:21:54

With VLAN enabled, tx_le_req would return on less list elements than required,
 leading to a potential wrap around of the transmit ring buffer.

Signed-off-by: Mike McCormack <redacted>
---
 drivers/net/sky2.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 00bc65a..018aa58 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -66,7 +66,7 @@
 
 /* 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)
+#define MAX_SKB_TX_LE	(5 + (sizeof(dma_addr_t)/sizeof(u32))*MAX_SKB_FRAGS)
 #define TX_MIN_PENDING		(MAX_SKB_TX_LE+1)
 #define TX_MAX_PENDING		4096
 #define TX_DEF_PENDING		127
@@ -1576,6 +1576,11 @@ static unsigned tx_le_req(const struct sk_buff *skb)
 	if (skb->ip_summed == CHECKSUM_PARTIAL)
 		++count;
 
+#ifdef SKY2_VLAN_TAG_USED
+	if (vlan_tx_tag_present(skb))
+		++count;
+#endif
+
 	return count;
 }
 
-- 
1.5.6.5

Re: [PATCH] sky2: Account for VLAN tag in tx_le_req

From: Stephen Hemminger <hidden>
Date: 2009-09-12 04:42:36

On Sat, 12 Sep 2009 12:17:29 +0900
Mike McCormack [off-list ref] wrote:
quoted hunk
With VLAN enabled, tx_le_req would return on less list elements than required,
 leading to a potential wrap around of the transmit ring buffer.

Signed-off-by: Mike McCormack <redacted>
---
 drivers/net/sky2.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 00bc65a..018aa58 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -66,7 +66,7 @@
 
 /* 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)
+#define MAX_SKB_TX_LE	(5 + (sizeof(dma_addr_t)/sizeof(u32))*MAX_SKB_FRAGS)
 #define TX_MIN_PENDING		(MAX_SKB_TX_LE+1)
 #define TX_MAX_PENDING		4096
 #define TX_DEF_PENDING		127
@@ -1576,6 +1576,11 @@ static unsigned tx_le_req(const struct sk_buff *skb)
 	if (skb->ip_summed == CHECKSUM_PARTIAL)
 		++count;
 
+#ifdef SKY2_VLAN_TAG_USED
+	if (vlan_tx_tag_present(skb))
+		++count;
+#endif
+
 	return count;
 }
 
The vlan tag can be nested with either ADDR64 or GSO element.
The correct test would be to do something like:

    	if (skb_is_gso(skb))
		++count;
        else if (sizeof(dma_addr_t) == sizeof(u32) && 
                 vlan_tx_tag_present(skb))
                ++count;

And the MAX_SKB_TX_LE value is fine. 

-- 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help