]> git.baikalelectronics.ru Git - kernel.git/commit
net: hns: Fix to conditionally convey RX checksum flag to stack
authorSalil <salil.mehta@huawei.com>
Tue, 6 Dec 2016 11:09:46 +0000 (11:09 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 6 Dec 2016 16:41:57 +0000 (11:41 -0500)
commitd2734c2defc8be37478e19aed46cb271235abcf9
tree535aad3a3a4ad981c4fd419702cd3020aeb7387b
parent9556f9466af5d738ef45c0d8e68e191a146a62c7
net: hns: Fix to conditionally convey RX checksum flag to stack

This patch introduces the RX checksum function to check the
status of the hardware calculated checksum and its error and
appropriately convey status to the upper stack in skb->ip_summed
field.

In hardware, we only support checksum for the following
protocols:
1) IPv4,
2) TCP(over IPv4 or IPv6),
3) UDP(over IPv4 or IPv6),
4) SCTP(over IPv4 or IPv6)
but we support many L3(IPv4, IPv6, MPLS, PPPoE etc) and
L4(TCP, UDP, GRE, SCTP, IGMP, ICMP etc.) protocols.

Hardware limitation:
Our present hardware RX Descriptor lacks L3/L4 checksum
"Status & Error" bit (which usually can be used to indicate whether
checksum was calculated by the hardware and if there was any error
encountered during checksum calculation).

Software workaround:
We do get info within the RX descriptor about the kind of
L3/L4 protocol coming in the packet and the error status. These
errors might not just be checksum errors but could be related to
version, length of IPv4, UDP, TCP etc.
Because there is no-way of knowing if it is a L3/L4 error due
to bad checksum or any other L3/L4 error, we will not (cannot)
convey hardware checksum status(CHECKSUM_UNNECESSARY) for such
cases to upper stack and will not maintain the RX L3/L4 checksum
counters as well.

Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns/hnae.h
drivers/net/ethernet/hisilicon/hns/hns_enet.c