public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] net: huawei: hinic: correct IPv6 version check in TX checksum path
@ 2026-03-21 16:52 Alok Tiwari
  2026-03-21 16:52 ` [PATCH net-next 2/2] net: huawei: hinic3: " Alok Tiwari
  2026-03-23 17:11 ` [PATCH net-next 1/2] net: huawei: hinic: " Simon Horman
  0 siblings, 2 replies; 4+ messages in thread
From: Alok Tiwari @ 2026-03-21 16:52 UTC (permalink / raw)
  To: gongfan1, cai.huoqing, andrew+netdev, kuba, davem, edumazet,
	pabeni, horms, netdev
  Cc: alok.a.tiwarilinux, alok.a.tiwari

The TX checksum/offload code determines whether the network header is
IPv4 or IPv6 by checking the version field. The IPv6 case incorrectly
checked ip->v4->version for a value of 6. Use ip->v6->version instead to
match the header type being parsed.

Use ip->v6->version in the IPv6 case to match intent and improve
readability.

Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/net/ethernet/huawei/hinic/hinic_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/ethernet/huawei/hinic/hinic_tx.c
index 9b60966736db..e26cdc3fc31b 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c
@@ -209,7 +209,7 @@ static void get_inner_l3_l4_type(struct sk_buff *skb, union hinic_l3 *ip,
 			   IPV4_PKT_NO_CHKSUM_OFFLOAD :
 			   IPV4_PKT_WITH_CHKSUM_OFFLOAD;
 		*l4_proto = ip->v4->protocol;
-	} else if (ip->v4->version == 6) {
+	} else if (ip->v6->version == 6) {
 		*l3_type = IPV6_PKT;
 		exthdr = ip->hdr + sizeof(*ip->v6);
 		*l4_proto = ip->v6->nexthdr;
-- 
2.50.1


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

* [PATCH net-next 2/2] net: huawei: hinic3: correct IPv6 version check in TX checksum path
  2026-03-21 16:52 [PATCH net-next 1/2] net: huawei: hinic: correct IPv6 version check in TX checksum path Alok Tiwari
@ 2026-03-21 16:52 ` Alok Tiwari
  2026-03-23 17:11 ` [PATCH net-next 1/2] net: huawei: hinic: " Simon Horman
  1 sibling, 0 replies; 4+ messages in thread
From: Alok Tiwari @ 2026-03-21 16:52 UTC (permalink / raw)
  To: gongfan1, cai.huoqing, andrew+netdev, kuba, davem, edumazet,
	pabeni, horms, netdev
  Cc: alok.a.tiwarilinux, alok.a.tiwari

The TX checksum/offload path determines IPv4 vs IPv6 by checking the IP
version. In the IPv6 case the code reads ip->v4->version even though the
header is treated as IPv6 (ip->v6). Since v4/v6 are union members, this
does not typically change behavior, but it is confusing and inconsistent
with the header type being parsed.

Use ip->v6->version in the IPv6 case to match intent and improve
readability.

Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/net/ethernet/huawei/hinic3/hinic3_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
index 9306bf0020ca..a57ceb4d68ef 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
@@ -242,7 +242,7 @@ static int hinic3_tx_csum(struct hinic3_txq *txq, struct hinic3_sq_task *task,
 		ip.hdr = skb_network_header(skb);
 		if (ip.v4->version == 4) {
 			l4_proto = ip.v4->protocol;
-		} else if (ip.v4->version == 6) {
+		} else if (ip.v6->version == 6) {
 			union hinic3_l4 l4;
 			unsigned char *exthdr;
 			__be16 frag_off;
-- 
2.50.1


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

* Re: [PATCH net-next 1/2] net: huawei: hinic: correct IPv6 version check in TX checksum path
  2026-03-21 16:52 [PATCH net-next 1/2] net: huawei: hinic: correct IPv6 version check in TX checksum path Alok Tiwari
  2026-03-21 16:52 ` [PATCH net-next 2/2] net: huawei: hinic3: " Alok Tiwari
@ 2026-03-23 17:11 ` Simon Horman
  2026-03-23 19:10   ` ALOK TIWARI
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Horman @ 2026-03-23 17:11 UTC (permalink / raw)
  To: Alok Tiwari
  Cc: gongfan1, cai.huoqing, andrew+netdev, kuba, davem, edumazet,
	pabeni, netdev, alok.a.tiwarilinux

On Sat, Mar 21, 2026 at 09:52:33AM -0700, Alok Tiwari wrote:
> The TX checksum/offload code determines whether the network header is
> IPv4 or IPv6 by checking the version field. The IPv6 case incorrectly
> checked ip->v4->version for a value of 6. Use ip->v6->version instead to
> match the header type being parsed.
> 
> Use ip->v6->version in the IPv6 case to match intent and improve
> readability.
> 
> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>

Hi,

I see where you are going with this.

But I discovered sashiko.dev a bit earlier today and it's AI generated
review of this patch-set points out that the same pattern also exists in
offload_tso and offload_csum in this file.

And likewise, for patch 2/2, the pattern exists in get_inner_l3_l4_type()
as well as where you updated it in hinic3_tx_csum().

-- 
pw-bot: changes-requested

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

* Re: [PATCH net-next 1/2] net: huawei: hinic: correct IPv6 version check in TX checksum path
  2026-03-23 17:11 ` [PATCH net-next 1/2] net: huawei: hinic: " Simon Horman
@ 2026-03-23 19:10   ` ALOK TIWARI
  0 siblings, 0 replies; 4+ messages in thread
From: ALOK TIWARI @ 2026-03-23 19:10 UTC (permalink / raw)
  To: Simon Horman
  Cc: gongfan1, cai.huoqing, andrew+netdev, kuba, davem, edumazet,
	pabeni, netdev, alok.a.tiwarilinux



On 3/23/2026 10:41 PM, Simon Horman wrote:
>> The TX checksum/offload code determines whether the network header is
>> IPv4 or IPv6 by checking the version field. The IPv6 case incorrectly
>> checked ip->v4->version for a value of 6. Use ip->v6->version instead to
>> match the header type being parsed.
>>
>> Use ip->v6->version in the IPv6 case to match intent and improve
>> readability.
>>
>> Signed-off-by: Alok Tiwari<alok.a.tiwari@oracle.com>
> Hi,
> 
> I see where you are going with this.
> 
> But I discovered sashiko.dev a bit earlier today and it's AI generated
> review of this patch-set points out that the same pattern also exists in
> offload_tso and offload_csum in this file.
> 
> And likewise, for patch 2/2, the pattern exists in get_inner_l3_l4_type()
> as well as where you updated it in hinic3_tx_csum().

Thanks, I will send v2.

Thanks,
Alok

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

end of thread, other threads:[~2026-03-23 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-21 16:52 [PATCH net-next 1/2] net: huawei: hinic: correct IPv6 version check in TX checksum path Alok Tiwari
2026-03-21 16:52 ` [PATCH net-next 2/2] net: huawei: hinic3: " Alok Tiwari
2026-03-23 17:11 ` [PATCH net-next 1/2] net: huawei: hinic: " Simon Horman
2026-03-23 19:10   ` ALOK TIWARI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox