[v2,4/5] examples/bond: use lcore accessor

Message ID 20190410171603.8979-5-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series make lcore_config internal |

Checks

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

Commit Message

Stephen Hemminger April 10, 2019, 5:16 p.m. UTC
  Referring to lcore_config directly is no longer recommended.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/bond/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

David Marchand May 3, 2019, 7:29 a.m. UTC | #1
On Wed, Apr 10, 2019 at 7:16 PM Stephen Hemminger <
stephen@networkplumber.org> wrote:

> Referring to lcore_config directly is no longer recommended.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  examples/bond/main.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/examples/bond/main.c b/examples/bond/main.c
> index ef86194fff4a..b047ab23f01d 100644
> --- a/examples/bond/main.c
> +++ b/examples/bond/main.c
> @@ -526,8 +526,9 @@ static void cmd_start_parsed(__attribute__((unused))
> void *parsed_result,
>         int slave_core_id = rte_lcore_id();
>
>         rte_spinlock_trylock(&global_flag_stru_p->lock);
> -       if (global_flag_stru_p->LcoreMainIsRunning == 0)        {
> -               if (lcore_config[global_flag_stru_p->LcoreMainCore].state
> != WAIT)      {
> +       if (global_flag_stru_p->LcoreMainIsRunning == 0) {
> +               if
> (rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore)
> +                   != WAIT) {
>                         rte_spinlock_unlock(&global_flag_stru_p->lock);
>                         return;
>                 }
> --
> 2.17.1
>
>
Same comment than in v2, you missed another lcore_config in this file at
line 800.
  

Patch

diff --git a/examples/bond/main.c b/examples/bond/main.c
index ef86194fff4a..b047ab23f01d 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -526,8 +526,9 @@  static void cmd_start_parsed(__attribute__((unused)) void *parsed_result,
 	int slave_core_id = rte_lcore_id();
 
 	rte_spinlock_trylock(&global_flag_stru_p->lock);
-	if (global_flag_stru_p->LcoreMainIsRunning == 0)	{
-		if (lcore_config[global_flag_stru_p->LcoreMainCore].state != WAIT)	{
+	if (global_flag_stru_p->LcoreMainIsRunning == 0) {
+		if (rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore)
+		    != WAIT) {
 			rte_spinlock_unlock(&global_flag_stru_p->lock);
 			return;
 		}