netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Greg Rose <gregory.v.rose@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 08/15] i40e/i40evf: Set Ethernet protocol correctly when Tx VLAN offloads are disabled
Date: Fri,  3 Apr 2015 05:04:51 -0700	[thread overview]
Message-ID: <1428062698-16180-9-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1428062698-16180-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Greg Rose <gregory.v.rose@intel.com>

If transmit VLAN HW offloads are disabled then the network stack sends up
an skb with the protocol set to 8021q. In that case to get the correct
checksum offloads we have to reset the skb protocol to the encapsulated
ethertype.

Change-ID: I903d78533de09b1c5d3ec695ee1990dd0fa5dd0d
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Jim Young <james.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 13 +++++++++++++
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 14 ++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 5a1a677..d8989f9 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2057,6 +2057,19 @@ static int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
 	__be16 protocol = skb->protocol;
 	u32  tx_flags = 0;
 
+	if (protocol == htons(ETH_P_8021Q) &&
+	    !(tx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) {
+		/* When HW VLAN acceleration is turned off by the user the
+		 * stack sets the protocol to 8021q so that the driver
+		 * can take any steps required to support the SW only
+		 * VLAN handling.  In our case the driver doesn't need
+		 * to take any further steps so just set the protocol
+		 * to the encapsulated ethertype.
+		 */
+		skb->protocol = vlan_get_protocol(skb);
+		goto out;
+	}
+
 	/* if we have a HW VLAN tag being added, default to the HW one */
 	if (skb_vlan_tag_present(skb)) {
 		tx_flags |= skb_vlan_tag_get(skb) << I40E_TX_FLAGS_VLAN_SHIFT;
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index 2be50a8..e2ddb30 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -1370,6 +1370,19 @@ static int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
 	__be16 protocol = skb->protocol;
 	u32  tx_flags = 0;
 
+	if (protocol == htons(ETH_P_8021Q) &&
+	    !(tx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) {
+		/* When HW VLAN acceleration is turned off by the user the
+		 * stack sets the protocol to 8021q so that the driver
+		 * can take any steps required to support the SW only
+		 * VLAN handling.  In our case the driver doesn't need
+		 * to take any further steps so just set the protocol
+		 * to the encapsulated ethertype.
+		 */
+		skb->protocol = vlan_get_protocol(skb);
+		goto out;
+	}
+
 	/* if we have a HW VLAN tag being added, default to the HW one */
 	if (skb_vlan_tag_present(skb)) {
 		tx_flags |= skb_vlan_tag_get(skb) << I40E_TX_FLAGS_VLAN_SHIFT;
@@ -1386,6 +1399,7 @@ static int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
 		tx_flags |= I40E_TX_FLAGS_SW_VLAN;
 	}
 
+out:
 	*flags = tx_flags;
 	return 0;
 }
-- 
1.9.3

  parent reply	other threads:[~2015-04-03 12:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-03 12:04 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-04-03 Jeff Kirsher
2015-04-03 12:04 ` [net-next 01/15] i40evf: Fix Outer UDP RX checksum code Jeff Kirsher
2015-04-03 12:04 ` [net-next 02/15] i40e: validate VSI param from VFs Jeff Kirsher
2015-04-03 12:04 ` [net-next 03/15] i40e: Print some more info to help figure out the cause of HMC error Jeff Kirsher
2015-04-03 12:04 ` [net-next 04/15] i40e: Change some memcpys to struct assignments Jeff Kirsher
2015-04-03 12:04 ` [net-next 05/15] i40e/i40evf: fix bug when skb allocation fails Jeff Kirsher
2015-04-03 12:04 ` [net-next 06/15] i40e: fix invalid void return in FCoE code Jeff Kirsher
2015-04-03 12:04 ` [net-next 07/15] i40e: warn at the right time Jeff Kirsher
2015-04-03 12:04 ` Jeff Kirsher [this message]
2015-04-03 12:04 ` [net-next 09/15] i40e: Don't register/de-register apps on NIC partitions in MFP mode Jeff Kirsher
2015-04-03 12:04 ` [net-next 10/15] i40e: fix up VXLAN messages Jeff Kirsher
2015-04-03 12:04 ` [net-next 11/15] i40e: stop flow director on shutdown Jeff Kirsher
2015-04-03 12:04 ` [net-next 12/15] i40e: Communicate VSI id in place of VSI index to the VFs Jeff Kirsher
2015-04-03 12:04 ` [net-next 13/15] i40evf: protect VLAN filter list Jeff Kirsher
2015-04-03 12:04 ` [net-next 14/15] i40evf: Refactor VF RSS code Jeff Kirsher
2015-04-03 12:04 ` [net-next 15/15] i40e: Bump to version 1.3.1 Jeff Kirsher
2015-04-03 16:44 ` [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-04-03 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=1428062698-16180-9-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=gregory.v.rose@intel.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@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).