From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 80314A0096 for ; Wed, 8 May 2019 04:02:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 76E671D7; Wed, 8 May 2019 04:02:48 +0200 (CEST) Received: from tama500.ecl.ntt.co.jp (tama500.ecl.ntt.co.jp [129.60.39.148]) by dpdk.org (Postfix) with ESMTP id 2158DDE3 for ; Wed, 8 May 2019 04:02:46 +0200 (CEST) Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x4822k3m023041; Wed, 8 May 2019 11:02:46 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 12997EA705C; Wed, 8 May 2019 11:02:46 +0900 (JST) Received: from localhost.localdomain (lobster.nslab.ecl.ntt.co.jp [129.60.13.95]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id F22CCEA702A; Wed, 8 May 2019 11:02:45 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Date: Wed, 8 May 2019 11:00:30 +0900 Message-Id: <1557280830-7774-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable Subject: [spp] [PATCH] spp_vf: move libs of classifier from common X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa 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 --- .../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 #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