All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@linaro.org>
To: subashab@codeaurora.org, stranche@codeaurora.org,
	davem@davemloft.net, kuba@kernel.org
Cc: bjorn.andersson@linaro.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next 8/8] net: qualcomm: rmnet: IPv6 payload length is simple
Date: Sat, 12 Jun 2021 09:37:36 -0500	[thread overview]
Message-ID: <20210612143736.3498712-9-elder@linaro.org> (raw)
In-Reply-To: <20210612143736.3498712-1-elder@linaro.org>

We don't support any extension headers for IPv6 packets.  Extension
headers therefore contribute 0 bytes to the payload length.  As a
result we can just use the IPv6 payload length as the length used to
compute the pseudo header checksum for both UDP and TCP messages.

Signed-off-by: Alex Elder <elder@linaro.org>
---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
index ed4737d0043d6..a6ce22f60a00c 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -114,7 +114,6 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb,
 	__sum16 *csum_field, pseudo_csum;
 	__sum16 ip6_payload_csum;
 	__be16 ip_header_csum;
-	u32 length;
 
 	/* Checksum offload is only supported for UDP and TCP protocols;
 	 * the packet cannot include any IPv6 extension headers
@@ -134,11 +133,9 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb,
 	ip_header_csum = (__force __be16)ip_fast_csum(ip6h, sizeof(*ip6h) / 4);
 	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);
+				      ntohs(ip6h->payload_len),
+				      ip6h->nexthdr, 0);
 
 	/* It's sufficient to compare the IP payload checksum with the
 	 * negated pseudo checksum to determine whether the packet
-- 
2.27.0


      parent reply	other threads:[~2021-06-12 14:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-12 14:37 [PATCH net-next 0/8] net: qualcomm: rmnet: MAPv4 download checksum cleanup, part 2 Alex Elder
2021-06-12 14:37 ` [PATCH net-next 1/8] net: qualcomm: rmnet: remove some local variables Alex Elder
2021-06-12 14:37 ` [PATCH net-next 2/8] net: qualcomm: rmnet: rearrange some NOTs Alex Elder
2021-06-12 14:37 ` [PATCH net-next 3/8] net: qualcomm: rmnet: show that an intermediate sum is zero Alex Elder
2021-06-12 14:37 ` [PATCH net-next 4/8] net: qualcomm: rmnet: return earlier for bad checksum Alex Elder
2021-06-12 14:37 ` [PATCH net-next 5/8] net: qualcomm: rmnet: remove unneeded code Alex Elder
2021-06-12 14:37 ` [PATCH net-next 6/8] net: qualcomm: rmnet: trailer value is a checksum Alex Elder
2021-06-12 14:37 ` [PATCH net-next 7/8] net: qualcomm: rmnet: drop some unary NOTs Alex Elder
2021-06-12 14:37 ` Alex Elder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210612143736.3498712-9-elder@linaro.org \
    --to=elder@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stranche@codeaurora.org \
    --cc=subashab@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.