From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tama50.ecl.ntt.co.jp (tama50.ecl.ntt.co.jp [129.60.39.147]) by dpdk.org (Postfix) with ESMTP id E3C1A1B1FB for ; Wed, 28 Nov 2018 03:51:01 +0100 (CET) Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id wAS2p0XU018129; Wed, 28 Nov 2018 11:51:00 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 96D2EEA7B3E; Wed, 28 Nov 2018 11:51:00 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 82424EA7632; Wed, 28 Nov 2018 11:51:00 +0900 (JST) Received: from [IPv6:::1] (watercress.nslab.ecl.ntt.co.jp [129.60.13.73]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 7D5804008CB; Wed, 28 Nov 2018 11:51:00 +0900 (JST) References: <201811210136.wAL1aUGj009819@imss03.silk.ntt-tx.co.jp> From: Yasufumi Ogawa Message-ID: <564fa95a-8040-67d1-4734-1dbbe673de48@lab.ntt.co.jp> Date: Wed, 28 Nov 2018 11:48:35 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <201811210136.wAL1aUGj009819@imss03.silk.ntt-tx.co.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: x-fn-spp@sl.ntt-tx.co.jp, spp@dpdk.org Cc: ferruh.yigit@intel.com X-TM-AS-MML: disable Subject: Re: [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, 28 Nov 2018 02:51:02 -0000 > 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`. Thsi patche is applied. Thanks! Acked-by: Yasufumi Ogawa > > 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); >