DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
@ 2020-08-11  6:14 Gregory Etelson
  2020-11-24 14:42 ` Ajit Khaparde
  2020-11-26 16:43 ` [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd flows left before " Gregory Etelson
  0 siblings, 2 replies; 13+ messages in thread
From: Gregory Etelson @ 2020-08-11  6:14 UTC (permalink / raw)
  To: dev
  Cc: getelson, matan, rasland, stable, Ori Kam, Wenzhuo Lu,
	Beilei Xing, Bernard Iremonger

According to current RTE API, port flow rules must not be kept
after port stop.

Testpmd did not flush port flow rules after `port stop' command was
called. As the result, after the port was restarted, it showed bogus
flow rules.

Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")

Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/testpmd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 7842c3b781..4ba5c41c6e 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2627,6 +2627,9 @@ stop_port(portid_t pid)
 						RTE_PORT_HANDLING) == 0)
 			continue;
 
+		if (port->flow_list)
+			port_flow_flush(pi);
+
 		rte_eth_dev_stop(pi);
 
 		if (rte_atomic16_cmpset(&(port->port_status),
-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
  2020-08-11  6:14 [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop Gregory Etelson
@ 2020-11-24 14:42 ` Ajit Khaparde
  2020-11-26 15:41   ` Thomas Monjalon
  2020-11-26 16:43 ` [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd flows left before " Gregory Etelson
  1 sibling, 1 reply; 13+ messages in thread
From: Ajit Khaparde @ 2020-11-24 14:42 UTC (permalink / raw)
  To: Gregory Etelson
  Cc: dpdk-dev, Matan Azrad, Raslan Darawsheh, dpdk stable, Ori Kam,
	Wenzhuo Lu, Beilei Xing, Bernard Iremonger

On Mon, Aug 10, 2020 at 11:15 PM Gregory Etelson <getelson@nvidia.com> wrote:
>
> According to current RTE API, port flow rules must not be kept
> after port stop.
>
> Testpmd did not flush port flow rules after `port stop' command was
> called. As the result, after the port was restarted, it showed bogus
> flow rules.
>
> Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
>
> Cc: stable@dpdk.org
>
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Ori Kam <orika@nvidia.com>

Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

> ---
>  app/test-pmd/testpmd.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 7842c3b781..4ba5c41c6e 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2627,6 +2627,9 @@ stop_port(portid_t pid)
>                                                 RTE_PORT_HANDLING) == 0)
>                         continue;
>
> +               if (port->flow_list)
> +                       port_flow_flush(pi);
> +
>                 rte_eth_dev_stop(pi);
>
>                 if (rte_atomic16_cmpset(&(port->port_status),
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
  2020-11-24 14:42 ` Ajit Khaparde
@ 2020-11-26 15:41   ` Thomas Monjalon
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Monjalon @ 2020-11-26 15:41 UTC (permalink / raw)
  To: Gregory Etelson
  Cc: dev, Matan Azrad, Raslan Darawsheh, dpdk stable, Ori Kam,
	Wenzhuo Lu, Beilei Xing, Bernard Iremonger, Ajit Khaparde

24/11/2020 15:42, Ajit Khaparde:
> On Mon, Aug 10, 2020 at 11:15 PM Gregory Etelson <getelson@nvidia.com> wrote:
> >
> > According to current RTE API, port flow rules must not be kept
> > after port stop.
> >
> > Testpmd did not flush port flow rules after `port stop' command was
> > called. As the result, after the port was restarted, it showed bogus
> > flow rules.
> >
> > Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
> >
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> > Acked-by: Ori Kam <orika@nvidia.com>
> 
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

The rte_flow doc is now updated to make clear that flow rules
are not kept after port stop.
This testpmd patch should make clear that the need of flushing
is only for testpmd objects.
The change is postponed to DPDK 21.02.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd flows left before port stop.
  2020-08-11  6:14 [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop Gregory Etelson
  2020-11-24 14:42 ` Ajit Khaparde
@ 2020-11-26 16:43 ` Gregory Etelson
  2020-11-27 16:01   ` Andrew Rybchenko
  2021-01-06 18:07   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  1 sibling, 2 replies; 13+ messages in thread
From: Gregory Etelson @ 2020-11-26 16:43 UTC (permalink / raw)
  To: dev
  Cc: getelson, matan, rasland, thomas, ajit.khaparde, stable,
	Wenzhuo Lu, Beilei Xing, Bernard Iremonger

According to RTE flow user guide, PMD will not keep flow rules after
port stop. Application resources that refer to flow rules become
obsolete after port stop and must not be used.
Testpmd maintains linked list of active flows for each port. Entries in
that list are allocated dynamically and must be explicitly released to
prevent memory leak.
The patch releases testpmd port flow_list that holds remaining flows
before port is stopped.

Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 app/test-pmd/testpmd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 33fc0fddf5..0bb192b2f5 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2806,6 +2806,9 @@ stop_port(portid_t pid)
 			}
 		}
 
+		if (port->flow_list)
+			port_flow_flush(pi);
+
 		if (rte_eth_dev_stop(pi) != 0)
 			RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port %u\n",
 				pi);
-- 
2.29.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd flows left before port stop.
  2020-11-26 16:43 ` [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd flows left before " Gregory Etelson
@ 2020-11-27 16:01   ` Andrew Rybchenko
  2020-11-29  6:59     ` Gregory Etelson
  2021-01-06 18:07   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  1 sibling, 1 reply; 13+ messages in thread
From: Andrew Rybchenko @ 2020-11-27 16:01 UTC (permalink / raw)
  To: Gregory Etelson, dev
  Cc: matan, rasland, thomas, ajit.khaparde, stable, Wenzhuo Lu,
	Beilei Xing, Bernard Iremonger

On 11/26/20 7:43 PM, Gregory Etelson wrote:
> According to RTE flow user guide, PMD will not keep flow rules after
> port stop. Application resources that refer to flow rules become
> obsolete after port stop and must not be used.
> Testpmd maintains linked list of active flows for each port. Entries in
> that list are allocated dynamically and must be explicitly released to
> prevent memory leak.
> The patch releases testpmd port flow_list that holds remaining flows
> before port is stopped.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> ---
>  app/test-pmd/testpmd.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 33fc0fddf5..0bb192b2f5 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2806,6 +2806,9 @@ stop_port(portid_t pid)
>  			}
>  		}
>  
> +		if (port->flow_list)
> +			port_flow_flush(pi);
> +
>  		if (rte_eth_dev_stop(pi) != 0)
>  			RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port %u\n",
>  				pi);
> 

port_flow_flush() does rte_flow_flush() which is not strictly
required. Description sounds like we should cleanup testpmd
lists only.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd flows left before port stop.
  2020-11-27 16:01   ` Andrew Rybchenko
@ 2020-11-29  6:59     ` Gregory Etelson
  0 siblings, 0 replies; 13+ messages in thread
From: Gregory Etelson @ 2020-11-29  6:59 UTC (permalink / raw)
  To: Andrew Rybchenko, dev
  Cc: Matan Azrad, Raslan Darawsheh, NBU-Contact-Thomas Monjalon,
	ajit.khaparde, stable, Wenzhuo Lu, Beilei Xing,
	Bernard Iremonger

Hello Andrew,

> On 11/26/20 7:43 PM, Gregory Etelson wrote:
> > According to RTE flow user guide, PMD will not keep flow rules after
> > port stop. Application resources that refer to flow rules become
> > obsolete after port stop and must not be used.
> > Testpmd maintains linked list of active flows for each port. Entries
> > in that list are allocated dynamically and must be explicitly released
> > to prevent memory leak.
> > The patch releases testpmd port flow_list that holds remaining flows
> > before port is stopped.
> >
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> > ---
> >  app/test-pmd/testpmd.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > 33fc0fddf5..0bb192b2f5 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -2806,6 +2806,9 @@ stop_port(portid_t pid)
> >                       }
> >               }
> >
> > +             if (port->flow_list)
> > +                     port_flow_flush(pi);
> > +
> >               if (rte_eth_dev_stop(pi) != 0)
> >                       RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for
> port %u\n",
> >                               pi);
> >
> 
> port_flow_flush() does rte_flow_flush() which is not strictly required.
> Description sounds like we should cleanup testpmd lists only.

