summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorThomas Monjalon <thomas@monjalon.net>2018-10-23 10:28:40 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2018-10-26 22:14:05 +0200
commitc9cce42876f5a45c4fb71eddb328562cf7fe315e (patch)
tree0865e2bc07f66f0abab62ab3e82ba1db13d8d273 /app
parent5f63d635a1b93389c41c361dd0e21329c2852739 (diff)
downloaddpdk-c9cce42876f5a45c4fb71eddb328562cf7fe315e.zip
dpdk-c9cce42876f5a45c4fb71eddb328562cf7fe315e.tar.gz
dpdk-c9cce42876f5a45c4fb71eddb328562cf7fe315e.tar.xz
ethdev: remove deprecated attach/detach functions
The hotplug attach/detach features are implemented in EAL layer. There is a new ethdev iterator to retrieve ports from ethdev layer. As announced earlier, the (buggy) ethdev functions are now removed. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Diffstat (limited to 'app')
-rw-r--r--app/test-pmd/testpmd.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6296f49..70c0822 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -481,6 +481,7 @@ struct nvgre_encap_conf nvgre_encap_conf = {
};
/* Forward function declarations */
+static void setup_attached_port(portid_t pi);
static void map_port_queue_stats_mapping_registers(portid_t pi,
struct rte_port *port);
static void check_all_ports_link_status(uint32_t port_mask);
@@ -2313,7 +2314,7 @@ void
attach_port(char *identifier)
{
portid_t pi = 0;
- unsigned int socket_id;
+ struct rte_dev_iterator iterator;
printf("Attaching a new port...\n");
@@ -2322,8 +2323,19 @@ attach_port(char *identifier)
return;
}
- if (rte_eth_dev_attach(identifier, &pi))
+ if (rte_dev_probe(identifier) != 0) {
+ TESTPMD_LOG(ERR, "Failed to attach port %s\n", identifier);
return;
+ }
+
+ RTE_ETH_FOREACH_MATCHING_DEV(pi, identifier, &iterator)
+ setup_attached_port(pi);
+}
+
+static void
+setup_attached_port(portid_t pi)
+{
+ unsigned int socket_id;
socket_id = (unsigned)rte_eth_dev_socket_id(pi);
/* if socket_id is invalid, set to the first available socket. */
@@ -2346,9 +2358,7 @@ attach_port(char *identifier)
void
detach_port(portid_t port_id)
{
- char name[RTE_ETH_NAME_MAX_LEN];
-
- printf("Detaching a port...\n");
+ printf("Removing a device...\n");
if (ports[port_id].port_status != RTE_PORT_CLOSED) {
if (ports[port_id].port_status != RTE_PORT_STOPPED) {
@@ -2360,7 +2370,7 @@ detach_port(portid_t port_id)
port_flow_flush(port_id);
}
- if (rte_eth_dev_detach(port_id, name)) {
+ if (rte_dev_remove(rte_eth_devices[port_id].device) != 0) {
TESTPMD_LOG(ERR, "Failed to detach port %u\n", port_id);
return;
}