提交 98c26690 编写于 作者: Y Yufeng Mo 提交者: Zheng Zengkai

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

mainline inclusion
from mainline-v5.15-rc2
commit d18e8118
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4CVS3
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d18e81183b1c

----------------------------------------------------------------------

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: NYufeng Mo <moyufeng@huawei.com>
Signed-off-by: NGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Reviewed-by: NYongxin Li <liyongxin1@huawei.com>
Signed-off-by: NJunxin Chen <chenjunxin1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 7338b2aa
...@@ -73,6 +73,7 @@ MODULE_PARM_DESC(tx_sgl, "Minimum number of frags when using dma_map_sg() to opt ...@@ -73,6 +73,7 @@ MODULE_PARM_DESC(tx_sgl, "Minimum number of frags when using dma_map_sg() to opt
#define HNS3_OUTER_VLAN_TAG 2 #define HNS3_OUTER_VLAN_TAG 2
#define HNS3_MIN_TX_LEN 33U #define HNS3_MIN_TX_LEN 33U
#define HNS3_MIN_TUN_PKT_LEN 65U
/* hns3_pci_tbl - PCI Device ID Table /* hns3_pci_tbl - PCI Device ID Table
* *
...@@ -1424,8 +1425,11 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, ...@@ -1424,8 +1425,11 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto,
l4.tcp->doff); l4.tcp->doff);
break; break;
case IPPROTO_UDP: case IPPROTO_UDP:
if (hns3_tunnel_csum_bug(skb)) if (hns3_tunnel_csum_bug(skb)) {
return skb_checksum_help(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_L4CS_B, 1);
hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_S, hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_S,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册