提交 3825ff58 编写于 作者: H Huazhong Tan 提交者: Zheng Zengkai

net: hns3: add a check for devcie's verion in hns3_tunnel_csum_bug()

mainline inclusion
from mainline-v5.11-rc1
commit ade36cce
category: feature
bugzilla: 173966
CVE: NA

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

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

For the device whose version is above V3(include V3), the hardware
can do checksum offload for the non-tunnel udp packet, who has
a dest port as the IANA assigned. So add a check for devcie's verion
in hns3_tunnel_csum_bug().
Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
Reviewed-by: Nli yongxin <liyongxin1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 a8c535b4
...@@ -828,8 +828,16 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto, ...@@ -828,8 +828,16 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto,
*/ */
static bool hns3_tunnel_csum_bug(struct sk_buff *skb) static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
{ {
struct hns3_nic_priv *priv = netdev_priv(skb->dev);
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(priv->ae_handle->pdev);
union l4_hdr_info l4; union l4_hdr_info l4;
/* device version above V3(include V3), the hardware can
* do this checksum offload.
*/
if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3)
return false;
l4.hdr = skb_transport_header(skb); l4.hdr = skb_transport_header(skb);
if (!(!skb->encapsulation && if (!(!skb->encapsulation &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册