be2net: Use correct byte order and format string for TCP seq and ack_seq
Subsystems (3)
PATCH 1/1 be2net: Use correct byte order and format string for TCP seq and ack_seq
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.
--- drivers/net/ethernet/emulex/benet/be_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/emulex/benet/be_main.c +4 -4
@@ -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);
Signature · 1 line
2.46.0
Quoted 6 lines · Alok Tiwari
The TCP header fields seq and
ack_seqare 32-bit values in network byte order as (__be32). these fields were earlier printed usingntohs(), which converts only 16-bit values and produces incorrect results for 32-bit fields. This patch is changeing the conversion tontohl(), ensuring correct interpretation of these sequence numbers.
Quoted 7 lines
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 <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Thu, 17 Jul 2025 12:35:47 -0700 you wrote:
The TCP header fields seq and
ack_seqare 32-bit values in network byte order as (__be32). these fields were earlier printed usingntohs(), which converts only 16-bit values and produces incorrect results for 32-bit fields. This patch is changeing the conversion tontohl(), 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html