drivers/net: enable hotplug on secondary process
[dpdk.git] / drivers / net / tap / rte_eth_tap.c
index 22ba872..84aaf24 100644 (file)
@@ -305,8 +305,7 @@ tap_rx_offload_get_queue_capa(void)
        return DEV_RX_OFFLOAD_SCATTER |
               DEV_RX_OFFLOAD_IPV4_CKSUM |
               DEV_RX_OFFLOAD_UDP_CKSUM |
-              DEV_RX_OFFLOAD_TCP_CKSUM |
-              DEV_RX_OFFLOAD_CRC_STRIP;
+              DEV_RX_OFFLOAD_TCP_CKSUM;
 }
 
 /* Callback to handle the rx burst of packets to the correct interface and
@@ -1931,6 +1930,8 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev)
                        return -1;
                }
                eth_dev->dev_ops = &ops;
+               eth_dev->device = &dev->device;
+               rte_eth_dev_probing_finish(eth_dev);
                return 0;
        }
 
@@ -1991,8 +1992,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
        name = rte_vdev_device_name(dev);
        params = rte_vdev_device_args(dev);
 
-       if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
-           strlen(params) == 0) {
+       if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
                eth_dev = rte_eth_dev_attach_secondary(name);
                if (!eth_dev) {
                        TAP_LOG(ERR, "Failed to probe %s", name);
@@ -2000,6 +2000,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
                }
                /* TODO: request info from primary to set up Rx and Tx */
                eth_dev->dev_ops = &ops;
+               eth_dev->device = &dev->device;
                rte_eth_dev_probing_finish(eth_dev);
                return 0;
        }
@@ -2073,7 +2074,10 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev)
        /* find the ethdev entry */
        eth_dev = rte_eth_dev_allocated(rte_vdev_device_name(dev));
        if (!eth_dev)
-               return 0;
+               return -ENODEV;
+
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return rte_eth_dev_release_port_secondary(eth_dev);
 
        internals = eth_dev->data->dev_private;