[v1,3/5] examples/bond: use lcore accessor

Message ID 20190408182510.16078-4-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 8, 2019, 6:25 p.m. UTC
  Use the accessor function to look at lcore state.

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

Comments

David Marchand April 9, 2019, 7:43 a.m. UTC | #1
On Mon, Apr 8, 2019 at 8:25 PM Stephen Hemminger <stephen@networkplumber.org>
wrote:

> Use the accessor function to look at lcore state.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  examples/bond/main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/examples/bond/main.c b/examples/bond/main.c
> index ef86194fff4a..48e6755ea294 100644
> --- a/examples/bond/main.c
> +++ b/examples/bond/main.c
> @@ -526,8 +526,8 @@ 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_lcore_state(global_flag_stru_p->LcoreMainCore) !=
> WAIT) {
>

s/rte_lcore_state/rte_eal_get_lcore_state/

                        rte_spinlock_unlock(&global_flag_stru_p->lock);
>                         return;
>                 }
> --
> 2.17.1
>
>
And you missed another reference in this file:

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 48e6755..982b7ea 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -527,7 +527,7 @@ static void cmd_start_parsed(__attribute__((unused))
void *parsed_result,

        rte_spinlock_trylock(&global_flag_stru_p->lock);
        if (global_flag_stru_p->LcoreMainIsRunning == 0) {
-               if (rte_lcore_state(global_flag_stru_p->LcoreMainCore) !=
WAIT) {
+               if
(rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore) != WAIT) {
                        rte_spinlock_unlock(&global_flag_stru_p->lock);
                        return;
                }
@@ -796,7 +796,7 @@ static void prompt(__attribute__((unused)) void *arg1)

        /* check state of lcores */
        RTE_LCORE_FOREACH_SLAVE(slave_core_id) {
-       if (lcore_config[slave_core_id].state != WAIT)
+       if (rte_eal_get_lcore_state(slave_core_id) != WAIT)
                return -EBUSY;
        }
        /* start lcore main on core != master_core - ARP response thread */
  

Patch

diff --git a/examples/bond/main.c b/examples/bond/main.c
index ef86194fff4a..48e6755ea294 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -526,8 +526,8 @@  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_lcore_state(global_flag_stru_p->LcoreMainCore) != WAIT) {
 			rte_spinlock_unlock(&global_flag_stru_p->lock);
 			return;
 		}