aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Rose <gregory.v.rose@intel.com>2015-03-31 03:45:03 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-04-03 06:54:30 -0400
commit31eaaccff0fedb7cf6b6716efa3a2b8b8315ec68 (patch)
tree4cb3f7fe4602ed5499ebd69d7661f49518509573
parent6d7b967db3b1607c789f62936d68ced6321482ed (diff)
i40e/i40evf: Set Ethernet protocol correctly when Tx VLAN offloads are disabled
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>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c13
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_txrx.c14
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 5a1a67733b88..d8989f9d1798 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,
2057 __be16 protocol = skb->protocol; 2057 __be16 protocol = skb->protocol;
2058 u32 tx_flags = 0; 2058 u32 tx_flags = 0;
2059 2059
2060 if (protocol == htons(ETH_P_8021Q) &&
2061 !(tx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) {
2062 /* When HW VLAN acceleration is turned off by the user the
2063 * stack sets the protocol to 8021q so that the driver
2064 * can take any steps required to support the SW only
2065 * VLAN handling. In our case the driver doesn't need
2066 * to take any further steps so just set the protocol
2067 * to the encapsulated ethertype.
2068 */
2069 skb->protocol = vlan_get_protocol(skb);
2070 goto out;
2071 }
2072
2060 /* if we have a HW VLAN tag being added, default to the HW one */ 2073 /* if we have a HW VLAN tag being added, default to the HW one */
2061 if (skb_vlan_tag_present(skb)) { 2074 if (skb_vlan_tag_present(skb)) {
2062 tx_flags |= skb_vlan_tag_get(skb) << I40E_TX_FLAGS_VLAN_SHIFT; 2075 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 2be50a8d3671..e2ddb30e96f5 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,
1370 __be16 protocol = skb->protocol; 1370 __be16 protocol = skb->protocol;
1371 u32 tx_flags = 0; 1371 u32 tx_flags = 0;
1372 1372
1373 if (protocol == htons(ETH_P_8021Q) &&
1374 !(tx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_TX)) {
1375 /* When HW VLAN acceleration is turned off by the user the
1376 * stack sets the protocol to 8021q so that the driver
1377 * can take any steps required to support the SW only
1378 * VLAN handling. In our case the driver doesn't need
1379 * to take any further steps so just set the protocol
1380 * to the encapsulated ethertype.
1381 */
1382 skb->protocol = vlan_get_protocol(skb);
1383 goto out;
1384 }
1385
1373 /* if we have a HW VLAN tag being added, default to the HW one */ 1386 /* if we have a HW VLAN tag being added, default to the HW one */
1374 if (skb_vlan_tag_present(skb)) { 1387 if (skb_vlan_tag_present(skb)) {
1375 tx_flags |= skb_vlan_tag_get(skb) << I40E_TX_FLAGS_VLAN_SHIFT; 1388 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,
1386 tx_flags |= I40E_TX_FLAGS_SW_VLAN; 1399 tx_flags |= I40E_TX_FLAGS_SW_VLAN;
1387 } 1400 }
1388 1401
1402out:
1389 *flags = tx_flags; 1403 *flags = tx_flags;
1390 return 0; 1404 return 0;
1391} 1405}