net/softnic: do not dereference global config struct
Prefer the existing apis rather than direct access the configuration
structure.
Fixes: a958a5c07f
("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>
This commit is contained in:
parent
64a46f14f6
commit
9c6b199354
@ -99,17 +99,12 @@ softnic_thread_init(struct pmd_internals *softnic)
|
|||||||
static inline int
|
static inline int
|
||||||
thread_is_valid(struct pmd_internals *softnic, uint32_t thread_id)
|
thread_is_valid(struct pmd_internals *softnic, uint32_t thread_id)
|
||||||
{
|
{
|
||||||
struct rte_config *cfg = rte_eal_get_configuration();
|
if (thread_id == rte_get_master_lcore())
|
||||||
enum rte_lcore_role_t role;
|
|
||||||
|
|
||||||
if ((thread_id >= RTE_MAX_LCORE) ||
|
|
||||||
(thread_id == cfg->master_lcore))
|
|
||||||
return 0; /* FALSE */
|
return 0; /* FALSE */
|
||||||
|
|
||||||
role = cfg->lcore_role[thread_id];
|
if (softnic->params.sc && rte_lcore_has_role(thread_id, ROLE_SERVICE))
|
||||||
|
return 1; /* TRUE */
|
||||||
if ((softnic->params.sc && (role == ROLE_SERVICE)) ||
|
if (!softnic->params.sc && rte_lcore_has_role(thread_id, ROLE_RTE))
|
||||||
(!softnic->params.sc && (role == ROLE_RTE)))
|
|
||||||
return 1; /* TRUE */
|
return 1; /* TRUE */
|
||||||
|
|
||||||
return 0; /* FALSE */
|
return 0; /* FALSE */
|
||||||
|
Loading…
Reference in New Issue
Block a user