netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: net: csum: Clean up recv_verify_packet_ipv6
@ 2024-09-30 16:29 Sean Anderson
  2024-09-30 17:16 ` Willem de Bruijn
  2024-10-04  0:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Sean Anderson @ 2024-09-30 16:29 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev
  Cc: Willem de Bruijn, Shuah Khan, linux-kselftest, linux-kernel,
	Sean Anderson

Rename ip_len to payload_len since the length in this case refers only
to the payload, and not the entire IP packet like for IPv4. While we're
at it, just use the variable directly when calling
recv_verify_packet_udp/tcp.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---

 tools/testing/selftests/net/lib/csum.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/net/lib/csum.c b/tools/testing/selftests/net/lib/csum.c
index e0a34e5e8dd5..27437590eeb5 100644
--- a/tools/testing/selftests/net/lib/csum.c
+++ b/tools/testing/selftests/net/lib/csum.c
@@ -675,22 +675,20 @@ static int recv_verify_packet_ipv6(void *nh, int len)
 {
 	struct ipv6hdr *ip6h = nh;
 	uint16_t proto = cfg_encap ? IPPROTO_UDP : cfg_proto;
-	uint16_t ip_len;
+	uint16_t payload_len;
 
 	if (len < sizeof(*ip6h) || ip6h->nexthdr != proto)
 		return -1;
 
-	ip_len = ntohs(ip6h->payload_len);
-	if (ip_len > len - sizeof(*ip6h))
+	payload_len = ntohs(ip6h->payload_len);
+	if (payload_len > len - sizeof(*ip6h))
 		return -1;
 
-	len = ip_len;
 	iph_addr_p = &ip6h->saddr;
-
 	if (proto == IPPROTO_TCP)
-		return recv_verify_packet_tcp(ip6h + 1, len);
+		return recv_verify_packet_tcp(ip6h + 1, payload_len);
 	else
-		return recv_verify_packet_udp(ip6h + 1, len);
+		return recv_verify_packet_udp(ip6h + 1, payload_len);
 }
 
 /* return whether auxdata includes TP_STATUS_CSUM_VALID */
-- 
2.35.1.1320.gc452695387.dirty


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] selftests: net: csum: Clean up recv_verify_packet_ipv6
  2024-09-30 16:29 [PATCH net-next] selftests: net: csum: Clean up recv_verify_packet_ipv6 Sean Anderson
@ 2024-09-30 17:16 ` Willem de Bruijn
  2024-09-30 18:12   ` Sean Anderson
  2024-10-04  0:00 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Willem de Bruijn @ 2024-09-30 17:16 UTC (permalink / raw)
  To: Sean Anderson, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev
  Cc: Willem de Bruijn, Shuah Khan, linux-kselftest, linux-kernel,
	Sean Anderson

Sean Anderson wrote:
> Rename ip_len to payload_len since the length in this case refers only
> to the payload, and not the entire IP packet like for IPv4. While we're
> at it, just use the variable directly when calling
> recv_verify_packet_udp/tcp.
> 
> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>

Not sure such refactoring patches are worth the effort.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] selftests: net: csum: Clean up recv_verify_packet_ipv6
  2024-09-30 17:16 ` Willem de Bruijn
@ 2024-09-30 18:12   ` Sean Anderson
  2024-09-30 18:47     ` Willem de Bruijn
  0 siblings, 1 reply; 5+ messages in thread
From: Sean Anderson @ 2024-09-30 18:12 UTC (permalink / raw)
  To: Willem de Bruijn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev
  Cc: Willem de Bruijn, Shuah Khan, linux-kselftest, linux-kernel

On 9/30/24 13:16, Willem de Bruijn wrote:
> Sean Anderson wrote:
>> Rename ip_len to payload_len since the length in this case refers only
>> to the payload, and not the entire IP packet like for IPv4. While we're
>> at it, just use the variable directly when calling
>> recv_verify_packet_udp/tcp.
>> 
>> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> 
> Not sure such refactoring patches are worth the effort.

Well, FWIW you commented on this in your review, so I figured I'd send it.

https://lore.kernel.org/all/66dbb4fcbf560_2af86229423@willemb.c.googlers.com.notmuch/

--Sean

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] selftests: net: csum: Clean up recv_verify_packet_ipv6
  2024-09-30 18:12   ` Sean Anderson
@ 2024-09-30 18:47     ` Willem de Bruijn
  0 siblings, 0 replies; 5+ messages in thread
From: Willem de Bruijn @ 2024-09-30 18:47 UTC (permalink / raw)
  To: Sean Anderson, Willem de Bruijn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: Willem de Bruijn, Shuah Khan, linux-kselftest, linux-kernel

Sean Anderson wrote:
> On 9/30/24 13:16, Willem de Bruijn wrote:
> > Sean Anderson wrote:
> >> Rename ip_len to payload_len since the length in this case refers only
> >> to the payload, and not the entire IP packet like for IPv4. While we're
> >> at it, just use the variable directly when calling
> >> recv_verify_packet_udp/tcp.
> >> 
> >> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> > 
> > Not sure such refactoring patches are worth the effort.
> 
> Well, FWIW you commented on this in your review, so I figured I'd send it.
> 
> https://lore.kernel.org/all/66dbb4fcbf560_2af86229423@willemb.c.googlers.com.notmuch/

True. I meant if respun.

Whether such changes are worth it as standalone patch is subjective.
And I get where you're coming from, given that thread.

Reviewed-by: Willem de Bruijn <willemb@google.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] selftests: net: csum: Clean up recv_verify_packet_ipv6
  2024-09-30 16:29 [PATCH net-next] selftests: net: csum: Clean up recv_verify_packet_ipv6 Sean Anderson
  2024-09-30 17:16 ` Willem de Bruijn
@ 2024-10-04  0:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-04  0:00 UTC (permalink / raw)
  To: Sean Anderson
  Cc: davem, edumazet, kuba, pabeni, netdev, willemb, shuah,
	linux-kselftest, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 30 Sep 2024 12:29:34 -0400 you wrote:
> Rename ip_len to payload_len since the length in this case refers only
> to the payload, and not the entire IP packet like for IPv4. While we're
> at it, just use the variable directly when calling
> recv_verify_packet_udp/tcp.
> 
> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> 
> [...]

Here is the summary with links:
  - [net-next] selftests: net: csum: Clean up recv_verify_packet_ipv6
    https://git.kernel.org/netdev/net-next/c/d772cc25ccf7

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-04  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 16:29 [PATCH net-next] selftests: net: csum: Clean up recv_verify_packet_ipv6 Sean Anderson
2024-09-30 17:16 ` Willem de Bruijn
2024-09-30 18:12   ` Sean Anderson
2024-09-30 18:47     ` Willem de Bruijn
2024-10-04  0:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).