Skip to contentSkip to conversation

tg3: Fix VLAN tag corruption

PATCH New Matt Carlson 1 participant 1 message Jul 5, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tg3: Fix VLAN tag corruption

This patch fixes a VLAN tag corruption bug introduced in the tx batching modifications.

drivers/net/tg3.c +16 -14
index be03cbd..cef9cbe 100644
@@ -3896,8 +3896,15 @@ struct tg3_tx_cbdata {
 static int tg3_prep_bug_frame(struct sk_buff *skb, struct net_device *dev)
 {
 	struct tg3_tx_cbdata *cb = TG3_SKB_CB(skb);
+	struct tg3 *tp = netdev_priv(dev);
+	u32 vlantag = 0;
+
+#if TG3_VLAN_TAG_USED
+	if (tp->vlgrp != NULL && vlan_tx_tag_present(skb))
+		vlantag = (TXD_FLAG_VLAN | (vlan_tx_tag_get(skb) << 16));
+#endif
 
-	cb->base_flags = 0;
+	cb->base_flags = vlantag;
 	cb->mss = skb_shinfo(skb)->gso_size;
 	if (cb->mss != 0) {
 		if (skb_header_cloned(skb) &&
@@ -3919,8 +3926,15 @@ static int tg3_prep_bug_frame(struct sk_buff *skb, struct net_device *dev)
 static int tg3_prep_frame(struct sk_buff *skb, struct net_device *dev)
 {
 	struct tg3_tx_cbdata *cb = TG3_SKB_CB(skb);
+	struct tg3 *tp = netdev_priv(dev);
+	u32 vlantag = 0;
+
+#if TG3_VLAN_TAG_USED
+	if (tp->vlgrp != NULL && vlan_tx_tag_present(skb))
+		vlantag = (TXD_FLAG_VLAN | (vlan_tx_tag_get(skb) << 16));
+#endif
 
-	cb->base_flags = 0;
+	cb->base_flags = vlantag;
 	cb->mss = skb_shinfo(skb)->gso_size;
 	if (cb->mss != 0) {
 		int tcp_opt_len, ip_tcp_len;
@@ -3985,13 +3999,6 @@ static int tg3_enqueue(struct sk_buff *skb, struct net_device *dev)
 	u32 len, entry;
 	struct tg3_tx_cbdata *cb = TG3_SKB_CB(skb);
 
-
-#if TG3_VLAN_TAG_USED
-	if (tp->vlgrp != NULL && vlan_tx_tag_present(skb))
-		cb->base_flags |= (TXD_FLAG_VLAN |
-			       (vlan_tx_tag_get(skb) << 16));
-#endif
-
 	entry = tp->tx_prod;
 	len = skb_headlen(skb);
 	/* Queue skb data, a.k.a. the main skb fragment. */
@@ -4187,11 +4194,6 @@ static int tg3_enqueue_buggy(struct sk_buff *skb, struct net_device *dev)
 			}
 		}
 	}
-#if TG3_VLAN_TAG_USED
-	if (tp->vlgrp != NULL && vlan_tx_tag_present(skb))
-		cb->base_flags |= (TXD_FLAG_VLAN |
-			       (vlan_tx_tag_get(skb) << 16));
-#endif
 	len = skb_headlen(skb);
 	entry = tp->tx_prod;