You are right, call to rte_flow_flush() is not required, if testpmd calls port_flow_flush()
as part of port stop sequence, because PMD will remove flows in that scenario.
port_flow_flush() has a general implementation. It destroys all flows without
port state consideration - current or future. In this form, port_flow_flush() can be
called from any testpmd scenario that needs flows destruction.

Regards,
Gregory

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] app/testpmd: fix testpmd flows left before port stop.
  2020-11-26 16:43 ` [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd flows left before " Gregory Etelson
  2020-11-27 16:01   ` Andrew Rybchenko
@ 2021-01-06 18:07   ` Ferruh Yigit
  1 sibling, 0 replies; 13+ messages in thread
From: Ferruh Yigit @ 2021-01-06 18:07 UTC (permalink / raw)
  To: Gregory Etelson, dev
  Cc: matan, rasland, thomas, ajit.khaparde, stable, Wenzhuo Lu,
	Beilei Xing, Bernard Iremonger

On 11/26/2020 4:43 PM, Gregory Etelson wrote:
> According to RTE flow user guide, PMD will not keep flow rules after
> port stop. Application resources that refer to flow rules become
> obsolete after port stop and must not be used.
> Testpmd maintains linked list of active flows for each port. Entries in
> that list are allocated dynamically and must be explicitly released to
> prevent memory leak.
> The patch releases testpmd port flow_list that holds remaining flows
> before port is stopped.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>

Carrying acks from previous version:
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Ori Kam <orika@nvidia.com>

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
  2020-09-13 14:00         ` Thomas Monjalon
