ethdev: use device handle to detach
[dpdk.git] / app / test-pmd / testpmd.c
index d32cbb9..0a23d82 100644 (file)
@@ -299,7 +299,7 @@ uint32_t event_print_mask = (UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN) |
  * NIC bypass mode configuration options.
  */
 
-#ifdef RTE_LIBRTE_IXGBE_BYPASS
+#if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS
 /* The NIC bypass watchdog timeout. */
 uint32_t bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_OFF;
 #endif
@@ -381,9 +381,9 @@ uint8_t bitrate_enabled;
 /* Forward function declarations */
 static void map_port_queue_stats_mapping_registers(uint8_t pi, struct rte_port *port);
 static void check_all_ports_link_status(uint32_t port_mask);
-static void eth_event_callback(uint8_t port_id,
-                              enum rte_eth_event_type type,
-                              void *param);
+static int eth_event_callback(uint8_t port_id,
+                             enum rte_eth_event_type type,
+                             void *param, void *ret_param);
 
 /*
  * Check if all the ports are started.
@@ -1824,13 +1824,14 @@ rmv_event_callback(void *arg)
        else if (da->type == RTE_DEVTYPE_WHITELISTED_PCI)
                rte_pci_device_name(&da->pci.addr, name, sizeof(name));
        printf("removing device %s\n", name);
-       rte_eal_dev_detach(name);
+       rte_eal_dev_detach(dev->device);
        dev->state = RTE_ETH_DEV_UNUSED;
 }
 
 /* This function is used by the interrupt thread */
-static void
-eth_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
+static int
+eth_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param,
+                 void *ret_param)
 {
        static const char * const event_desc[] = {
                [RTE_ETH_EVENT_UNKNOWN] = "Unknown",
@@ -1844,6 +1845,7 @@ eth_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
        };
 
        RTE_SET_USED(param);
+       RTE_SET_USED(ret_param);
 
        if (type >= RTE_ETH_EVENT_MAX) {
                fprintf(stderr, "\nPort %" PRIu8 ": %s called upon invalid event %d\n",
@@ -1864,6 +1866,7 @@ eth_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
        default:
                break;
        }
+       return 0;
 }
 
 static int
@@ -2015,7 +2018,7 @@ init_port_config(void)
                rte_eth_macaddr_get(pid, &port->eth_addr);
 
                map_port_queue_stats_mapping_registers(pid, port);
-#ifdef RTE_LIBRTE_IXGBE_BYPASS
+#if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS
                rte_pmd_ixgbe_bypass_init(pid);
 #endif