aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qualcomm/rmnet
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2021-06-12 09:37:31 -0500
committerDavid S. Miller <davem@davemloft.net>2021-06-12 13:18:48 -0700
commit9d0407bc4c9ca7a2378230dd86f8ce90a2b6ad09 (patch)
tree61a9fd7fa2b1cab1eb3ff9a8aa38ce927d1f2d4e /drivers/net/ethernet/qualcomm/rmnet
parentnet: qualcomm: rmnet: rearrange some NOTs (diff)
downloadlinux-dev-9d0407bc4c9ca7a2378230dd86f8ce90a2b6ad09.tar.xz
linux-dev-9d0407bc4c9ca7a2378230dd86f8ce90a2b6ad09.zip
net: qualcomm: rmnet: show that an intermediate sum is zero
This patch simply demonstrates that a checksum value computed when verifying an offloaded transport checksum value for both IPv4 and IPv6 is (normally) 0. It can be squashed into the next patch. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qualcomm/rmnet')
-rw-r--r--drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
index 1b170e9189d8..51909b8fa8a8 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -84,6 +84,11 @@ rmnet_map_ipv4_dl_csum_trailer(struct sk_buff *skb,
ip4h->protocol, 0);
pseudo_csum = csum16_add(ip_payload_csum, (__force __be16)pseudo_csum);
+ /* The trailer checksum *includes* the checksum in the transport
+ * header. Adding that to the pseudo checksum will yield 0xffff
+ * ("negative 0") if the message arrived intact.
+ */
+ WARN_ON((__sum16)~pseudo_csum);
csum_value_final = ~csum16_sub(pseudo_csum, (__force __be16)*csum_field);
if (unlikely(!csum_value_final)) {
@@ -150,6 +155,10 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb,
length, ip6h->nexthdr, 0);
pseudo_csum = csum16_add(ip6_payload_csum, (__force __be16)pseudo_csum);
+ /* Adding the payload checksum to the pseudo checksum yields 0xffff
+ * ("negative 0") if the message arrived intact.
+ */
+ WARN_ON((__sum16)~pseudo_csum);
csum_value_final = ~csum16_sub(pseudo_csum, (__force __be16)*csum_field);
if (unlikely(csum_value_final == 0)) {