idpf: Fix issues in rxhash and rss lut logic
Subsystems (3)
v2 cover idpf: Fix issues in rxhash and rss lut logic
ethtool -K rxhash on/off and ethtool -x/-X related to setting up RSS LUT indirection table have dependencies. There were some issues in the logic that were resulting in NULL pointer issues and configuration constraints. This series fixes these issues.
Changes in v2:
- Fixed some issues in patch-1 with goto statements
- Formatting issues in patch-2 fixed
- updated the logic during soft-reset (patch-3) (Reviewer: [email protected])
Sreedevi Joshi (3):
idpf: Fix RSS LUT NULL pointer crash on early ethtool operations
idpf: Fix RSS LUT configuration on down interfaces
idpf: Fix RSS LUT NULL ptr issue after soft reset
drivers/net/ethernet/intel/idpf/idpf.h | 2 - .../net/ethernet/intel/idpf/idpf_ethtool.c | 17 ++-- drivers/net/ethernet/intel/idpf/idpf_lib.c | 80 +++++++------------ drivers/net/ethernet/intel/idpf/idpf_txrx.c | 36 +++------ drivers/net/ethernet/intel/idpf/idpf_txrx.h | 5 +- .../net/ethernet/intel/idpf/idpf_virtchnl.c | 9 ++- 6 files changed, 64 insertions(+), 85 deletions(-)
Signature · 1 line
2.43.0
PATCH v2 1/3 idpf: Fix RSS LUT NULL pointer crash on early ethtool operations
The RSS LUT is not initialized until the interface comes up, causing the following NULL pointer crash when ethtool operations like rxhash on/off are performed before the interface is brought up for the first time.
Move RSS LUT initialization from ndo_open to vport creation to ensure LUT is always available. This enables RSS configuration via ethtool before bringing the interface up. Simplify LUT management by maintaining all changes in the driver's soft copy and programming zeros to the indirection table when rxhash is disabled. Defer HW programming until the interface comes up if it is down during rxhash and LUT configuration changes.
Steps to reproduce:
** Load idpf driver; interfaces will be created
modprobe idpf
** Before bringing the interfaces up, turn rxhash off
ethtool -K eth2 rxhash off
[89408.371875] BUG: kernel NULL pointer dereference, address: 0000000000000000 [89408.371908] #PF: supervisor read access in kernel mode [89408.371924] #PF: error_code(0x0000) - not-present page [89408.371940] PGD 0 P4D 0 [89408.371953] Oops: Oops: 0000 [#1] SMP NOPTI <snip> [89408.372052] RIP: 0010:memcpy_orig+0x16/0x130 [89408.372310] Call Trace: [89408.372317] <TASK> [89408.372326] ? idpf_set_features+0xfc/0x180 [idpf] [89408.372363] __netdev_update_features+0x295/0xde0 [89408.372384] ethnl_set_features+0x15e/0x460 [89408.372406] genl_family_rcv_msg_doit+0x11f/0x180 [89408.372429] genl_rcv_msg+0x1ad/0x2b0 [89408.372446] ? __pfx_ethnl_set_features+0x10/0x10 [89408.372465] ? __pfx_genl_rcv_msg+0x10/0x10 [89408.372482] netlink_rcv_skb+0x58/0x100 [89408.372502] genl_rcv+0x2c/0x50 [89408.372516] netlink_unicast+0x289/0x3e0 [89408.372533] netlink_sendmsg+0x215/0x440 [89408.372551] __sys_sendto+0x234/0x240 [89408.372571] __x64_sys_sendto+0x28/0x30 [89408.372585] x64_sys_call+0x1909/0x1da0 [89408.372604] do_syscall_64+0x7a/0xfa0 [89408.373140] ? clear_bhb_loop+0x60/0xb0 [89408.373647] entry_SYSCALL_64_after_hwframe+0x76/0x7e [89408.378887] </TASK>
<snip>
--- drivers/net/ethernet/intel/idpf/idpf.h | 2 - drivers/net/ethernet/intel/idpf/idpf_lib.c | 89 +++++++++---------- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 34 +++---- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 4 +- .../net/ethernet/intel/idpf/idpf_virtchnl.c | 9 +- 5 files changed, 62 insertions(+), 76 deletions(-)
drivers/net/ethernet/intel/idpf/idpf.h +0 -2
@@ -425,14 +425,12 @@ enum idpf_user_flags {* @rss_key: RSS hash key * @rss_lut_size: Size of RSS lookup table * @rss_lut: RSS lookup table -* @cached_lut: Used to restore previously init RSS lut */ struct idpf_rss_data {u16 rss_key_size;u8 *rss_key;u16 rss_lut_size;u32 *rss_lut; -u32 *cached_lut; };/**
drivers/net/ethernet/intel/idpf/idpf_lib.c +40 -49
163 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_txrx.c +12 -22
@@ -4652,57 +4652,47 @@ static void idpf_fill_dflt_rss_lut(struct idpf_vport *vport) rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; -for (i =0 ; i < rss_data->rss_lut_size; i++) { +for (i =0 ; i < rss_data->rss_lut_size; i++) rss_data->rss_lut[i] = i % num_active_rxq; - rss_data->cached_lut[i] = rss_data->rss_lut[i]; - } }/** -* idpf_init_rss - Allocate and initialize RSS resources +* idpf_init_rss_lut - Allocate and initialize RSS LUT * @vport: virtual port * * Return 0 on success, negative on failure */ -int idpf_init_rss (struct idpf_vport *vport) +int idpf_init_rss_lut (struct idpf_vport *vport) {struct idpf_adapter *adapter = vport->adapter;struct idpf_rss_data *rss_data; -u32 lut_size; rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; +if (!rss_data->rss_lut) { +u32 lut_size; - lut_size = rss_data->rss_lut_size *sizeof (u32); - rss_data->rss_lut =kzalloc (lut_size,GFP_KERNEL ); -if (!rss_data->rss_lut) -return -ENOMEM ; - - rss_data->cached_lut =kzalloc (lut_size,GFP_KERNEL ); -if (!rss_data->cached_lut) { -kfree (rss_data->rss_lut); - rss_data->rss_lut =NULL ; - -return -ENOMEM ; + lut_size = rss_data->rss_lut_size *sizeof (u32); + rss_data->rss_lut =kzalloc (lut_size,GFP_KERNEL ); +if (!rss_data->rss_lut) +return -ENOMEM ; }/* Fill the default RSS lut values */ idpf_fill_dflt_rss_lut (vport); -return idpf_config_rss (vport); +return 0 ; }/** -* idpf_deinit_rss - Release RSS resources +* idpf_deinit_rss_lut - Release RSS LUT * @vport: virtual port */ -void idpf_deinit_rss (struct idpf_vport *vport) +void idpf_deinit_rss_lut (struct idpf_vport *vport) {struct idpf_adapter *adapter = vport->adapter;struct idpf_rss_data *rss_data; rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; -kfree (rss_data->cached_lut); - rss_data->cached_lut =NULL ;kfree (rss_data->rss_lut); rss_data->rss_lut =NULL ; }
drivers/net/ethernet/intel/idpf/idpf_txrx.h +2 -2
@@ -1087,8 +1087,8 @@ void idpf_vport_intr_deinit(struct idpf_vport *vport);int idpf_vport_intr_init (struct idpf_vport *vport);void idpf_vport_intr_ena (struct idpf_vport *vport);int idpf_config_rss (struct idpf_vport *vport); -int idpf_init_rss (struct idpf_vport *vport); -void idpf_deinit_rss (struct idpf_vport *vport); +int idpf_init_rss_lut (struct idpf_vport *vport); +void idpf_deinit_rss_lut (struct idpf_vport *vport);int idpf_rx_bufs_init_all (struct idpf_vport *vport); struct idpf_q_vector *idpf_find_rxq_vec(const struct idpf_vport *vport,
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +8 -1
@@ -2804,6 +2804,10 @@ int idpf_send_get_stats_msg(struct idpf_vport *vport)* @vport: virtual port data structure * @get: flag to set or get rss look up table * +* When rxhash is disabled, RSS LUT will be configured with zeros. If rxhash +* is enabled, the LUT values stored in driver's soft copy will be used to setup +* the HW. +* * Returns 0 on success, negative on failure. */ int idpf_send_get_set_rss_lut_msg (struct idpf_vport *vport,bool get)
@@ -2814,10 +2818,12 @@ int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport, bool get)struct idpf_rss_data *rss_data;int buf_size, lut_buf_size;ssize_t reply_sz; +bool rxhash_ena;int i; rss_data = &vport->adapter->vport_config[vport->idx]->user_config.rss_data; + rxhash_ena =idpf_is_feature_ena (vport,NETIF_F_RXHASH ); buf_size =struct_size (rl, lut, rss_data->rss_lut_size); rl =kzalloc (buf_size,GFP_KERNEL );if (!rl)
@@ -2839,7 +2845,8 @@ int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport, bool get) }else { rl->lut_entries =cpu_to_le16 (rss_data->rss_lut_size);for (i =0 ; i < rss_data->rss_lut_size; i++) - rl->lut[i] =cpu_to_le32 (rss_data->rss_lut[i]); + rl->lut[i] = rxhash_ena ? +cpu_to_le32 (rss_data->rss_lut[i]) :0 ; xn_params.vc_op =VIRTCHNL2_OP_SET_RSS_LUT ; }
Signature · 1 line
2.43.0
Re: [PATCH iwl-net v2 1/3] idpf: Fix RSS LUT NULL pointer crash on early ethtool operations
Quoted 44 lines · Sreedevi Joshi
The RSS LUT is not initialized until the interface comes up, causing the following NULL pointer crash when ethtool operations like rxhash on/off are performed before the interface is brought up for the first time.
Move RSS LUT initialization from
ndo_opento vport creation to ensure LUT is always available. This enables RSS configuration via ethtool before bringing the interface up. Simplify LUT management by maintaining all changes in the driver's soft copy and programming zeros to the indirection table when rxhash is disabled. Defer HW programming until the interface comes up if it is down during rxhash and LUT configuration changes.Steps to reproduce:
** Load idpf driver; interfaces will be created
modprobe idpf
** Before bringing the interfaces up, turn rxhash off
ethtool -K eth2 rxhash off[89408.371875] BUG: kernel NULL pointer dereference, address: 0000000000000000 [89408.371908] #PF: supervisor read access in kernel mode [89408.371924] #PF: error_code(0x0000) - not-present page [89408.371940] PGD 0 P4D 0 [89408.371953] Oops: Oops: 0000 [#1] SMP NOPTI <snip> [89408.372052] RIP: 0010:memcpy_orig+0x16/0x130 [89408.372310] Call Trace: [89408.372317] <TASK> [89408.372326] ? idpf_set_features+0xfc/0x180 [idpf] [89408.372363] __netdev_update_features+0x295/0xde0 [89408.372384] ethnl_set_features+0x15e/0x460 [89408.372406] genl_family_rcv_msg_doit+0x11f/0x180 [89408.372429] genl_rcv_msg+0x1ad/0x2b0 [89408.372446] ? __pfx_ethnl_set_features+0x10/0x10 [89408.372465] ? __pfx_genl_rcv_msg+0x10/0x10 [89408.372482] netlink_rcv_skb+0x58/0x100 [89408.372502] genl_rcv+0x2c/0x50 [89408.372516] netlink_unicast+0x289/0x3e0 [89408.372533] netlink_sendmsg+0x215/0x440 [89408.372551] __sys_sendto+0x234/0x240 [89408.372571] __x64_sys_sendto+0x28/0x30 [89408.372585] x64_sys_call+0x1909/0x1da0 [89408.372604] do_syscall_64+0x7a/0xfa0 [89408.373140] ? clear_bhb_loop+0x60/0xb0 [89408.373647] entry_SYSCALL_64_after_hwframe+0x76/0x7e [89408.378887] </TASK>
Quoted 8 lines
<snip>
Fixes a251eee62133 ("idpf: add SRIOV support and other ndo_ops")Signed-off-by Sreedevi Joshi <[email protected]>Reviewed-by Sridhar Samudrala <[email protected]>Reviewed-by Emil Tantilov <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Paul Menzel <[email protected]>
Salin, Samuel
Tested-byRE: [Intel-wired-lan] [PATCH iwl-net v2 1/3] idpf: Fix RSS LUT NULL pointer crash on early ethtool operations
Quoted 58 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Simon Horman
Sent: Thursday, November 27, 2025 3:45 AM
To: Joshi, Sreedevi <[email protected]>
Cc: [email protected]; [email protected]; Samudrala, Sridhar <[email protected]>; Tantilov, Emil S <[email protected]>; Loktionov, Aleksandr <[email protected]>; Paul Menzel <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2 1/3] idpf: Fix RSS LUT NULL pointer crash on early ethtool operationsQuoted 10 lines · Sreedevi Joshi
The RSS LUT is not initialized until the interface comes up, causing the following NULL pointer crash when ethtool operations like rxhash on/off are performed before the interface is brought up for the first time.
Move RSS LUT initialization from
ndo_opento vport creation to ensure LUT is always available. This enables RSS configuration via ethtool before bringing the interface up. Simplify LUT management by maintaining all changes in the driver's soft copy and programming zeros to the indirection table when rxhash is disabled. Defer HW programming until the interface comes up if it is down during rxhash and LUTconfiguration changes.
Quoted 16 lines
Steps to reproduce:
** Load idpf driver; interfaces will be created
modprobe idpf
** Before bringing the interfaces up, turn rxhash off
ethtool -K eth2 rxhash off[89408.371875] BUG: kernel NULL pointer dereference, address: 0000000000000000 [89408.371908] #PF: supervisor read access in kernel mode [89408.371924] #PF: error_code(0x0000) - not-present page [89408.371940] PGD 0 P4D 0 [89408.371953] Oops: Oops: 0000 [#1] SMP NOPTI <snip> [89408.372052] RIP: 0010:memcpy_orig+0x16/0x130 [89408.372310] Call Trace: [89408.372317] <TASK> [89408.372326] ? idpf_set_features+0xfc/0x180 [idpf] [89408.372363] __netdev_update_features+0x295/0xde0Quoted 8 lines
[89408.372384] ethnl_set_features+0x15e/0x460 [89408.372406] genl_family_rcv_msg_doit+0x11f/0x180 [89408.372429] genl_rcv_msg+0x1ad/0x2b0 [89408.372446] ? __pfx_ethnl_set_features+0x10/0x10 [89408.372465] ? __pfx_genl_rcv_msg+0x10/0x10 [89408.372482] netlink_rcv_skb+0x58/0x100 [89408.372502] genl_rcv+0x2c/0x50 [89408.372516] netlink_unicast+0x289/0x3e0 [89408.372533] netlink_sendmsg+0x215/0x440 [89408.372551]__sys_sendto+0x234/0x240 > [89408.372571] __x64_sys_sendto+0x28/0x30 [89408.372585] > x64_sys_call+0x1909/0x1da0 [89408.372604] do_syscall_64+0x7a/0xfa0 > [89408.373140] ? clear_bhb_loop+0x60/0xb0 [89408.373647] > entry_SYSCALL_64_after_hwframe+0x76/0x7eQuoted 3 lines
[89408.378887] </TASK><snip>
Quoted 8 lines
Quoted 6 lines
Fixes a251eee62133 ("idpf: add SRIOV support and other ndo_ops")Signed-off-by Sreedevi Joshi <[email protected]>Reviewed-by Sridhar Samudrala <[email protected]>Reviewed-by Emil Tantilov <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Paul Menzel <[email protected]>Reviewed-by Simon Horman <[email protected]>
PATCH v2 2/3 idpf: Fix RSS LUT configuration on down interfaces
In reply to Sreedevi JoshiRSS LUT provisioning and queries on a down interface currently return silently without effect. Users should be able to configure RSS settings even when the interface is down.
Fix by maintaining RSS configuration changes in the driver's soft copy and deferring HW programming until the interface comes up.
--- drivers/net/ethernet/intel/idpf/idpf_ethtool.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_ethtool.c +11 -6
@@ -393,7 +393,10 @@ static u32 idpf_get_rxfh_indir_size(struct net_device *netdev)* @netdev: network interface device structure * @rxfh: pointer to param struct (indir, key, hfunc) * -* Reads the indirection table directly from the hardware. Always returns 0. +* RSS LUT and Key information are read from driver's cached +* copy. When rxhash is off, rss lut will be displayed as zeros. +* +* Return: 0 on success, -errno otherwise. */ static int idpf_get_rxfh (struct net_device *netdev,struct ethtool_rxfh_param *rxfh)
@@ -401,10 +404,13 @@ static int idpf_get_rxfh(struct net_device *netdev,struct idpf_netdev_priv *np =netdev_priv (netdev);struct idpf_rss_data *rss_data;struct idpf_adapter *adapter; +struct idpf_vport *vport; +bool rxhash_ena;int err =0 ;u16 i;idpf_vport_ctrl_lock (netdev); + vport =idpf_netdev_to_vport (netdev); adapter = np->adapter;
@@ -414,9 +420,8 @@ static int idpf_get_rxfh(struct net_device *netdev, } rss_data = &adapter->vport_config[np->vport_idx]->user_config.rss_data; -if (np->state != __IDPF_VPORT_UP) - goto unlock_mutex; + rxhash_ena =idpf_is_feature_ena (vport,NETIF_F_RXHASH ); rxfh->hfunc =ETH_RSS_HASH_TOP ;if (rxfh->key)
@@ -424,7 +429,7 @@ static int idpf_get_rxfh(struct net_device *netdev,if (rxfh->indir) {for (i =0 ; i < rss_data->rss_lut_size; i++) - rxfh->indir[i] = rss_data->rss_lut[i]; + rxfh->indir[i] = rxhash_ena ? rss_data->rss_lut[i] :0 ; } unlock_mutex:
@@ -464,8 +469,6 @@ static int idpf_set_rxfh(struct net_device *netdev, } rss_data = &adapter->vport_config[vport->idx]->user_config.rss_data; -if (np->state != __IDPF_VPORT_UP) - goto unlock_mutex;if (rxfh->hfunc !=ETH_RSS_HASH_NO_CHANGE && rxfh->hfunc !=ETH_RSS_HASH_TOP ) {
@@ -481,6 +484,8 @@ static int idpf_set_rxfh(struct net_device *netdev, rss_data->rss_lut[lut] = rxfh->indir[lut]; } +if (np->state != __IDPF_VPORT_UP) + goto unlock_mutex; err =idpf_config_rss (vport); unlock_mutex:
Signature · 1 line
2.43.0
Simon Horman
reviewerRe: [PATCH iwl-net v2 2/3] idpf: Fix RSS LUT configuration on down interfaces
Quoted 17 lines · Sreedevi Joshi
RSS LUT provisioning and queries on a down interface currently return silently without effect. Users should be able to configure RSS settings even when the interface is down.
Fix by maintaining RSS configuration changes in the driver's soft copy and deferring HW programming until the interface comes up.
Fixes 02cbfba1add5 ("idpf: add ethtool callbacks")Signed-off-by Sreedevi Joshi <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Sridhar Samudrala <[email protected]>Reviewed-by Emil Tantilov <[email protected]>--- drivers/net/ethernet/intel/idpf/idpf_ethtool.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)drivers/net/ethernet/intel/idpf/idpf_ethtool.c +0
-0
...
drivers/net/ethernet/intel/idpf/idpf_ethtool.c static int idpf_get_rxfh(struct net_device *netdev, · line 432
Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_ethtool.c +1
-1@@ -424,7 +429,7 @@ static int idpf_get_rxfh(struct net_device *netdev,if (rxfh->indir) {for (i =0 ; i < rss_data->rss_lut_size; i++) - rxfh->indir[i] = rss_data->rss_lut[i]; + rxfh->indir[i] = rxhash_ena ? rss_data->rss_lut[i] :0 ;
Hi,
I feel that I am missing something here.
But I would have expected rxfh->indir to be populated by rss_data->rss_lut regardless of the port is up or down. IOW, I'm unclear on why 0 is reported for the indirection table if the interface is down.
Quoted 3 lines
drivers/net/ethernet/intel/idpf/idpf_ethtool.c +0
-0} unlock_mutex:
...
RE: [PATCH iwl-net v2 2/3] idpf: Fix RSS LUT configuration on down interfaces
Quoted 38 lines
-----Original Message-----
From: Simon Horman <[email protected]>
Sent: Thursday, November 27, 2025 6:45 AM
To: Joshi, Sreedevi <[email protected]>
Cc: [email protected]; [email protected]; Loktionov, Aleksandr <[email protected]>; Samudrala, Sridhar <[email protected]>; Tantilov, Emil S <[email protected]>
Subject: Re: [PATCH iwl-net v2 2/3] idpf: Fix RSS LUT configuration on down interfacesQuoted 17 lines · Sreedevi Joshi
RSS LUT provisioning and queries on a down interface currently return silently without effect. Users should be able to configure RSS settings even when the interface is down.
Fix by maintaining RSS configuration changes in the driver's soft copy and deferring HW programming until the interface comes up.
Fixes 02cbfba1add5 ("idpf: add ethtool callbacks")Signed-off-by Sreedevi Joshi <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Sridhar Samudrala <[email protected]>Reviewed-by Emil Tantilov <[email protected]>--- drivers/net/ethernet/intel/idpf/idpf_ethtool.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)drivers/net/ethernet/intel/idpf/idpf_ethtool.c +0
-0...
drivers/net/ethernet/intel/idpf/idpf_ethtool.c static int idpf_get_rxfh(struct net_device *netdev, · line 432
Quoted 6 lines
drivers/net/ethernet/intel/idpf/idpf_ethtool.c +1
-1@@ -424,7 +429,7 @@ static int idpf_get_rxfh(struct net_device *netdev,if (rxfh->indir) {for (i =0 ; i < rss_data->rss_lut_size; i++) - rxfh->indir[i] = rss_data->rss_lut[i]; + rxfh->indir[i] = rxhash_ena ? rss_data->rss_lut[i] :0 ;Hi,
Quoted 5 lines
I feel that I am missing something here.
But I would have expectedrxfh->indirto be populated byrss_data->rss_lutregardless of the port is up or down. IOW, I'm unclear on why 0 is reported for the indirection table if the interface is down.
Interface being up/down does not affect filling out the rxfh->indir[]. User will be able to setup the indirection table even when interface is down and query the table as well (changes are cached in driver's copy and setup in HW when interface is brought up). However, when the rxhash is disabled on the interface, the indirection table has no effect, and it is programmed with zeros in the HW and returning all zeros in rxfh->indir[] here reflects that state. Thanks for your review, Simon!
Regards,
Sreedevi
Quoted 5 lines
Quoted 3 lines
drivers/net/ethernet/intel/idpf/idpf_ethtool.c +0
-0} unlock_mutex:...
Salin, Samuel
Tested-byRE: [PATCH iwl-net v2 2/3] idpf: Fix RSS LUT configuration on down interfaces
Quoted 63 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Joshi, Sreedevi
Sent: Friday, November 28, 2025 3:31 PM
To: Simon Horman <[email protected]>
Cc: [email protected]; [email protected]; Loktionov, Aleksandr <[email protected]>; Samudrala, Sridhar <[email protected]>; Tantilov, Emil S <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2 2/3] idpf: Fix RSS LUT configuration on down interfacesQuoted 44 lines
-----Original Message-----
From: Simon Horman <[email protected]>
Sent: Thursday, November 27, 2025 6:45 AM
To: Joshi, Sreedevi <[email protected]>
Cc: [email protected]; [email protected]; Loktionov, Aleksandr <[email protected]>; Samudrala, Sridhar <[email protected]>; Tantilov, Emil S <[email protected]>
Subject: Re: [PATCH iwl-net v2 2/3] idpf: Fix RSS LUT configuration on down interfacesQuoted 19 lines · Sreedevi Joshi
RSS LUT provisioning and queries on a down interface currently return silently without effect. Users should be able to configure RSS settings even when the interface is down.
Fix by maintaining RSS configuration changes in the driver's soft copy and deferring HW programming until the interface comes up.
Fixes 02cbfba1add5 ("idpf: add ethtool callbacks")Signed-off-by Sreedevi Joshi <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Sridhar Samudrala <[email protected]>Reviewed-by Emil Tantilov <[email protected]>--- drivers/net/ethernet/intel/idpf/idpf_ethtool.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)drivers/net/ethernet/intel/idpf/idpf_ethtool.c +0
-0...
drivers/net/ethernet/intel/idpf/idpf_ethtool.c static int idpf_get_rxfh(struct net_device · line 433
Quoted 7 lines
drivers/net/ethernet/intel/idpf/idpf_ethtool.c +1
-1@@ -424,7 +429,7 @@ static int idpf_get_rxfh(struct net_device *netdev, if (rxfh->indir) {for (i =0 ; i < rss_data->rss_lut_size; i++) - rxfh->indir[i] = rss_data->rss_lut[i]; + rxfh->indir[i] = rxhash_ena ? rss_data->rss_lut[i] :0 ;Hi,
Quoted 6 lines
I feel that I am missing something here.
But I would have expectedrxfh->indirto be populated byrss_data->rss_lutregardless of the port is up or down. IOW, I'm unclear on why
0 is reported for the indirection table if the interface is down.
Quoted 14 lines
Interface being up/down does not affect filling out the rxfh->indir[]. User will be able to setup the indirection table even when interface is down and query the table as well (changes are cached in driver's copy and setup in HW when interface is brought up). However, when the rxhash is disabled on the interface, the indirection table has no effect, and it is programmed with zeros in the HW and returning all zeros in rxfh->indir[] here reflects that state. Thanks for your review, Simon!
Regards,
SreedeviQuoted 5 lines
Quoted 3 lines
drivers/net/ethernet/intel/idpf/idpf_ethtool.c +0
-0}
unlock_mutex:...
PATCH v2 3/3 idpf: Fix RSS LUT NULL ptr issue after soft reset
In reply to Sreedevi JoshiDuring soft reset, the RSS LUT is freed and not restored unless the interface is up. If an ethtool command that accesses the rss lut is attempted immediately after reset, it will result in NULL ptr dereference. Also, there is no need to reset the rss lut if the soft reset does not involve queue count change.
After soft reset, set the RSS LUT to default values based on the updated queue count only if the reset was a result of a queue count change and the LUT was not configured by the user. In all other cases, don't touch the LUT.
Steps to reproduce:
** Bring the interface down (if up)
ifconfig eth1 down
** update the queue count (eg., 27->20)
ethtool -L eth1 combined 20
** display the RSS LUT
ethtool -x eth1
[82375.558338] BUG: kernel NULL pointer dereference, address: 0000000000000000 [82375.558373] #PF: supervisor read access in kernel mode [82375.558391] #PF: error_code(0x0000) - not-present page [82375.558408] PGD 0 P4D 0 [82375.558421] Oops: Oops: 0000 [#1] SMP NOPTI <snip> [82375.558516] RIP: 0010:idpf_get_rxfh+0x108/0x150 [idpf] [82375.558786] Call Trace: [82375.558793] <TASK> [82375.558804] rss_prepare.isra.0+0x187/0x2a0 [82375.558827] rss_prepare_data+0x3a/0x50 [82375.558845] ethnl_default_doit+0x13d/0x3e0 [82375.558863] genl_family_rcv_msg_doit+0x11f/0x180 [82375.558886] genl_rcv_msg+0x1ad/0x2b0 [82375.558902] ? __pfx_ethnl_default_doit+0x10/0x10 [82375.558920] ? __pfx_genl_rcv_msg+0x10/0x10 [82375.558937] netlink_rcv_skb+0x58/0x100 [82375.558957] genl_rcv+0x2c/0x50 [82375.558971] netlink_unicast+0x289/0x3e0 [82375.558988] netlink_sendmsg+0x215/0x440 [82375.559005] __sys_sendto+0x234/0x240 [82375.559555] __x64_sys_sendto+0x28/0x30 [82375.560068] x64_sys_call+0x1909/0x1da0 [82375.560576] do_syscall_64+0x7a/0xfa0 [82375.561076] ? clear_bhb_loop+0x60/0xb0 [82375.561567] entry_SYSCALL_64_after_hwframe+0x76/0x7e
<snip>
--- drivers/net/ethernet/intel/idpf/idpf_lib.c | 19 +++---------------- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 2 +- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 1 + 3 files changed, 5 insertions(+), 17 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_lib.c +3 -16
@@ -1484,8 +1484,6 @@ static int idpf_vport_open(struct idpf_vport *vport, bool rtnl) {struct idpf_netdev_priv *np =netdev_priv (vport->netdev);struct idpf_adapter *adapter = vport->adapter; -struct idpf_vport_config *vport_config; -struct idpf_rss_data *rss_data;int err;if (np->state != __IDPF_VPORT_DOWN)
@@ -1579,19 +1577,6 @@ static int idpf_vport_open(struct idpf_vport *vport, bool rtnl)idpf_restore_features (vport); - vport_config = adapter->vport_config[vport->idx]; - rss_data = &vport_config->user_config.rss_data; - -if (!rss_data->rss_lut) { - err =idpf_init_rss_lut (vport); -if (err) { -dev_err (&adapter->pdev->dev, -"Failed to initialize RSS LUT for vport %u: %d\n" , - vport->vport_id, err); - goto disable_vport; - } - } - err =idpf_config_rss (vport);if (err) { dev_err(&adapter->pdev->dev, "Failed to configure RSS for vport %u: %d\n",
@@ -2059,7 +2044,6 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,idpf_vport_stop (vport, false); } -idpf_deinit_rss_lut (vport);/* We're passing in vport here because we need its wait_queue * to send a message and it should be getting all the vport * config data out of the adapter but we need to be careful not
@@ -2085,6 +2069,9 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,if (err) goto err_open; +if (reset_cause ==IDPF_SR_Q_CHANGE && !netif_is_rxfh_configured (vport->netdev)) +idpf_fill_dflt_rss_lut (vport); +if (current_state == __IDPF_VPORT_UP) err =idpf_vport_open (vport, false);
drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 -1
@@ -4643,7 +4643,7 @@ int idpf_config_rss(struct idpf_vport *vport)* idpf_fill_dflt_rss_lut - Fill the indirection table with the default values * @vport: virtual port structure */ -static void idpf_fill_dflt_rss_lut (struct idpf_vport *vport) +void idpf_fill_dflt_rss_lut (struct idpf_vport *vport) {struct idpf_adapter *adapter = vport->adapter;u16 num_active_rxq = vport->num_rxq;
drivers/net/ethernet/intel/idpf/idpf_txrx.h +1 -0
@@ -1086,6 +1086,7 @@ void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector);void idpf_vport_intr_deinit (struct idpf_vport *vport);int idpf_vport_intr_init (struct idpf_vport *vport);void idpf_vport_intr_ena (struct idpf_vport *vport); +void idpf_fill_dflt_rss_lut (struct idpf_vport *vport);int idpf_config_rss (struct idpf_vport *vport);int idpf_init_rss_lut (struct idpf_vport *vport);void idpf_deinit_rss_lut (struct idpf_vport *vport);
Signature · 1 line
2.43.0
Re: [PATCH iwl-net v2 3/3] idpf: Fix RSS LUT NULL ptr issue after soft reset
Quoted 48 lines · Sreedevi Joshi
During soft reset, the RSS LUT is freed and not restored unless the interface is up. If an ethtool command that accesses the rss lut is attempted immediately after reset, it will result in NULL ptr dereference. Also, there is no need to reset the rss lut if the soft reset does not involve queue count change.
After soft reset, set the RSS LUT to default values based on the updated queue count only if the reset was a result of a queue count change and the LUT was not configured by the user. In all other cases, don't touch the LUT.
Steps to reproduce:
** Bring the interface down (if up)
ifconfig eth1 down** update the queue count (eg., 27->20)
ethtool -L eth1 combined 20** display the RSS LUT
ethtool -x eth1[82375.558338] BUG: kernel NULL pointer dereference, address: 0000000000000000 [82375.558373] #PF: supervisor read access in kernel mode [82375.558391] #PF: error_code(0x0000) - not-present page [82375.558408] PGD 0 P4D 0 [82375.558421] Oops: Oops: 0000 [#1] SMP NOPTI <snip> [82375.558516] RIP: 0010:idpf_get_rxfh+0x108/0x150 [idpf] [82375.558786] Call Trace: [82375.558793] <TASK> [82375.558804] rss_prepare.isra.0+0x187/0x2a0 [82375.558827] rss_prepare_data+0x3a/0x50 [82375.558845] ethnl_default_doit+0x13d/0x3e0 [82375.558863] genl_family_rcv_msg_doit+0x11f/0x180 [82375.558886] genl_rcv_msg+0x1ad/0x2b0 [82375.558902] ? __pfx_ethnl_default_doit+0x10/0x10 [82375.558920] ? __pfx_genl_rcv_msg+0x10/0x10 [82375.558937] netlink_rcv_skb+0x58/0x100 [82375.558957] genl_rcv+0x2c/0x50 [82375.558971] netlink_unicast+0x289/0x3e0 [82375.558988] netlink_sendmsg+0x215/0x440 [82375.559005] __sys_sendto+0x234/0x240 [82375.559555] __x64_sys_sendto+0x28/0x30 [82375.560068] x64_sys_call+0x1909/0x1da0 [82375.560576] do_syscall_64+0x7a/0xfa0 [82375.561076] ? clear_bhb_loop+0x60/0xb0 [82375.561567] entry_SYSCALL_64_after_hwframe+0x76/0x7e
Quoted 7 lines
<snip>
Fixes 02cbfba1add5 ("idpf: add ethtool callbacks")Signed-off-by Sreedevi Joshi <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Sridhar Samudrala <[email protected]>Reviewed-by Emil Tantilov <[email protected]>
Salin, Samuel
Tested-byRE: [Intel-wired-lan] [PATCH iwl-net v2 3/3] idpf: Fix RSS LUT NULL ptr issue after soft reset
Quoted 59 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Simon Horman
Sent: Thursday, November 27, 2025 3:45 AM
To: Joshi, Sreedevi <[email protected]>
Cc: [email protected]; [email protected]; Loktionov, Aleksandr <[email protected]>; Samudrala, Sridhar <[email protected]>; Tantilov, Emil S <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2 3/3] idpf: Fix RSS LUT NULL ptr issue after soft resetQuoted 30 lines · Sreedevi Joshi
During soft reset, the RSS LUT is freed and not restored unless the interface is up. If an ethtool command that accesses the rss lut is attempted immediately after reset, it will result in NULL ptr dereference. Also, there is no need to reset the rss lut if the soft reset does not involve queue count change.
After soft reset, set the RSS LUT to default values based on the updated queue count only if the reset was a result of a queue count change and the LUT was not configured by the user. In all other cases, don't touch the LUT.
Steps to reproduce:
** Bring the interface down (if up)
ifconfig eth1 down** update the queue count (eg., 27->20) ethtool -L eth1 combined 20
** display the RSS LUT
ethtool -x eth1[82375.558338] BUG: kernel NULL pointer dereference, address: 0000000000000000 [82375.558373] #PF: supervisor read access in kernel mode [82375.558391] #PF: error_code(0x0000) - not-present page [82375.558408] PGD 0 P4D 0 [82375.558421] Oops: Oops: 0000 [#1] SMP NOPTI <snip> [82375.558516] RIP: 0010:idpf_get_rxfh+0x108/0x150 [idpf] [82375.558786] Call Trace: [82375.558793] <TASK> [82375.558804] rss_prepare.isra.0+0x187/0x2a0 [82375.558827] rss_prepare_data+0x3a/0x50 [82375.558845]Quoted 8 lines
ethnl_default_doit+0x13d/0x3e0 [82375.558863] genl_family_rcv_msg_doit+0x11f/0x180 [82375.558886] genl_rcv_msg+0x1ad/0x2b0 [82375.558902] ? __pfx_ethnl_default_doit+0x10/0x10 [82375.558920] ? __pfx_genl_rcv_msg+0x10/0x10 [82375.558937] netlink_rcv_skb+0x58/0x100 [82375.558957] genl_rcv+0x2c/0x50 [82375.558971] netlink_unicast+0x289/0x3e0 [82375.558988] netlink_sendmsg+0x215/0x440 [82375.559005]__sys_sendto+0x234/0x240 > [82375.559555] __x64_sys_sendto+0x28/0x30 [82375.560068] > x64_sys_call+0x1909/0x1da0 [82375.560576] do_syscall_64+0x7a/0xfa0 > [82375.561076] ? clear_bhb_loop+0x60/0xb0 [82375.561567] > entry_SYSCALL_64_after_hwframe+0x76/0x7eQuoted 2 lines
<snip>
Quoted 7 lines
Quoted 5 lines
Fixes 02cbfba1add5 ("idpf: add ethtool callbacks")Signed-off-by Sreedevi Joshi <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Sridhar Samudrala <[email protected]>Reviewed-by Emil Tantilov <[email protected]>Reviewed-by Simon Horman <[email protected]>