netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladislav Yasevich <vyasevich@gmail.com>
To: netdev@vger.kernel.org
Cc: Vladislav Yasevich <vyasevic@redhat.com>,
	Prashant Sreedharan <prashant@broadcom.com>,
	Michael Chan <mchan@broadcom.com>
Subject: [PATCH v2 1/2] tg3: Work around HW/FW limitations with vlan encapsulated frames
Date: Fri, 19 Sep 2014 18:23:08 -0400	[thread overview]
Message-ID: <1411165389-21276-2-git-send-email-vyasevic@redhat.com> (raw)
In-Reply-To: <1411165389-21276-1-git-send-email-vyasevic@redhat.com>

TG3 appears to have an issue performing TSO and checksum offloading
correctly when the frame has been vlan encapsulated (non-accelerated).
In these cases, tcp checksum is not correctly updated.

This patch attempts to work around this issue.  After the patch,
802.1ad vlans start working correctly over tg3 devices.

CC: Prashant Sreedharan <prashant@broadcom.com>
CC: Michael Chan <mchan@broadcom.com>
Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
v2: - Moved segmentation call sooner
    - Preserve checksum txd flag for LSO.

 drivers/net/ethernet/broadcom/tg3.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index cb77ae9..b78d043 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -7924,6 +7924,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		if (skb_cow_head(skb, 0))
 			goto drop;
 
+		/* HW/FW can not correctly segment packets that have been
+		 * vlan encapsulated.
+		 */
+		if (skb->protocol == htons(ETH_P_8021Q) ||
+		    skb->protocol == htons(ETH_P_8021AD))
+			return tg3_tso_bug(tp, tnapi, txq, skb);
+
 		iph = ip_hdr(skb);
 		tcp_opt_len = tcp_optlen(skb);
 
@@ -7979,6 +7986,16 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
 				base_flags |= tsflags << 12;
 			}
 		}
+	} else if (skb->ip_summed == CHECKSUM_PARTIAL) {
+		/* HW/FW can not correctly checksum packets that have been
+		 * vlan encapsulated.
+		 */
+		if (skb->protocol == htons(ETH_P_8021Q) ||
+		    skb->protocol == htons(ETH_P_8021AD)) {
+			if (skb_checksum_help(skb))
+				goto drop;
+			base_flags &= ~TXD_FLAG_TCPUDP_CSUM;
+		}
 	}
 
 	if (tg3_flag(tp, USE_JUMBO_BDFLAG) &&
-- 
1.9.3

  reply	other threads:[~2014-09-19 22:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-19 22:23 [PATCH v2 0/2] tg3: Fix handling of non-acceleration vlans Vladislav Yasevich
2014-09-19 22:23 ` Vladislav Yasevich [this message]
2014-09-19 22:23 ` [PATCH v2 2/2] tg3: Allow for receive of full-size 8021AD frames Vladislav Yasevich
2014-09-19 22:59   ` Eric Dumazet
2014-09-19 23:14     ` Prashant Sreedharan
2014-09-19 23:37       ` Eric Dumazet
2014-09-20  0:39 ` [PATCH v2 0/2] tg3: Fix handling of non-acceleration vlans Prashant Sreedharan
2014-09-30 18:53 ` [PATCH] tg3: Allow for receive of full-size 8021AD frames Vlad Yasevich
2014-09-30 21:02   ` David Miller

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=1411165389-21276-2-git-send-email-vyasevic@redhat.com \
    --to=vyasevich@gmail.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=prashant@broadcom.com \
    --cc=vyasevic@redhat.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).