Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e365c013 authored by Yufeng Mo's avatar Yufeng Mo Committed by Greg Kroah-Hartman
Browse files

net: hns3: pad the short tunnel frame before sending to hardware



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: 3db084d2("net: hns3: Fix for vxlan tx checksum bug")
Signed-off-by: default avatarYufeng Mo <moyufeng@huawei.com>
Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6323a3ec
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ static const char hns3_driver_string[] =
static const char hns3_copyright[] = "Copyright (c) 2017 Huawei Corporation.";
static struct hnae3_client client;

#define HNS3_MIN_TUN_PKT_LEN	65U

/* hns3_pci_tbl - PCI Device ID Table
 *
 * Last entry must be all 0s
@@ -792,8 +794,11 @@ static int hns3_set_l3l4_type_csum(struct sk_buff *skb, u8 ol4_proto,
				HNS3_L4T_TCP);
		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);
		}

		hnae3_set_bit(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1);
		hnae3_set_field(*type_cs_vlan_tso,