ethdev: fix port visibility before initialization
authorThomas Monjalon <thomas@monjalon.net>
Thu, 10 May 2018 23:58:33 +0000 (01:58 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 14 May 2018 21:31:53 +0000 (22:31 +0100)
commite06227e2fa234f056227fb74beedc51f503ebac9
treef7fe05e8224c089b371633d7d307c2afd7125c6d
parentac7d3b6ddf87e1e0435de6d40cfe2749dc0ff9a4
ethdev: fix port visibility before initialization

The port was set to the state ATTACHED during allocation.
The consequence was to iterate over ports which are not initialized.

The state ATTACHED is now set as the last step of probing.

The uniqueness of port name is now checked before the availability
of a port id for allocation (order reversed).

As the state is not set on allocation anymore, it is also not checked
in the function telling whether a port is allocated or not.
The name of the port is set on allocation, so it is enough as a check.

Fixes: 5588909af21b ("ethdev: add device iterator")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
lib/librte_ethdev/rte_ethdev.c
lib/librte_ethdev/rte_ethdev_driver.h