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 C0E33A2EEB for ; Thu, 12 Sep 2019 13:40:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B077F1BEE3; Thu, 12 Sep 2019 13:40:30 +0200 (CEST) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by dpdk.org (Postfix) with ESMTP id 013B71BEE3 for ; Thu, 12 Sep 2019 13:40:29 +0200 (CEST) Received: by mail-pf1-f180.google.com with SMTP id x127so15833431pfb.7 for ; Thu, 12 Sep 2019 04:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=3IBj1ipSoGw9QJmaPczzgJx5O+2V1jztib7DdK8SBQM=; b=hssEwP0EyqWgD+bSSxaKRQd74rMzM6GIuM4KObN3RvM2+8ml6bacWb3uThunUQiLgx d37WlQSkXK7JJK73WYH2+1Ju+8gbI3h1lrcjHGjwL1CIzjr8+XcBuxwmlUua5k60JmMP 6ZU9ROzfSzZu3hGJ/mwYU8NNw0M+LFwxhJGRSIHun50VdKP3ynLuGIJalz+hVpsbn2Ed e8rABhhYqYXR28ExVzRSkU5I/ShQ9kJr+9QtXXZzrUUNP7eKLSC4wojx4qaj4Y5b0yxz JbiHDCreNlpDwMpGkQ1hxeu3nk0FDST2A4JMM7QPwVw2nc/Z1knmy28jaEByH6NWjk3/ 2irA== 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; bh=3IBj1ipSoGw9QJmaPczzgJx5O+2V1jztib7DdK8SBQM=; b=aHXxO1bpBZH8L7iasBPk8B4dwacrV9VuXlBh6V31X2gFBq2zeSz6IJ3mnqIxGlAA9X fi9yd6s+9MZ5a0qMgJc2d2/0VDYWRkwwgUwVcKwK1F8+mgkZ4MGLPTRvc81li6Z5O6C5 jWqJ9kniJLtrE49jZ9XUVltGYnRZbSyxkSJqP29FDZ25pDdLR7biUF0PrJ42ljIvdrpQ HSPHOumVxaIIIVPE4LnBsYlNYfj9ZIATDAwwyOzvydldtv16lNcCnIDcRW/iiQg7a8Yf UH4AWMTEgA0sAt+DKayFqgGKz3hHqWJAELIRQJG3Hf4qQ7oWSmIfSu/7FPGfk5ZJrBWg 7Spw== X-Gm-Message-State: APjAAAUWmnXGeIj3tpgZ/kF4EFVzUkzUTJ3A49y2+lao4c2BWbMvow2r 38rwnqjrCfH+xCZyjmKcnlb+Rh/p X-Google-Smtp-Source: APXvYqyuCpbKdghQjU2QfX/w0oaKEWi3ZQLHNqo9wQq9yDaAN6MRTxfs7q2NVUIKvZ2ruR/pHZfzHQ== X-Received: by 2002:a17:90a:1502:: with SMTP id l2mr11087949pja.140.1568288429104; Thu, 12 Sep 2019 04:40:29 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id d20sm36171123pfq.88.2019.09.12.04.40.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Sep 2019 04:40:28 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Thu, 12 Sep 2019 20:40:25 +0900 Message-Id: <20190912114025.12531-1-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [spp] [PATCH] shared: refactor func spp_check_core_update 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 spp_check_core_update() is used for inspecting lcore information of given ID is updated or not. If it is not updated, it returns SPP_RET_NG. However, it is not appropriate NG for the case just made no changed. This update is to change to return 0 if info is not changed, or 1. Name of function is also changed to sppwk_is_lcore_updated() to be more specific for the usage. Signed-off-by: Yasufumi Ogawa --- src/mirror/spp_mirror.c | 2 +- src/shared/secondary/spp_worker_th/cmd_utils.c | 8 ++++---- src/shared/secondary/spp_worker_th/cmd_utils.h | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c index a6bad3a..440c780 100644 --- a/src/mirror/spp_mirror.c +++ b/src/mirror/spp_mirror.c @@ -457,7 +457,7 @@ slave_main(void *arg __attribute__ ((unused))) if (status != SPPWK_LCORE_RUNNING) continue; - if (spp_check_core_update(lcore_id) == SPPWK_RET_OK) { + if (sppwk_is_lcore_updated(lcore_id) == 1) { /* Setting with the flush command trigger. */ info->ref_index = (info->upd_index+1) % TWO_SIDES; core = get_core_info(lcore_id); diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c index 58db631..1606d4f 100644 --- a/src/shared/secondary/spp_worker_th/cmd_utils.c +++ b/src/shared/secondary/spp_worker_th/cmd_utils.c @@ -506,15 +506,15 @@ get_core_info(unsigned int lcore_id) return &(info->core[info->ref_index]); } -/* Check core index change */ +/* Check lcore info of given ID is updated */ int -spp_check_core_update(unsigned int lcore_id) +sppwk_is_lcore_updated(unsigned int lcore_id) { struct core_mng_info *info = (g_mng_data.p_core_info + lcore_id); if (info->ref_index == info->upd_index) - return SPPWK_RET_OK; + return 1; else - return SPPWK_RET_NG; + return 0; } /* Check if component is using port. */ diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h index 4e2f888..db12e75 100644 --- a/src/shared/secondary/spp_worker_th/cmd_utils.h +++ b/src/shared/secondary/spp_worker_th/cmd_utils.h @@ -208,13 +208,13 @@ void del_vhost_sockfile(struct sppwk_port_info *vhost); struct core_info *get_core_info(unsigned int lcore_id); /** - * Check core index change + * Check lcore info of given ID is updated. * * @param lcore_id Lcore ID. - * @retval SPPWK_RET_OK If index is updated. - * @retval SPPWK_RET_NG If index is not updated. + * @retval 1 If it is updated. + * @retval 0 If it is not updated. */ -int spp_check_core_update(unsigned int lcore_id); +int sppwk_is_lcore_updated(unsigned int lcore_id); /** * Check if component is using port. -- 2.17.1