[2/4] net/softnic: do not dereference global config struct
Checks
Commit Message
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>
---
drivers/net/softnic/rte_eth_softnic_thread.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
Comments
On 5/15/19 9:54 AM, David Marchand wrote:
> 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>
> ---
> drivers/net/softnic/rte_eth_softnic_thread.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
@@ -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 */