@ 2020-11-17 19:08           ` Gregory Etelson
  0 siblings, 0 replies; 13+ messages in thread
From: Gregory Etelson @ 2020-11-17 19:08 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon, Ori Kam
  Cc: Ferruh Yigit, Wenzhuo Lu, Beilei Xing, Bernard Iremonger, dev,
	Matan Azrad, Raslan Darawsheh, Jeff Guo, Qi Zhang

Hello,

> 13/09/2020 14:12, Ori Kam:
> > Hi Ferruh,
> > Can we proceed with this patch?
> 
> Below, you said "first thing to do it update the rte_flow doc".
> So I am expecting a patch on the doc to start this discussion.
> This testpmd patch is on hold in my understanding.
> 

Documentation patch "doc: flow rule removal on port stop"
Was sent to the list on September 16. The patch URL is
https://inbox.dpdk.org/dev/20200916111854.1949-1-getelson@nvidia.com/#r


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
  2020-09-13 12:12       ` Ori Kam
@ 2020-09-13 14:00         ` Thomas Monjalon
  2020-11-17 19:08           ` Gregory Etelson
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Monjalon @ 2020-09-13 14:00 UTC (permalink / raw)
  To: Gregory Etelson, Ori Kam
  Cc: Ferruh Yigit, Wenzhuo Lu, Beilei Xing, Bernard Iremonger, dev,
	Matan Azrad, Raslan Darawsheh, Jeff Guo, Qi Zhang

13/09/2020 14:12, Ori Kam:
> Hi Ferruh,
> Can we proceed with this patch?

Below, you said "first thing to do it update the rte_flow doc".
So I am expecting a patch on the doc to start this discussion.
This testpmd patch is on hold in my understanding.


