app/testpmd: cleanup port resources after implicit close
authorDmitry Kozlyuk <dkozlyuk@nvidia.com>
Wed, 15 Jun 2022 23:12:12 +0000 (02:12 +0300)
committerAndrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Thu, 23 Jun 2022 11:12:50 +0000 (13:12 +0200)
commit4b27989d24f4d662f95bb42b5ad892c9a5d9b60f
tree05b0d10dac92ffc791adb370213522a9894282b9
parentb275e298c11aad100cf7966cdcc6d6cb5d36549a
app/testpmd: cleanup port resources after implicit close

When a port is closed implicitly by the PMD, for example,
if it is a representor port and its master port is detached,
flow indirect actions could remain with their handles no longer valid.
If a newly attached device is assigned the same ID as the closed port,
those indirect actions became accessible again.
Any attempt to use them resulted in an undefined behavior.
Flow flex items had no such issue on close, but had it on detach.

Introduce flush_port_owned_resources() function for consistent
cleanup and call it when a port is closed or detached.
Make it flush flow rules and multicast addresses too
because they logically belong to the port being removed.

Fixes: 55509e3a49fb ("app/testpmd: support shared flow action")
Fixes: 59f3a8acbcdb ("app/testpmd: add flex item commands")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
app/test-pmd/testpmd.c