Commit d18e8118 authored by Yufeng Mo's avatar Yufeng Mo Committed by David S. Miller
Browse files

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



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>
parent f7ec554b
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ module_param(page_pool_enabled, bool, 0400);
#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
 *
@@ -1427,8 +1428,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,