* [PATCH v2 1/3] igb: Add UDP segmentation offload support
2019-10-11 0:24 [PATCH v2 0/3] igb, ixgbe, i40e UDP segmentation offload support Josh Hunt
@ 2019-10-11 0:25 ` Josh Hunt
2019-10-11 15:29 ` Alexander Duyck
2019-10-11 0:25 ` [PATCH v2 2/3] ixgbe: " Josh Hunt
2019-10-11 0:25 ` [PATCH v2 3/3] i40e: " Josh Hunt
2 siblings, 1 reply; 6+ messages in thread
From: Josh Hunt @ 2019-10-11 0:25 UTC (permalink / raw)
To: netdev, intel-wired-lan, jeffrey.t.kirsher
Cc: willemb, sridhar.samudrala, aaron.f.brown, alexander.h.duyck,
Josh Hunt, Alexander Duyck
Based on a series from Alexander Duyck this change adds UDP segmentation
offload support to the igb driver.
CC: Alexander Duyck <alexander.h.duyck@intel.com>
CC: Willem de Bruijn <willemb@google.com>
Signed-off-by: Josh Hunt <johunt@akamai.com>
---
drivers/net/ethernet/intel/igb/e1000_82575.h | 1 +
drivers/net/ethernet/intel/igb/igb_main.c | 23 +++++++++++++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.h b/drivers/net/ethernet/intel/igb/e1000_82575.h
index 6ad775b1a4c5..63ec253ac788 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.h
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.h
@@ -127,6 +127,7 @@ struct e1000_adv_tx_context_desc {
};
#define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */
+#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */
#define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */
#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */
#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 packet TYPE of SCTP */
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 105b0624081a..4131bc8b079e 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2516,6 +2516,7 @@ igb_features_check(struct sk_buff *skb, struct net_device *dev,
if (unlikely(mac_hdr_len > IGB_MAX_MAC_HDR_LEN))
return features & ~(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
+ NETIF_F_GSO_UDP_L4 |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6);
@@ -2524,6 +2525,7 @@ igb_features_check(struct sk_buff *skb, struct net_device *dev,
if (unlikely(network_hdr_len > IGB_MAX_NETWORK_HDR_LEN))
return features & ~(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
+ NETIF_F_GSO_UDP_L4 |
NETIF_F_TSO |
NETIF_F_TSO6);
@@ -3120,7 +3122,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
NETIF_F_HW_CSUM;
if (hw->mac.type >= e1000_82576)
- netdev->features |= NETIF_F_SCTP_CRC;
+ netdev->features |= NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4;
if (hw->mac.type >= e1000_i350)
netdev->features |= NETIF_F_HW_TC;
@@ -5694,6 +5696,7 @@ static int igb_tso(struct igb_ring *tx_ring,
} ip;
union {
struct tcphdr *tcp;
+ struct udphdr *udp;
unsigned char *hdr;
} l4;
u32 paylen, l4_offset;
@@ -5713,7 +5716,8 @@ static int igb_tso(struct igb_ring *tx_ring,
l4.hdr = skb_checksum_start(skb);
/* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
- type_tucmd = E1000_ADVTXD_TUCMD_L4T_TCP;
+ type_tucmd = (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)) ?
+ E1000_ADVTXD_TUCMD_L4T_TCP : E1000_ADVTXD_TUCMD_L4T_UDP;
/* initialize outer IP header fields */
if (ip.v4->version == 4) {
@@ -5741,12 +5745,19 @@ static int igb_tso(struct igb_ring *tx_ring,
/* determine offset of inner transport header */
l4_offset = l4.hdr - skb->data;
- /* compute length of segmentation header */
- *hdr_len = (l4.tcp->doff * 4) + l4_offset;
-
/* remove payload length from inner checksum */
paylen = skb->len - l4_offset;
- csum_replace_by_diff(&l4.tcp->check, htonl(paylen));
+ if (type_tucmd & E1000_ADVTXD_TUCMD_L4T_TCP) {
+ /* compute length of segmentation header */
+ *hdr_len = (l4.tcp->doff * 4) + l4_offset;
+ csum_replace_by_diff(&l4.tcp->check,
+ (__force __wsum)htonl(paylen));
+ } else {
+ /* compute length of segmentation header */
+ *hdr_len = sizeof(*l4.udp) + l4_offset;
+ csum_replace_by_diff(&l4.udp->check,
+ (__force __wsum)htonl(paylen));
+ }
/* update gso size and bytecount with header size */
first->gso_segs = skb_shinfo(skb)->gso_segs;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] igb: Add UDP segmentation offload support
2019-10-11 0:25 ` [PATCH v2 1/3] igb: Add " Josh Hunt
@ 2019-10-11 15:29 ` Alexander Duyck
2019-10-11 16:18 ` Josh Hunt
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Duyck @ 2019-10-11 15:29 UTC (permalink / raw)
To: Josh Hunt, netdev, intel-wired-lan, jeffrey.t.kirsher
Cc: willemb, sridhar.samudrala, aaron.f.brown
On Thu, 2019-10-10 at 20:25 -0400, Josh Hunt wrote:
> Based on a series from Alexander Duyck this change adds UDP segmentation
> offload support to the igb driver.
>
> CC: Alexander Duyck <alexander.h.duyck@intel.com>
> CC: Willem de Bruijn <willemb@google.com>
> Signed-off-by: Josh Hunt <johunt@akamai.com>
> ---
> drivers/net/ethernet/intel/igb/e1000_82575.h | 1 +
> drivers/net/ethernet/intel/igb/igb_main.c | 23 +++++++++++++++++------
> 2 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.h b/drivers/net/ethernet/intel/igb/e1000_82575.h
> index 6ad775b1a4c5..63ec253ac788 100644
> --- a/drivers/net/ethernet/intel/igb/e1000_82575.h
> +++ b/drivers/net/ethernet/intel/igb/e1000_82575.h
> @@ -127,6 +127,7 @@ struct e1000_adv_tx_context_desc {
> };
>
> #define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */
> +#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */
> #define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */
> #define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */
> #define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 packet TYPE of SCTP */
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 105b0624081a..4131bc8b079e 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -2516,6 +2516,7 @@ igb_features_check(struct sk_buff *skb, struct net_device *dev,
> if (unlikely(mac_hdr_len > IGB_MAX_MAC_HDR_LEN))
> return features & ~(NETIF_F_HW_CSUM |
> NETIF_F_SCTP_CRC |
> + NETIF_F_GSO_UDP_L4 |
> NETIF_F_HW_VLAN_CTAG_TX |
> NETIF_F_TSO |
> NETIF_F_TSO6);
> @@ -2524,6 +2525,7 @@ igb_features_check(struct sk_buff *skb, struct net_device *dev,
> if (unlikely(network_hdr_len > IGB_MAX_NETWORK_HDR_LEN))
> return features & ~(NETIF_F_HW_CSUM |
> NETIF_F_SCTP_CRC |
> + NETIF_F_GSO_UDP_L4 |
> NETIF_F_TSO |
> NETIF_F_TSO6);
>
> @@ -3120,7 +3122,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> NETIF_F_HW_CSUM;
>
> if (hw->mac.type >= e1000_82576)
> - netdev->features |= NETIF_F_SCTP_CRC;
> + netdev->features |= NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4;
>
> if (hw->mac.type >= e1000_i350)
> netdev->features |= NETIF_F_HW_TC;
> @@ -5694,6 +5696,7 @@ static int igb_tso(struct igb_ring *tx_ring,
> } ip;
> union {
> struct tcphdr *tcp;
> + struct udphdr *udp;
> unsigned char *hdr;
> } l4;
> u32 paylen, l4_offset;
> @@ -5713,7 +5716,8 @@ static int igb_tso(struct igb_ring *tx_ring,
> l4.hdr = skb_checksum_start(skb);
>
> /* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
> - type_tucmd = E1000_ADVTXD_TUCMD_L4T_TCP;
> + type_tucmd = (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)) ?
> + E1000_ADVTXD_TUCMD_L4T_TCP : E1000_ADVTXD_TUCMD_L4T_UDP;
The logic here seems a bit convoluted. Instead of testing for
'!SKB_GSO_UDP_L4' why not just make L4T_UDP the first option and drop the
'!'? That will make the TCP offload the default case rather than the UDP
offload.
The same applies to the other 2 patches.
> /* initialize outer IP header fields */
> if (ip.v4->version == 4) {
> @@ -5741,12 +5745,19 @@ static int igb_tso(struct igb_ring *tx_ring,
> /* determine offset of inner transport header */
> l4_offset = l4.hdr - skb->data;
>
> - /* compute length of segmentation header */
> - *hdr_len = (l4.tcp->doff * 4) + l4_offset;
> -
> /* remove payload length from inner checksum */
> paylen = skb->len - l4_offset;
> - csum_replace_by_diff(&l4.tcp->check, htonl(paylen));
> + if (type_tucmd & E1000_ADVTXD_TUCMD_L4T_TCP) {
> + /* compute length of segmentation header */
> + *hdr_len = (l4.tcp->doff * 4) + l4_offset;
> + csum_replace_by_diff(&l4.tcp->check,
> + (__force __wsum)htonl(paylen));
> + } else {
> + /* compute length of segmentation header */
> + *hdr_len = sizeof(*l4.udp) + l4_offset;
> + csum_replace_by_diff(&l4.udp->check,
> + (__force __wsum)htonl(paylen));
> + }
>
> /* update gso size and bytecount with header size */
> first->gso_segs = skb_shinfo(skb)->gso_segs;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] igb: Add UDP segmentation offload support
2019-10-11 15:29 ` Alexander Duyck
@ 2019-10-11 16:18 ` Josh Hunt
0 siblings, 0 replies; 6+ messages in thread
From: Josh Hunt @ 2019-10-11 16:18 UTC (permalink / raw)
To: Alexander Duyck, netdev, intel-wired-lan, jeffrey.t.kirsher
Cc: willemb, sridhar.samudrala, aaron.f.brown
On 10/11/19 8:29 AM, Alexander Duyck wrote:
> On Thu, 2019-10-10 at 20:25 -0400, Josh Hunt wrote:
>> Based on a series from Alexander Duyck this change adds UDP segmentation
>> offload support to the igb driver.
>>
>> CC: Alexander Duyck <alexander.h.duyck@intel.com>
>> CC: Willem de Bruijn <willemb@google.com>
>> Signed-off-by: Josh Hunt <johunt@akamai.com>
>> ---
>> drivers/net/ethernet/intel/igb/e1000_82575.h | 1 +
>> drivers/net/ethernet/intel/igb/igb_main.c | 23 +++++++++++++++++------
>> 2 files changed, 18 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.h b/drivers/net/ethernet/intel/igb/e1000_82575.h
>> index 6ad775b1a4c5..63ec253ac788 100644
>> --- a/drivers/net/ethernet/intel/igb/e1000_82575.h
>> +++ b/drivers/net/ethernet/intel/igb/e1000_82575.h
>> @@ -127,6 +127,7 @@ struct e1000_adv_tx_context_desc {
>> };
>>
>> #define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */
>> +#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */
>> #define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */
>> #define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */
>> #define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 packet TYPE of SCTP */
>> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
>> index 105b0624081a..4131bc8b079e 100644
>> --- a/drivers/net/ethernet/intel/igb/igb_main.c
>> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
>> @@ -2516,6 +2516,7 @@ igb_features_check(struct sk_buff *skb, struct net_device *dev,
>> if (unlikely(mac_hdr_len > IGB_MAX_MAC_HDR_LEN))
>> return features & ~(NETIF_F_HW_CSUM |
>> NETIF_F_SCTP_CRC |
>> + NETIF_F_GSO_UDP_L4 |
>> NETIF_F_HW_VLAN_CTAG_TX |
>> NETIF_F_TSO |
>> NETIF_F_TSO6);
>> @@ -2524,6 +2525,7 @@ igb_features_check(struct sk_buff *skb, struct net_device *dev,
>> if (unlikely(network_hdr_len > IGB_MAX_NETWORK_HDR_LEN))
>> return features & ~(NETIF_F_HW_CSUM |
>> NETIF_F_SCTP_CRC |
>> + NETIF_F_GSO_UDP_L4 |
>> NETIF_F_TSO |
>> NETIF_F_TSO6);
>>
>> @@ -3120,7 +3122,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>> NETIF_F_HW_CSUM;
>>
>> if (hw->mac.type >= e1000_82576)
>> - netdev->features |= NETIF_F_SCTP_CRC;
>> + netdev->features |= NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4;
>>
>> if (hw->mac.type >= e1000_i350)
>> netdev->features |= NETIF_F_HW_TC;
>> @@ -5694,6 +5696,7 @@ static int igb_tso(struct igb_ring *tx_ring,
>> } ip;
>> union {
>> struct tcphdr *tcp;
>> + struct udphdr *udp;
>> unsigned char *hdr;
>> } l4;
>> u32 paylen, l4_offset;
>> @@ -5713,7 +5716,8 @@ static int igb_tso(struct igb_ring *tx_ring,
>> l4.hdr = skb_checksum_start(skb);
>>
>> /* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
>> - type_tucmd = E1000_ADVTXD_TUCMD_L4T_TCP;
>> + type_tucmd = (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)) ?
>> + E1000_ADVTXD_TUCMD_L4T_TCP : E1000_ADVTXD_TUCMD_L4T_UDP;
>
> The logic here seems a bit convoluted. Instead of testing for
> '!SKB_GSO_UDP_L4' why not just make L4T_UDP the first option and drop the
> '!'? That will make the TCP offload the default case rather than the UDP
> offload.
>
> The same applies to the other 2 patches.
OK sure. I think I was trying to keep the TCP case first for some
reason, but agree that I should probably just reverse the order. Will
send a v3.
Josh
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] ixgbe: Add UDP segmentation offload support
2019-10-11 0:24 [PATCH v2 0/3] igb, ixgbe, i40e UDP segmentation offload support Josh Hunt
2019-10-11 0:25 ` [PATCH v2 1/3] igb: Add " Josh Hunt
@ 2019-10-11 0:25 ` Josh Hunt
2019-10-11 0:25 ` [PATCH v2 3/3] i40e: " Josh Hunt
2 siblings, 0 replies; 6+ messages in thread
From: Josh Hunt @ 2019-10-11 0:25 UTC (permalink / raw)
To: netdev, intel-wired-lan, jeffrey.t.kirsher
Cc: willemb, sridhar.samudrala, aaron.f.brown, alexander.h.duyck,
Josh Hunt, Alexander Duyck
Repost from a series by Alexander Duyck to add UDP segmentation offload
support to the igb driver:
https://lore.kernel.org/netdev/20180504003916.4769.66271.stgit@localhost.localdomain/
CC: Alexander Duyck <alexander.h.duyck@intel.com>
CC: Willem de Bruijn <willemb@google.com>
Suggested-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Josh Hunt <johunt@akamai.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 1ce2397306b9..7d50c1a4a3be 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7946,6 +7946,7 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
} ip;
union {
struct tcphdr *tcp;
+ struct udphdr *udp;
unsigned char *hdr;
} l4;
u32 paylen, l4_offset;
@@ -7969,7 +7970,8 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
l4.hdr = skb_checksum_start(skb);
/* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
- type_tucmd = IXGBE_ADVTXD_TUCMD_L4T_TCP;
+ type_tucmd = (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)) ?
+ IXGBE_ADVTXD_TUCMD_L4T_TCP : IXGBE_ADVTXD_TUCMD_L4T_UDP;
/* initialize outer IP header fields */
if (ip.v4->version == 4) {
@@ -7999,12 +8001,20 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
/* determine offset of inner transport header */
l4_offset = l4.hdr - skb->data;
- /* compute length of segmentation header */
- *hdr_len = (l4.tcp->doff * 4) + l4_offset;
-
/* remove payload length from inner checksum */
paylen = skb->len - l4_offset;
- csum_replace_by_diff(&l4.tcp->check, (__force __wsum)htonl(paylen));
+
+ if (type_tucmd & IXGBE_ADVTXD_TUCMD_L4T_TCP) {
+ /* compute length of segmentation header */
+ *hdr_len = (l4.tcp->doff * 4) + l4_offset;
+ csum_replace_by_diff(&l4.tcp->check,
+ (__force __wsum)htonl(paylen));
+ } else {
+ /* compute length of segmentation header */
+ *hdr_len = sizeof(*l4.udp) + l4_offset;
+ csum_replace_by_diff(&l4.udp->check,
+ (__force __wsum)htonl(paylen));
+ }
/* update gso size and bytecount with header size */
first->gso_segs = skb_shinfo(skb)->gso_segs;
@@ -10190,6 +10200,7 @@ ixgbe_features_check(struct sk_buff *skb, struct net_device *dev,
if (unlikely(mac_hdr_len > IXGBE_MAX_MAC_HDR_LEN))
return features & ~(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
+ NETIF_F_GSO_UDP_L4 |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_TSO |
NETIF_F_TSO6);
@@ -10198,6 +10209,7 @@ ixgbe_features_check(struct sk_buff *skb, struct net_device *dev,
if (unlikely(network_hdr_len > IXGBE_MAX_NETWORK_HDR_LEN))
return features & ~(NETIF_F_HW_CSUM |
NETIF_F_SCTP_CRC |
+ NETIF_F_GSO_UDP_L4 |
NETIF_F_TSO |
NETIF_F_TSO6);
@@ -10907,7 +10919,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
IXGBE_GSO_PARTIAL_FEATURES;
if (hw->mac.type >= ixgbe_mac_82599EB)
- netdev->features |= NETIF_F_SCTP_CRC;
+ netdev->features |= NETIF_F_SCTP_CRC | NETIF_F_GSO_UDP_L4;
#ifdef CONFIG_IXGBE_IPSEC
#define IXGBE_ESP_FEATURES (NETIF_F_HW_ESP | \
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] i40e: Add UDP segmentation offload support
2019-10-11 0:24 [PATCH v2 0/3] igb, ixgbe, i40e UDP segmentation offload support Josh Hunt
2019-10-11 0:25 ` [PATCH v2 1/3] igb: Add " Josh Hunt
2019-10-11 0:25 ` [PATCH v2 2/3] ixgbe: " Josh Hunt
@ 2019-10-11 0:25 ` Josh Hunt
2 siblings, 0 replies; 6+ messages in thread
From: Josh Hunt @ 2019-10-11 0:25 UTC (permalink / raw)
To: netdev, intel-wired-lan, jeffrey.t.kirsher
Cc: willemb, sridhar.samudrala, aaron.f.brown, alexander.h.duyck,
Josh Hunt, Alexander Duyck
Based on a series from Alexander Duyck this change adds UDP segmentation
offload support to the i40e driver.
CC: Alexander Duyck <alexander.h.duyck@intel.com>
CC: Willem de Bruijn <willemb@google.com>
Signed-off-by: Josh Hunt <johunt@akamai.com>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 12 +++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 6031223eafab..56f8c52cbba1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -12911,6 +12911,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
NETIF_F_GSO_IPXIP6 |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
+ NETIF_F_GSO_UDP_L4 |
NETIF_F_SCTP_CRC |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index e3f29dc8b290..2250284e27fd 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2960,10 +2960,16 @@ static int i40e_tso(struct i40e_tx_buffer *first, u8 *hdr_len,
/* remove payload length from inner checksum */
paylen = skb->len - l4_offset;
- csum_replace_by_diff(&l4.tcp->check, (__force __wsum)htonl(paylen));
- /* compute length of segmentation header */
- *hdr_len = (l4.tcp->doff * 4) + l4_offset;
+ if (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)) {
+ csum_replace_by_diff(&l4.tcp->check, (__force __wsum)htonl(paylen));
+ /* compute length of segmentation header */
+ *hdr_len = (l4.tcp->doff * 4) + l4_offset;
+ } else {
+ csum_replace_by_diff(&l4.udp->check, (__force __wsum)htonl(paylen));
+ /* compute length of segmentation header */
+ *hdr_len = sizeof(*l4.udp) + l4_offset;
+ }
/* pull values out of skb_shinfo */
gso_size = skb_shinfo(skb)->gso_size;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread