summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qualcomm
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2021-06-12 16:37:35 +0200
committerDavid S. Miller <davem@davemloft.net>2021-06-12 22:18:49 +0200
commit411a795e14b1fcbf64bc9ef6869d2bf9a5bf3c9a (patch)
tree64a41655ebbd6b7d1833f20a1c82ad8ab02c88ee /drivers/net/ethernet/qualcomm
parentnet: qualcomm: rmnet: trailer value is a checksum (diff)
downloadlinux-411a795e14b1fcbf64bc9ef6869d2bf9a5bf3c9a.tar.xz
linux-411a795e14b1fcbf64bc9ef6869d2bf9a5bf3c9a.zip
net: qualcomm: rmnet: drop some unary NOTs
We compare a payload checksum with a pseudo checksum value for equality in rmnet_map_ipv4_dl_csum_trailer(). Both of those values are computed with a unary NOT (~) operation. The result of the comparison is the same if we omit that NOT for both values. Remove these operations in rmnet_map_ipv6_dl_csum_trailer() also. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qualcomm')
-rw-r--r--drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
index 610c8b5a8f46..ed4737d0043d 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -87,11 +87,11 @@ rmnet_map_ipv4_dl_csum_trailer(struct sk_buff *skb,
* header checksum value; it is already accounted for in the
* checksum value found in the trailer.
*/
- ip_payload_csum = ~csum_trailer->csum_value;
+ ip_payload_csum = csum_trailer->csum_value;
- pseudo_csum = ~csum_tcpudp_magic(ip4h->saddr, ip4h->daddr,
- ntohs(ip4h->tot_len) - ip4h->ihl * 4,
- ip4h->protocol, 0);
+ pseudo_csum = csum_tcpudp_magic(ip4h->saddr, ip4h->daddr,
+ ntohs(ip4h->tot_len) - ip4h->ihl * 4,
+ ip4h->protocol, 0);
/* The cast is required to ensure only the low 16 bits are examined */
if (ip_payload_csum != (__sum16)~pseudo_csum) {
@@ -132,13 +132,13 @@ 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(csum_trailer->csum_value, ip_header_csum);
+ ip6_payload_csum = csum16_sub(csum_trailer->csum_value, ip_header_csum);
length = (ip6h->nexthdr == IPPROTO_UDP) ?
ntohs(((struct udphdr *)txporthdr)->len) :
ntohs(ip6h->payload_len);
- pseudo_csum = ~csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
- length, ip6h->nexthdr, 0);
+ pseudo_csum = csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
+ length, ip6h->nexthdr, 0);
/* It's sufficient to compare the IP payload checksum with the
* negated pseudo checksum to determine whether the packet