[spp] [PATCH 01/11] shared/sec: refactor defines of VLAN in spp_vf

yasufum.o at gmail.com yasufum.o at gmail.com
Mon Jun 24 04:24:54 CEST 2019


From: Yasufumi Ogawa <yasufum.o at gmail.com>

* Rename `SPP_NUM_VLAN_VID` to `NOF_VLAN` and move it to `vf_deps.h`.

* Rename `NUM_CLASSIFIER_MAC_INFO` to `NOF_CLS_INFO` and move it to
  `classifier_mac.c`.

* Rename `NUM_CLASSIFIER_MAC_TABLE_ENTRY` to `NOF_CLS_TABLE_ENTRIES`.

Signed-off-by: Yasufumi Ogawa <yasufum.o at gmail.com>
---
 src/shared/secondary/spp_worker_th/cmd_utils.h |  3 ---
 src/shared/secondary/spp_worker_th/vf_deps.h   |  6 +++---
 src/vf/classifier_mac.c                        | 17 ++++++++++-------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index ee44cee..1d6c332 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -40,9 +40,6 @@
 
 #define SPP_PORT_ABILITY_MAX 4  /* Max num of port abilities. */
 
-/** Number of VLAN ID */
-#define SPP_NUM_VLAN_VID 4096
-
 /** Maximum VLAN PCP */
 #define SPP_VLAN_PCP_MAX 7
 
diff --git a/src/shared/secondary/spp_worker_th/vf_deps.h b/src/shared/secondary/spp_worker_th/vf_deps.h
index fe03490..fd0dc5d 100644
--- a/src/shared/secondary/spp_worker_th/vf_deps.h
+++ b/src/shared/secondary/spp_worker_th/vf_deps.h
@@ -9,8 +9,8 @@
 #include <rte_hash.h>
 #include "cmd_utils.h"
 
-/* number of classifier information (reference/update) */
-#define NUM_CLASSIFIER_MAC_INFO 2
+/** Number of VLAN ID */
+#define NOF_VLAN 4096
 
 /* mac address classification */
 struct mac_classification {
@@ -54,7 +54,7 @@ struct component_info {
 	int mac_addr_entry;  /* mac address entry flag */
 
 	/* mac address classification per vlan-id */
-	struct mac_classification *mac_classifications[SPP_NUM_VLAN_VID];
+	struct mac_classification *mac_classifications[NOF_VLAN];
 
 	int n_classified_data_tx;  /* number of transmission ports */
 	struct classified_data classified_data_rx;  /* RX handled by cls */
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index b3a6cba..76dd9e7 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -35,8 +35,11 @@
 #define DEFAULT_HASH_FUNC rte_jhash
 #endif
 
+/* number of classifier information (reference/update) */
+#define NOF_CLS_INFO 2
+
 /* number of classifier mac table entry */
-#define NUM_CLASSIFIER_MAC_TABLE_ENTRY 128
+#define NOF_CLS_TABLE_ENTRIES 128
 
 /* interval that wait until change update index (micro second) */
 #define CHANGE_UPDATE_INDEX_WAIT_INTERVAL SPP_CHANGE_UPDATE_INTERVAL
@@ -53,7 +56,7 @@
 /* classifier management information */
 struct management_info {
 	/* classifier information */
-	struct component_info cmp_infos[NUM_CLASSIFIER_MAC_INFO];
+	struct component_info cmp_infos[NOF_CLS_INFO];
 
 	/* Reference index number for classifier information */
 	volatile int ref_index;
@@ -75,7 +78,7 @@ uninit_classifier(struct management_info *mng_info)
 
 	mng_info->is_used = 0;
 
-	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i)
+	for (i = 0; i < NOF_CLS_INFO; ++i)
 		uninit_component_info(mng_info->cmp_infos + (long)i);
 
 	memset(mng_info, 0, sizeof(struct management_info));
@@ -298,7 +301,7 @@ create_mac_classification(void)
 	/* set hash creating parameters */
 	struct rte_hash_parameters hash_params = {
 			.name      = hash_tab_name,
-			.entries   = NUM_CLASSIFIER_MAC_TABLE_ENTRY,
+			.entries   = NOF_CLS_TABLE_ENTRIES,
 			.key_len   = sizeof(struct ether_addr),
 			.hash_func = DEFAULT_HASH_FUNC,
 			.hash_func_init_val = 0,
@@ -440,7 +443,7 @@ uninit_component_info(struct component_info *cmp_info)
 {
 	int i;
 
-	for (i = 0; i < SPP_NUM_VLAN_VID; ++i)
+	for (i = 0; i < NOF_VLAN; ++i)
 		free_mac_classification(cmp_info->mac_classifications[i]);
 
 	memset(cmp_info, 0, sizeof(struct component_info));
@@ -686,7 +689,7 @@ change_classifier_index(struct management_info *mng_info, int id)
 				"Core[%u] Change update index.\n", id);
 		mng_info->ref_index =
 				(mng_info->upd_index + 1) %
-				NUM_CLASSIFIER_MAC_INFO;
+				NOF_CLS_INFO;
 	}
 }
 
@@ -943,7 +946,7 @@ spp_classifier_mac_iterate_table(
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 			"Core[%u] Start iterate classifier table.\n", i);
 
-		for (n = 0; n < SPP_NUM_VLAN_VID; ++n) {
+		for (n = 0; n < NOF_VLAN; ++n) {
 			if (cmp_info->mac_classifications[n] == NULL)
 				continue;
 
-- 
2.17.1



More information about the spp mailing list