summaryrefslogtreecommitdiff
path: root/drivers/net/softnic
diff options
context:
space:
mode:
authorDavid Marchand <david.marchand@redhat.com>2019-05-15 09:54:20 +0200
committerThomas Monjalon <thomas@monjalon.net>2019-05-30 00:29:09 +0200
commit9c6b199354fa7773ef2e65ce51a94342925eb5ea (patch)
tree2d44f6e592c42a268e648cc24b22c595277c987d /drivers/net/softnic
parent64a46f14f616ff83da9ebfa8ab1c93e62dc99dd5 (diff)
downloaddpdk-9c6b199354fa7773ef2e65ce51a94342925eb5ea.zip
dpdk-9c6b199354fa7773ef2e65ce51a94342925eb5ea.tar.gz
dpdk-9c6b199354fa7773ef2e65ce51a94342925eb5ea.tar.xz
net/softnic: do not dereference global config struct
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 <david.marchand@redhat.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Diffstat (limited to 'drivers/net/softnic')
-rw-r--r--drivers/net/softnic/rte_eth_softnic_thread.c13
1 files 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 @@ softnic_thread_init(struct pmd_internals *softnic)
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 */