> From: Ori Kam
> > From: Ferruh Yigit <ferruh.yigit@intel.com>
> > > On 8/20/2020 9:40 AM, Gregory Etelson wrote:
> > > > Hello,
> > > >
> > > > Is this patch scheduled for merge with dpdk.org ?
> > > > Please update me.
> > > >
> > > >> From: Gregory Etelson <getelson@mellanox.com>
> > > >>
> > > >> According to current RTE API, port flow rules must not be kept after port
> > > >> stop.
> > >
> > > Hi Gregory, Ori,
> > >
> > > Can you please point where this is documented?
> > >
> > From: rte_ethdev.h
> > "Please note that some configuration is not stored between calls to
> >  rte_eth_dev_stop()/rte_eth_dev_start(). The following configuration will
> >  be retained:
> > 
> >      - MTU
> >      - flow control settings
> >      - receive mode configuration (promiscuous mode, all-multicast mode,
> >        hardware checksum mode, RSS/VMDQ settings etc.)
> >      - VLAN filtering configuration
> >      - default MAC address
> >      - MAC addresses supplied to MAC address array
> >      - flow director filtering mode (but not filtering rules)
> >      - NIC queue statistics mappings"
> > 
> > From my understanding this means that flows should not be stored on device
> > stop.
> > 
> > 
> > > >>
> > > >> Testpmd did not flush port flow rules after `port stop' command was
> > called.
> > > >> As the result, after the port was restarted, it showed bogus flow rules.
> > >
> > > There are two issues,
> > >
> > > 1) According what I see in the rte_flow documentation, not sure if the "port
> > > stop" should clear the rules:
> > > "
> > > PMDs, not applications, are responsible for maintaining flow rules
> > > configuration
> > > when stopping and restarting a port or performing other actions which may
> > > affect
> > > them. They can only be destroyed explicitly by applications.
> > > "
> > >
> > Good catch I think this part should be removed, since it has many issues. The
> > application is the only
> > one that can be responsible for the rules.
> > 
> > Thinks about the following scenario: application configures 2 queues 0 and 1.
> > It insert flow with queue action 1.
> > It stops the port and remove queue 1. What should the PMD do?
> > What happens if he changed some thing else in configuration that make
> > the actions invalid?
> > 
> > For those reason (the description in rte_ethdev.h and the above issues with
> > keeping the rules)
> > we (Mellanox) modified our code to remove the flows in stop function from the
> > device.
> > This code was inserted to DPDK in 20.05 release.
> > One more reason is that saving the flows also waste a lot of memory
> > which is very costly to many applications.
> > 
> > 
> > > As I tested with i40e, it keeps the rules after stop/start, cc'ing @Jeff,
> > > @Beilei & @Qi if this is done intentionally.
> > >
> > >
> > > 2) From the perspective of the testers, users of the testpmd. If they are
> > > testing a complex set of filter rules, stopping and starting the port flushing
> > > all rules may be troublesome.
> > > Since there is explicit command to remove a rte_flow rule or to remove them
> > > all,
> > > user may prefer to call it when required to delete the rules, instead of this is
> > > done implicitly in port stop.
> > >
> > > Btw, this is based on PMD should handle the rules on stop/start, we need to
> > > agree on it first, but even that is not the case, we are in the application
> > > domain now and we can apply the rules back again in the 'start' if it serves
> > > better to the user.
> > >
> > First like I said above I think we should agree that it is the application
> > responsibility to manage the rules and not the PMD, and first thing to do it
> > update the rte_flow doc.
> > 
> > Second I agree that we should discuss if test-pmd should keep the rules and
> > reapply them,
> > but just like for the PMD the user may create invalid configuration, so re-
> > applying the rules
> > maybe incorrect.
> > Currently test-pmd is not build to support large number of rules, unless using a
> > script, and if the user uses a script
> > he can reuse this script.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
  2020-08-26 17:34     ` Ori Kam
@ 2020-09-13 12:12       ` Ori Kam
  2020-09-13 14:00         ` Thomas Monjalon
  0 siblings, 1 reply; 13+ messages in thread
From: Ori Kam @ 2020-09-13 12:12 UTC (permalink / raw)
  To: Ferruh Yigit, Gregory Etelson, Wenzhuo Lu, Beilei Xing,
	Bernard Iremonger, Thomas Monjalon, dev
  Cc: Matan Azrad, Raslan Darawsheh, Jeff Guo, Qi Zhang

Hi Ferruh,
Can we proceed with this patch?

