[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <IA3PR11MB8986F36CD0CB9F5167822EDDE5FCA@IA3PR11MB8986.namprd11.prod.outlook.com>
Date: Mon, 27 Oct 2025 07:16:52 +0000
From: "Loktionov, Aleksandr" <aleksandr.loktionov@...el.com>
To: Kohei Enju <enjuk@...zon.com>, "intel-wired-lan@...ts.osuosl.org"
<intel-wired-lan@...ts.osuosl.org>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>
CC: "Nguyen, Anthony L" <anthony.l.nguyen@...el.com>, "Kitszel, Przemyslaw"
<przemyslaw.kitszel@...el.com>, Andrew Lunn <andrew+netdev@...n.ch>, "David
S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, "Jakub
Kicinski" <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
"kohei.enju@...il.com" <kohei.enju@...il.com>
Subject: RE: [Intel-wired-lan] [PATCH iwl-next v1 3/3] igc: allow configuring
RSS key via ethtool set_rxfh
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@...osl.org> On Behalf
> Of Kohei Enju
> Sent: Saturday, October 25, 2025 5:02 PM
> To: intel-wired-lan@...ts.osuosl.org; netdev@...r.kernel.org
> Cc: Nguyen, Anthony L <anthony.l.nguyen@...el.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@...el.com>; Andrew Lunn
> <andrew+netdev@...n.ch>; David S. Miller <davem@...emloft.net>; Eric
> Dumazet <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>; Paolo
> Abeni <pabeni@...hat.com>; kohei.enju@...il.com; Kohei Enju
> <enjuk@...zon.com>
> Subject: [Intel-wired-lan] [PATCH iwl-next v1 3/3] igc: allow
> configuring RSS key via ethtool set_rxfh
>
> Change igc_ethtool_set_rxfh() to accept and save a userspace-provided
> RSS key. When a key is provided, store it in the adapter and write the
> RSSRK registers accordingly.
>
> This can be tested using `ethtool -X <dev> hkey <key>`.
>
> Signed-off-by: Kohei Enju <enjuk@...zon.com>
> ---
> drivers/net/ethernet/intel/igc/igc.h | 1 +
> drivers/net/ethernet/intel/igc/igc_ethtool.c | 31 ++++++++++++-------
> -
> drivers/net/ethernet/intel/igc/igc_main.c | 3 +-
> 3 files changed, 21 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igc/igc.h
> b/drivers/net/ethernet/intel/igc/igc.h
> index dd159397d191..c894a5a99fc0 100644
> --- a/drivers/net/ethernet/intel/igc/igc.h
> +++ b/drivers/net/ethernet/intel/igc/igc.h
> @@ -304,6 +304,7 @@ struct igc_adapter {
>
> u8 rss_indir_tbl[IGC_RETA_SIZE];
> u8 rss_key[IGC_RSS_KEY_SIZE];
> + bool has_user_rss_key;
>
> unsigned long link_check_timeout;
> struct igc_info ei;
> diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c
> b/drivers/net/ethernet/intel/igc/igc_ethtool.c
> index 0482e590bc5a..64eac1ccb3ff 100644
> --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
> +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
> @@ -1527,24 +1527,29 @@ static int igc_ethtool_set_rxfh(struct
> net_device *netdev,
> int i;
>
> /* We do not allow change in unsupported parameters */
> - if (rxfh->key ||
> - (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
> - rxfh->hfunc != ETH_RSS_HASH_TOP))
> + if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
> + rxfh->hfunc != ETH_RSS_HASH_TOP)
> return -EOPNOTSUPP;
> - if (!rxfh->indir)
> - return 0;
>
> - num_queues = adapter->rss_queues;
> + if (rxfh->indir) {
> + num_queues = adapter->rss_queues;
>
> - /* Verify user input. */
> - for (i = 0; i < IGC_RETA_SIZE; i++)
> - if (rxfh->indir[i] >= num_queues)
> - return -EINVAL;
> + /* Verify user input. */
> + for (i = 0; i < IGC_RETA_SIZE; i++)
> + if (rxfh->indir[i] >= num_queues)
> + return -EINVAL;
>
> - for (i = 0; i < IGC_RETA_SIZE; i++)
> - adapter->rss_indir_tbl[i] = rxfh->indir[i];
> + for (i = 0; i < IGC_RETA_SIZE; i++)
> + adapter->rss_indir_tbl[i] = rxfh->indir[i];
>
> - igc_write_rss_indir_tbl(adapter);
> + igc_write_rss_indir_tbl(adapter);
> + }
> +
> + if (rxfh->key) {
> + adapter->has_user_rss_key = true;
> + memcpy(adapter->rss_key, rxfh->key, sizeof(adapter-
> >rss_key));
> + igc_write_rss_key(adapter);
> + }
>
> return 0;
> }
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c
> b/drivers/net/ethernet/intel/igc/igc_main.c
> index 1f0a601cbcef..e977661bed2f 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -779,7 +779,8 @@ static void igc_setup_mrqc(struct igc_adapter
> *adapter)
> u32 j, num_rx_queues;
> u32 mrqc, rxcsum;
>
> - netdev_rss_key_fill(adapter->rss_key, sizeof(adapter-
> >rss_key));
> + if (!adapter->has_user_rss_key)
> + netdev_rss_key_fill(adapter->rss_key, sizeof(adapter-
> >rss_key));
> igc_write_rss_key(adapter);
>
> num_rx_queues = adapter->rss_queues;
> --
> 2.51.0
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@...el.com>
Powered by blists - more mailing lists