Skip to contentSkip to conversation

iavf: fix double-broken HW hash report

PATCH RESEND In review Alexander Lobakin 3 participants 6 messages Mar 1, 2023 – Mar 14, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover iavf: fix double-broken HW hash report

Currently, passing HW hash from descriptors to skb is broken two times. The first bug effectively disables hash from being filled at all, unless %NETIF_F_RXHASH is *disabled* via Ethtool. The second incorrectly says that IPv6 UDP packets are L3, which also triggers CPU hashing when needed (the networking core treats only L4 HW hash as "true"). The very same problems were fixed in i40e and ice, but not in iavf, although each of the original commits bugged at least two drivers. It's never too late (I hope), so fix iavf this time.

Alexander Lobakin (2):
iavf: fix inverted Rx hash condition leading to disabled hash
iavf: fix non-tunneled IPv6 UDP packet type and hashing

 drivers/net/ethernet/intel/iavf/iavf_common.c | 2 +-
 drivers/net/ethernet/intel/iavf/iavf_txrx.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

---
To Tony: this is very trivial and tested for a while already, I hope it could hit one of the first couple RCs :p

Signature · 6 lines
2.39.2

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#1 lore raw

PATCH RESEND 1/2 iavf: fix inverted Rx hash condition leading to disabled hash

Condition, which checks whether the netdev has hashing enabled is inverted. Basically, the tagged commit effectively disabled passing flow hash from descriptor to skb, unless user *disables* it via Ethtool. Commit a876c3ba59a6 ("i40e/i40evf: properly report Rx packet hash") fixed this problem, but only for i40e.
Invert the condition now in iavf and unblock passing hash to skbs again.

Fixes 857942fd1aa1 ("i40e: Fix Rx hash reported to the stack by our driver")
---
 drivers/net/ethernet/intel/iavf/iavf_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_txrx.c +1 -1
