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 A6FA45942 for ; Wed, 21 Nov 2018 02:42:14 +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 wAL1gD2M003232; Wed, 21 Nov 2018 10:42:13 +0900 Received: (from root@localhost) by gwchk03.silk.ntt-tx.co.jp (unknown) id wAL1gDtJ005562; Wed, 21 Nov 2018 10:42:13 +0900 Received: from gwchk.silk.ntt-tx.co.jp [10.107.0.110] by gwchk03.silk.ntt-tx.co.jp with ESMTP id LAA02291; Wed, 21 Nov 2018 10:36:30 +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 wAL1aUl1009822; Wed, 21 Nov 2018 10:36:30 +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 wAL1aUGj009819; Wed, 21 Nov 2018 10:36:30 +0900 Message-Id: <201811210136.wAL1aUGj009819@imss03.silk.ntt-tx.co.jp> Received: from localhost by mgate02.silk.ntt-tx.co.jp (unknown) id wAL1aTiA008462 ; Wed, 21 Nov 2018 10:36:29 +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:36:29 +0900 X-Mailer: git-send-email 2.18.0 X-TM-AS-MML: No Subject: [spp] [PATCH 1/1] spp_vf: return secondary process type 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:42:15 -0000 From: Hideyuki Yamashita spp-ctl requires to be notified ID and type from secondary processes while registering. This update is to change to return the secondary type of `none`, `vf` or `mirror`. Signed-off-by: Hideyuki Yamashita Signed-off-by: Naoki Takada --- src/vf/common/command_proc.c | 34 ++++++++++++++++++++++++++++++++++ src/vf/common/spp_proc.h | 9 +++++++++ src/vf/spp_vf.c | 4 +++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/vf/common/command_proc.c b/src/vf/common/command_proc.c index e6a9fab..cf35ce0 100644 --- a/src/vf/common/command_proc.c +++ b/src/vf/common/command_proc.c @@ -66,6 +66,18 @@ struct command_response_list { int (*func)(const char *name, char **output, void *tmp); }; +/* + * seconary type string list + * do it same the order enum secondary_type (spp_proc.h) + */ +const char *SECONDARY_PROCESS_TYPE_SRINGS[] = { + "none", + "vf", + "mirror", + + /* termination */ "", +}; + /* * port ability string list * do it same as the order of enum spp_port_ability_type (spp_vf.h) @@ -101,6 +113,17 @@ spp_get_client_id(void) return startup_param->client_id; } +/* get process type */ +static int +spp_get_process_type(void) +{ + struct startup_param *startup_param; + + spp_get_mng_data_addr(&startup_param, + NULL, NULL, NULL, NULL, NULL, NULL); + return startup_param->secondary_type; +} + /* Check if port has been flushed. */ static int spp_check_flush_port(enum port_type iface_type, int iface_no) @@ -886,6 +909,15 @@ append_interface_array(char **output, const enum port_type type) return SPP_RET_OK; } +/* append a secondary process type for JSON format */ +static int +append_process_type_value(const char *name, char **output, + void *tmp __attribute__ ((unused))) +{ + return append_json_str_value(name, output, + SECONDARY_PROCESS_TYPE_SRINGS[spp_get_process_type()]); +} + /* append a list of interface numbers for JSON format */ static int append_interface_value(const char *name, char **output, @@ -1465,6 +1497,8 @@ send_command_result_response(int *sock, "client id response.\n"); return; } + ret = append_process_type_value("process_type", + &tmp_buff, NULL); } /* append info value */ diff --git a/src/vf/common/spp_proc.h b/src/vf/common/spp_proc.h index 8bb43ec..4001c21 100644 --- a/src/vf/common/spp_proc.h +++ b/src/vf/common/spp_proc.h @@ -148,6 +148,13 @@ enum copy_mng_flg { COPY_MNG_FLG_ALLCOPY, }; +/* secondary process type used only from spp_vf and spp_mirror */ +enum secondary_type { + SECONDARY_TYPE_NONE, + SECONDARY_TYPE_VF, + SECONDARY_TYPE_MIRROR, +}; + /** * Interface information structure */ @@ -218,6 +225,8 @@ struct startup_param { /* IP address stiring of spp-ctl */ int server_port; /* Port Number of spp-ctl */ int vhost_client; /* Flag for --vhost-client option */ + enum secondary_type secondary_type; + /* secondary type */ }; /* Manage number of interfaces and port information as global variable */ diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c index 7ceb88f..4e4a8e1 100644 --- a/src/vf/spp_vf.c +++ b/src/vf/spp_vf.c @@ -171,10 +171,12 @@ parse_app_args(int argc, char *argv[]) usage(progname); return SPP_RET_NG; } + g_startup_param.secondary_type = SECONDARY_TYPE_VF; RTE_LOG(INFO, APP, - "app opts (client_id=%d,server=%s:%d," + "app opts (client_id=%d,type=%d,server=%s:%d," "vhost_client=%d)\n", g_startup_param.client_id, + g_startup_param.secondary_type, g_startup_param.server_ip, g_startup_param.server_port, g_startup_param.vhost_client); -- 2.18.0