[1/1] app/testpmd: fix port detach cleanup

Message ID 1555084091-24641-1-git-send-email-viacheslavo@mellanox.com
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series
  • [1/1] app/testpmd: fix port detach cleanup
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Viacheslav Ovsiienko April 12, 2019, 3:48 p.m.
At port detach routine after calling the rte_dev_remove()
testpmd performs some cleanup, checking the statuses of
remaining ports and closes the appropriate ones. The port
scanning is based on the new sibling iterator which uses the
invalid (already closed) port for reference. This patch
replaces the foreach iterator and uses the device object for
reference. It is worth to note this cleanup is not needed
for some drivers (at least for mlx5 and probably for others)
and is preserved due to possible compatibility issues.

Fixes: 13302cd5bd63 ("app/testpmd: use port sibling iterator in device cleanup")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 app/test-pmd/testpmd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Yongseok Koh April 12, 2019, 7:52 p.m. | #1
> On Apr 12, 2019, at 8:48 AM, Viacheslav Ovsiienko <viacheslavo@mellanox.com> wrote:
> 
> At port detach routine after calling the rte_dev_remove()
> testpmd performs some cleanup, checking the statuses of
> remaining ports and closes the appropriate ones. The port
> scanning is based on the new sibling iterator which uses the
> invalid (already closed) port for reference. This patch
> replaces the foreach iterator and uses the device object for
> reference. It is worth to note this cleanup is not needed
> for some drivers (at least for mlx5 and probably for others)
> and is preserved due to possible compatibility issues.
> 
> Fixes: 13302cd5bd63 ("app/testpmd: use port sibling iterator in device cleanup")
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
Acked-by: Yongseok Koh <yskoh@mellanox.com>


> app/test-pmd/testpmd.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index aeaa74c..739f96e 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2369,8 +2369,7 @@ struct extmem_param {
> 		TESTPMD_LOG(ERR, "Failed to detach device %s\n", dev->name);
> 		return;
> 	}
> -
> -	RTE_ETH_FOREACH_DEV_SIBLING(sibling, port_id) {
> +	RTE_ETH_FOREACH_DEV_OF(sibling, dev) {
> 		/* reset mapping between old ports and removed device */
> 		rte_eth_devices[sibling].device = NULL;
> 		if (ports[sibling].port_status != RTE_PORT_CLOSED) {
> -- 
> 1.8.3.1
>
Thomas Monjalon April 16, 2019, 4:48 p.m. | #2
12/04/2019 21:52, Yongseok Koh:
> 
> > On Apr 12, 2019, at 8:48 AM, Viacheslav Ovsiienko <viacheslavo@mellanox.com> wrote:
> > 
> > At port detach routine after calling the rte_dev_remove()
> > testpmd performs some cleanup, checking the statuses of
> > remaining ports and closes the appropriate ones. The port
> > scanning is based on the new sibling iterator which uses the
> > invalid (already closed) port for reference. This patch
> > replaces the foreach iterator and uses the device object for
> > reference. It is worth to note this cleanup is not needed
> > for some drivers (at least for mlx5 and probably for others)
> > and is preserved due to possible compatibility issues.
> > 
> > Fixes: 13302cd5bd63 ("app/testpmd: use port sibling iterator in device cleanup")
> > 
> > Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> > ---
> Acked-by: Yongseok Koh <yskoh@mellanox.com>

Acked-by: Thomas Monjalon <thomas@monjalon.net>
Ferruh Yigit April 16, 2019, 5:05 p.m. | #3
On 4/16/2019 5:48 PM, Thomas Monjalon wrote:
> 12/04/2019 21:52, Yongseok Koh:
>>
>>> On Apr 12, 2019, at 8:48 AM, Viacheslav Ovsiienko <viacheslavo@mellanox.com> wrote:
>>>
>>> At port detach routine after calling the rte_dev_remove()
>>> testpmd performs some cleanup, checking the statuses of
>>> remaining ports and closes the appropriate ones. The port
>>> scanning is based on the new sibling iterator which uses the
>>> invalid (already closed) port for reference. This patch
>>> replaces the foreach iterator and uses the device object for
>>> reference. It is worth to note this cleanup is not needed
>>> for some drivers (at least for mlx5 and probably for others)
>>> and is preserved due to possible compatibility issues.
>>>
>>> Fixes: 13302cd5bd63 ("app/testpmd: use port sibling iterator in device cleanup")
>>>
>>> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
>>> ---
>> Acked-by: Yongseok Koh <yskoh@mellanox.com>
> 
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
> 

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

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index aeaa74c..739f96e 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2369,8 +2369,7 @@  struct extmem_param {
 		TESTPMD_LOG(ERR, "Failed to detach device %s\n", dev->name);
 		return;
 	}
-
-	RTE_ETH_FOREACH_DEV_SIBLING(sibling, port_id) {
+	RTE_ETH_FOREACH_DEV_OF(sibling, dev) {
 		/* reset mapping between old ports and removed device */
 		rte_eth_devices[sibling].device = NULL;
 		if (ports[sibling].port_status != RTE_PORT_CLOSED) {