patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] app/testpmd: fix flow rules list after port stop
@ 2020-08-11  6:14 Gregory Etelson
  2020-11-24 14:42 ` [dpdk-stable] [dpdk-dev] " Ajit Khaparde
  2020-11-26 16:43 ` [dpdk-stable] [PATCH v2] app/testpmd: fix testpmd flows left before " Gregory Etelson
  0 siblings, 2 replies; 7+ 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] 7+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
  2020-08-11  6:14 [dpdk-stable] [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-stable] [PATCH v2] app/testpmd: fix testpmd flows left before " Gregory Etelson
  1 sibling, 1 reply; 7+ 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] 7+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] app/testpmd: fix flow rules list after port stop
  2020-11-24 14:42 ` [dpdk-stable] [dpdk-dev] " Ajit Khaparde
@ 2020-11-26 15:41   ` Thomas Monjalon
  0 siblings, 0 replies; 7+ 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] 7+ messages in thread

* [dpdk-stable] [PATCH v2] app/testpmd: fix testpmd flows left before port stop.
  2020-08-11  6:14 [dpdk-stable] [PATCH] app/testpmd: fix flow rules list after port stop Gregory Etelson
  2020-11-24 14:42 ` [dpdk-stable] [dpdk-dev] " Ajit Khaparde
@ 2020-11-26 16:43 ` Gregory Etelson
  2020-11-27 16:01   ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko
  2021-01-06 18:07   ` [dpdk-stable] " Ferruh Yigit
  1 sibling, 2 replies; 7+ 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] 7+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd flows left before port stop.
  2020-11-26 16:43 ` [dpdk-stable] [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-stable] " Ferruh Yigit
  1 sibling, 1 reply; 7+ 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] 7+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v2] app/testpmd: fix testpmd flows left before port stop.
  2020-11-27 16:01   ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko
@ 2020-11-29  6:59     ` Gregory Etelson
  0 siblings, 0 replies; 7+ 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] 7+ messages in thread

* Re: [dpdk-stable] [PATCH v2] app/testpmd: fix testpmd flows left before port stop.
  2020-11-26 16:43 ` [dpdk-stable] [PATCH v2] app/testpmd: fix testpmd flows left before " Gregory Etelson
  2020-11-27 16:01   ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko
@ 2021-01-06 18:07   ` Ferruh Yigit
  1 sibling, 0 replies; 7+ 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] 7+ messages in thread

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11  6:14 [dpdk-stable] [PATCH] app/testpmd: fix flow rules list after port stop Gregory Etelson
2020-11-24 14:42 ` [dpdk-stable] [dpdk-dev] " Ajit Khaparde
2020-11-26 15:41   ` Thomas Monjalon
2020-11-26 16:43 ` [dpdk-stable] [PATCH v2] app/testpmd: fix testpmd flows left before " Gregory Etelson
2020-11-27 16:01   ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko
2020-11-29  6:59     ` Gregory Etelson
2021-01-06 18:07   ` [dpdk-stable] " Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).