[dpdk-dev,v4,4/4] app/testpmd: add isolated mode parameter
Checks
Commit Message
In case if --isolated-mode parameter was added to the command line
the rte flow isolate action will be applied on each port before
the device configuring.
Providing this parameter requests isolated mode from the flow API on all
ports at initialization time in order to ensure that all traffic is
received through the configured flow rules only (see flow command).
This automatically discards ports that do not support this mode.
Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
---
app/test-pmd/parameters.c | 3 +++
app/test-pmd/testpmd.c | 14 ++++++++++++++
app/test-pmd/testpmd.h | 1 +
3 files changed, 18 insertions(+)
Comments
> +/*
> * Avoids to check link status when starting/stopping a port.
> */
> uint8_t no_link_check = 0; /* check by default */
> @@ -1422,6 +1427,15 @@ static void eth_event_callback(uint8_t port_id,
> if (port->need_reconfig > 0) {
> port->need_reconfig = 0;
>
> + if (isolated_mode) {
> + int ret = port_flow_isolate(pi, 1);
> + if (ret) {
> + printf("Failed to apply isolated"
> + " mode on port %d\n", pi);
> + return -1;
> + }
> + }
> +
Should it block the app startup if isolated-mode setting fails?
> -----Original Message-----
> From: Wu, Jingjing [mailto:jingjing.wu@intel.com]
> Sent: Tuesday, June 20, 2017 04:27
> To: Vasily Philipov <vasilyf@mellanox.com>; dev@dpdk.org
> Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Nélio Laranjeiro
> <nelio.laranjeiro@6wind.com>
> Subject: RE: [dpdk-dev] [PATCH v4 4/4] app/testpmd: add isolated mode
> parameter
>
>
> > +/*
> > * Avoids to check link status when starting/stopping a port.
> > */
> > uint8_t no_link_check = 0; /* check by default */ @@ -1422,6 +1427,15
> > @@ static void eth_event_callback(uint8_t port_id,
> > if (port->need_reconfig > 0) {
> > port->need_reconfig = 0;
> >
> > + if (isolated_mode) {
> > + int ret = port_flow_isolate(pi, 1);
> > + if (ret) {
> > + printf("Failed to apply isolated"
> > + " mode on port %d\n", pi);
> > + return -1;
> > + }
> > + }
> > +
> Should it block the app startup if isolated-mode setting fails?
if isolated mode cannot be enabled on any port, that port cannot be initialized
and that causes testpmd to quit, at least it won't go against the user's wishes
> -----Original Message-----
> From: Vasily Philipov [mailto:vasilyf@mellanox.com]
> Sent: Wednesday, June 21, 2017 5:44 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org
> Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Nélio Laranjeiro
> <nelio.laranjeiro@6wind.com>
> Subject: RE: [dpdk-dev] [PATCH v4 4/4] app/testpmd: add isolated mode
> parameter
>
>
>
> > -----Original Message-----
> > From: Wu, Jingjing [mailto:jingjing.wu@intel.com]
> > Sent: Tuesday, June 20, 2017 04:27
> > To: Vasily Philipov <vasilyf@mellanox.com>; dev@dpdk.org
> > Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Nélio Laranjeiro
> > <nelio.laranjeiro@6wind.com>
> > Subject: RE: [dpdk-dev] [PATCH v4 4/4] app/testpmd: add isolated mode
> > parameter
> >
> >
> > > +/*
> > > * Avoids to check link status when starting/stopping a port.
> > > */
> > > uint8_t no_link_check = 0; /* check by default */ @@ -1422,6
> > > +1427,15 @@ static void eth_event_callback(uint8_t port_id,
> > > if (port->need_reconfig > 0) {
> > > port->need_reconfig = 0;
> > >
> > > + if (isolated_mode) {
> > > + int ret = port_flow_isolate(pi, 1);
> > > + if (ret) {
> > > + printf("Failed to apply isolated"
> > > + " mode on port %d\n", pi);
> > > + return -1;
> > > + }
> > > + }
> > > +
> > Should it block the app startup if isolated-mode setting fails?
>
> if isolated mode cannot be enabled on any port, that port cannot be initialized
> and that causes testpmd to quit, at least it won't go against the user's wishes
If so, I prefer the isolated_mode to be port's argument but not global one.
How about to add a command to configure the isolate mode?
> -----Original Message-----
> From: Wu, Jingjing [mailto:jingjing.wu@intel.com]
> Sent: Thursday, June 22, 2017 04:13
> To: Vasily Philipov <vasilyf@mellanox.com>; dev@dpdk.org
> Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Nélio Laranjeiro
> <nelio.laranjeiro@6wind.com>
> Subject: RE: [dpdk-dev] [PATCH v4 4/4] app/testpmd: add isolated mode
> parameter
>
>
>
> > -----Original Message-----
> > From: Vasily Philipov [mailto:vasilyf@mellanox.com]
> > Sent: Wednesday, June 21, 2017 5:44 PM
> > To: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org
> > Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Nélio Laranjeiro
> > <nelio.laranjeiro@6wind.com>
> > Subject: RE: [dpdk-dev] [PATCH v4 4/4] app/testpmd: add isolated mode
> > parameter
> >
> >
> >
> > > -----Original Message-----
> > > From: Wu, Jingjing [mailto:jingjing.wu@intel.com]
> > > Sent: Tuesday, June 20, 2017 04:27
> > > To: Vasily Philipov <vasilyf@mellanox.com>; dev@dpdk.org
> > > Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Nélio Laranjeiro
> > > <nelio.laranjeiro@6wind.com>
> > > Subject: RE: [dpdk-dev] [PATCH v4 4/4] app/testpmd: add isolated
> > > mode parameter
> > >
> > >
> > > > +/*
> > > > * Avoids to check link status when starting/stopping a port.
> > > > */
> > > > uint8_t no_link_check = 0; /* check by default */ @@ -1422,6
> > > > +1427,15 @@ static void eth_event_callback(uint8_t port_id,
> > > > if (port->need_reconfig > 0) {
> > > > port->need_reconfig = 0;
> > > >
> > > > + if (isolated_mode) {
> > > > + int ret = port_flow_isolate(pi, 1);
> > > > + if (ret) {
> > > > + printf("Failed to apply isolated"
> > > > + " mode on port %d\n", pi);
> > > > + return -1;
> > > > + }
> > > > + }
> > > > +
> > > Should it block the app startup if isolated-mode setting fails?
> >
> > if isolated mode cannot be enabled on any port, that port cannot be
> > initialized and that causes testpmd to quit, at least it won't go
> > against the user's wishes
>
> If so, I prefer the isolated_mode to be port's argument but not global one.
Could you please provide some example of such argument - I will take it as a reference...
> How about to add a command to configure the isolate mode?
This is already exists - just type "flow isolate {port_id} {boolean}" from testpmd prompt
Please see at:
http://dpdk.org/ml/archives/dev/2017-April/064327.html
http://dpdk.org/dev/patchwork/patch/23741/
22/06/2017 03:13, Wu, Jingjing:
> From: Vasily Philipov [mailto:vasilyf@mellanox.com]
> > From: Wu, Jingjing [mailto:jingjing.wu@intel.com]
> > >
> > > > +/*
> > > > * Avoids to check link status when starting/stopping a port.
> > > > */
> > > > uint8_t no_link_check = 0; /* check by default */ @@ -1422,6
> > > > +1427,15 @@ static void eth_event_callback(uint8_t port_id,
> > > > if (port->need_reconfig > 0) {
> > > > port->need_reconfig = 0;
> > > >
> > > > + if (isolated_mode) {
> > > > + int ret = port_flow_isolate(pi, 1);
> > > > + if (ret) {
> > > > + printf("Failed to apply isolated"
> > > > + " mode on port %d\n", pi);
> > > > + return -1;
> > > > + }
> > > > + }
> > > > +
> > > Should it block the app startup if isolated-mode setting fails?
> >
> > if isolated mode cannot be enabled on any port, that port cannot be initialized
> > and that causes testpmd to quit, at least it won't go against the user's wishes
>
> If so, I prefer the isolated_mode to be port's argument but not global one.
> How about to add a command to configure the isolate mode?
There is already a command to configure isolate mode per-port:
http://dpdk.org/patch/25320
http://dpdk.org/doc/guides/testpmd_app_ug/testpmd_funcs.html#flow-syntax
I think it does not make sense to replicate this per-port command in
command line parameters.
All the other parameters are global:
http://dpdk.org/doc/guides/testpmd_app_ug/run_app.html#testpmd-command-line-options
The idea here is to have a global isolate mode with a general option.
> > > > Should it block the app startup if isolated-mode setting fails?
> > >
> > > if isolated mode cannot be enabled on any port, that port cannot be
> > > initialized and that causes testpmd to quit, at least it won't go
> > > against the user's wishes
> >
> > If so, I prefer the isolated_mode to be port's argument but not global one.
> > How about to add a command to configure the isolate mode?
>
> There is already a command to configure isolate mode per-port:
> http://dpdk.org/patch/25320
> http://dpdk.org/doc/guides/testpmd_app_ug/testpmd_funcs.html#flow
> -syntax
>
> I think it does not make sense to replicate this per-port command in command
> line parameters.
> All the other parameters are global:
> http://dpdk.org/doc/guides/testpmd_app_ug/run_app.html#testpmd-
> command-line-options
> The idea here is to have a global isolate mode with a general option.
OK. Thanks
Then I'm fine with it.
@@ -623,6 +623,7 @@
{ "tx-queue-stats-mapping", 1, 0, 0 },
{ "rx-queue-stats-mapping", 1, 0, 0 },
{ "no-flush-rx", 0, 0, 0 },
+ { "isolated-mode", 0, 0, 0 },
{ "txpkts", 1, 0, 0 },
{ "disable-link-check", 0, 0, 0 },
{ "no-lsc-interrupt", 0, 0, 0 },
@@ -1081,6 +1082,8 @@
lsc_interrupt = 0;
if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt"))
rmv_interrupt = 0;
+ if (!strcmp(lgopts[opt_idx].name, "isolated-mode"))
+ isolated_mode = 1;
if (!strcmp(lgopts[opt_idx].name, "print-event"))
if (parse_event_printing_config(optarg, 1)) {
rte_exit(EXIT_FAILURE,
@@ -267,6 +267,11 @@ struct fwd_engine * fwd_engines[] = {
uint8_t no_flush_rx = 0; /* flush by default */
/*
+ * Flow API isolated mode.
+ */
+uint8_t isolated_mode;
+
+/*
* Avoids to check link status when starting/stopping a port.
*/
uint8_t no_link_check = 0; /* check by default */
@@ -1422,6 +1427,15 @@ static void eth_event_callback(uint8_t port_id,
if (port->need_reconfig > 0) {
port->need_reconfig = 0;
+ if (isolated_mode) {
+ int ret = port_flow_isolate(pi, 1);
+ if (ret) {
+ printf("Failed to apply isolated"
+ " mode on port %d\n", pi);
+ return -1;
+ }
+ }
+
printf("Configuring Port %d (socket %u)\n", pi,
port->socket_id);
/* configure port */
@@ -303,6 +303,7 @@ struct queue_stats_mappings {
extern uint8_t numa_support; /**< set by "--numa" parameter */
extern uint16_t port_topology; /**< set by "--port-topology" parameter */
extern uint8_t no_flush_rx; /**<set by "--no-flush-rx" parameter */
+extern uint8_t isolated_mode; /**<set by "--isolated-mode */
extern uint8_t mp_anon; /**< set by "--mp-anon" parameter */
extern uint8_t no_link_check; /**<set by "--disable-link-check" parameter */
extern volatile int test_done; /* stop packet forwarding when set to 1. */