Skip to contentSkip to conversation

net/mlx5: functions refactor for getting counter's action

PATCH In review Haifei Luo 2 participants 2 messages Feb 21, 2022 – Feb 23, 2022 Network drivers

lore
Share & tools
lore

Haifei Luo

author
#0 lore raw

PATCH 1/1 net/mlx5: functions refactor for getting counter's action

Previously API flow_dv_query_count_ptr is defined to get counter's action pointer. This dv function is directly called and the better way is by the callback.

Add one arg in API mlx5_counter_query and the related callback counter_query. The added arg is for counter's action pointer.

---
 drivers/net/mlx5/mlx5.h            |  2 +-
 drivers/net/mlx5/mlx5_flow.c       | 41 ++++++++++++++++---------------
 drivers/net/mlx5/mlx5_flow.h       |  7 +-----
 drivers/net/mlx5/mlx5_flow_dv.c    | 49 ++++----------------------------------
 drivers/net/mlx5/mlx5_flow_meter.c |  2 +-
 5 files changed, 28 insertions(+), 73 deletions(-)
drivers/net/mlx5/mlx5.h +1 -1
index 737ad68..c217a7d 100644
@@ -1734,7 +1734,7 @@ void mlx5_flow_async_pool_query_handle(struct mlx5_dev_ctx_shared *sh,
 uint32_t mlx5_counter_alloc(struct rte_eth_dev *dev);
 void mlx5_counter_free(struct rte_eth_dev *dev, uint32_t cnt);
 int mlx5_counter_query(struct rte_eth_dev *dev, uint32_t cnt,
-		       bool clear, uint64_t *pkts, uint64_t *bytes);
+		    bool clear, uint64_t *pkts, uint64_t *bytes, void **action);
 int mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow,
 			FILE *file, struct rte_flow_error *error);
 int save_dump_file(const unsigned char *data, uint32_t size,
drivers/net/mlx5/mlx5_flow.c +20 -21

77 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow.h +1 -6
index 7fec79a..2b53961 100644
@@ -1180,7 +1180,7 @@ typedef void (*mlx5_flow_counter_free_t)(struct rte_eth_dev *dev,
 typedef int (*mlx5_flow_counter_query_t)(struct rte_eth_dev *dev,
 					 uint32_t cnt,
 					 bool clear, uint64_t *pkts,
-					 uint64_t *bytes);
+					 uint64_t *bytes, void **action);
 typedef int (*mlx5_flow_get_aged_flows_t)
 					(struct rte_eth_dev *dev,
 					 void **context,
@@ -1723,11 +1723,6 @@ struct mlx5_list_entry *flow_dv_dest_array_clone_cb(void *tool_ctx,
 				   struct mlx5_list_entry *entry, void *cb_ctx);
 void flow_dv_dest_array_clone_free_cb(void *tool_ctx,
 				      struct mlx5_list_entry *entry);
-int flow_dv_query_count_ptr(struct rte_eth_dev *dev, uint32_t cnt_idx,
-				void **action, struct rte_flow_error *error);
-int
-flow_dv_query_count(struct rte_eth_dev *dev, uint32_t cnt_idx, void *data,
-		    struct rte_flow_error *error);
 
 struct mlx5_aso_age_action *flow_aso_age_get_by_idx(struct rte_eth_dev *dev,
 						    uint32_t age_idx);
drivers/net/mlx5/mlx5_flow_dv.c +5 -44

73 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow_meter.c +1 -1
index 4f5de5e..b2725db 100644
@@ -1726,7 +1726,7 @@ struct mlx5_flow_meter_policy *
 	memset(stats, 0, sizeof(*stats));
 	if (fm->drop_cnt) {
 		ret = mlx5_counter_query(dev, fm->drop_cnt, clear, &pkts,
-						 &bytes);
+						 &bytes, NULL);
 		if (ret)
 			goto error;
 		/* If need to read the packets, set it. */
Signature · 1 line
1.8.3.1
#1 lore raw

Hi,

Quoted 13 lines

-----Original Message-----
From: Haifei Luo <[email protected]>
Sent: Monday, February 21, 2022 10:27 AM
To: Matan Azrad <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Shahaf Shuler <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: [PATCH] net/mlx5: functions refactor for getting counter's action

Previously API flow_dv_query_count_ptr is defined to get counter's action pointer. This dv function is directly called and the better way is by the callback.

Quoted 5 lines

Add one arg in API mlx5_counter_query and the related callback counter_query. The added arg is for counter's action pointer.

Patch rebased and applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh