提交 0ec94e64 编写于 作者: Y Yonglong Liu 提交者: Yang Yingliang

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

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

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

The hardware can not handle short tunnel frames below or equal
to 64 bytes, and will cause vlan tag missing problem.

This patch pads packet size to 65 bytes for tunnel frames to
fix this bug.
Signed-off-by: NYonglong Liu <liuyonglong@huawei.com>
Reviewed-by: NJunxin Chen <chenjunxin1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 ac001446
...@@ -61,6 +61,7 @@ MODULE_PARM_DESC(debug, " Network interface message level setting"); ...@@ -61,6 +61,7 @@ MODULE_PARM_DESC(debug, " Network interface message level setting");
#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
* *
...@@ -898,8 +899,13 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, ...@@ -898,8 +899,13 @@ 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)) {
int ret = skb_put_padto(skb, HNS3_MIN_TUN_PKT_LEN);
if (ret)
return ret;
return skb_checksum_help(skb); return 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.
先完成此消息的编辑!
想要评论请 注册