From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.ics.ntt-tx.co.jp (mail05.ics.ntt-tx.co.jp [210.232.35.69]) by dpdk.org (Postfix) with ESMTP id DC65A58F6 for ; Wed, 21 Nov 2018 02:41:08 +0100 (CET) Received: from gwchk03.silk.ntt-tx.co.jp (gwchk03.silk.ntt-tx.co.jp [10.107.0.111]) by mail04.ics.ntt-tx.co.jp (unknown) with ESMTP id wAL1f7es002688; Wed, 21 Nov 2018 10:41:07 +0900 Received: (from root@localhost) by gwchk03.silk.ntt-tx.co.jp (unknown) id wAL1f6Ro004542; Wed, 21 Nov 2018 10:41:06 +0900 Received: from gwchk.silk.ntt-tx.co.jp [10.107.0.110] by gwchk03.silk.ntt-tx.co.jp with ESMTP id LAA01841; Wed, 21 Nov 2018 10:36:01 +0900 Received: from imss03.silk.ntt-tx.co.jp (localhost [127.0.0.1]) by imss03.silk.ntt-tx.co.jp (unknown) with ESMTP id wAL1a1vP009666; Wed, 21 Nov 2018 10:36:01 +0900 Received: from mgate02.silk.ntt-tx.co.jp (smtp02.silk.ntt-tx.co.jp [10.107.0.37]) by imss03.silk.ntt-tx.co.jp (unknown) with ESMTP id wAL1a0w1009657; Wed, 21 Nov 2018 10:36:00 +0900 Message-Id: <201811210136.wAL1a0w1009657@imss03.silk.ntt-tx.co.jp> Received: from localhost by mgate02.silk.ntt-tx.co.jp (unknown) id wAL1ZwWf008346 ; Wed, 21 Nov 2018 10:36:00 +0900 From: x-fn-spp@sl.ntt-tx.co.jp To: ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Cc: spp@dpdk.org Date: Wed, 21 Nov 2018 10:35:48 +0900 X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181121013558.8869-1-x-fn-spp@sl.ntt-tx.co.jp> References: <20181121013558.8869-1-x-fn-spp@sl.ntt-tx.co.jp> X-TM-AS-MML: No Subject: [spp] [PATCH 13/23] spp_vf: define terms of commands as consts 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: , X-List-Received-Date: Wed, 21 Nov 2018 01:41:09 -0000 From: Hideyuki Yamashita Add defines of terms of commands of spp_vf. Signed-off-by: Hideyuki Yamashita Signed-off-by: Naoki Takada --- src/vf/common/command_dec.c | 80 ++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 24 deletions(-) diff --git a/src/vf/common/command_dec.c b/src/vf/common/command_dec.c index 7cebbb5..13af984 100644 --- a/src/vf/common/command_dec.c +++ b/src/vf/common/command_dec.c @@ -14,14 +14,44 @@ #define RTE_LOGTYPE_SPP_COMMAND_PROC RTE_LOGTYPE_USER1 +/* command string */ +#define SPP_COMMAND_CLASSFIER_TABLE_STR "classifier_table" +#define SPP_COMMAND_GET_CLIENT_ID_STR "_get_client_id" +#define SPP_COMMAND_STATUS_STR "status" +#define SPP_COMMAND_EXIT_STR "exit" +#define SPP_COMMAND_COMPONENT_STR "component" +#define SPP_COMMAND_PORT_STR "port" + +/* classifiler_type string */ +#define SPP_CLASSIFLER_NONE_STR "none" +#define SPP_CLASSIFLER_MAC_STR "mac" +#define SPP_CLASSIFLER_VLAN_STR "vlan" + +/* command action string */ +#define SPP_ACTION_NONE_STR "none" +#define SPP_ACTION_START_STR "start" +#define SPP_ACTION_STOP_STR "stop" +#define SPP_ACTION_ADD_STR "add" +#define SPP_ACTION_DEL_STR "del" + +/* port rx/tx string */ +#define SPP_PORT_RXTX_NONE_STR "none" +#define SPP_PORT_RXTX_RX_STR "rx" +#define SPP_PORT_RXTX_TX_STR "tx" + +/* port ability string */ +#define SPP_ABILITY_NONE_STR "none" +#define SPP_ABILITY_ADD_VLANTAG_STR "add_vlantag" +#define SPP_ABILITY_DEL_VLANTAG_STR "del_vlantag" + /* * classifier type string list * do it same as the order of enum spp_classifier_type (spp_vf.h) */ const char *CLASSIFILER_TYPE_STRINGS[] = { - "none", - "mac", - "vlan", + SPP_CLASSIFLER_NONE_STR, + SPP_CLASSIFLER_MAC_STR, + SPP_CLASSIFLER_VLAN_STR, /* termination */ "", }; @@ -31,11 +61,11 @@ const char *CLASSIFILER_TYPE_STRINGS[] = { * do it same as the order of enum spp_command_action (spp_vf.h) */ const char *COMMAND_ACTION_STRINGS[] = { - "none", - "start", - "stop", - "add", - "del", + SPP_ACTION_NONE_STR, + SPP_ACTION_START_STR, + SPP_ACTION_STOP_STR, + SPP_ACTION_ADD_STR, + SPP_ACTION_DEL_STR, /* termination */ "", }; @@ -45,9 +75,9 @@ const char *COMMAND_ACTION_STRINGS[] = { * do it same as the order of enum spp_port_rxtx (spp_vf.h) */ const char *PORT_RXTX_STRINGS[] = { - "none", - "rx", - "tx", + SPP_PORT_RXTX_NONE_STR, + SPP_PORT_RXTX_RX_STR, + SPP_PORT_RXTX_TX_STR, /* termination */ "", }; @@ -57,9 +87,9 @@ const char *PORT_RXTX_STRINGS[] = { * do it same as the order of enum spp_port_ability_type (spp_vf.h) */ const char *PORT_ABILITY_STRINGS[] = { - "none", - "add_vlantag", - "del_vlantag", + SPP_ABILITY_NONE_STR, + SPP_ABILITY_ADD_VLANTAG_STR, + SPP_ABILITY_DEL_VLANTAG_STR, /* termination */ "", }; @@ -863,18 +893,20 @@ struct decode_command_list { /* command list */ static struct decode_command_list command_list[] = { - { "classifier_table", 5, 5, decode_command_parameter_in_list }, + { SPP_COMMAND_CLASSFIER_TABLE_STR, 5, 5, + decode_command_parameter_in_list }, /* classifier_table(mac) */ - { "classifier_table", 6, 6, decode_command_parameter_in_list }, + { SPP_COMMAND_CLASSFIER_TABLE_STR, 6, 6, + decode_command_parameter_in_list }, /* classifier_table(vlan) */ - { "_get_client_id", 1, 1, NULL }, /* _get_client_id */ - { "status", 1, 1, NULL }, /* status */ - { "exit", 1, 1, NULL }, /* exit */ - { "component", 3, 5, decode_command_parameter_in_list }, - /* component */ - { "port", 5, 8, decode_command_parameter_in_list }, - /* port */ - { "", 0, 0, NULL } /* termination */ + { SPP_COMMAND_GET_CLIENT_ID_STR, 1, 1, NULL }, /* _get_client_id */ + { SPP_COMMAND_STATUS_STR, 1, 1, NULL }, /* status */ + { SPP_COMMAND_EXIT_STR, 1, 1, NULL }, /* exit */ + { SPP_COMMAND_COMPONENT_STR, 3, 5, + decode_command_parameter_in_list }, /* component */ + { SPP_COMMAND_PORT_STR, 5, 8, + decode_command_parameter_in_list }, /* port */ + { "", 0, 0, NULL } /* termination */ }; /* Decode command line parameters */ -- 2.18.0