netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] be2net: Use correct byte order and format string for TCP seq and ack_seq
@ 2025-07-17 19:35 Alok Tiwari
  2025-07-18 17:01 ` Simon Horman
  2025-07-19  0:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Alok Tiwari @ 2025-07-17 19:35 UTC (permalink / raw)
  To: somnath.kotur, ajit.khaparde, sriharsha.basavapatna,
	andrew+netdev, davem, edumazet, kuba, pabeni, horms, netdev
  Cc: alok.a.tiwari

The TCP header fields seq and ack_seq are 32-bit values in network
byte order as (__be32). these fields were earlier printed using
ntohs(), which converts only 16-bit values and produces incorrect
results for 32-bit fields. This patch is changeing the conversion
to ntohl(), ensuring correct interpretation of these sequence numbers.

Notably, the format specifier is updated from %d to %u to reflect the
unsigned nature of these fields.

improves the accuracy of debug log messages for TCP sequence and
acknowledgment numbers during TX timeouts.

Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 3d2e215921191..490af66594294 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1465,10 +1465,10 @@ static void be_tx_timeout(struct net_device *netdev, unsigned int txqueue)
 						 ntohs(tcphdr->source));
 					dev_info(dev, "TCP dest port %d\n",
 						 ntohs(tcphdr->dest));
-					dev_info(dev, "TCP sequence num %d\n",
-						 ntohs(tcphdr->seq));
-					dev_info(dev, "TCP ack_seq %d\n",
-						 ntohs(tcphdr->ack_seq));
+					dev_info(dev, "TCP sequence num %u\n",
+						 ntohl(tcphdr->seq));
+					dev_info(dev, "TCP ack_seq %u\n",
+						 ntohl(tcphdr->ack_seq));
 				} else if (ip_hdr(skb)->protocol ==
 					   IPPROTO_UDP) {
 					udphdr = udp_hdr(skb);
-- 
2.46.0


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

* Re: [PATCH net-next] be2net: Use correct byte order and format string for TCP seq and ack_seq
  2025-07-17 19:35 [PATCH net-next] be2net: Use correct byte order and format string for TCP seq and ack_seq Alok Tiwari
@ 2025-07-18 17:01 ` Simon Horman
  2025-07-19  0:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-07-18 17:01 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: somnath.kotur, ajit.khaparde, sriharsha.basavapatna,
	andrew+netdev, davem, edumazet, kuba, pabeni, netdev

On Thu, Jul 17, 2025 at 12:35:47PM -0700, Alok Tiwari wrote:
> The TCP header fields seq and ack_seq are 32-bit values in network
> byte order as (__be32). these fields were earlier printed using
> ntohs(), which converts only 16-bit values and produces incorrect
> results for 32-bit fields. This patch is changeing the conversion
> to ntohl(), ensuring correct interpretation of these sequence numbers.
> 
> Notably, the format specifier is updated from %d to %u to reflect the
> unsigned nature of these fields.
> 
> improves the accuracy of debug log messages for TCP sequence and
> acknowledgment numbers during TX timeouts.
> 
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH net-next] be2net: Use correct byte order and format string for TCP seq and ack_seq
  2025-07-17 19:35 [PATCH net-next] be2net: Use correct byte order and format string for TCP seq and ack_seq Alok Tiwari
  2025-07-18 17:01 ` Simon Horman
@ 2025-07-19  0:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-19  0:50 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: somnath.kotur, ajit.khaparde, sriharsha.basavapatna,
	andrew+netdev, davem, edumazet, kuba, pabeni, horms, netdev

Hello:

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

On Thu, 17 Jul 2025 12:35:47 -0700 you wrote:
> The TCP header fields seq and ack_seq are 32-bit values in network
> byte order as (__be32). these fields were earlier printed using
> ntohs(), which converts only 16-bit values and produces incorrect
> results for 32-bit fields. This patch is changeing the conversion
> to ntohl(), ensuring correct interpretation of these sequence numbers.
> 
> Notably, the format specifier is updated from %d to %u to reflect the
> unsigned nature of these fields.
> 
> [...]

Here is the summary with links:
  - [net-next] be2net: Use correct byte order and format string for TCP seq and ack_seq
    https://git.kernel.org/netdev/net-next/c/4701ee5044fb

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] 3+ messages in thread

end of thread, other threads:[~2025-07-19  0:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17 19:35 [PATCH net-next] be2net: Use correct byte order and format string for TCP seq and ack_seq Alok Tiwari
2025-07-18 17:01 ` Simon Horman
2025-07-19  0:50 ` 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).