From 06eca7dba3116c3edf14793b95df2419cb5c6ab6 Mon Sep 17 00:00:00 2001 From: Bhadram Varka Date: Wed, 3 Feb 2021 19:49:15 +0530 Subject: [PATCH] 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 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2479782 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/net/ethernet/nvidia/nvethernet/ether_linux.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c index b4df82cf..f92b9ae4 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c @@ -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 */ + if (skb_shinfo(skb)->gso_type & (SKB_GSO_UDP_L4)) { +#else if (skb_shinfo(skb)->gso_type & (SKB_GSO_UDP)) { +#endif tx_pkt_cx->tcp_udp_hdrlen = sizeof(struct udphdr); tx_pkt_cx->mss = skb_shinfo(skb)->gso_size - sizeof(struct udphdr); @@ -5860,6 +5864,11 @@ static void ether_set_ndev_features(struct net_device *ndev, 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) { features |= NETIF_F_IP_CSUM; features |= NETIF_F_IPV6_CSUM;