From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-f65.google.com (mail-ua1-f65.google.com [209.85.222.65]) by dpdk.org (Postfix) with ESMTP id 885341B3A7 for ; Wed, 3 Apr 2019 14:00:10 +0200 (CEST) Received: by mail-ua1-f65.google.com with SMTP id l22so1643657uao.8 for ; Wed, 03 Apr 2019 05:00:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s+nDpjl2ER/dVH5l9OI4qamAi8qnOI5rwzDVfoj1eCw=; b=abHKXfP1oRHWhMmnjCNgX8JZW81fxEVGmIGkbnF7AW6rzZO64T6wN/7mMCA3PgjhyJ T8RAqljjwNT52XtWsuOx+1X4Iip2KMIS/bicXKgQq2LnMQaKdewzFuZC02FfNurdmOu0 80+Bp8Aw6sSnvnz7qHxvFuzHXSQkHAgK17mSud6S/HLTLAEoJU+DKP2nHaaID4+cwjTk UjiOO5d+ndlTb6DpfQrgNbeX28PoekkpAjxNtt5/IL96IDbj0G/9Ng5CBiZdrJOxhIHZ wBMf08rFOP3WwTweMxWfgZEeg7BYHj6InF/fbRuo79Xo7TVDPswfLY6fcc6SsmMuw1Ea aADA== X-Gm-Message-State: APjAAAXbUPyQa3rfxBd9WEygInGNMUA0FCHnH2/kKmW5ZEQ8gAGPyOdQ GKLOnoKbkQCUUU2349j/XfoLAuV5o0WwZYQ/SelwwRJSNlI= X-Google-Smtp-Source: APXvYqxGTqwDYOG3IQe2VkG3oqs14CQZmOa20qB1vny5sXeQKCu2t77mn5YBHXOcRThv8pVnmD9Tdq4h0+R70LF6ao0= X-Received: by 2002:ab0:2a5a:: with SMTP id p26mr44127834uar.105.1554292809882; Wed, 03 Apr 2019 05:00:09 -0700 (PDT) MIME-Version: 1.0 References: <20190402155722.21400-1-stephen@networkplumber.org> <20190402205335.13745-1-stephen@networkplumber.org> In-Reply-To: <20190402205335.13745-1-stephen@networkplumber.org> From: David Marchand Date: Wed, 3 Apr 2019 13:59:58 +0200 Message-ID: To: Stephen Hemminger Cc: dev Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v3] eal: rename state values in rte_lcore_state X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Apr 2019 12:00:10 -0000 On Tue, Apr 2, 2019 at 10:54 PM Stephen Hemminger < stephen@networkplumber.org> wrote: > C language does not really treat enum's as first class symbols. > The values in an enum live in a global namespace. That means if > DPDK defines "RUNNING" it can't be used by another enum in an > application using DPDK. > > To solve this add a prefix "RTE_LCORE_" to the enum values, and > make them grammatically consistent. > > Also, simplify the inline thread_is_running() which is copied > in softnic and ip_pipeline. > > Signed-off-by: Stephen Hemminger > --- > v3 - fix BSD and bond driver usage of state > > > > diff --git a/examples/bond/main.c b/examples/bond/main.c > index ef86194fff4a..12123a4b16d8 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 (lcore_config[global_flag_stru_p->LcoreMainCore].state > != WAIT) { > + if (lcore_config[global_flag_stru_p->LcoreMainCore].state > != RTE_LCORE_WAIT) { > rte_spinlock_unlock(&global_flag_stru_p->lock); > return; > } > @@ -796,7 +796,7 @@ main(int argc, char *argv[]) > > /* check state of lcores */ > RTE_LCORE_FOREACH_SLAVE(slave_core_id) { > - if (lcore_config[slave_core_id].state != WAIT) > + if (lcore_config[slave_core_id].state != RTE_LCORE_WAIT) > return -EBUSY; > } > /* start lcore main on core != master_core - ARP response thread */ > diff --git a/lib/librte_eal/freebsd/eal/eal.c > b/lib/librte_eal/freebsd/eal/eal.c > index 790c6afa7050..aae4243486bd 100644 > --- a/lib/librte_eal/freebsd/eal/eal.c > +++ b/lib/librte_eal/freebsd/eal/eal.c > @@ -784,7 +784,7 @@ rte_eal_init(int argc, char **argv) > if (pipe(lcore_config[i].pipe_slave2master) < 0) > rte_panic("Cannot create pipe\n"); > > - lcore_config[i].state = WAIT; > + lcore_config[i].state = RTE_LCORE_WAIT; > > /* create a thread for each lcore */ > ret = pthread_create(&lcore_config[i].thread_id, NULL, > s/RTE_LCORE_WAIT/RTE_LCORE_WAITING/g -- David Marchand From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 4AEEEA0679 for ; Wed, 3 Apr 2019 14:00:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1474E1B3AC; Wed, 3 Apr 2019 14:00:12 +0200 (CEST) Received: from mail-ua1-f65.google.com (mail-ua1-f65.google.com [209.85.222.65]) by dpdk.org (Postfix) with ESMTP id 885341B3A7 for ; Wed, 3 Apr 2019 14:00:10 +0200 (CEST) Received: by mail-ua1-f65.google.com with SMTP id l22so1643657uao.8 for ; Wed, 03 Apr 2019 05:00:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s+nDpjl2ER/dVH5l9OI4qamAi8qnOI5rwzDVfoj1eCw=; b=abHKXfP1oRHWhMmnjCNgX8JZW81fxEVGmIGkbnF7AW6rzZO64T6wN/7mMCA3PgjhyJ T8RAqljjwNT52XtWsuOx+1X4Iip2KMIS/bicXKgQq2LnMQaKdewzFuZC02FfNurdmOu0 80+Bp8Aw6sSnvnz7qHxvFuzHXSQkHAgK17mSud6S/HLTLAEoJU+DKP2nHaaID4+cwjTk UjiOO5d+ndlTb6DpfQrgNbeX28PoekkpAjxNtt5/IL96IDbj0G/9Ng5CBiZdrJOxhIHZ wBMf08rFOP3WwTweMxWfgZEeg7BYHj6InF/fbRuo79Xo7TVDPswfLY6fcc6SsmMuw1Ea aADA== X-Gm-Message-State: APjAAAXbUPyQa3rfxBd9WEygInGNMUA0FCHnH2/kKmW5ZEQ8gAGPyOdQ GKLOnoKbkQCUUU2349j/XfoLAuV5o0WwZYQ/SelwwRJSNlI= X-Google-Smtp-Source: APXvYqxGTqwDYOG3IQe2VkG3oqs14CQZmOa20qB1vny5sXeQKCu2t77mn5YBHXOcRThv8pVnmD9Tdq4h0+R70LF6ao0= X-Received: by 2002:ab0:2a5a:: with SMTP id p26mr44127834uar.105.1554292809882; Wed, 03 Apr 2019 05:00:09 -0700 (PDT) MIME-Version: 1.0 References: <20190402155722.21400-1-stephen@networkplumber.org> <20190402205335.13745-1-stephen@networkplumber.org> In-Reply-To: <20190402205335.13745-1-stephen@networkplumber.org> From: David Marchand Date: Wed, 3 Apr 2019 13:59:58 +0200 Message-ID: To: Stephen Hemminger Cc: dev Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v3] eal: rename state values in rte_lcore_state X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190403115958.mzffaF-L4nWGjVXzsm3_djABJg78XDeGkhRpgVEXaHo@z> On Tue, Apr 2, 2019 at 10:54 PM Stephen Hemminger < stephen@networkplumber.org> wrote: > C language does not really treat enum's as first class symbols. > The values in an enum live in a global namespace. That means if > DPDK defines "RUNNING" it can't be used by another enum in an > application using DPDK. > > To solve this add a prefix "RTE_LCORE_" to the enum values, and > make them grammatically consistent. > > Also, simplify the inline thread_is_running() which is copied > in softnic and ip_pipeline. > > Signed-off-by: Stephen Hemminger > --- > v3 - fix BSD and bond driver usage of state > > > > diff --git a/examples/bond/main.c b/examples/bond/main.c > index ef86194fff4a..12123a4b16d8 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 (lcore_config[global_flag_stru_p->LcoreMainCore].state > != WAIT) { > + if (lcore_config[global_flag_stru_p->LcoreMainCore].state > != RTE_LCORE_WAIT) { > rte_spinlock_unlock(&global_flag_stru_p->lock); > return; > } > @@ -796,7 +796,7 @@ main(int argc, char *argv[]) > > /* check state of lcores */ > RTE_LCORE_FOREACH_SLAVE(slave_core_id) { > - if (lcore_config[slave_core_id].state != WAIT) > + if (lcore_config[slave_core_id].state != RTE_LCORE_WAIT) > return -EBUSY; > } > /* start lcore main on core != master_core - ARP response thread */ > diff --git a/lib/librte_eal/freebsd/eal/eal.c > b/lib/librte_eal/freebsd/eal/eal.c > index 790c6afa7050..aae4243486bd 100644 > --- a/lib/librte_eal/freebsd/eal/eal.c > +++ b/lib/librte_eal/freebsd/eal/eal.c > @@ -784,7 +784,7 @@ rte_eal_init(int argc, char **argv) > if (pipe(lcore_config[i].pipe_slave2master) < 0) > rte_panic("Cannot create pipe\n"); > > - lcore_config[i].state = WAIT; > + lcore_config[i].state = RTE_LCORE_WAIT; > > /* create a thread for each lcore */ > ret = pthread_create(&lcore_config[i].thread_id, NULL, > s/RTE_LCORE_WAIT/RTE_LCORE_WAITING/g -- David Marchand