]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
net: hns3: pad the short tunnel frame before sending to hardware
authorYufeng Mo <moyufeng@huawei.com>
Mon, 13 Sep 2021 13:08:21 +0000 (21:08 +0800)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Tue, 12 Oct 2021 22:31:43 +0000 (16:31 -0600)
BugLink: https://bugs.launchpad.net/bugs/1946802
commit d18e81183b1cb9c309266cbbce9acd3e0c528d04 upstream.

The hardware cannot handle short tunnel frames below 65 bytes,
and will cause vlan tag missing problem. So pads packet size to
65 bytes for tunnel frames to fix this bug.

Fixes: 3db084d28dc0("net: hns3: Fix for vxlan tx checksum bug")
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index b2728530e39875d67d9506d39ee370c9793beec8..24859440cf4767b024ff8b72e484569d91e35447 100644 (file)
@@ -62,6 +62,7 @@ MODULE_PARM_DESC(debug, " Network interface message level setting");
 #define HNS3_OUTER_VLAN_TAG    2
 
 #define HNS3_MIN_TX_LEN                33U
+#define HNS3_MIN_TUN_PKT_LEN   65U
 
 /* hns3_pci_tbl - PCI Device ID Table
  *
@@ -921,8 +922,11 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto,
                               l4.tcp->doff);
                break;
        case IPPROTO_UDP:
-               if (hns3_tunnel_csum_bug(skb))
-                       return skb_checksum_help(skb);
+               if (hns3_tunnel_csum_bug(skb)) {
+                       int ret = skb_put_padto(skb, HNS3_MIN_TUN_PKT_LEN);
+
+                       return ret ? ret : skb_checksum_help(skb);
+               }
 
                hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1);
                hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_S,