[PATCH v1 1/1] net/ice: remove obsolete shared counter support

Anatoly Burakov anatoly.burakov at intel.com
Mon Oct 19 17:16:00 CEST 2026


The shared attribute was removed from the `COUNT` action, with indirect
actions replacing it. ICE still carries shared-counter handling, but
its FDIR path always allocates a dedicated counter.

Remove the unreachable shared-counter lookup and reference counting,
along with the saved action ID used only for sharing.

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---

Notes:
    The API was removed in 92ef4b8f1688 ("ethdev: remove deprecated shared counter attribute")
    
    However, it may not be reasonable to pin a Fixline on that commit because that
    would imply that it *should have* updated ice driver's plubmbing to not support
    shared counters any more, which I do not believe is reasonable. I'm leaving
    this note for posterity and in case it is determined that the Fixline is needed
    after all.

 drivers/net/intel/ice/ice_ethdev.h      |  4 --
 drivers/net/intel/ice/ice_fdir_filter.c | 61 +++----------------------
 2 files changed, 7 insertions(+), 58 deletions(-)

diff --git a/drivers/net/intel/ice/ice_ethdev.h b/drivers/net/intel/ice/ice_ethdev.h
index 08c2b61519..afef59d6bd 100644
--- a/drivers/net/intel/ice/ice_ethdev.h
+++ b/drivers/net/intel/ice/ice_ethdev.h
@@ -389,7 +389,6 @@ struct ice_fdir_filter_conf {
 	enum ice_fdir_tunnel_type tunnel_type;
 
 	struct ice_fdir_counter *counter; /* flow specific counter context */
-	struct rte_flow_action_count act_count;
 
 	uint64_t input_set_o; /* used for non-tunnel or tunnel outer fields */
 	uint64_t input_set_i; /* only for tunnel inner fields */
@@ -431,9 +430,6 @@ struct ice_fdir_counter_pool;
 struct ice_fdir_counter {
 	TAILQ_ENTRY(ice_fdir_counter) next;
 	struct ice_fdir_counter_pool *pool;
-	uint8_t shared;
-	uint32_t ref_cnt;
-	uint32_t id;
 	uint64_t hits;
 	uint64_t bytes;
 	uint32_t hw_index;
diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index 517c32cecf..f4b0d01e35 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -329,30 +329,7 @@ ice_fdir_counter_release(struct ice_pf *pf)
 }
 
 static struct ice_fdir_counter *
-ice_fdir_counter_shared_search(struct ice_fdir_counter_pool_container
-					*container,
-			       uint32_t id)
-{
-	struct ice_fdir_counter_pool *pool;
-	struct ice_fdir_counter *counter;
-	int i;
-
-	TAILQ_FOREACH(pool, &container->pool_list, next) {
-		for (i = 0; i < ICE_FDIR_COUNTERS_PER_BLOCK; i++) {
-			counter = &pool->counters[i];
-
-			if (counter->shared &&
-			    counter->ref_cnt &&
-			    counter->id == id)
-				return counter;
-		}
-	}
-
-	return NULL;
-}
-
-static struct ice_fdir_counter *
-ice_fdir_counter_alloc(struct ice_pf *pf, uint32_t shared, uint32_t id)
+ice_fdir_counter_alloc(struct ice_pf *pf)
 {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
 	struct ice_fdir_info *fdir_info = &pf->fdir;
@@ -361,18 +338,6 @@ ice_fdir_counter_alloc(struct ice_pf *pf, uint32_t shared, uint32_t id)
 	struct ice_fdir_counter_pool *pool = NULL;
 	struct ice_fdir_counter *counter_free = NULL;
 
-	if (shared) {
-		counter_free = ice_fdir_counter_shared_search(container, id);
-		if (counter_free) {
-			if (counter_free->ref_cnt + 1 == 0) {
-				rte_errno = E2BIG;
-				return NULL;
-			}
-			counter_free->ref_cnt++;
-			return counter_free;
-		}
-	}
-
 	TAILQ_FOREACH(pool, &container->pool_list, next) {
 		counter_free = TAILQ_FIRST(&pool->counter_list);
 		if (counter_free)
@@ -385,9 +350,6 @@ ice_fdir_counter_alloc(struct ice_pf *pf, uint32_t shared, uint32_t id)
 		return NULL;
 	}
 
-	counter_free->shared = shared;
-	counter_free->id = id;
-	counter_free->ref_cnt = 1;
 	counter_free->pool = pool;
 
 	/* reset statistic counter value */
@@ -404,17 +366,14 @@ ice_fdir_counter_alloc(struct ice_pf *pf, uint32_t shared, uint32_t id)
 }
 
 static void
-ice_fdir_counter_free(__rte_unused struct ice_pf *pf,
-		      struct ice_fdir_counter *counter)
+ice_fdir_counter_free(struct ice_fdir_counter *counter)
 {
 	if (!counter)
 		return;
 
-	if (--counter->ref_cnt == 0) {
-		struct ice_fdir_counter_pool *pool = counter->pool;
+	struct ice_fdir_counter_pool *pool = counter->pool;
 
-		TAILQ_INSERT_TAIL(&pool->counter_list, counter, next);
-	}
+	TAILQ_INSERT_TAIL(&pool->counter_list, counter, next);
 }
 
 static int
@@ -1642,9 +1601,7 @@ ice_fdir_create_filter(struct ice_adapter *ad,
 
 	/* alloc counter for FDIR */
 	if (filter->input.cnt_ena) {
-		struct rte_flow_action_count *act_count = &filter->act_count;
-
-		filter->counter = ice_fdir_counter_alloc(pf, 0, act_count->id);
+		filter->counter = ice_fdir_counter_alloc(pf);
 		if (!filter->counter) {
 			rte_flow_error_set(error, EINVAL,
 					RTE_FLOW_ERROR_TYPE_ACTION, NULL,
@@ -1681,7 +1638,7 @@ ice_fdir_create_filter(struct ice_adapter *ad,
 
 free_counter:
 	if (filter->counter) {
-		ice_fdir_counter_free(pf, filter->counter);
+		ice_fdir_counter_free(filter->counter);
 		filter->counter = NULL;
 	}
 
@@ -1748,7 +1705,7 @@ ice_fdir_destroy_filter(struct ice_adapter *ad,
 	is_tun = ice_fdir_is_tunnel_profile(filter->tunnel_type);
 
 	if (filter->counter) {
-		ice_fdir_counter_free(pf, filter->counter);
+		ice_fdir_counter_free(filter->counter);
 		filter->counter = NULL;
 	}
 
@@ -2870,11 +2827,7 @@ ice_fdir_parse_action(struct ice_adapter *ad,
 		}
 		case RTE_FLOW_ACTION_TYPE_COUNT:
 		{
-			const struct rte_flow_action_count *act_count = act->conf;
-
 			filter->input.cnt_ena = ICE_FXD_FLTR_QW0_STAT_ENA_PKTS;
-			rte_memcpy(&filter->act_count, act_count,
-						sizeof(filter->act_count));
 			break;
 		}
 		default:
-- 
2.52.0



More information about the dev mailing list