From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id BDF14A00E6 for ; Wed, 15 May 2019 09:54:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 551E65B38; Wed, 15 May 2019 09:54:42 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 49D555B1C; Wed, 15 May 2019 09:54:38 +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 70579A971A; Wed, 15 May 2019 07:54:37 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-116-80.ams2.redhat.com [10.36.116.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id C085F5D6A6; Wed, 15 May 2019 07:54:35 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, stephen@networkplumber.org, stable@dpdk.org, Jasvinder Singh , Cristian Dumitrescu Date: Wed, 15 May 2019 09:54:20 +0200 Message-Id: <1557906862-1116-2-git-send-email-david.marchand@redhat.com> In-Reply-To: <1557906862-1116-1-git-send-email-david.marchand@redhat.com> References: <1557906862-1116-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.38]); Wed, 15 May 2019 07:54:37 +0000 (UTC) Subject: [dpdk-stable] [PATCH 2/4] net/softnic: do not dereference global config struct X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Prefer the existing apis rather than direct access the configuration structure. Fixes: a958a5c07f4b ("net/softnic: support service cores") Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/net/softnic/rte_eth_softnic_thread.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic_thread.c b/drivers/net/softnic/rte_eth_softnic_thread.c index 855408e..d610b16 100644 --- a/drivers/net/softnic/rte_eth_softnic_thread.c +++ b/drivers/net/softnic/rte_eth_softnic_thread.c @@ -99,17 +99,12 @@ static inline int thread_is_valid(struct pmd_internals *softnic, uint32_t thread_id) { - struct rte_config *cfg = rte_eal_get_configuration(); - enum rte_lcore_role_t role; - - if ((thread_id >= RTE_MAX_LCORE) || - (thread_id == cfg->master_lcore)) + if (thread_id == rte_get_master_lcore()) return 0; /* FALSE */ - role = cfg->lcore_role[thread_id]; - - if ((softnic->params.sc && (role == ROLE_SERVICE)) || - (!softnic->params.sc && (role == ROLE_RTE))) + if (softnic->params.sc && rte_lcore_has_role(thread_id, ROLE_SERVICE)) + return 1; /* TRUE */ + if (!softnic->params.sc && rte_lcore_has_role(thread_id, ROLE_RTE)) return 1; /* TRUE */ return 0; /* FALSE */ -- 1.8.3.1