Soft Patch Panel
 help / color / mirror / Atom feed
From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 01/11] shared/sec: refactor defines of VLAN in spp_vf
Date: Mon, 24 Jun 2019 11:24:54 +0900	[thread overview]
Message-ID: <20190624022504.18752-2-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190624022504.18752-1-yasufum.o@gmail.com>

From: Yasufumi Ogawa <yasufum.o@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@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


  reply	other threads:[~2019-06-24  2:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24  2:24 [spp] [PATCH 00/11] Refactor libs for classifier " yasufum.o
2019-06-24  2:24 ` yasufum.o [this message]
2019-06-24  2:24 ` [spp] [PATCH 02/11] shared/sec: rename struct mac_classification yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 03/11] shared/sec: refactor comments in vf_deps.h yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 04/11] shared/sec: rename struct classified_data yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 05/11] shared/sec: revise usage of term component_info yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 06/11] shared/sec: revise members of struct cls_port_info yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 07/11] shared/sec: rename func free_mac_classification yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 08/11] shared/sec: refactor updating classifier info yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 09/11] shared/sec: refactor updating forwarder yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 10/11] shared/sec: refactor getting classifier status yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 11/11] shared/sec: refactor setup cls table stat in JSON yasufum.o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190624022504.18752-2-yasufum.o@gmail.com \
    --to=yasufum.o@gmail.com \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).