* [PATCH v2 iwl-net 0/2] idpf: fix flow steering issues
@ 2025-09-30 21:23 Sreedevi Joshi
2025-09-30 21:23 ` [PATCH v2 iwl-net 1/2] idpf: fix memory leak of flow steer list on rmmod Sreedevi Joshi
2025-09-30 21:23 ` [PATCH v2 iwl-net 2/2] idpf: fix issue with ethtool -n command display Sreedevi Joshi
0 siblings, 2 replies; 7+ messages in thread
From: Sreedevi Joshi @ 2025-09-30 21:23 UTC (permalink / raw)
To: sreedevi.joshi, intel-wired-lan; +Cc: netdev
Fix some issues in the recently added idpf flow steering
logic that cause ethtool functionality problems and memory
leak.
This series addresses:
- Memory leaks during module removal with active flow rules
- ethtool -n display errors due to incomplete flow spec storage
- Add logic to detect and reject duplicate filter entries at the same
location
Changes:
v2:
* patch2
Update commit message to add details of improved validation
sequence. (Simon Horman)
Thanks
Sreedevi
Erik Gabriel Carrillo (1):
idpf: fix issue with ethtool -n command display
Sreedevi Joshi (1):
idpf: fix memory leak of flow steer list on rmmod
drivers/net/ethernet/intel/idpf/idpf.h | 5 +-
.../net/ethernet/intel/idpf/idpf_ethtool.c | 72 +++++++++++++------
drivers/net/ethernet/intel/idpf/idpf_lib.c | 28 +++++++-
3 files changed, 80 insertions(+), 25 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 iwl-net 1/2] idpf: fix memory leak of flow steer list on rmmod
2025-09-30 21:23 [PATCH v2 iwl-net 0/2] idpf: fix flow steering issues Sreedevi Joshi
@ 2025-09-30 21:23 ` Sreedevi Joshi
2025-10-01 15:43 ` Simon Horman
2025-09-30 21:23 ` [PATCH v2 iwl-net 2/2] idpf: fix issue with ethtool -n command display Sreedevi Joshi
1 sibling, 1 reply; 7+ messages in thread
From: Sreedevi Joshi @ 2025-09-30 21:23 UTC (permalink / raw)
To: sreedevi.joshi, intel-wired-lan
Cc: netdev, Przemek Kitszel, Aleksandr Loktionov
The flow steering list maintains entries that are added and removed as
ethtool creates and deletes flow steering rules. Module removal with active
entries causes memory leak as the list is not properly cleaned up.
Prevent this by iterating through the remaining entries in the list and
freeing the associated memory during module removal. Add a spinlock
(flow_steer_list_lock) to protect the list access from multiple threads.
Fixes: ada3e24b84a0 ("idpf: add flow steering support")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Sreedevi Joshi <sreedevi.joshi@intel.com>
---
drivers/net/ethernet/intel/idpf/idpf.h | 2 ++
.../net/ethernet/intel/idpf/idpf_ethtool.c | 15 ++++++++--
drivers/net/ethernet/intel/idpf/idpf_lib.c | 28 ++++++++++++++++++-
3 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf.h b/drivers/net/ethernet/intel/idpf/idpf.h
index cfbf3a716f34..4f4cf21e3c46 100644
--- a/drivers/net/ethernet/intel/idpf/idpf.h
+++ b/drivers/net/ethernet/intel/idpf/idpf.h
@@ -525,6 +525,7 @@ struct idpf_vector_lifo {
* @max_q: Maximum possible queues
* @req_qs_chunks: Queue chunk data for requested queues
* @mac_filter_list_lock: Lock to protect mac filters
+ * @flow_steer_list_lock: Lock to protect fsteer filters
* @flags: See enum idpf_vport_config_flags
*/
struct idpf_vport_config {
@@ -532,6 +533,7 @@ struct idpf_vport_config {
struct idpf_vport_max_q max_q;
struct virtchnl2_add_queues *req_qs_chunks;
spinlock_t mac_filter_list_lock;
+ spinlock_t flow_steer_list_lock;
DECLARE_BITMAP(flags, IDPF_VPORT_CONFIG_FLAGS_NBITS);
};
diff --git a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
index f84e247399a7..1352f18b60b0 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
@@ -18,6 +18,7 @@ static int idpf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
{
struct idpf_netdev_priv *np = netdev_priv(netdev);
struct idpf_vport_user_config_data *user_config;
+ struct idpf_vport_config *vport_config;
struct idpf_fsteer_fltr *f;
struct idpf_vport *vport;
unsigned int cnt = 0;
@@ -25,7 +26,8 @@ static int idpf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
idpf_vport_ctrl_lock(netdev);
vport = idpf_netdev_to_vport(netdev);
- user_config = &np->adapter->vport_config[np->vport_idx]->user_config;
+ vport_config = np->adapter->vport_config[np->vport_idx];
+ user_config = &vport_config->user_config;
switch (cmd->cmd) {
case ETHTOOL_GRXRINGS:
@@ -37,15 +39,18 @@ static int idpf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
break;
case ETHTOOL_GRXCLSRULE:
err = -EINVAL;
+ spin_lock_bh(&vport_config->flow_steer_list_lock);
list_for_each_entry(f, &user_config->flow_steer_list, list)
if (f->loc == cmd->fs.location) {
cmd->fs.ring_cookie = f->q_index;
err = 0;
break;
}
+ spin_unlock_bh(&vport_config->flow_steer_list_lock);
break;
case ETHTOOL_GRXCLSRLALL:
cmd->data = idpf_fsteer_max_rules(vport);
+ spin_lock_bh(&vport_config->flow_steer_list_lock);
list_for_each_entry(f, &user_config->flow_steer_list, list) {
if (cnt == cmd->rule_cnt) {
err = -EMSGSIZE;
@@ -56,6 +61,7 @@ static int idpf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
}
if (!err)
cmd->rule_cnt = user_config->num_fsteer_fltrs;
+ spin_unlock_bh(&vport_config->flow_steer_list_lock);
break;
default:
break;
@@ -224,6 +230,7 @@ static int idpf_add_flow_steer(struct net_device *netdev,
fltr->loc = fsp->location;
fltr->q_index = q_index;
+ spin_lock_bh(&vport_config->flow_steer_list_lock);
list_for_each_entry(f, &user_config->flow_steer_list, list) {
if (f->loc >= fltr->loc)
break;
@@ -234,6 +241,7 @@ static int idpf_add_flow_steer(struct net_device *netdev,
list_add(&fltr->list, &user_config->flow_steer_list);
user_config->num_fsteer_fltrs++;
+ spin_unlock_bh(&vport_config->flow_steer_list_lock);
out:
kfree(rule);
@@ -286,17 +294,20 @@ static int idpf_del_flow_steer(struct net_device *netdev,
goto out;
}
+ spin_lock_bh(&vport_config->flow_steer_list_lock);
list_for_each_entry_safe(f, iter,
&user_config->flow_steer_list, list) {
if (f->loc == fsp->location) {
list_del(&f->list);
kfree(f);
user_config->num_fsteer_fltrs--;
- goto out;
+ goto out_unlock;
}
}
err = -EINVAL;
+out_unlock:
+ spin_unlock_bh(&vport_config->flow_steer_list_lock);
out:
kfree(rule);
return err;
diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
index 01ab42fa23f9..72685f8b48f7 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
@@ -440,6 +440,29 @@ int idpf_intr_req(struct idpf_adapter *adapter)
return err;
}
+/**
+ * idpf_del_all_flow_steer_filters - Delete all flow steer filters in list
+ * @vport: main vport struct
+ *
+ * Takes flow_steer_list_lock spinlock. Deletes all filters
+ */
+static void idpf_del_all_flow_steer_filters(struct idpf_vport *vport)
+{
+ struct idpf_vport_config *vport_config;
+ struct idpf_fsteer_fltr *f, *ftmp;
+
+ vport_config = vport->adapter->vport_config[vport->idx];
+
+ spin_lock_bh(&vport_config->flow_steer_list_lock);
+ list_for_each_entry_safe(f, ftmp, &vport_config->user_config.flow_steer_list,
+ list) {
+ list_del(&f->list);
+ kfree(f);
+ }
+ vport_config->user_config.num_fsteer_fltrs = 0;
+ spin_unlock_bh(&vport_config->flow_steer_list_lock);
+}
+
/**
* idpf_find_mac_filter - Search filter list for specific mac filter
* @vconfig: Vport config structure
@@ -1031,8 +1054,10 @@ static void idpf_vport_dealloc(struct idpf_vport *vport)
if (!test_bit(IDPF_HR_RESET_IN_PROG, adapter->flags))
idpf_decfg_netdev(vport);
- if (test_bit(IDPF_REMOVE_IN_PROG, adapter->flags))
+ if (test_bit(IDPF_REMOVE_IN_PROG, adapter->flags)) {
idpf_del_all_mac_filters(vport);
+ idpf_del_all_flow_steer_filters(vport);
+ }
if (adapter->netdevs[i]) {
struct idpf_netdev_priv *np = netdev_priv(adapter->netdevs[i]);
@@ -1549,6 +1574,7 @@ void idpf_init_task(struct work_struct *work)
init_waitqueue_head(&vport->sw_marker_wq);
spin_lock_init(&vport_config->mac_filter_list_lock);
+ spin_lock_init(&vport_config->flow_steer_list_lock);
INIT_LIST_HEAD(&vport_config->user_config.mac_filter_list);
INIT_LIST_HEAD(&vport_config->user_config.flow_steer_list);
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 iwl-net 2/2] idpf: fix issue with ethtool -n command display
2025-09-30 21:23 [PATCH v2 iwl-net 0/2] idpf: fix flow steering issues Sreedevi Joshi
2025-09-30 21:23 ` [PATCH v2 iwl-net 1/2] idpf: fix memory leak of flow steer list on rmmod Sreedevi Joshi
@ 2025-09-30 21:23 ` Sreedevi Joshi
2025-10-01 15:44 ` Simon Horman
1 sibling, 1 reply; 7+ messages in thread
From: Sreedevi Joshi @ 2025-09-30 21:23 UTC (permalink / raw)
To: sreedevi.joshi, intel-wired-lan
Cc: netdev, Erik Gabriel Carrillo, Przemek Kitszel,
Aleksandr Loktionov
From: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
When ethtool -n is executed on an interface to display the flow steering
rules, "rxclass: Unknown flow type" error is generated.
The flow steering list maintained in the driver currently stores only the
location and q_index but other fields of the ethtool_rx_flow_spec are not
stored. This may be enough for the virtchnl command to delete the entry.
However, when the ethtool -n command is used to query the flow steering
rules, the ethtool_rx_flow_spec returned is not complete causing the
error below.
Resolve this by storing the flow spec (fsp) when rules are added and
returning the complete flow spec when rules are queried.
Also, change the return value from EINVAL to ENOENT when flow steering
entry is not found during query by location or when deleting an entry.
Add logic to detect and reject duplicate filter entries at the same
location and change logic to perform upfront validation of all error
conditions before adding flow rules through virtchnl. This avoids the
need for additional virtchnl delete messages when subsequent operations
fail, which was missing in the original upstream code.
Example:
Before the fix:
ethtool -n eth1
2 RX rings available
Total 2 rules
rxclass: Unknown flow type
rxclass: Unknown flow type
After the fix:
ethtool -n eth1
2 RX rings available
Total 2 rules
Filter: 0
Rule Type: TCP over IPv4
Src IP addr: 10.0.0.1 mask: 0.0.0.0
Dest IP addr: 0.0.0.0 mask: 255.255.255.255
TOS: 0x0 mask: 0xff
Src port: 0 mask: 0xffff
Dest port: 0 mask: 0xffff
Action: Direct to queue 0
Filter: 1
Rule Type: UDP over IPv4
Src IP addr: 10.0.0.1 mask: 0.0.0.0
Dest IP addr: 0.0.0.0 mask: 255.255.255.255
TOS: 0x0 mask: 0xff
Src port: 0 mask: 0xffff
Dest port: 0 mask: 0xffff
Action: Direct to queue 0
Fixes: ada3e24b84a0 ("idpf: add flow steering support")
Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Co-developed-by: Sreedevi Joshi <sreedevi.joshi@intel.com>
Signed-off-by: Sreedevi Joshi <sreedevi.joshi@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
drivers/net/ethernet/intel/idpf/idpf.h | 3 +-
.../net/ethernet/intel/idpf/idpf_ethtool.c | 57 ++++++++++++-------
2 files changed, 38 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf.h b/drivers/net/ethernet/intel/idpf/idpf.h
index 4f4cf21e3c46..ec759bc5b3ce 100644
--- a/drivers/net/ethernet/intel/idpf/idpf.h
+++ b/drivers/net/ethernet/intel/idpf/idpf.h
@@ -269,8 +269,7 @@ struct idpf_port_stats {
struct idpf_fsteer_fltr {
struct list_head list;
- u32 loc;
- u32 q_index;
+ struct ethtool_rx_flow_spec fs;
};
/**
diff --git a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
index 1352f18b60b0..6a39cc1feeb5 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
@@ -38,11 +38,13 @@ static int idpf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
cmd->data = idpf_fsteer_max_rules(vport);
break;
case ETHTOOL_GRXCLSRULE:
- err = -EINVAL;
+ err = -ENOENT;
spin_lock_bh(&vport_config->flow_steer_list_lock);
list_for_each_entry(f, &user_config->flow_steer_list, list)
- if (f->loc == cmd->fs.location) {
- cmd->fs.ring_cookie = f->q_index;
+ if (f->fs.location == cmd->fs.location) {
+ /* Avoid infoleak from padding: zero first, then assign fields */
+ memset(&cmd->fs, 0, sizeof(cmd->fs));
+ cmd->fs = f->fs;
err = 0;
break;
}
@@ -56,7 +58,7 @@ static int idpf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
err = -EMSGSIZE;
break;
}
- rule_locs[cnt] = f->loc;
+ rule_locs[cnt] = f->fs.location;
cnt++;
}
if (!err)
@@ -158,7 +160,7 @@ static int idpf_add_flow_steer(struct net_device *netdev,
struct idpf_vport *vport;
u32 flow_type, q_index;
u16 num_rxq;
- int err;
+ int err = 0;
vport = idpf_netdev_to_vport(netdev);
vport_config = vport->adapter->vport_config[np->vport_idx];
@@ -184,6 +186,29 @@ static int idpf_add_flow_steer(struct net_device *netdev,
if (!rule)
return -ENOMEM;
+ fltr = kzalloc(sizeof(*fltr), GFP_KERNEL);
+ if (!fltr) {
+ err = -ENOMEM;
+ goto out_free_rule;
+ }
+
+ /* detect duplicate entry and reject before adding rules */
+ spin_lock_bh(&vport_config->flow_steer_list_lock);
+ list_for_each_entry(f, &user_config->flow_steer_list, list) {
+ if (f->fs.location == fsp->location) {
+ err = -EEXIST;
+ break;
+ }
+
+ if (f->fs.location > fsp->location)
+ break;
+ parent = f;
+ }
+ spin_unlock_bh(&vport_config->flow_steer_list_lock);
+
+ if (err)
+ goto out;
+
rule->vport_id = cpu_to_le32(vport->vport_id);
rule->count = cpu_to_le32(1);
info = &rule->rule_info[0];
@@ -222,28 +247,20 @@ static int idpf_add_flow_steer(struct net_device *netdev,
goto out;
}
- fltr = kzalloc(sizeof(*fltr), GFP_KERNEL);
- if (!fltr) {
- err = -ENOMEM;
- goto out;
- }
+ /* Save a copy of the user's flow spec so ethtool can later retrieve it */
+ fltr->fs = *fsp;
- fltr->loc = fsp->location;
- fltr->q_index = q_index;
spin_lock_bh(&vport_config->flow_steer_list_lock);
- list_for_each_entry(f, &user_config->flow_steer_list, list) {
- if (f->loc >= fltr->loc)
- break;
- parent = f;
- }
-
parent ? list_add(&fltr->list, &parent->list) :
list_add(&fltr->list, &user_config->flow_steer_list);
user_config->num_fsteer_fltrs++;
spin_unlock_bh(&vport_config->flow_steer_list_lock);
+ goto out_free_rule;
out:
+ kfree(fltr);
+out_free_rule:
kfree(rule);
return err;
}
@@ -297,14 +314,14 @@ static int idpf_del_flow_steer(struct net_device *netdev,
spin_lock_bh(&vport_config->flow_steer_list_lock);
list_for_each_entry_safe(f, iter,
&user_config->flow_steer_list, list) {
- if (f->loc == fsp->location) {
+ if (f->fs.location == fsp->location) {
list_del(&f->list);
kfree(f);
user_config->num_fsteer_fltrs--;
goto out_unlock;
}
}
- err = -EINVAL;
+ err = -ENOENT;
out_unlock:
spin_unlock_bh(&vport_config->flow_steer_list_lock);
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 iwl-net 1/2] idpf: fix memory leak of flow steer list on rmmod
2025-09-30 21:23 ` [PATCH v2 iwl-net 1/2] idpf: fix memory leak of flow steer list on rmmod Sreedevi Joshi
@ 2025-10-01 15:43 ` Simon Horman
2025-12-18 0:56 ` Mina Almasry
0 siblings, 1 reply; 7+ messages in thread
From: Simon Horman @ 2025-10-01 15:43 UTC (permalink / raw)
To: Sreedevi Joshi
Cc: intel-wired-lan, netdev, Przemek Kitszel, Aleksandr Loktionov
On Tue, Sep 30, 2025 at 04:23:51PM -0500, Sreedevi Joshi wrote:
> The flow steering list maintains entries that are added and removed as
> ethtool creates and deletes flow steering rules. Module removal with active
> entries causes memory leak as the list is not properly cleaned up.
>
> Prevent this by iterating through the remaining entries in the list and
> freeing the associated memory during module removal. Add a spinlock
> (flow_steer_list_lock) to protect the list access from multiple threads.
>
> Fixes: ada3e24b84a0 ("idpf: add flow steering support")
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Sreedevi Joshi <sreedevi.joshi@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 iwl-net 2/2] idpf: fix issue with ethtool -n command display
2025-09-30 21:23 ` [PATCH v2 iwl-net 2/2] idpf: fix issue with ethtool -n command display Sreedevi Joshi
@ 2025-10-01 15:44 ` Simon Horman
2025-12-18 0:52 ` Mina Almasry
0 siblings, 1 reply; 7+ messages in thread
From: Simon Horman @ 2025-10-01 15:44 UTC (permalink / raw)
To: Sreedevi Joshi
Cc: intel-wired-lan, netdev, Erik Gabriel Carrillo, Przemek Kitszel,
Aleksandr Loktionov
On Tue, Sep 30, 2025 at 04:23:52PM -0500, Sreedevi Joshi wrote:
> From: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
>
> When ethtool -n is executed on an interface to display the flow steering
> rules, "rxclass: Unknown flow type" error is generated.
>
> The flow steering list maintained in the driver currently stores only the
> location and q_index but other fields of the ethtool_rx_flow_spec are not
> stored. This may be enough for the virtchnl command to delete the entry.
> However, when the ethtool -n command is used to query the flow steering
> rules, the ethtool_rx_flow_spec returned is not complete causing the
> error below.
>
> Resolve this by storing the flow spec (fsp) when rules are added and
> returning the complete flow spec when rules are queried.
>
> Also, change the return value from EINVAL to ENOENT when flow steering
> entry is not found during query by location or when deleting an entry.
>
> Add logic to detect and reject duplicate filter entries at the same
> location and change logic to perform upfront validation of all error
> conditions before adding flow rules through virtchnl. This avoids the
> need for additional virtchnl delete messages when subsequent operations
> fail, which was missing in the original upstream code.
>
> Example:
> Before the fix:
> ethtool -n eth1
> 2 RX rings available
> Total 2 rules
>
> rxclass: Unknown flow type
> rxclass: Unknown flow type
>
> After the fix:
> ethtool -n eth1
> 2 RX rings available
> Total 2 rules
>
> Filter: 0
> Rule Type: TCP over IPv4
> Src IP addr: 10.0.0.1 mask: 0.0.0.0
> Dest IP addr: 0.0.0.0 mask: 255.255.255.255
> TOS: 0x0 mask: 0xff
> Src port: 0 mask: 0xffff
> Dest port: 0 mask: 0xffff
> Action: Direct to queue 0
>
> Filter: 1
> Rule Type: UDP over IPv4
> Src IP addr: 10.0.0.1 mask: 0.0.0.0
> Dest IP addr: 0.0.0.0 mask: 255.255.255.255
> TOS: 0x0 mask: 0xff
> Src port: 0 mask: 0xffff
> Dest port: 0 mask: 0xffff
> Action: Direct to queue 0
>
> Fixes: ada3e24b84a0 ("idpf: add flow steering support")
> Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
> Co-developed-by: Sreedevi Joshi <sreedevi.joshi@intel.com>
> Signed-off-by: Sreedevi Joshi <sreedevi.joshi@intel.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 iwl-net 2/2] idpf: fix issue with ethtool -n command display
2025-10-01 15:44 ` Simon Horman
@ 2025-12-18 0:52 ` Mina Almasry
0 siblings, 0 replies; 7+ messages in thread
From: Mina Almasry @ 2025-12-18 0:52 UTC (permalink / raw)
To: Simon Horman
Cc: Sreedevi Joshi, intel-wired-lan, netdev, Erik Gabriel Carrillo,
Przemek Kitszel, Aleksandr Loktionov
On Wed, Oct 1, 2025 at 8:45 AM Simon Horman <horms@kernel.org> wrote:
>
> On Tue, Sep 30, 2025 at 04:23:52PM -0500, Sreedevi Joshi wrote:
> > From: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
> >
> > When ethtool -n is executed on an interface to display the flow steering
> > rules, "rxclass: Unknown flow type" error is generated.
> >
> > The flow steering list maintained in the driver currently stores only the
> > location and q_index but other fields of the ethtool_rx_flow_spec are not
> > stored. This may be enough for the virtchnl command to delete the entry.
> > However, when the ethtool -n command is used to query the flow steering
> > rules, the ethtool_rx_flow_spec returned is not complete causing the
> > error below.
> >
> > Resolve this by storing the flow spec (fsp) when rules are added and
> > returning the complete flow spec when rules are queried.
> >
> > Also, change the return value from EINVAL to ENOENT when flow steering
> > entry is not found during query by location or when deleting an entry.
> >
> > Add logic to detect and reject duplicate filter entries at the same
> > location and change logic to perform upfront validation of all error
> > conditions before adding flow rules through virtchnl. This avoids the
> > need for additional virtchnl delete messages when subsequent operations
> > fail, which was missing in the original upstream code.
> >
> > Example:
> > Before the fix:
> > ethtool -n eth1
> > 2 RX rings available
> > Total 2 rules
> >
> > rxclass: Unknown flow type
> > rxclass: Unknown flow type
> >
> > After the fix:
> > ethtool -n eth1
> > 2 RX rings available
> > Total 2 rules
> >
> > Filter: 0
> > Rule Type: TCP over IPv4
> > Src IP addr: 10.0.0.1 mask: 0.0.0.0
> > Dest IP addr: 0.0.0.0 mask: 255.255.255.255
> > TOS: 0x0 mask: 0xff
> > Src port: 0 mask: 0xffff
> > Dest port: 0 mask: 0xffff
> > Action: Direct to queue 0
> >
> > Filter: 1
> > Rule Type: UDP over IPv4
> > Src IP addr: 10.0.0.1 mask: 0.0.0.0
> > Dest IP addr: 0.0.0.0 mask: 255.255.255.255
> > TOS: 0x0 mask: 0xff
> > Src port: 0 mask: 0xffff
> > Dest port: 0 mask: 0xffff
> > Action: Direct to queue 0
> >
> > Fixes: ada3e24b84a0 ("idpf: add flow steering support")
> > Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
> > Co-developed-by: Sreedevi Joshi <sreedevi.joshi@intel.com>
> > Signed-off-by: Sreedevi Joshi <sreedevi.joshi@intel.com>
> > Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> > Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
>
Tested-by: Mina Almasry <almasrymina@google.com>
--
Thanks,
Mina
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 iwl-net 1/2] idpf: fix memory leak of flow steer list on rmmod
2025-10-01 15:43 ` Simon Horman
@ 2025-12-18 0:56 ` Mina Almasry
0 siblings, 0 replies; 7+ messages in thread
From: Mina Almasry @ 2025-12-18 0:56 UTC (permalink / raw)
To: Simon Horman
Cc: Sreedevi Joshi, intel-wired-lan, netdev, Przemek Kitszel,
Aleksandr Loktionov
On Wed, Oct 1, 2025 at 8:44 AM Simon Horman <horms@kernel.org> wrote:
>
> On Tue, Sep 30, 2025 at 04:23:51PM -0500, Sreedevi Joshi wrote:
> > The flow steering list maintains entries that are added and removed as
> > ethtool creates and deletes flow steering rules. Module removal with active
> > entries causes memory leak as the list is not properly cleaned up.
> >
> > Prevent this by iterating through the remaining entries in the list and
> > freeing the associated memory during module removal. Add a spinlock
> > (flow_steer_list_lock) to protect the list access from multiple threads.
> >
> > Fixes: ada3e24b84a0 ("idpf: add flow steering support")
> > Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> > Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> > Signed-off-by: Sreedevi Joshi <sreedevi.joshi@intel.com>
>
> Reviewed-by: Simon Horman <horms@kernel.org>
>
Tested-by: Mina Almasry <almasrymina@google.com>
--
Thanks,
Mina
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-12-18 0:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-30 21:23 [PATCH v2 iwl-net 0/2] idpf: fix flow steering issues Sreedevi Joshi
2025-09-30 21:23 ` [PATCH v2 iwl-net 1/2] idpf: fix memory leak of flow steer list on rmmod Sreedevi Joshi
2025-10-01 15:43 ` Simon Horman
2025-12-18 0:56 ` Mina Almasry
2025-09-30 21:23 ` [PATCH v2 iwl-net 2/2] idpf: fix issue with ethtool -n command display Sreedevi Joshi
2025-10-01 15:44 ` Simon Horman
2025-12-18 0:52 ` Mina Almasry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).