index 18b6a702a1d6..e989feda133c 100644
@@ -1096,7 +1096,7 @@ static inline void iavf_rx_hash(struct iavf_ring *ring,
 		cpu_to_le64((u64)IAVF_RX_DESC_FLTSTAT_RSS_HASH <<
 			    IAVF_RX_DESC_STATUS_FLTSTAT_SHIFT);
 
-	if (ring->netdev->features & NETIF_F_RXHASH)
+	if (!(ring->netdev->features & NETIF_F_RXHASH))
 		return;
 
 	if ((rx_desc->wb.qword1.status_error_len & rss_mask) == rss_mask) {
Signature · 1 line
2.39.2
Tested-by on v1 1/2
#2 lore raw

Re: [Intel-wired-lan] [PATCH RESEND net v1 1/2] iavf: fix inverted Rx hash condition leading to disabled hash

Quoted 32 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Alexander Lobakin
Sent: środa, 1 marca 2023 12:59
To: Nguyen, Anthony L <[email protected]>
Cc: Zaremba, Larysa <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; linux- [email protected]; Eric Dumazet <[email protected]>; Kubiak, Michal <[email protected]>; [email protected]; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; David S. Miller <[email protected]>
Subject: [Intel-wired-lan] [PATCH RESEND net v1 1/2] iavf: fix inverted Rx hash condition leading to disabled hash

Condition, which checks whether the netdev has hashing enabled is inverted. Basically, the tagged commit effectively disabled passing flow hash from descriptor to skb, unless user *disables* it via Ethtool. Commit a876c3ba59a6 ("i40e/i40evf: properly report Rx packet hash") fixed this problem, but only for i40e.
Invert the condition now in iavf and unblock passing hash to skbs again.

Fixes 857942fd1aa1 ("i40e: Fix Rx hash reported to the stack by our driver")
---
 drivers/net/ethernet/intel/iavf/iavf_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_txrx.c +0 -0
index 18b6a702a1d6..e989feda133c 100644

drivers/net/ethernet/intel/iavf/iavf_txrx.c

Quoted 1 line
drivers/net/ethernet/intel/iavf/iavf_txrx.c +0 -1
--- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#3 lore raw

PATCH RESEND 2/2 iavf: fix non-tunneled IPv6 UDP packet type and hashing

In reply to Alexander Lobakin

Currently, IAVF's decode_rx_desc_ptype() correctly reports payload type of L4 for IPv4 UDP packets and IPv{4,6} TCP, but only L3 for IPv6 UDP. Originally, i40e, ice and iavf were affected.
Commit 73df8c9e3e3d ("i40e: Correct UDP packet header for non_tunnel-ipv6") fixed that in i40e, then
commit 638a0c8c8861 ("ice: fix incorrect payload indicator on PTYPE") fixed that for ice.
IPv6 UDP is L4 obviously. Fix it and make iavf report correct L4 hash type for such packets, so that the stack won't calculate it on CPU when needs it.

Fixes 206812b5fccb ("i40e/i40evf: i40e implementation for skb_set_hash")
---
 drivers/net/ethernet/intel/iavf/iavf_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_common.c +1 -1
index 16c490965b61..dd11dbbd5551 100644
@@ -661,7 +661,7 @@ struct iavf_rx_ptype_decoded iavf_ptype_lookup[BIT(8)] = {
 	/* Non Tunneled IPv6 */
 	IAVF_PTT(88, IP, IPV6, FRG, NONE, NONE, NOF, NONE, PAY3),
 	IAVF_PTT(89, IP, IPV6, NOF, NONE, NONE, NOF, NONE, PAY3),
-	IAVF_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP,  PAY3),
+	IAVF_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP,  PAY4),
 	IAVF_PTT_UNUSED_ENTRY(91),
 	IAVF_PTT(92, IP, IPV6, NOF, NONE, NONE, NOF, TCP,  PAY4),
 	IAVF_PTT(93, IP, IPV6, NOF, NONE, NONE, NOF, SCTP, PAY4),
Signature · 1 line
2.39.2
Tested-by on v1 2/2
#4 lore raw

Re: [Intel-wired-lan] [PATCH RESEND net v1 2/2] iavf: fix non-tunneled IPv6 UDP packet type and hashing

drivers/net/ethernet/intel/iavf/iavf_common.c

Quoted 36 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Alexander Lobakin
Sent: środa, 1 marca 2023 12:59
To: Nguyen, Anthony L <[email protected]>
Cc: Zaremba, Larysa <[email protected]>; [email protected]; Brandeburg, Jesse <[email protected]>; linux- [email protected]; Eric Dumazet <[email protected]>; Kubiak, Michal <[email protected]>; [email protected]; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; David S. Miller <[email protected]>
Subject: [Intel-wired-lan] [PATCH RESEND net v1 2/2] iavf: fix non-tunneled IPv6 UDP packet type and hashing

Currently, IAVF's decode_rx_desc_ptype() correctly reports payload type of L4 for IPv4 UDP packets and IPv{4,6} TCP, but only L3 for IPv6 UDP. Originally, i40e, ice and iavf were affected.
Commit 73df8c9e3e3d ("i40e: Correct UDP packet header for non_tunnel- ipv6") fixed that in i40e, then commit 638a0c8c8861 ("ice: fix incorrect payload indicator on PTYPE") fixed that for ice.
IPv6 UDP is L4 obviously. Fix it and make iavf report correct L4 hash type for such packets, so that the stack won't calculate it on CPU when needs it.

Fixes 206812b5fccb ("i40e/i40evf: i40e implementation for skb_set_hash")
---
 drivers/net/ethernet/intel/iavf/iavf_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_common.c +0 -0
index 16c490965b61..dd11dbbd5551 100644

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by on the v1 series
#5 lore raw
In reply to Alexander Lobakin
Quoted 9 lines · Alexander Lobakin

Currently, passing HW hash from descriptors to skb is broken two times. The first bug effectively disables hash from being filled at all, unless %NETIF_F_RXHASH is *disabled* via Ethtool. The second incorrectly says that IPv6 UDP packets are L3, which also triggers CPU hashing when needed (the networking core treats only L4 HW hash as "true"). The very same problems were fixed in i40e and ice, but not in iavf, although each of the original commits bugged at least two drivers. It's never too late (I hope), so fix iavf this time.

Quoted 4 lines

Alexander Lobakin (2):
iavf: fix inverted Rx hash condition leading to disabled hash
iavf: fix non-tunneled IPv6 UDP packet type and hashing

Thanks,