Message ID | 1462462795-18767-5-git-send-email-bernard.iremonger@intel.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Thomas Monjalon |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 372F25A55; Thu, 5 May 2016 17:40:44 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 9089F5A38 for <dev@dpdk.org>; Thu, 5 May 2016 17:40:42 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 05 May 2016 08:40:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,582,1455004800"; d="scan'208";a="946955118" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 05 May 2016 08:40:31 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u45FeQse022305; Thu, 5 May 2016 16:40:26 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u45FeQF2019282; Thu, 5 May 2016 16:40:26 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id u45FeQ1x019278; Thu, 5 May 2016 16:40:26 +0100 From: Bernard Iremonger <bernard.iremonger@intel.com> To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com, Bernard Iremonger <bernard.iremonger@intel.com> Date: Thu, 5 May 2016 16:39:51 +0100 Message-Id: <1462462795-18767-5-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1462462795-18767-1-git-send-email-bernard.iremonger@intel.com> References: <1461156779-24737-1-git-send-email-bernard.iremonger@intel.com> <1462462795-18767-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v2 4/8] app/testpmd: reconfigure forwarding after changing portlist X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Iremonger, Bernard
May 5, 2016, 3:39 p.m. UTC
Set nb_fwd_ports to zero on quit.
Check portlist has been set before displaying forwarding configuration.
Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM")
Fixes: af75078fece3 ("first public release")
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/config.c | 8 ++++++--
app/test-pmd/testpmd.c | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
Comments
Hi Bernard, > -----Original Message----- > From: Iremonger, Bernard > Sent: Thursday, May 05, 2016 4:40 PM > To: dev@dpdk.org > Cc: De Lara Guarch, Pablo; Iremonger, Bernard > Subject: [PATCH v2 4/8] app/testpmd: reconfigure forwarding after changing > portlist > > Set nb_fwd_ports to zero on quit. > Check portlist has been set before displaying forwarding configuration. > > Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM") > Fixes: af75078fece3 ("first public release") This patch is not fixing any issue, right? You are trying to improve the behaviour when changing portlist. Therefore, you don't need to use Fixes tag. > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com> > --- > app/test-pmd/config.c | 8 ++++++-- > app/test-pmd/testpmd.c | 1 + > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index f434999..10ac768 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -1424,8 +1424,10 @@ pkt_fwd_config_display(struct fwd_config *cfg) > void > fwd_config_display(void) > { > - fwd_config_setup(); > - pkt_fwd_config_display(&cur_fwd_config); > + if (cur_fwd_config.nb_fwd_ports) > + pkt_fwd_config_display(&cur_fwd_config); > + else > + printf("Please set portlist first\n"); > } The problem of doing this is that if user starts testpmd, it is not possible to show the configuration of the ports directly, since fwd_config_setup() has not being called (because set_fwd_ports_list() has not being called), so it looks like portlist must be set, but if user starts forwarding directly, then it is not necessary. What I mean, is that by default, portlist should be all the ports. Maybe we need to call fwd_config_setup after all the testpmd initialization. > > int > @@ -1529,6 +1531,8 @@ set_fwd_ports_list(unsigned int *portlist, unsigned > int nb_pt) > (unsigned int) nb_fwd_ports, nb_pt); > nb_fwd_ports = (portid_t) nb_pt; > } > + > + fwd_config_setup(); > } I understand what you are doing here, but there is a problem. If you use --portmask parameter, this function gets called when the arguments are parsed, but at that point, the ports are not configured yet, and you get the following: Fail: nb_rxq(1) is greater than max_rx_queues(0) Program received signal SIGSEGV, Segmentation fault. 0x00000000004835c9 in setup_fwd_config_of_each_lcore (cfg=0xca4160 <cur_fwd_config>) at /tmp/dpdk-latest/app/test-pmd/config.c:1073 Anyway, I like the idea of moving fwd_config_setup out of fwd_config_display(). The problem is that there are other functions that should call this, such as set_fwd_lcores_list (so, with this patch, if coremask is changed and then we call "show config fwd", we will not see any change). Basically, all that affects the forwarding configuration should reconfigure it. That's why I think it was decided to reconfigure the configuration when starting the forwarding or when showing the configuration. So, we have two options: 1 - We add fwd_config_setup() in all the functions that are changing the configurations. 2 - We leave it as it was, especially with this patch, it makes more sense: http://dpdk.org/dev/patchwork/patch/13132/ > > void > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index 11b4cf7..2c58075 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -1560,6 +1560,7 @@ pmd_test_exit(void) > > if (ports != NULL) { > no_link_check = 1; > + nb_fwd_ports = 0; Is this really necessary? I have removed it and I can quit testpmd with no problem. > FOREACH_PORT(pt_id, ports) { > printf("\nShutting down port %d...\n", pt_id); > fflush(stdout); > -- > 2.6.3
Hi Pablo, <snip> > > Subject: [PATCH v2 4/8] app/testpmd: reconfigure forwarding after > > changing portlist > > > > Set nb_fwd_ports to zero on quit. > > Check portlist has been set before displaying forwarding configuration. > > > > Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM") > > Fixes: af75078fece3 ("first public release") > > This patch is not fixing any issue, right? You are trying to improve the > behaviour when changing portlist. > Therefore, you don't need to use Fixes tag. Ok, fixes tag is not necessary here. > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com> > > --- > > app/test-pmd/config.c | 8 ++++++-- > > app/test-pmd/testpmd.c | 1 + > > 2 files changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > > f434999..10ac768 100644 > > --- a/app/test-pmd/config.c > > +++ b/app/test-pmd/config.c > > @@ -1424,8 +1424,10 @@ pkt_fwd_config_display(struct fwd_config *cfg) > > void > > fwd_config_display(void) > > { > > - fwd_config_setup(); > > - pkt_fwd_config_display(&cur_fwd_config); > > + if (cur_fwd_config.nb_fwd_ports) > > + pkt_fwd_config_display(&cur_fwd_config); > > + else > > + printf("Please set portlist first\n"); > > } > > The problem of doing this is that if user starts testpmd, it is not possible to > show the configuration of the ports directly, since fwd_config_setup() has > not being called (because set_fwd_ports_list() has not being called), so it > looks like portlist must be set, but if user starts forwarding directly, then it is > not necessary. > What I mean, is that by default, portlist should be all the ports. > Maybe we need to call fwd_config_setup after all the testpmd initialization. > > > > > int > > @@ -1529,6 +1531,8 @@ set_fwd_ports_list(unsigned int *portlist, > > unsigned int nb_pt) > > (unsigned int) nb_fwd_ports, nb_pt); > > nb_fwd_ports = (portid_t) nb_pt; > > } > > + > > + fwd_config_setup(); > > } > > I understand what you are doing here, but there is a problem. If you use -- > portmask parameter, this function gets called when the arguments are > parsed, but at that point, the ports are not configured yet, and you get the > following: > > Fail: nb_rxq(1) is greater than max_rx_queues(0) Program received signal > SIGSEGV, Segmentation fault. > 0x00000000004835c9 in setup_fwd_config_of_each_lcore (cfg=0xca4160 > <cur_fwd_config>) at /tmp/dpdk-latest/app/test-pmd/config.c:1073 > > Anyway, I like the idea of moving fwd_config_setup out of > fwd_config_display(). > The problem is that there are other functions that should call this, such as > set_fwd_lcores_list (so, with this patch, if coremask is changed and then we > call "show config fwd", we will not see any change). > Basically, all that affects the forwarding configuration should reconfigure it. > That's why I think it was decided to reconfigure the configuration when > starting the forwarding or when showing the configuration. > > So, we have two options: > 1 - We add fwd_config_setup() in all the functions that are changing the > configurations. > 2 - We leave it as it was, especially with this patch, it makes more sense: > http://dpdk.org/dev/patchwork/patch/13132/ Option 2 looks like the best choice here, to drop this patch in favour of patch http://dpdk.org/dev/patchwork/patch/13132/ which is already acked. > > void > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > > 11b4cf7..2c58075 100644 > > --- a/app/test-pmd/testpmd.c > > +++ b/app/test-pmd/testpmd.c > > @@ -1560,6 +1560,7 @@ pmd_test_exit(void) > > > > if (ports != NULL) { > > no_link_check = 1; > > + nb_fwd_ports = 0; > > Is this really necessary? I have removed it and I can quit testpmd with no > problem. Ok, was just clearing this on exit as it had been set previously. > > > FOREACH_PORT(pt_id, ports) { > > printf("\nShutting down port %d...\n", pt_id); > > fflush(stdout); > > -- > > 2.6.3
Hi Pablo, <snip> > > > Subject: [PATCH v2 4/8] app/testpmd: reconfigure forwarding after > > > changing portlist > > > > > > Set nb_fwd_ports to zero on quit. > > > Check portlist has been set before displaying forwarding configuration. > > > > > > Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM") > > > Fixes: af75078fece3 ("first public release") > > > > This patch is not fixing any issue, right? You are trying to improve > > the behaviour when changing portlist. > > Therefore, you don't need to use Fixes tag. > > Ok, fixes tag is not necessary here. > > > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com> > > > --- > > > app/test-pmd/config.c | 8 ++++++-- app/test-pmd/testpmd.c | 1 + > > > 2 files changed, 7 insertions(+), 2 deletions(-) > > > > > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > > > f434999..10ac768 100644 > > > --- a/app/test-pmd/config.c > > > +++ b/app/test-pmd/config.c > > > @@ -1424,8 +1424,10 @@ pkt_fwd_config_display(struct fwd_config > > > *cfg) void > > > fwd_config_display(void) > > > { > > > - fwd_config_setup(); > > > - pkt_fwd_config_display(&cur_fwd_config); > > > + if (cur_fwd_config.nb_fwd_ports) > > > + pkt_fwd_config_display(&cur_fwd_config); > > > + else > > > + printf("Please set portlist first\n"); > > > } > > > > The problem of doing this is that if user starts testpmd, it is not > > possible to show the configuration of the ports directly, since > > fwd_config_setup() has not being called (because set_fwd_ports_list() > > has not being called), so it looks like portlist must be set, but if > > user starts forwarding directly, then it is not necessary. > > What I mean, is that by default, portlist should be all the ports. > > Maybe we need to call fwd_config_setup after all the testpmd > initialization. I will investigate this. > > > int > > > @@ -1529,6 +1531,8 @@ set_fwd_ports_list(unsigned int *portlist, > > > unsigned int nb_pt) > > > (unsigned int) nb_fwd_ports, nb_pt); > > > nb_fwd_ports = (portid_t) nb_pt; > > > } > > > + > > > + fwd_config_setup(); > > > } > > > > I understand what you are doing here, but there is a problem. If you > > use -- portmask parameter, this function gets called when the > > arguments are parsed, but at that point, the ports are not configured > > yet, and you get the > > following: > > > > Fail: nb_rxq(1) is greater than max_rx_queues(0) Program received > > signal SIGSEGV, Segmentation fault. > > 0x00000000004835c9 in setup_fwd_config_of_each_lcore (cfg=0xca4160 > > <cur_fwd_config>) at /tmp/dpdk-latest/app/test-pmd/config.c:1073 > > > > Anyway, I like the idea of moving fwd_config_setup out of > > fwd_config_display(). fwd_config_setup() should be moved out of fwd_config_display() . The display should not setup the config again. > > The problem is that there are other functions that should call this, > > such as set_fwd_lcores_list (so, with this patch, if coremask is > > changed and then we call "show config fwd", we will not see any change). > > Basically, all that affects the forwarding configuration should reconfigure it. > > That's why I think it was decided to reconfigure the configuration > > when starting the forwarding or when showing the configuration. > > > > So, we have two options: > > 1 - We add fwd_config_setup() in all the functions that are changing > > the configurations. This is probably the best way to go. > > 2 - We leave it as it was, especially with this patch, it makes more sense: > > http://dpdk.org/dev/patchwork/patch/13132/ > > Option 2 looks like the best choice here, to drop this patch in favour of patch > http://dpdk.org/dev/patchwork/patch/13132/ > which is already acked. I have changed my mind about option 2, this is doing a rename to clarify what is happening. fwd_config_display() is renamed to fwd_config_setup_display(), it does not separate the setup from the display. > > > void > > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > > > 11b4cf7..2c58075 100644 > > > --- a/app/test-pmd/testpmd.c > > > +++ b/app/test-pmd/testpmd.c > > > @@ -1560,6 +1560,7 @@ pmd_test_exit(void) > > > > > > if (ports != NULL) { > > > no_link_check = 1; > > > + nb_fwd_ports = 0; > > > > Is this really necessary? I have removed it and I can quit testpmd > > with no problem. > > Ok, was just clearing this on exit as it had been set previously. > > > > > > FOREACH_PORT(pt_id, ports) { > > > printf("\nShutting down port %d...\n", pt_id); > > > fflush(stdout); > > > -- > > > 2.6.3
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index f434999..10ac768 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1424,8 +1424,10 @@ pkt_fwd_config_display(struct fwd_config *cfg) void fwd_config_display(void) { - fwd_config_setup(); - pkt_fwd_config_display(&cur_fwd_config); + if (cur_fwd_config.nb_fwd_ports) + pkt_fwd_config_display(&cur_fwd_config); + else + printf("Please set portlist first\n"); } int @@ -1529,6 +1531,8 @@ set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt) (unsigned int) nb_fwd_ports, nb_pt); nb_fwd_ports = (portid_t) nb_pt; } + + fwd_config_setup(); } void diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 11b4cf7..2c58075 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1560,6 +1560,7 @@ pmd_test_exit(void) if (ports != NULL) { no_link_check = 1; + nb_fwd_ports = 0; FOREACH_PORT(pt_id, ports) { printf("\nShutting down port %d...\n", pt_id); fflush(stdout);