netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matt Carlson" <mcarlson@broadcom.com>
To: "jamal" <hadi@cyberus.ca>
Cc: "Robert Olsson" <Robert.Olsson@data.slu.se>,
	"Evgeniy Polyakov" <johnpol@2ka.mipt.ru>,
	"Krishna Kumar2" <krkumar2@in.ibm.com>,
	"Gagan Arneja" <gaagaan@gmail.com>,
	netdev@vger.kernel.org, "Rick Jones" <rick.jones2@hp.com>,
	"Sridhar Samudrala" <sri@us.ibm.com>,
	"David Miller" <davem@davemloft.net>,
	"Jeff Garzik" <jeff@garzik.org>,
	"Michael Chan" <mchan@broadcom.com>
Subject: [PATCH] tg3: Fix VLAN tag corruption
Date: Thu, 05 Jul 2007 14:54:33 -0700	[thread overview]
Message-ID: <1183672474.24582.9.camel@teletran1> (raw)

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

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index be03cbd..cef9cbe 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -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;
 



                 reply	other threads:[~2007-07-05 21:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1183672474.24582.9.camel@teletran1 \
    --to=mcarlson@broadcom.com \
    --cc=Robert.Olsson@data.slu.se \
    --cc=davem@davemloft.net \
    --cc=gaagaan@gmail.com \
    --cc=hadi@cyberus.ca \
    --cc=jeff@garzik.org \
    --cc=johnpol@2ka.mipt.ru \
    --cc=krkumar2@in.ibm.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=rick.jones2@hp.com \
    --cc=sri@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).