[v2] app/testpmd: fix testpmd flows left before port stop.
diff mbox series

Message ID 20201126164302.19120-1-getelson@nvidia.com
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series
  • [v2] app/testpmd: fix testpmd flows left before port stop.
Related show

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

Gregory Etelson Nov. 26, 2020, 4:43 p.m. UTC
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(+)

Comments

Andrew Rybchenko Nov. 27, 2020, 4:01 p.m. UTC | #1
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.
Gregory Etelson Nov. 29, 2020, 6:59 a.m. UTC | #2
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
Ferruh Yigit Jan. 6, 2021, 6:07 p.m. UTC | #3
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.

Patch
diff mbox series

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);