Avoid removal of additional flows after requested number of flows has
been already removed.

Issue with removal of multiple flows is internal testpmd bug at
port_flow_destroy(). This function goes through all flows and compares
given flow ‘id’ with them. However in some cases it can advance pointer
with “given ID” and thus remove additional flow.

Fixes: de956d5ecf08 ("app/testpmd: support age shared action context")

Signed-off-by: Danylo Vodopianov <dvo-...@napatech.com>
---
 app/test-pmd/config.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index bf50f6adef..50c4b018c1 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -4170,8 +4170,12 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
                               ctx.pf->rule.attr->ingress ? 'i' : '-',
                               ctx.pf->rule.attr->egress ? 'e' : '-',
                               ctx.pf->rule.attr->transfer ? 't' : '-');
+                       /* use local copy of id as ctx.pf is freed by
+                        * port_flow_destroy() during processing
+                        */
+                       uint64_t flow_id = ctx.pf->id;
                        if (destroy && !port_flow_destroy(port_id, 1,
-                                                         &ctx.pf->id, false))
+                                                         &flow_id, false))
                                total++;
                        break;
                case ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION:
-- 
2.43.5

Reply via email to