Thanks,
Ori
> -----Original Message-----
> From: Ori Kam
> 
> Hi Ferruh,
> 
> > -----Original Message-----
> > From: Ferruh Yigit <ferruh.yigit@intel.com>
> >
> > On 8/20/2020 9:40 AM, Gregory Etelson wrote:
> > > Hello,
> > >
> > > Is this patch scheduled for merge with dpdk.org ?
> > > Please update me.
> > >
> > > Regards,
> > > Gregory
> > >
> > >> -----Original Message-----
> > >> From: Gregory Etelson <getelson@mellanox.com>
> > >>
> > >> According to current RTE API, port flow rules must not be kept after port
> > >> stop.
> >
> > Hi Gregory, Ori,
> >
> > Can you please point where this is documented?
> >
> From: rte_ethdev.h
> "Please note that some configuration is not stored between calls to
>  rte_eth_dev_stop()/rte_eth_dev_start(). The following configuration will
>  be retained:
> 
>      - MTU
>      - flow control settings
>      - receive mode configuration (promiscuous mode, all-multicast mode,
>        hardware checksum mode, RSS/VMDQ settings etc.)
>      - VLAN filtering configuration
>      - default MAC address
>      - MAC addresses supplied to MAC address array
>      - flow director filtering mode (but not filtering rules)
>      - NIC queue statistics mappings"
> 
> From my understanding this means that flows should not be stored on device
> stop.
> 
> 
> > >>
> > >> Testpmd did not flush port flow rules after `port stop' command was
> called.
> > >> As the result, after the port was restarted, it showed bogus flow rules.
> >
> > There are two issues,
> >
> > 1) According what I see in the rte_flow documentation, not sure if the "port
> > stop" should clear the rules:
> > "
> > PMDs, not applications, are responsible for maintaining flow rules
> > configuration
> > when stopping and restarting a port or performing other actions which may
> > affect
> > them. They can only be destroyed explicitly by applications.
> > "
> >
> Good catch I think this part should be removed, since it has many issues. The
> application is the only
> one that can be responsible for the rules.
> 
> Thinks about the following scenario: application configures 2 queues 0 and 1.
> It insert flow with queue action 1.
> It stops the port and remove queue 1. What should the PMD do?
> What happens if he changed some thing else in configuration that make
> the actions invalid?
> 
> For those reason (the description in rte_ethdev.h and the above issues with
> keeping the rules)
> we (Mellanox) modified our code to remove the flows in stop function from the
> device.
> This code was inserted to DPDK in 20.05 release.
> One more reason is that saving the flows also waste a lot of memory
> which is very costly to many applications.
> 
> 
> > As I tested with i40e, it keeps the rules after stop/start, cc'ing @Jeff,
> > @Beilei & @Qi if this is done intentionally.
> >
> >
> > 2) From the perspective of the testers, users of the testpmd. If they are
> > testing a complex set of filter rules, stopping and starting the port flushing
> > all rules may be troublesome.
> > Since there is explicit command to remove a rte_flow rule or to remove them
> > all,
> > user may prefer to call it when required to delete the rules, instead of this is
> > done implicitly in port stop.
> >
> > Btw, this is based on PMD should handle the rules on stop/start, we need to
> > agree on it first, but even that is not the case, we are in the application
> > domain now and we can apply the rules back again in the 'start' if it serves
> > better to the user.
> >
> First like I said above I think we should agree that it is the application
> responsibility to manage the rules and not the PMD, and first thing to do it
> update the rte_flow doc.
> 
> Second I agree that we should discuss if test-pmd should keep the rules and
> reapply them,
> but just like for the PMD the user may create invalid configuration, so re-
> applying the rules
> maybe incorrect.
> Currently test-pmd is not build to support large number of rules, unless using a
> script, and if the user uses a script
> he can reuse this script.
> 
> 
> 
> Best,
> Ori


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
  2020-08-25 15:51   ` Ferruh Yigit
@ 2020-08-26 17:34     ` Ori Kam
  2020-09-13 12:12       ` Ori Kam
  0 siblings, 1 reply; 13+ messages in thread
From: Ori Kam @ 2020-08-26 17:34 UTC (permalink / raw)
  To: Ferruh Yigit, Gregory Etelson, Wenzhuo Lu, Beilei Xing,
	Bernard Iremonger, Thomas Monjalon, dev
  Cc: Matan Azrad, Raslan Darawsheh, Jeff Guo, Qi Zhang

Hi Ferruh,

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> On 8/20/2020 9:40 AM, Gregory Etelson wrote:
> > Hello,
> >
> > Is this patch scheduled for merge with dpdk.org ?
> > Please update me.
> >
> > Regards,
> > Gregory
> >
> >> -----Original Message-----
> >> From: Gregory Etelson <getelson@mellanox.com>
> >>
> >> According to current RTE API, port flow rules must not be kept after port
> >> stop.
> 
> Hi Gregory, Ori,
> 
> Can you please point where this is documented?
> 
From: rte_ethdev.h
"Please note that some configuration is not stored between calls to
 rte_eth_dev_stop()/rte_eth_dev_start(). The following configuration will
 be retained:

     - MTU
     - flow control settings
     - receive mode configuration (promiscuous mode, all-multicast mode,
       hardware checksum mode, RSS/VMDQ settings etc.)
     - VLAN filtering configuration
     - default MAC address
     - MAC addresses supplied to MAC address array
     - flow director filtering mode (but not filtering rules)
     - NIC queue statistics mappings"

From my understanding this means that flows should not be stored on device stop.


> >>
> >> Testpmd did not flush port flow rules after `port stop' command was called.
> >> As the result, after the port was restarted, it showed bogus flow rules.
> 
> There are two issues,
> 
> 1) According what I see in the rte_flow documentation, not sure if the "port
> stop" should clear the rules:
> "
> PMDs, not applications, are responsible for maintaining flow rules
> configuration
> when stopping and restarting a port or performing other actions which may
> affect
> them. They can only be destroyed explicitly by applications.
> "
> 
Good catch I think this part should be removed, since it has many issues. The application is the only
one that can be responsible for the rules.

Thinks about the following scenario: application configures 2 queues 0 and 1.
It insert flow with queue action 1.
It stops the port and remove queue 1. What should the PMD do?
What happens if he changed some thing else in configuration that make
the actions invalid?

For those reason (the description in rte_ethdev.h and the above issues with keeping the rules)
we (Mellanox) modified our code to remove the flows in stop function from the device.
This code was inserted to DPDK in 20.05 release.
One more reason is that saving the flows also waste a lot of memory
which is very costly to many applications.


> As I tested with i40e, it keeps the rules after stop/start, cc'ing @Jeff,
> @Beilei & @Qi if this is done intentionally.
> 
> 
> 2) From the perspective of the testers, users of the testpmd. If they are
> testing a complex set of filter rules, stopping and starting the port flushing
> all rules may be troublesome.
> Since there is explicit command to remove a rte_flow rule or to remove them
> all,
> user may prefer to call it when required to delete the rules, instead of this is
> done implicitly in port stop.
> 
> Btw, this is based on PMD should handle the rules on stop/start, we need to
> agree on it first, but even that is not the case, we are in the application
> domain now and we can apply the rules back again in the 'start' if it serves
> better to the user.
> 
First like I said above I think we should agree that it is the application 
responsibility to manage the rules and not the PMD, and first thing to do it
update the rte_flow doc.

Second I agree that we should discuss if test-pmd should keep the rules and reapply them,
but just like for the PMD the user may create invalid configuration, so re-applying the rules
maybe incorrect. 
Currently test-pmd is not build to support large number of rules, unless using a script, and if the user uses a script
he can reuse this script. 



Best,
Ori


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
  2020-08-20  8:40 ` [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after " Gregory Etelson
@ 2020-08-25 15:51   ` Ferruh Yigit
  2020-08-26 17:34     ` Ori Kam
  0 siblings, 1 reply; 13+ messages in thread
From: Ferruh Yigit @ 2020-08-25 15:51 UTC (permalink / raw)
  To: Gregory Etelson, Wenzhuo Lu, Beilei Xing, Bernard Iremonger,
	Thomas Monjalon, dev
  Cc: Matan Azrad, Raslan Darawsheh, Ori Kam, Jeff Guo, Qi Zhang

On 8/20/2020 9:40 AM, Gregory Etelson wrote:
> Hello,
> 
> Is this patch scheduled for merge with dpdk.org ?
> Please update me.
> 
> Regards,
> Gregory
> 
>> -----Original Message-----
>> From: Gregory Etelson <getelson@mellanox.com>
>> Sent: Monday, August 10, 2020 19:15
>> To: dev@dpdk.org
>> Cc: Gregory Etelson <getelson@nvidia.com>; Matan Azrad
>> <matan@nvidia.com>; Raslan Darawsheh <rasland@nvidia.com>;
>> stable@dpdk.org; Ori Kam <orika@mellanox.com>; Wenzhuo Lu
>> <wenzhuo.lu@intel.com>; Beilei Xing <beilei.xing@intel.com>; Bernard
>> Iremonger <bernard.iremonger@intel.com>
>> Subject: [PATCH] app/testpmd: fix flow rules list after port stop
>>
>> According to current RTE API, port flow rules must not be kept after port
>> stop.

Hi Gregory, Ori,

Can you please point where this is documented?

>>
>> Testpmd did not flush port flow rules after `port stop' command was called.
>> As the result, after the port was restarted, it showed bogus flow rules.

There are two issues,

1) According what I see in the rte_flow documentation, not sure if the "port
stop" should clear the rules:
"
PMDs, not applications, are responsible for maintaining flow rules configuration
when stopping and restarting a port or performing other actions which may affect
them. They can only be destroyed explicitly by applications.
"

As I tested with i40e, it keeps the rules after stop/start, cc'ing @Jeff,
@Beilei & @Qi if this is done intentionally.


2) From the perspective of the testers, users of the testpmd. If they are
testing a complex set of filter rules, stopping and starting the port flushing
all rules may be troublesome.
Since there is explicit command to remove a rte_flow rule or to remove them all,
user may prefer to call it when required to delete the rules, instead of this is
done implicitly in port stop.

Btw, this is based on PMD should handle the rules on stop/start, we need to
agree on it first, but even that is not the case, we are in the application
domain now and we can apply the rules back again in the 'start' if it serves
better to the user.


>>
>> Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
>>
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Gregory Etelson <getelson@mellanox.com>
>> Acked-by: Ori Kam <orika@mellanox.com>
>> ---
>>  app/test-pmd/testpmd.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
>> 7842c3b781..4ba5c41c6e 100644
>> --- a/app/test-pmd/testpmd.c
>> +++ b/app/test-pmd/testpmd.c
>> @@ -2627,6 +2627,9 @@ stop_port(portid_t pid)
>>  						RTE_PORT_HANDLING) == 0)
>>  			continue;
>>
>> +		if (port->flow_list)
>> +			port_flow_flush(pi);
>> +
>>  		rte_eth_dev_stop(pi);
>>
>>  		if (rte_atomic16_cmpset(&(port->port_status),
>> --
>> 2.25.1
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
       [not found] <20200810161523.6904-1-getelson@mellanox.com>
@ 2020-08-20  8:40 ` Gregory Etelson
  2020-08-25 15:51   ` Ferruh Yigit
  0 siblings, 1 reply; 13+ messages in thread
From: Gregory Etelson @ 2020-08-20  8:40 UTC (permalink / raw)
  To: Wenzhuo Lu, Beilei Xing, Bernard Iremonger, Thomas Monjalon, dev
  Cc: Matan Azrad, Raslan Darawsheh, Ori Kam

Hello,

Is this patch scheduled for merge with dpdk.org ?
Please update me.

Regards,
Gregory

> -----Original Message-----
> From: Gregory Etelson <getelson@mellanox.com>
> Sent: Monday, August 10, 2020 19:15
> To: dev@dpdk.org
> Cc: Gregory Etelson <getelson@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org; Ori Kam <orika@mellanox.com>; Wenzhuo Lu
> <wenzhuo.lu@intel.com>; Beilei Xing <beilei.xing@intel.com>; Bernard
> Iremonger <bernard.iremonger@intel.com>
> Subject: [PATCH] app/testpmd: fix flow rules list after port stop
> 
> According to current RTE API, port flow rules must not be kept after port
> stop.
> 
> Testpmd did not flush port flow rules after `port stop' command was called.
> As the result, after the port was restarted, it showed bogus flow rules.
> 
> Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gregory Etelson <getelson@mellanox.com>
> Acked-by: Ori Kam <orika@mellanox.com>
> ---
>  app/test-pmd/testpmd.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> 7842c3b781..4ba5c41c6e 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2627,6 +2627,9 @@ stop_port(portid_t pid)
>  						RTE_PORT_HANDLING) == 0)
>  			continue;
> 
> +		if (port->flow_list)
> +			port_flow_flush(pi);
> +
>  		rte_eth_dev_stop(pi);
> 
>  		if (rte_atomic16_cmpset(&(port->port_status),
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-01-06 18:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11  6:14 [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop Gregory Etelson
2020-11-24 14:42 ` Ajit Khaparde
2020-11-26 15:41   ` Thomas Monjalon
2020-11-26 16:43 ` [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd flows left before " Gregory Etelson
2020-11-27 16:01   ` Andrew Rybchenko
2020-11-29  6:59     ` Gregory Etelson
2021-01-06 18:07   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
     [not found] <20200810161523.6904-1-getelson@mellanox.com>
2020-08-20  8:40 ` [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after " Gregory Etelson
2020-08-25 15:51   ` Ferruh Yigit
2020-08-26 17:34     ` Ori Kam
2020-09-13 12:12       ` Ori Kam
2020-09-13 14:00         ` Thomas Monjalon
2020-11-17 19:08           ` Gregory Etelson

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git