Skip to content

Commit 34fc06d

Browse files
Yufeng Mogregkh
authored andcommitted
net: hns3: pad the short tunnel frame before sending to hardware
commit d18e811 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: 3db084d("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>
1 parent 0511d09 commit 34fc06d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎drivers/net/ethernet/hisilicon/hns3/hns3_enet.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ MODULE_PARM_DESC(debug, " Network interface message level setting");
6060
#define HNS3_OUTER_VLAN_TAG 2
6161

6262
#define HNS3_MIN_TX_LEN 33U
63+
#define HNS3_MIN_TUN_PKT_LEN 65U
6364

6465
/* hns3_pci_tbl - PCI Device ID Table
6566
*
@@ -913,8 +914,11 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto,
913914
l4.tcp->doff);
914915
break;
915916
case IPPROTO_UDP:
916-
if (hns3_tunnel_csum_bug(skb))
917-
return skb_checksum_help(skb);
917+
if (hns3_tunnel_csum_bug(skb)) {
918+
int ret = skb_put_padto(skb, HNS3_MIN_TUN_PKT_LEN);
919+
920+
return ret ? ret : skb_checksum_help(skb);
921+
}
918922

919923
hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1);
920924
hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_S,

0 commit comments

Comments
 (0)