[v4,28/34] net/sfc: rename SW structures used by transfer flow counters

Message ID 20230607130245.8048-29-ivan.malov@arknetworks.am (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/sfc: support HW conntrack assistance |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ivan Malov June 7, 2023, 1:02 p.m. UTC
  Doing so facilitates rearrangements of the next patch needed
to make software counter objects shareable across many flows.

Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/net/sfc/sfc_mae.c         | 14 +++++++-------
 drivers/net/sfc/sfc_mae.h         | 14 +++++++-------
 drivers/net/sfc/sfc_mae_counter.c | 31 ++++++++++++++++---------------
 drivers/net/sfc/sfc_mae_counter.h | 16 ++++++++--------
 4 files changed, 38 insertions(+), 37 deletions(-)
  

Patch

diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index c58a2520da..2b4c821883 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -151,7 +151,7 @@  sfc_mae_attach(struct sfc_adapter *sa)
 		if (rc != 0)
 			goto fail_mae_get_limits;
 
-		sfc_log_init(sa, "init MAE counter registry");
+		sfc_log_init(sa, "init MAE counter record registry");
 		rc = sfc_mae_counter_registry_init(&mae->counter_registry,
 						   limits.eml_max_n_counters);
 		if (rc != 0) {
@@ -817,7 +817,7 @@  sfc_mae_encap_header_disable(struct sfc_adapter *sa,
 
 static int
 sfc_mae_counters_enable(struct sfc_adapter *sa,
-			struct sfc_mae_counter_id *counters,
+			struct sfc_mae_counter *counters,
 			unsigned int n_counters,
 			efx_mae_actions_t *action_set_spec)
 {
@@ -833,7 +833,7 @@  sfc_mae_counters_enable(struct sfc_adapter *sa,
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
 	SFC_ASSERT(n_counters == 1);
 
-	rc = sfc_mae_counter_enable(sa, &counters[0]);
+	rc = sfc_mae_counter_fw_rsrc_enable(sa, &counters[0]);
 	if (rc != 0) {
 		sfc_err(sa, "failed to enable MAE counter %u: %s",
 			counters[0].mae_id.id, rte_strerror(rc));
@@ -851,7 +851,7 @@  sfc_mae_counters_enable(struct sfc_adapter *sa,
 	return 0;
 
 fail_fill_in_id:
-	(void)sfc_mae_counter_disable(sa, &counters[0]);
+	(void)sfc_mae_counter_fw_rsrc_disable(sa, &counters[0]);
 
 fail_counter_add:
 	sfc_log_init(sa, "failed: %s", rte_strerror(rc));
@@ -860,7 +860,7 @@  sfc_mae_counters_enable(struct sfc_adapter *sa,
 
 static int
 sfc_mae_counters_disable(struct sfc_adapter *sa,
-			 struct sfc_mae_counter_id *counters,
+			 struct sfc_mae_counter *counters,
 			 unsigned int n_counters)
 {
 	if (n_counters == 0)
@@ -874,7 +874,7 @@  sfc_mae_counters_disable(struct sfc_adapter *sa,
 		return EALREADY;
 	}
 
-	return sfc_mae_counter_disable(sa, &counters[0]);
+	return sfc_mae_counter_fw_rsrc_disable(sa, &counters[0]);
 }
 
 struct sfc_mae_aset_ctx {
@@ -1039,7 +1039,7 @@  sfc_mae_action_set_enable(struct sfc_adapter *sa,
 	struct sfc_mae_encap_header *encap_header;
 	struct sfc_mae_mac_addr *dst_mac_addr;
 	struct sfc_mae_mac_addr *src_mac_addr;
-	struct sfc_mae_counter_id *counters;
+	struct sfc_mae_counter *counters;
 	struct sfc_mae_fw_rsrc *fw_rsrc;
 	int rc;
 
diff --git a/drivers/net/sfc/sfc_mae.h b/drivers/net/sfc/sfc_mae.h
index 67fa2ca5c9..7337fcf14d 100644
--- a/drivers/net/sfc/sfc_mae.h
+++ b/drivers/net/sfc/sfc_mae.h
@@ -68,7 +68,7 @@  struct sfc_mae_encap_header {
 TAILQ_HEAD(sfc_mae_encap_headers, sfc_mae_encap_header);
 
 /* Counter ID */
-struct sfc_mae_counter_id {
+struct sfc_mae_counter {
 	/* ID of a counter in MAE */
 	efx_counter_t			mae_id;
 	/* ID of a counter in RTE */
@@ -86,7 +86,7 @@  struct sfc_mae_counter_id {
 struct sfc_mae_action_set {
 	TAILQ_ENTRY(sfc_mae_action_set)	entries;
 	unsigned int			refcnt;
-	struct sfc_mae_counter_id	*counters;
+	struct sfc_mae_counter		*counters;
 	uint32_t			n_counters;
 	efx_mae_actions_t		*spec;
 	struct sfc_mae_encap_header	*encap_header;
@@ -129,7 +129,7 @@  struct sfc_mae_bounce_eh {
 };
 
 /** Counter collection entry */
-struct sfc_mae_counter {
+struct sfc_mae_counter_record {
 	bool				inuse;
 	uint32_t			generation_count;
 	union sfc_pkts_bytes		value;
@@ -143,9 +143,9 @@  struct sfc_mae_counters_xstats {
 	uint64_t			realloc_update;
 };
 
-struct sfc_mae_counters {
+struct sfc_mae_counter_records {
 	/** An array of all MAE counters */
-	struct sfc_mae_counter		*mae_counters;
+	struct sfc_mae_counter_record	*mae_counters;
 	/** Extra statistics for counters */
 	struct sfc_mae_counters_xstats	xstats;
 	/** Count of all MAE counters */
@@ -162,7 +162,7 @@  enum sfc_mae_counter_polling_mode {
 struct sfc_mae_counter_registry {
 	/* Common counter information */
 	/** Counters collection */
-	struct sfc_mae_counters		counters;
+	struct sfc_mae_counter_records	counters;
 
 	/* Information used by counter update service */
 	/** Callback to get packets from RxQ */
@@ -219,7 +219,7 @@  struct sfc_mae {
 	struct sfc_mae_bounce_eh	bounce_eh;
 	/** Flag indicating whether counter-only RxQ is running */
 	bool				counter_rxq_running;
-	/** Counter registry */
+	/** Counter record registry */
 	struct sfc_mae_counter_registry	counter_registry;
 	/**
 	 * Switchdev default rules. They forward traffic from PHY port
diff --git a/drivers/net/sfc/sfc_mae_counter.c b/drivers/net/sfc/sfc_mae_counter.c
index 818b4dad4a..8170175991 100644
--- a/drivers/net/sfc/sfc_mae_counter.c
+++ b/drivers/net/sfc/sfc_mae_counter.c
@@ -76,12 +76,12 @@  sfc_mae_counter_rxq_required(struct sfc_adapter *sa)
 }
 
 int
-sfc_mae_counter_enable(struct sfc_adapter *sa,
-		       struct sfc_mae_counter_id *counterp)
+sfc_mae_counter_fw_rsrc_enable(struct sfc_adapter *sa,
+			       struct sfc_mae_counter *counterp)
 {
 	struct sfc_mae_counter_registry *reg = &sa->mae.counter_registry;
-	struct sfc_mae_counters *counters = &reg->counters;
-	struct sfc_mae_counter *p;
+	struct sfc_mae_counter_records *counters = &reg->counters;
+	struct sfc_mae_counter_record *p;
 	efx_counter_t mae_counter;
 	uint32_t generation_count;
 	uint32_t unused;
@@ -147,12 +147,12 @@  sfc_mae_counter_enable(struct sfc_adapter *sa,
 }
 
 int
-sfc_mae_counter_disable(struct sfc_adapter *sa,
-			struct sfc_mae_counter_id *counter)
+sfc_mae_counter_fw_rsrc_disable(struct sfc_adapter *sa,
+				struct sfc_mae_counter *counter)
 {
 	struct sfc_mae_counter_registry *reg = &sa->mae.counter_registry;
-	struct sfc_mae_counters *counters = &reg->counters;
-	struct sfc_mae_counter *p;
+	struct sfc_mae_counter_records *counters = &reg->counters;
+	struct sfc_mae_counter_record *p;
 	uint32_t unused;
 	int rc;
 
@@ -189,12 +189,13 @@  sfc_mae_counter_disable(struct sfc_adapter *sa,
 
 static void
 sfc_mae_counter_increment(struct sfc_adapter *sa,
-			  struct sfc_mae_counters *counters,
+			  struct sfc_mae_counter_records *counters,
 			  uint32_t mae_counter_id,
 			  uint32_t generation_count,
 			  uint64_t pkts, uint64_t bytes)
 {
-	struct sfc_mae_counter *p = &counters->mae_counters[mae_counter_id];
+	struct sfc_mae_counter_record *p =
+		&counters->mae_counters[mae_counter_id];
 	struct sfc_mae_counters_xstats *xstats = &counters->xstats;
 	union sfc_pkts_bytes cnt_val;
 	bool inuse;
@@ -667,7 +668,7 @@  sfc_mae_counter_thread_spawn(struct sfc_adapter *sa,
 }
 
 int
-sfc_mae_counters_init(struct sfc_mae_counters *counters,
+sfc_mae_counters_init(struct sfc_mae_counter_records *counters,
 		      uint32_t nb_counters_max)
 {
 	int rc;
@@ -691,7 +692,7 @@  sfc_mae_counters_init(struct sfc_mae_counters *counters,
 }
 
 void
-sfc_mae_counters_fini(struct sfc_mae_counters *counters)
+sfc_mae_counters_fini(struct sfc_mae_counter_records *counters)
 {
 	rte_free(counters->mae_counters);
 	counters->mae_counters = NULL;
@@ -942,13 +943,13 @@  sfc_mae_counter_start(struct sfc_adapter *sa)
 }
 
 int
-sfc_mae_counter_get(struct sfc_mae_counters *counters,
-		    const struct sfc_mae_counter_id *counter,
+sfc_mae_counter_get(struct sfc_mae_counter_records *counters,
+		    const struct sfc_mae_counter *counter,
 		    struct rte_flow_query_count *data)
 {
 	struct sfc_ft_ctx *ft_ctx = counter->ft_ctx;
 	uint64_t non_reset_tunnel_hit_counter;
-	struct sfc_mae_counter *p;
+	struct sfc_mae_counter_record *p;
 	union sfc_pkts_bytes value;
 
 	SFC_ASSERT(counter->mae_id.id < counters->n_mae_counters);
diff --git a/drivers/net/sfc/sfc_mae_counter.h b/drivers/net/sfc/sfc_mae_counter.h
index 28d70f7d69..9c6d8103ac 100644
--- a/drivers/net/sfc/sfc_mae_counter.h
+++ b/drivers/net/sfc/sfc_mae_counter.h
@@ -38,15 +38,15 @@  void sfc_mae_counter_rxq_detach(struct sfc_adapter *sa);
 int sfc_mae_counter_rxq_init(struct sfc_adapter *sa);
 void sfc_mae_counter_rxq_fini(struct sfc_adapter *sa);
 
-int sfc_mae_counters_init(struct sfc_mae_counters *counters,
+int sfc_mae_counters_init(struct sfc_mae_counter_records *counters,
 			  uint32_t nb_counters_max);
-void sfc_mae_counters_fini(struct sfc_mae_counters *counters);
-int sfc_mae_counter_enable(struct sfc_adapter *sa,
-			   struct sfc_mae_counter_id *counterp);
-int sfc_mae_counter_disable(struct sfc_adapter *sa,
-			    struct sfc_mae_counter_id *counter);
-int sfc_mae_counter_get(struct sfc_mae_counters *counters,
-			const struct sfc_mae_counter_id *counter,
+void sfc_mae_counters_fini(struct sfc_mae_counter_records *counters);
+int sfc_mae_counter_fw_rsrc_enable(struct sfc_adapter *sa,
+				   struct sfc_mae_counter *counterp);
+int sfc_mae_counter_fw_rsrc_disable(struct sfc_adapter *sa,
+				    struct sfc_mae_counter *counter);
+int sfc_mae_counter_get(struct sfc_mae_counter_records *counters,
+			const struct sfc_mae_counter *counter,
 			struct rte_flow_query_count *data);
 
 int sfc_mae_counter_start(struct sfc_adapter *sa);