[4/4] examples/qos_sched: do not dereference global config struct

Message ID 1557906862-1116-4-git-send-email-david.marchand@redhat.com
State New
Delegated to: Thomas Monjalon
Headers show
Series
  • [1/4] net/cxgbe: do not dereference global config struct
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

David Marchand May 15, 2019, 7:54 a.m.
Prefer the existing apis rather than direct access the configuration
structure.

Fixes: de3cfa2c9823 ("sched: initial import")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 examples/qos_sched/args.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Maxime Coquelin May 15, 2019, 10:08 a.m. | #1
On 5/15/19 9:54 AM, David Marchand wrote:
> Prefer the existing apis rather than direct access the configuration
> structure.
> 
> Fixes: de3cfa2c9823 ("sched: initial import")
> Cc:stable@dpdk.org
> 
> Signed-off-by: David Marchand<david.marchand@redhat.com>
> ---
>   examples/qos_sched/args.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)


Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

Patch

diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c
index 83eee95..7431b29 100644
--- a/examples/qos_sched/args.c
+++ b/examples/qos_sched/args.c
@@ -90,16 +90,15 @@  static inline int str_is(const char *str, const char *is)
 static uint64_t
 app_eal_core_mask(void)
 {
-	uint32_t i;
 	uint64_t cm = 0;
-	struct rte_config *cfg = rte_eal_get_configuration();
+	uint32_t i;
 
 	for (i = 0; i < APP_MAX_LCORE; i++) {
-		if (cfg->lcore_role[i] == ROLE_RTE)
+		if (rte_lcore_has_role(i, ROLE_RTE))
 			cm |= (1ULL << i);
 	}
 
-	cm |= (1ULL << cfg->master_lcore);
+	cm |= (1ULL << rte_get_master_lcore());
 
 	return cm;
 }