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 10BA91B020 for ; Thu, 28 Dec 2017 05:56:13 +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 vBS4uCVH025264 for unknown; Thu, 28 Dec 2017 13:56:12 +0900 Received: (from root@localhost) by gwchk03.silk.ntt-tx.co.jp (unknown) id vBS4u8AH027393 for unknown; Thu, 28 Dec 2017 13:56:08 +0900 Received: from gwchk.silk.ntt-tx.co.jp [10.107.0.110] by gwchk03.silk.ntt-tx.co.jp with ESMTP id PAA27379; Thu, 28 Dec 2017 13:56:08 +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 vBS4u7n3011129 for unknown; Thu, 28 Dec 2017 13:56:07 +0900 Received: from mgate01.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 vBS4u7e3011094 for unknown; Thu, 28 Dec 2017 13:56:07 +0900 Message-Id: <201712280456.vBS4u7e3011094@imss03.silk.ntt-tx.co.jp> Received: from localhost by mgate01.silk.ntt-tx.co.jp (unknown) id vBS4u4bB025622 ; Thu, 28 Dec 2017 13:56:06 +0900 From: x-fn-spp@sl.ntt-tx.co.jp To: spp@dpdk.org Date: Thu, 28 Dec 2017 13:55:44 +0900 X-Mailer: git-send-email 1.9.1 In-Reply-To: <4aae78ff-3b6c-cdfe-a8b7-24ec08b73935@lab.ntt.co.jp> References: <4aae78ff-3b6c-cdfe-a8b7-24ec08b73935@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-MML: No Subject: [spp] [PATCH 37/57] spp_vf: add restart procedure for vhost client 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: Thu, 28 Dec 2017 04:56:15 -0000 From: Hiroyuki Nakamura Add procedure for restarting vhost-user client Signed-off-by: Kentaro Watanabe Signed-off-by: Yasufum Ogawa --- src/vf/spp_vf.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c index 6947bf0..23c1bd9 100644 --- a/src/vf/spp_vf.c +++ b/src/vf/spp_vf.c @@ -23,15 +23,16 @@ enum SPP_LONGOPT_RETVAL { /* add below */ SPP_LONGOPT_RETVAL_CONFIG, - SPP_LONGOPT_RETVAL_PROCESS_ID + SPP_LONGOPT_RETVAL_PROCESS_ID, + SPP_LONGOPT_RETVAL_VHOST_CLIENT }; /* struct */ struct startup_param { - uint64_t cpu; int process_id; char server_ip[INET_ADDRSTRLEN]; int server_port; + int vhost_client; }; struct patch_info { @@ -68,10 +69,15 @@ static char config_file_path[PATH_MAX]; static void usage(const char *progname) { - RTE_LOG(INFO, APP, "Usage: %s [EAL args] -- --process-id PROC_ID [--config CONFIG_FILE_PATH] -s SERVER_IP:SERVER_PORT\n" + RTE_LOG(INFO, APP, "Usage: %s [EAL args] --" + " --process-id PROC_ID" + " [--config CONFIG_FILE_PATH]" + " -s SERVER_IP:SERVER_PORT" + " [--vhost-client]\n" " --process-id PROCESS_ID : My process ID\n" " --config CONFIG_FILE_PATH : specific config file path\n" " -s SERVER_IP:SERVER_PORT : Access information to the server\n" + " --vhost-client : Run vhost on client\n" , progname); } @@ -103,7 +109,7 @@ add_ring_pmd(int ring_id) * Set VHOST PMD */ static int -add_vhost_pmd(int index) +add_vhost_pmd(int index, int client) { struct rte_eth_conf port_conf = { .rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN } @@ -129,7 +135,8 @@ add_vhost_pmd(int index) name = get_vhost_backend_name(index); iface = get_vhost_iface_name(index); - sprintf(devargs, "%s,iface=%s,queues=%d", name, iface, nr_queues); + sprintf(devargs, "%s,iface=%s,queues=%d,client=%d", + name, iface, nr_queues, client); ret = rte_eth_dev_attach(devargs, &vhost_port_id); if (unlikely(ret < 0)) { RTE_LOG(ERR, APP, "rte_eth_dev_attach error. (ret = %d)\n", ret); @@ -308,6 +315,7 @@ parse_app_args(int argc, char *argv[]) static struct option lgopts[] = { { "config", required_argument, NULL, SPP_LONGOPT_RETVAL_CONFIG }, { "process-id", required_argument, NULL, SPP_LONGOPT_RETVAL_PROCESS_ID }, + { "vhost-client", no_argument, NULL, SPP_LONGOPT_RETVAL_VHOST_CLIENT }, { 0 }, }; @@ -316,6 +324,9 @@ parse_app_args(int argc, char *argv[]) argvopt[cnt] = argv[cnt]; } + /* Clear startup parameters */ + memset(&g_startup_param, 0x00, sizeof(g_startup_param)); + /* Check application parameter */ optind = 0; opterr = 0; @@ -336,6 +347,9 @@ parse_app_args(int argc, char *argv[]) } proc_flg = 1; break; + case SPP_LONGOPT_RETVAL_VHOST_CLIENT: + g_startup_param.vhost_client = 1; + break; case 's': if (parse_app_server(optarg, g_startup_param.server_ip, &g_startup_param.server_port) != 0) { @@ -356,11 +370,12 @@ parse_app_args(int argc, char *argv[]) usage(progname); return -1; } - RTE_LOG(INFO, APP, "application arguments value. (process id = %d, config = %s, server = %s:%d)\n", + RTE_LOG(INFO, APP, "application arguments value. (process id = %d, config = %s, server = %s:%d, vhost client = %d)\n", g_startup_param.process_id, config_file_path, g_startup_param.server_ip, - g_startup_param.server_port); + g_startup_param.server_port, + g_startup_param.vhost_client); return 0; } @@ -619,7 +634,7 @@ set_vhost_interface(struct spp_config_area *config) } /* Set DPDK port */ - int dpdk_port = add_vhost_pmd(vhost_cnt); + int dpdk_port = add_vhost_pmd(vhost_cnt, g_startup_param.vhost_client); if (unlikely(dpdk_port < 0)) { RTE_LOG(ERR, APP, "VHOST add failed. (no = %d)\n", vhost_cnt); @@ -779,6 +794,11 @@ static void del_vhost_sockfile(struct patch_info *vhost_patchs) { int cnt; + + /* Do not delete for vhost client. */ + if (g_startup_param.vhost_client != 0) + return; + for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) { if (likely(vhost_patchs[cnt].use_flg == 0)) { /* VHOST未使用はスキップ */ -- 1.9.1