]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: hns3: add l4_type check for both ipv4 and ipv6
authorPeng Li <lipeng321@huawei.com>
Thu, 28 Jun 2018 04:12:22 +0000 (12:12 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Jun 2018 02:06:34 +0000 (11:06 +0900)
HW supports UDP, TCP and SCTP packets checksum for both ipv4 and
ipv6,  but do not support other type packets checksum for ipv4 or
ipv6.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index 25a73bb2e642dde42ae59f10369e7d3fefcb53f7..99bb6a82626aaea4e4f67ed851ad104dde49b7e9 100644 (file)
@@ -2103,11 +2103,11 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb,
                skb->csum_level = 1;
        case HNS3_OL4_TYPE_NO_TUN:
                /* Can checksum ipv4 or ipv6 + UDP/TCP/SCTP packets */
-               if (l3_type == HNS3_L3_TYPE_IPV4 ||
-                   (l3_type == HNS3_L3_TYPE_IPV6 &&
-                    (l4_type == HNS3_L4_TYPE_UDP ||
-                     l4_type == HNS3_L4_TYPE_TCP ||
-                     l4_type == HNS3_L4_TYPE_SCTP)))
+               if ((l3_type == HNS3_L3_TYPE_IPV4 ||
+                    l3_type == HNS3_L3_TYPE_IPV6) &&
+                   (l4_type == HNS3_L4_TYPE_UDP ||
+                    l4_type == HNS3_L4_TYPE_TCP ||
+                    l4_type == HNS3_L4_TYPE_SCTP))
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                break;
        }