Soft Patch Panel
 help / color / mirror / Atom feed
From: x-fn-spp@sl.ntt-tx.co.jp
To: ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Cc: spp@dpdk.org
Subject: [spp] [PATCH 3/5] spp_vf: move classifier component init
Date: Tue,  5 Feb 2019 20:47:40 +0900	[thread overview]
Message-ID: <201902051147.x15BlgJ1014228@imss03.silk.ntt-tx.co.jp> (raw)
In-Reply-To: <20190205114742.24502-1-x-fn-spp@sl.ntt-tx.co.jp>

From: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>

So far, initialization of classifier component is called before
while loop in spp_classifier_mac_do(). However, when introducing
core sharing, spp_classifier_mac_do() does not loop and initialization
of classifier component should be moved.

Signed-off-by: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.c      | 52 +++++++-----------------------------
 src/vf/classifier_mac.h      | 11 +++++++-
 src/vf/common/command_proc.c |  9 ++++++-
 3 files changed, 28 insertions(+), 44 deletions(-)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 27e2355..f1a3049 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -469,48 +469,6 @@ init_component_info(struct component_info *cmp_info,
 	return SPP_RET_OK;
 }
 
-/* initialize classifier. */
-static int
-init_classifier(struct management_info *mng_info)
-{
-	int ret = SPP_RET_NG;
-	struct spp_component_info component_info;
-
-	memset(mng_info, 0, sizeof(struct management_info));
-	/*
-	 * Set the same value for "ref_index" and "upd_index"
-	 * so that it will not be changed from others during initialization,
-	 * and update "upd_index" after initialization is completed.
-	 * Therefore, this setting is consciously described.
-	 */
-	mng_info->ref_index = 0;
-	mng_info->upd_index = 0;
-	memset(&component_info, 0x00, sizeof(component_info));
-
-#ifdef RTE_MACHINE_CPUFLAG_SSE4_2
-	RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, "Enabled SSE4.2. use CRC hash.\n");
-#else
-	RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
-			"Disabled SSE4.2. use Jenkins hash.\n");
-#endif
-
-	/* populate the classifier information at reference */
-	ret = init_component_info(&mng_info->
-			cmp_infos[mng_info->ref_index], &component_info);
-	if (unlikely(ret != SPP_RET_OK)) {
-		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
-				"Cannot initialize classifier mac table. "
-				"ret=%d\n", ret);
-		return SPP_RET_NG;
-	}
-
-	/* updating side can be set by completion of initialization. */
-	mng_info->upd_index = mng_info->ref_index + 1;
-	mng_info->is_used = 1;
-
-	return SPP_RET_OK;
-}
-
 /* free mac classification instance. */
 static inline void
 free_mac_classification(struct mac_classification *mac_cls)
@@ -803,6 +761,16 @@ spp_classifier_mac_init(void)
 	return 0;
 }
 
+/* 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);
+}
+
 /* classifier(mac address) update component info. */
 int
 spp_classifier_mac_update(struct spp_component_info *component_info)
diff --git a/src/vf/classifier_mac.h b/src/vf/classifier_mac.h
index ba25e75..1671ff0 100644
--- a/src/vf/classifier_mac.h
+++ b/src/vf/classifier_mac.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2017-2018 Nippon Telegraph and Telephone Corporation
+ * Copyright(c) 2017-2019 Nippon Telegraph and Telephone Corporation
  */
 
 #ifndef _CLASSIFIER_MAC_H_
@@ -27,6 +27,15 @@ struct spp_iterate_classifier_table_params;
  */
 int spp_classifier_mac_init(void);
 
+/**
+ * initialize classifier information.
+ *
+ * @param component_id
+ *  The unique component ID.
+ *
+ */
+void init_classifier_info(int component_id);
+
 /**
  * classifier(mac address) update component info.
  *
diff --git a/src/vf/common/command_proc.c b/src/vf/common/command_proc.c
index 3011873..3f44174 100644
--- a/src/vf/common/command_proc.c
+++ b/src/vf/common/command_proc.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2017-2018 Nippon Telegraph and Telephone Corporation
+ * Copyright(c) 2017-2019 Nippon Telegraph and Telephone Corporation
  */
 
 #include <unistd.h>
@@ -303,6 +303,13 @@ spp_update_component(
 
 		info = (core_info + tmp_lcore_id);
 		core = &info->core[info->upd_index];
+
+#ifdef SPP_VF_MODULE
+		/* initialize classifier information */
+		if (component->type == SPP_COMPONENT_CLASSIFIER_MAC)
+			init_classifier_info(component_id);
+#endif /* SPP_VF_MODULE */
+
 		ret_del = del_component_info(component_id,
 				core->num, core->id);
 		if (ret_del >= 0)
-- 
2.17.1

  parent reply	other threads:[~2019-02-05 11:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190205114742.24502-1-x-fn-spp@sl.ntt-tx.co.jp>
2019-02-05 11:47 ` [spp] [PATCH 1/5] spp_vf: remove while loop in classifier_mac x-fn-spp
2019-02-06  3:46   ` Yasufumi Ogawa
2019-02-05 11:47 ` [spp] [PATCH 2/5] spp_vf: change to handle multiples component x-fn-spp
2019-02-06  3:58   ` Yasufumi Ogawa
2019-02-05 11:47 ` x-fn-spp [this message]
2019-02-05 11:47 ` [spp] [PATCH 4/5] spp_vf: remove to check unused cores no needed x-fn-spp
2019-02-05 11:47 ` [spp] [PATCH 5/5] spp_vf: change retrieve component type x-fn-spp

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=201902051147.x15BlgJ1014228@imss03.silk.ntt-tx.co.jp \
    --to=x-fn-spp@sl.ntt-tx.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=ogawa.yasufumi@lab.ntt.co.jp \
    --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).