* [PATCH v2 iwl-next] igb: set skb hash type from RSS_TYPE
@ 2026-01-22 13:47 Kohei Enju
2026-01-22 15:00 ` [Intel-wired-lan] " Paul Menzel
2026-04-01 16:50 ` Rinitha, SX
0 siblings, 2 replies; 3+ messages in thread
From: Kohei Enju @ 2026-01-22 13:47 UTC (permalink / raw)
To: intel-wired-lan, netdev
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, kohei.enju, Kohei Enju,
Aleksandr Loktionov
igb always marks the RX hash as L3 regardless of RSS_TYPE in the
advanced descriptor, which may indicate L4 (TCP/UDP) hash. This can
trigger unnecessary SW hash recalculation and breaks toeplitz selftests.
Use RSS_TYPE from pkt_info to set the correct PKT_HASH_TYPE_*
Tested by toeplitz.py with the igb RSS key get/set patches applied as
they are required for toeplitz.py (see Link below).
# ethtool -N $DEV rx-flow-hash udp4 sdfn
# ethtool -N $DEV rx-flow-hash udp6 sdfn
# python toeplitz.py | grep -E "^# Totals"
Without patch:
# Totals: pass:0 fail:12 xfail:0 xpass:0 skip:0 error:0
With patch:
# Totals: pass:12 fail:0 xfail:0 xpass:0 skip:0 error:0
Link: https://lore.kernel.org/intel-wired-lan/20260119084511.95287-5-takkozu@amazon.com/
Signed-off-by: Kohei Enju <kohei@enjuk.jp>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
Changelog:
v2:
- Fix max-line-length by removing unnecessary comment
v1: https://lore.kernel.org/intel-wired-lan/20260119175922.199950-1-kohei@enjuk.jp/
---
drivers/net/ethernet/intel/igb/e1000_82575.h | 21 ++++++++++++++++++++
drivers/net/ethernet/intel/igb/igb_main.c | 18 +++++++++++++----
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.h b/drivers/net/ethernet/intel/igb/e1000_82575.h
index 63ec253ac788..9e696d55e512 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.h
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.h
@@ -87,6 +87,27 @@ union e1000_adv_rx_desc {
} wb; /* writeback */
};
+#define E1000_RSS_TYPE_NO_HASH 0
+#define E1000_RSS_TYPE_HASH_TCP_IPV4 1
+#define E1000_RSS_TYPE_HASH_IPV4 2
+#define E1000_RSS_TYPE_HASH_TCP_IPV6 3
+#define E1000_RSS_TYPE_HASH_IPV6_EX 4
+#define E1000_RSS_TYPE_HASH_IPV6 5
+#define E1000_RSS_TYPE_HASH_TCP_IPV6_EX 6
+#define E1000_RSS_TYPE_HASH_UDP_IPV4 7
+#define E1000_RSS_TYPE_HASH_UDP_IPV6 8
+#define E1000_RSS_TYPE_HASH_UDP_IPV6_EX 9
+
+#define E1000_RSS_TYPE_MASK GENMASK(3, 0)
+
+#define E1000_RSS_L4_TYPES_MASK \
+ (BIT(E1000_RSS_TYPE_HASH_TCP_IPV4) | \
+ BIT(E1000_RSS_TYPE_HASH_TCP_IPV6) | \
+ BIT(E1000_RSS_TYPE_HASH_TCP_IPV6_EX) | \
+ BIT(E1000_RSS_TYPE_HASH_UDP_IPV4) | \
+ BIT(E1000_RSS_TYPE_HASH_UDP_IPV6) | \
+ BIT(E1000_RSS_TYPE_HASH_UDP_IPV6_EX))
+
#define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0
#define E1000_RXDADV_HDRBUFLEN_SHIFT 5
#define E1000_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 8dab133296ca..ef0cbf532716 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -8824,10 +8824,20 @@ static inline void igb_rx_hash(struct igb_ring *ring,
union e1000_adv_rx_desc *rx_desc,
struct sk_buff *skb)
{
- if (ring->netdev->features & NETIF_F_RXHASH)
- skb_set_hash(skb,
- le32_to_cpu(rx_desc->wb.lower.hi_dword.rss),
- PKT_HASH_TYPE_L3);
+ u16 rss_type;
+
+ if (!(ring->netdev->features & NETIF_F_RXHASH))
+ return;
+
+ rss_type = le16_to_cpu(rx_desc->wb.lower.lo_dword.pkt_info) &
+ E1000_RSS_TYPE_MASK;
+
+ if (!rss_type)
+ return;
+
+ skb_set_hash(skb, le32_to_cpu(rx_desc->wb.lower.hi_dword.rss),
+ (E1000_RSS_L4_TYPES_MASK & BIT(rss_type)) ?
+ PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
}
/**
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Intel-wired-lan] [PATCH v2 iwl-next] igb: set skb hash type from RSS_TYPE
2026-01-22 13:47 [PATCH v2 iwl-next] igb: set skb hash type from RSS_TYPE Kohei Enju
@ 2026-01-22 15:00 ` Paul Menzel
2026-04-01 16:50 ` Rinitha, SX
1 sibling, 0 replies; 3+ messages in thread
From: Paul Menzel @ 2026-01-22 15:00 UTC (permalink / raw)
To: Kohei Enju
Cc: intel-wired-lan, netdev, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, kohei.enju, Aleksandr Loktionov
Dear Kohei,
Thank you for your patch.
Am 22.01.26 um 14:47 schrieb Kohei Enju:
> igb always marks the RX hash as L3 regardless of RSS_TYPE in the
> advanced descriptor, which may indicate L4 (TCP/UDP) hash. This can
> trigger unnecessary SW hash recalculation and breaks toeplitz selftests.
>
> Use RSS_TYPE from pkt_info to set the correct PKT_HASH_TYPE_*
>
> Tested by toeplitz.py with the igb RSS key get/set patches applied as
> they are required for toeplitz.py (see Link below).
> # ethtool -N $DEV rx-flow-hash udp4 sdfn
> # ethtool -N $DEV rx-flow-hash udp6 sdfn
> # python toeplitz.py | grep -E "^# Totals"
>
> Without patch:
> # Totals: pass:0 fail:12 xfail:0 xpass:0 skip:0 error:0
>
> With patch:
> # Totals: pass:12 fail:0 xfail:0 xpass:0 skip:0 error:0
>
> Link: https://lore.kernel.org/intel-wired-lan/20260119084511.95287-5-takkozu@amazon.com/
> Signed-off-by: Kohei Enju <kohei@enjuk.jp>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
> Changelog:
> v2:
> - Fix max-line-length by removing unnecessary comment
> v1: https://lore.kernel.org/intel-wired-lan/20260119175922.199950-1-kohei@enjuk.jp/
> ---
> drivers/net/ethernet/intel/igb/e1000_82575.h | 21 ++++++++++++++++++++
> drivers/net/ethernet/intel/igb/igb_main.c | 18 +++++++++++++----
> 2 files changed, 35 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.h b/drivers/net/ethernet/intel/igb/e1000_82575.h
> index 63ec253ac788..9e696d55e512 100644
> --- a/drivers/net/ethernet/intel/igb/e1000_82575.h
> +++ b/drivers/net/ethernet/intel/igb/e1000_82575.h
> @@ -87,6 +87,27 @@ union e1000_adv_rx_desc {
> } wb; /* writeback */
> };
>
> +#define E1000_RSS_TYPE_NO_HASH 0
> +#define E1000_RSS_TYPE_HASH_TCP_IPV4 1
> +#define E1000_RSS_TYPE_HASH_IPV4 2
> +#define E1000_RSS_TYPE_HASH_TCP_IPV6 3
> +#define E1000_RSS_TYPE_HASH_IPV6_EX 4
> +#define E1000_RSS_TYPE_HASH_IPV6 5
> +#define E1000_RSS_TYPE_HASH_TCP_IPV6_EX 6
> +#define E1000_RSS_TYPE_HASH_UDP_IPV4 7
> +#define E1000_RSS_TYPE_HASH_UDP_IPV6 8
> +#define E1000_RSS_TYPE_HASH_UDP_IPV6_EX 9
> +
> +#define E1000_RSS_TYPE_MASK GENMASK(3, 0)
> +
> +#define E1000_RSS_L4_TYPES_MASK \
> + (BIT(E1000_RSS_TYPE_HASH_TCP_IPV4) | \
> + BIT(E1000_RSS_TYPE_HASH_TCP_IPV6) | \
> + BIT(E1000_RSS_TYPE_HASH_TCP_IPV6_EX) | \
> + BIT(E1000_RSS_TYPE_HASH_UDP_IPV4) | \
> + BIT(E1000_RSS_TYPE_HASH_UDP_IPV6) | \
> + BIT(E1000_RSS_TYPE_HASH_UDP_IPV6_EX))
> +
> #define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0
> #define E1000_RXDADV_HDRBUFLEN_SHIFT 5
> #define E1000_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 8dab133296ca..ef0cbf532716 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -8824,10 +8824,20 @@ static inline void igb_rx_hash(struct igb_ring *ring,
> union e1000_adv_rx_desc *rx_desc,
> struct sk_buff *skb)
> {
> - if (ring->netdev->features & NETIF_F_RXHASH)
> - skb_set_hash(skb,
> - le32_to_cpu(rx_desc->wb.lower.hi_dword.rss),
> - PKT_HASH_TYPE_L3);
> + u16 rss_type;
> +
> + if (!(ring->netdev->features & NETIF_F_RXHASH))
> + return;
> +
> + rss_type = le16_to_cpu(rx_desc->wb.lower.lo_dword.pkt_info) &
> + E1000_RSS_TYPE_MASK;
> +
> + if (!rss_type)
> + return;
> +
> + skb_set_hash(skb, le32_to_cpu(rx_desc->wb.lower.hi_dword.rss),
> + (E1000_RSS_L4_TYPES_MASK & BIT(rss_type)) ?
> + PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
> }
>
> /**
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Kind regards,
Paul
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [Intel-wired-lan] [PATCH v2 iwl-next] igb: set skb hash type from RSS_TYPE
2026-01-22 13:47 [PATCH v2 iwl-next] igb: set skb hash type from RSS_TYPE Kohei Enju
2026-01-22 15:00 ` [Intel-wired-lan] " Paul Menzel
@ 2026-04-01 16:50 ` Rinitha, SX
1 sibling, 0 replies; 3+ messages in thread
From: Rinitha, SX @ 2026-04-01 16:50 UTC (permalink / raw)
To: Kohei Enju, intel-wired-lan@lists.osuosl.org,
netdev@vger.kernel.org
Cc: Nguyen, Anthony L, Kitszel, Przemyslaw, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
kohei.enju@gmail.com, Loktionov, Aleksandr
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Kohei Enju
> Sent: 22 January 2026 19:18
> To: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; kohei.enju@gmail.com; Kohei Enju <kohei@enjuk.jp>; Loktionov, Aleksandr <aleksandr.loktionov@intel.com>
> Subject: [Intel-wired-lan] [PATCH v2 iwl-next] igb: set skb hash type from RSS_TYPE
>
> igb always marks the RX hash as L3 regardless of RSS_TYPE in the advanced descriptor, which may indicate L4 (TCP/UDP) hash. This can trigger unnecessary SW hash recalculation and breaks toeplitz selftests.
>
> Use RSS_TYPE from pkt_info to set the correct PKT_HASH_TYPE_*
>
> Tested by toeplitz.py with the igb RSS key get/set patches applied as they are required for toeplitz.py (see Link below).
> # ethtool -N $DEV rx-flow-hash udp4 sdfn # ethtool -N $DEV rx-flow-hash udp6 sdfn # python toeplitz.py | grep -E "^# Totals"
>
> Without patch:
> # Totals: pass:0 fail:12 xfail:0 xpass:0 skip:0 error:0
>
> With patch:
> # Totals: pass:12 fail:0 xfail:0 xpass:0 skip:0 error:0
>
> Link: https://lore.kernel.org/intel-wired-lan/20260119084511.95287-5-takkozu@amazon.com/
> Signed-off-by: Kohei Enju <kohei@enjuk.jp>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
> Changelog:
> v2:
> - Fix max-line-length by removing unnecessary comment
> v1: https://lore.kernel.org/intel-wired-lan/20260119175922.199950-1-kohei@enjuk.jp/
> ---
> drivers/net/ethernet/intel/igb/e1000_82575.h | 21 ++++++++++++++++++++
> drivers/net/ethernet/intel/igb/igb_main.c | 18 +++++++++++++----
> 2 files changed, 35 insertions(+), 4 deletions(-)
>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-01 16:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22 13:47 [PATCH v2 iwl-next] igb: set skb hash type from RSS_TYPE Kohei Enju
2026-01-22 15:00 ` [Intel-wired-lan] " Paul Menzel
2026-04-01 16:50 ` Rinitha, SX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox