Commit bbd45f10 authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

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/rfc1071Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0e6af897
...@@ -140,8 +140,8 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb, ...@@ -140,8 +140,8 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb,
* checksum computed over the pseudo header. * checksum computed over the pseudo header.
*/ */
ip_header_csum = (__force __be16)ip_fast_csum(ip6h, sizeof(*ip6h) / 4); ip_header_csum = (__force __be16)ip_fast_csum(ip6h, sizeof(*ip6h) / 4);
ip6_payload_csum = csum16_sub((__force __sum16)~csum_trailer->csum_value, ip6_payload_csum = ~csum16_sub((__force __sum16)csum_trailer->csum_value,
~ip_header_csum); ip_header_csum);
length = (ip6h->nexthdr == IPPROTO_UDP) ? length = (ip6h->nexthdr == IPPROTO_UDP) ?
ntohs(((struct udphdr *)txporthdr)->len) : ntohs(((struct udphdr *)txporthdr)->len) :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment