nvethernet: Enable UDP L4 USO

UDP L4 USO support present for kernel-5.10 onwards.
So updating driver to make use UDP L4 USO flag
to make use of USO feature from kernel.

Ethtool can be used to enable/disable USO -
o sudo ethtool -K eth0 tx-udp-segmentation on/off

Bug 3106903

Change-Id: I0767a7bee1de047149c058b9582c4a00b72ea8fd
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2479782
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Bhadram Varka
2021-02-03 19:49:15 +05:30
committed by Revanth Kumar Uppala
parent 75aada80c2
commit 06eca7dba3

View File

@@ -2761,8 +2761,12 @@ static int ether_handle_tso(struct osi_tx_pkt_cx *tx_pkt_cx,
} }
} }
#if (KERNEL_VERSION(5, 9, 0) < LINUX_VERSION_CODE)
/* Start filling packet details in Tx_pkt_cx */ /* Start filling packet details in Tx_pkt_cx */
if (skb_shinfo(skb)->gso_type & (SKB_GSO_UDP_L4)) {
#else
if (skb_shinfo(skb)->gso_type & (SKB_GSO_UDP)) { if (skb_shinfo(skb)->gso_type & (SKB_GSO_UDP)) {
#endif
tx_pkt_cx->tcp_udp_hdrlen = sizeof(struct udphdr); tx_pkt_cx->tcp_udp_hdrlen = sizeof(struct udphdr);
tx_pkt_cx->mss = skb_shinfo(skb)->gso_size - tx_pkt_cx->mss = skb_shinfo(skb)->gso_size -
sizeof(struct udphdr); sizeof(struct udphdr);
@@ -5860,6 +5864,11 @@ static void ether_set_ndev_features(struct net_device *ndev,
features |= NETIF_F_SG; features |= NETIF_F_SG;
} }
#if (KERNEL_VERSION(5, 9, 0) < LINUX_VERSION_CODE)
if (pdata->osi_core->mac == OSI_MAC_HW_MGBE)
features |= NETIF_F_GSO_UDP_L4;
#endif
if (pdata->hw_feat.tx_coe_sel) { if (pdata->hw_feat.tx_coe_sel) {
features |= NETIF_F_IP_CSUM; features |= NETIF_F_IP_CSUM;
features |= NETIF_F_IPV6_CSUM; features |= NETIF_F_IPV6_CSUM;