[spp] [PATCH] spp_vf: move libs of classifier from common

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Wed May 8 04:00:30 CEST 2019


From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>

Struct `management_info` is for containing attributes of classifier, but
included in common libs unnecessarily. It is because vf siblings use
common function `spp_command_proc_do` for parsing user command and
`management_info` is referred from the function.

It should be moved to as a local function of spp_vf, not common. This
update is to fix this issue. The names of these should be refactored
because of ambiguity in a future update.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
 .../secondary/spp_worker_th/command_proc.c    | 29 +------------
 src/vf/classifier_mac.c                       | 41 +++++++++++++++++++
 2 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/command_proc.c b/src/shared/secondary/spp_worker_th/command_proc.c
index 2fc1829..1e16bd0 100644
--- a/src/shared/secondary/spp_worker_th/command_proc.c
+++ b/src/shared/secondary/spp_worker_th/command_proc.c
@@ -9,13 +9,10 @@
 #include <rte_branch_prediction.h>
 
 #include "vf_deps.h"
+#include "mirror_deps.h"
 #include "spp_port.h"
 #include "string_buffer.h"
 
-#ifdef SPP_MIRROR_MODULE
-#include "../../mirror/spp_mirror.h"
-#endif /* SPP_MIRROR_MODULE */
-
 #include "command_conn.h"
 #include "command_dec.h"
 #include "command_proc.h"
@@ -102,30 +99,6 @@ const char *CLASSIFILER_TYPE_STATUS_STRINGS[] = {
 	/* termination */ "",
 };
 
-/* uninitialize classifier. */
-static void
-uninit_classifier(struct management_info *mng_info)
-{
-	int i;
-
-	mng_info->is_used = 0;
-
-	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i)
-		uninit_component_info(mng_info->cmp_infos + (long)i);
-
-	memset(mng_info, 0, sizeof(struct management_info));
-}
-
-/* initialize classifier information. */
-void
-init_classifier_info(int component_id)
-{
-	struct management_info *mng_info = NULL;
-
-	mng_info = g_mng_infos + component_id;
-	uninit_classifier(mng_info);
-}
-
 /* get client id */
 static int
 spp_get_client_id(void)
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index a7ccd78..b49cf14 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -50,6 +50,47 @@
 /* VID of VLAN untagged */
 #define VLAN_UNTAGGED_VID 0x0fff
 
+/* classifier management information */
+struct management_info {
+	/* classifier information */
+	struct component_info cmp_infos[NUM_CLASSIFIER_MAC_INFO];
+
+	/* Reference index number for classifier information */
+	volatile int ref_index;
+
+	/* Update index number for classifier information */
+	volatile int upd_index;
+
+	/* used flag */
+	volatile int is_used;
+};
+
+struct management_info g_mng_infos[RTE_MAX_LCORE];
+
+/* uninitialize classifier. */
+static void
+uninit_classifier(struct management_info *mng_info)
+{
+	int i;
+
+	mng_info->is_used = 0;
+
+	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i)
+		uninit_component_info(mng_info->cmp_infos + (long)i);
+
+	memset(mng_info, 0, sizeof(struct management_info));
+}
+
+/* initialize classifier information. */
+void
+init_classifier_info(int component_id)
+{
+	struct management_info *mng_info = NULL;
+
+	mng_info = g_mng_infos + component_id;
+	uninit_classifier(mng_info);
+}
+
 /*
  * hash table name buffer size
  *[reson for value]
-- 
2.17.1



More information about the spp mailing list