From patchwork Thu May 23 13:59:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 53668 X-Patchwork-Delegate: thomas@monjalon.net 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 A45E41B974; Thu, 23 May 2019 16:00:01 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id CB5C21B958 for ; Thu, 23 May 2019 15:59:59 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6220C30024D5; Thu, 23 May 2019 13:59:59 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-124.brq.redhat.com [10.40.204.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F26C5B683; Thu, 23 May 2019 13:59:53 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, stephen@networkplumber.org, Chas Williams Date: Thu, 23 May 2019 15:59:00 +0200 Message-Id: <1558619942-9723-5-git-send-email-david.marchand@redhat.com> In-Reply-To: <1558619942-9723-1-git-send-email-david.marchand@redhat.com> References: <20190408182510.16078-1-stephen@networkplumber.org> <1558619942-9723-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 23 May 2019 13:59:59 +0000 (UTC) Subject: [dpdk-dev] [PATCH v4 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 ef86194..1b35d53 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -526,8 +526,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; } @@ -760,7 +761,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 */ @@ -792,13 +793,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))