Commit 411a795e authored by Alex Elder's avatar Alex Elder Committed by David S. Miller
Browse files

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: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent be754f64
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -87,9 +87,9 @@ 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,
	pseudo_csum = csum_tcpudp_magic(ip4h->saddr, ip4h->daddr,
					ntohs(ip4h->tot_len) - ip4h->ihl * 4,
					ip4h->protocol, 0);

@@ -132,12 +132,12 @@ 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,
	pseudo_csum = csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
				      length, ip6h->nexthdr, 0);

	/* It's sufficient to compare the IP payload checksum with the