From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D278A0471 for ; Thu, 18 Jul 2019 07:01:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4BA9F2C17; Thu, 18 Jul 2019 07:01:29 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 438382BA8 for ; Thu, 18 Jul 2019 07:01:27 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id 4so6230338pld.10 for ; Wed, 17 Jul 2019 22:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=1hilg8eivQkLEDS7luhY3m78GkRPSB1Xlyi9pJZRc2M=; b=pW8H/cOjDhyo8b8vgTlvGNyCOWx6YuzwUPdx6qoGiWaN1j2TLc1ziaWSiO19Njt2LV c4pWzIzcpHa4PblH0dlRnXsFVcQAQUPBT/rNLLaDlTdZnQext4xkLps2VIONIHBjE9n/ 5anz83uWU0gAOcKxDZJTkNDl4OpEGbXv5CAKLmfDrZdQxEqho89+iXMCy0Cyj1g9aVYu IOHbMs61LCtexdunvqEZ2BPQJQS+PIShQmEDX6PTOMDnQOy8YC85lqxM3g9rWZ8fhUAe qGcXpyDyzUGZy2JucuxpIY9CdHWoKqHDkTGaXCIfddAdXK2Bq90OLFxWCoYfABQBNmvV 0uoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=1hilg8eivQkLEDS7luhY3m78GkRPSB1Xlyi9pJZRc2M=; b=BtQtbbFwiYy6nf425GVMEc/pdpSl48WNWvk+SteOX7M+XHdgXr7nsB74oAykzbtrW+ N+9xbvRBFTnNyrhGObB1SU+MEt9KvVfXNfSUVMbcV7xJGIb2gXdL+G7x5fRSgi4hHNw1 cE1IZ+j71E9CF1U20vGZ0zfZDtYCJSXdDFE9gYK8qWN132YynWE21ByiE8/RXwUpmTyw Ycmj6GBPyz/FuvnwQzkfGNE/e69QS71K36+Lqr1w1hz+C+R3fXOpNm1XY1GJbVYTsusS c7L0EUSqcwfSgc2pR016kxtUaRwrJtqI8H4lpiatRPZLy3liGpITPm5JY+YRmvnkEqm9 N25w== X-Gm-Message-State: APjAAAUGfjCNHR1J+yFmEtEDdDWneNQISM2faaMPw7ab+UdNydxnVBWc qcds3dr/OzeTu3GmkyZwgoAJCFsp X-Google-Smtp-Source: APXvYqxdBZv1CAC+uD+sbVBZz5EQL4nmcJo9iSBkk2x9R0WIi+lk5Ur9qxf2qeqwWTxOsDf0EURHZA== X-Received: by 2002:a17:902:6b07:: with SMTP id o7mr46703633plk.180.1563426086420; Wed, 17 Jul 2019 22:01:26 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id k25sm18958372pgt.53.2019.07.17.22.01.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jul 2019 22:01:25 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Thu, 18 Jul 2019 14:01:18 +0900 Message-Id: <20190718050119.6822-3-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190718050119.6822-1-yasufum.o@gmail.com> References: <20190718050119.6822-1-yasufum.o@gmail.com> Subject: [spp] [PATCH 2/3] spp_mirror: fix wrong master lcore other than 0 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 As previous patch, fix assigning wrong master lcore by moving rte_eal_init() before rte_get_master_lcore(). Fixes: 310c51b918e9 ("spp_vf: initialize variable master_lcore") Signed-off-by: Yasufumi Ogawa --- src/mirror/spp_mirror.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c index 5cee655..4b62349 100644 --- a/src/mirror/spp_mirror.c +++ b/src/mirror/spp_mirror.c @@ -484,7 +484,7 @@ slave_main(void *arg __attribute__ ((unused))) int main(int argc, char *argv[]) { - int ret = SPP_RET_NG; + int ret; char ctl_ip[IPADDR_LEN] = { 0 }; int ctl_port; int ret_cmd_init; @@ -505,20 +505,24 @@ main(int argc, char *argv[]) signal(SIGTERM, stop_process); signal(SIGINT, stop_process); + ret = rte_eal_init(argc, argv); + if (unlikely(ret < 0)) + rte_exit(EXIT_FAILURE, "Invalid EAL arguments.\n"); + + argc -= ret; + argv += ret; + /** * It should be initialized outside of while loop, or failed to * compile because it is referred when finalize `g_core_info`. */ master_lcore = rte_get_master_lcore(); + /** + * If any failure is occured in the while block, break to go the end + * of the block to finalize. + */ while (1) { - int ret_dpdk = rte_eal_init(argc, argv); - if (unlikely(ret_dpdk < 0)) - break; - - argc -= ret_dpdk; - argv += ret_dpdk; - /* Parse spp_mirror specific parameters */ int ret_parse = parse_app_args(argc, argv); if (unlikely(ret_parse != 0)) -- 2.17.1