net: hns3: fix miss L3E checking for rx packet
authorJian Shen <shenjian15@huawei.com>
Thu, 22 Dec 2022 06:43:42 +0000 (14:43 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 10:59:10 +0000 (11:59 +0100)
[ Upstream commit 7d89b53cea1a702f97117fb4361523519bb1e52c ]

For device supports RXD advanced layout, the driver will
return directly if the hardware finish the checksum
calculate. It cause missing L3E checking for ip packets.
Fixes it.

Fixes: 1ddc028ac849 ("net: hns3: refactor out RX completion checksum")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Hao Lan <lanhao@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index d06e2d0..822193b 100644 (file)
@@ -3667,18 +3667,16 @@ static int hns3_gro_complete(struct sk_buff *skb, u32 l234info)
        return 0;
 }
 
-static bool hns3_checksum_complete(struct hns3_enet_ring *ring,
+static void hns3_checksum_complete(struct hns3_enet_ring *ring,
                                   struct sk_buff *skb, u32 ptype, u16 csum)
 {
        if (ptype == HNS3_INVALID_PTYPE ||
            hns3_rx_ptype_tbl[ptype].ip_summed != CHECKSUM_COMPLETE)
-               return false;
+               return;
 
        hns3_ring_stats_update(ring, csum_complete);
        skb->ip_summed = CHECKSUM_COMPLETE;
        skb->csum = csum_unfold((__force __sum16)csum);
-
-       return true;
 }
 
 static void hns3_rx_handle_csum(struct sk_buff *skb, u32 l234info,
@@ -3738,8 +3736,7 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb,
                ptype = hnae3_get_field(ol_info, HNS3_RXD_PTYPE_M,
                                        HNS3_RXD_PTYPE_S);
 
-       if (hns3_checksum_complete(ring, skb, ptype, csum))
-               return;
+       hns3_checksum_complete(ring, skb, ptype, csum);
 
        /* check if hardware has done checksum */
        if (!(bd_base_info & BIT(HNS3_RXD_L3L4P_B)))
@@ -3748,6 +3745,7 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb,
        if (unlikely(l234info & (BIT(HNS3_RXD_L3E_B) | BIT(HNS3_RXD_L4E_B) |
                                 BIT(HNS3_RXD_OL3E_B) |
                                 BIT(HNS3_RXD_OL4E_B)))) {
+               skb->ip_summed = CHECKSUM_NONE;
                hns3_ring_stats_update(ring, l3l4_csum_err);
 
                return;