[PATCH] net/ice: fix RSS rule overwriting an existing one
Anurag Mandal
anurag.mandal at intel.com
Tue Nov 3 07:44:38 CET 2026
An RSS flow rule only selects the hash input set of a packet type,
& the hardware keeps a single RSS profile per packet type for a
port or the PF VSI.
When a second rule is created for a packet type already used by
another rule, the existing profile is silently replaced, while both
flow handles remain valid.
For example:
flow create 0 ingress pattern eth / vlan vid is 1500 / ipv6 / end
actions rss types ipv6 l3-dst-only end queues end / end
flow create 0 ingress pattern eth / vlan vid is 2640 / ipv6 / end
actions rss types ipv6 l3-src-only end queues end / end
Only the second rule is applied, whatever the VLAN ID of the packet,
and destroying it, leaves the first rule without any hardware
configuration.
Reject the creation of an RSS rule when another RSS rule of the port
already uses the same protocol header stack.
An outer VLAN header is ignored in the comparison, as it does not
change the packet type.
The existing rule has to be destroyed first to change the hash input
set of that packet type.
Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS")
Cc: stable at dpdk.org
Signed-off-by: Anurag Mandal <anurag.mandal at intel.com>
---
drivers/net/intel/ice/ice_hash.c | 43 ++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/drivers/net/intel/ice/ice_hash.c b/drivers/net/intel/ice/ice_hash.c
index 2930aca228..6643820ae3 100644
--- a/drivers/net/intel/ice/ice_hash.c
+++ b/drivers/net/intel/ice/ice_hash.c
@@ -1311,6 +1311,40 @@ ice_hash_add_raw_cfg(struct ice_adapter *ad,
return 0;
}
+/* Check duplicate packet type RSS rule in same port */
+static bool
+ice_hash_ptype_in_use(struct ice_adapter *ad,
+ const struct ice_hash_flow_cfg *new_cfg)
+{
+ const struct ice_rss_hash_cfg *hash = &new_cfg->rss_cfg.hash;
+ const struct ice_rss_raw_cfg *raw = &new_cfg->rss_cfg.raw;
+ const struct ice_hash_flow_cfg *cfg;
+ struct rte_flow *flow;
+
+ /* flow_ops_lock is held by ice_flow_create() */
+ TAILQ_FOREACH(flow, &ad->pf.flow_list, node) {
+ cfg = flow->rule;
+ if (flow->engine != &ice_hash_engine || cfg->simple_xor ||
+ cfg->rss_cfg.raw.raw_ena != raw->raw_ena)
+ continue;
+
+ if (raw->raw_ena) {
+ if (ice_find_first_bit(cfg->rss_cfg.raw.prof.ptypes, ICE_FLOW_PTYPE_MAX) ==
+ ice_find_first_bit(raw->prof.ptypes, ICE_FLOW_PTYPE_MAX))
+ return true;
+ continue;
+ }
+
+ /* an outer VLAN header does not change the packet type */
+ if (cfg->rss_cfg.hash.hdr_type == hash->hdr_type &&
+ !((cfg->rss_cfg.hash.addl_hdrs ^ hash->addl_hdrs) &
+ ~ICE_FLOW_SEG_HDR_VLAN))
+ return true;
+ }
+
+ return false;
+}
+
static int
ice_hash_create(struct ice_adapter *ad,
void *flow_rule,
@@ -1332,6 +1366,15 @@ ice_hash_create(struct ice_adapter *ad,
goto out;
} else {
+ /* Reject duplicate packet type rule in same port */
+ if (ice_hash_ptype_in_use(ad, filter_ptr)) {
+ PMD_DRV_LOG(ERR, "RSS rule for this packet type already exists");
+ rte_flow_error_set(error, EEXIST,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "RSS rule for this packet type already exists");
+ goto error;
+ }
+
if (filter_ptr->rss_cfg.raw.raw_ena) {
ret = ice_hash_add_raw_cfg(ad, &filter_ptr->rss_cfg.raw,
pf->main_vsi->idx);
--
2.25.1
More information about the stable
mailing list