diff options
author | Alex Elder <elder@linaro.org> | 2021-06-12 17:37:30 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-12 23:18:48 +0300 |
commit | bbd45f10ed0e032b599973d56d5c221266cf2ccf (patch) | |
tree | c4a5a425c79d16c0e713d0df14440ebcd60fb01c /drivers | |
parent | 0e6af897fcd9c154c06f239669401c64da52d84e (diff) | |
download | linux-bbd45f10ed0e032b599973d56d5c221266cf2ccf.tar.xz |
net: qualcomm: rmnet: rearrange some NOTs
With the ones' complement arithmetic, the sum of two negated values
is equal to the negation of the sum of the two original values [1].
Rearrange the calculation ip6_payload_sum using this property.
[1] https://tools.ietf.org/html/rfc1071
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c index 3e6feef0fd25..1b170e9189d8 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c @@ -140,8 +140,8 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb, * checksum computed over the pseudo header. */ ip_header_csum = (__force __be16)ip_fast_csum(ip6h, sizeof(*ip6h) / 4); - ip6_payload_csum = csum16_sub((__force __sum16)~csum_trailer->csum_value, - ~ip_header_csum); + ip6_payload_csum = ~csum16_sub((__force __sum16)csum_trailer->csum_value, + ip_header_csum); length = (ip6h->nexthdr == IPPROTO_UDP) ? ntohs(((struct udphdr *)txporthdr)->len) : |