Soft Patch Panel
 help / color / mirror / Atom feed
* [spp] [PATCH] spp_vf: move libs of classifier from common
@ 2019-05-08  2:00 ogawa.yasufumi
  0 siblings, 0 replies; only message in thread
From: ogawa.yasufumi @ 2019-05-08  2:00 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

From: Yasufumi Ogawa <ogawa.yasufumi@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@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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-05-08  2:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08  2:00 [spp] [PATCH] spp_vf: move libs of classifier from common ogawa.yasufumi

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).