From patchwork Fri May 31 15:37:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 53961 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 659011B9A4; Fri, 31 May 2019 17:37:26 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 0AE662AB for ; Fri, 31 May 2019 17:37:20 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 74D8B309B15E; Fri, 31 May 2019 15:37:19 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-116-185.ams2.redhat.com [10.36.116.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1915060BFC; Fri, 31 May 2019 15:37:17 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, stephen@networkplumber.org, bruce.richardson@intel.com, Chas Williams Date: Fri, 31 May 2019 17:37:01 +0200 Message-Id: <1559317022-28779-5-git-send-email-david.marchand@redhat.com> In-Reply-To: <1559317022-28779-1-git-send-email-david.marchand@redhat.com> References: <20190408182510.16078-1-stephen@networkplumber.org> <1559317022-28779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 31 May 2019 15:37:19 +0000 (UTC) Subject: [dpdk-dev] [PATCH v5 4/5] examples/bond: use lcore accessors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Stephen Hemminger Referring to lcore_config directly is no longer recommended. Also remove unnecessary assignment of slave_core_id. Signed-off-by: Stephen Hemminger Signed-off-by: David Marchand --- examples/bond/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- Changelog since v3: - updated title diff --git a/examples/bond/main.c b/examples/bond/main.c index 9b9ed56..4c650ef 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -531,8 +531,9 @@ static void cmd_start_parsed(__attribute__((unused)) void *parsed_result, int slave_core_id = rte_lcore_id(); rte_spinlock_trylock(&global_flag_stru_p->lock); - if (global_flag_stru_p->LcoreMainIsRunning == 0) { - if (lcore_config[global_flag_stru_p->LcoreMainCore].state != WAIT) { + if (global_flag_stru_p->LcoreMainIsRunning == 0) { + if (rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore) + != WAIT) { rte_spinlock_unlock(&global_flag_stru_p->lock); return; } @@ -765,7 +766,7 @@ static void prompt(__attribute__((unused)) void *arg1) int main(int argc, char *argv[]) { - int ret; + int ret, slave_core_id; uint16_t nb_ports, i; /* init EAL */ @@ -797,13 +798,13 @@ static void prompt(__attribute__((unused)) void *arg1) bond_port_init(mbuf_pool); rte_spinlock_init(&global_flag_stru_p->lock); - int slave_core_id = rte_lcore_id(); /* check state of lcores */ RTE_LCORE_FOREACH_SLAVE(slave_core_id) { - if (lcore_config[slave_core_id].state != WAIT) - return -EBUSY; + if (rte_eal_get_lcore_state(slave_core_id) != WAIT) + return -EBUSY; } + /* start lcore main on core != master_core - ARP response thread */ slave_core_id = rte_get_next_lcore(rte_lcore_id(), 1, 0); if ((slave_core_id >= RTE_MAX_LCORE) || (slave_core_id == 0))