net/tap: add queue and port ids in queue structures
[dpdk.git] / drivers / net / tap / rte_eth_tap.c
index 0331eb9..4d1ac23 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
@@ -686,7 +685,7 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
        txq->stats.errs += nb_pkts - num_tx;
        txq->stats.obytes += num_tx_bytes;
 
-       return num_tx;
+       return num_packets;
 }
 
 static const char *
@@ -1294,6 +1293,7 @@ tap_rx_queue_setup(struct rte_eth_dev *dev,
        rxq->mp = mp;
        rxq->trigger_seen = 1; /* force initial burst */
        rxq->in_port = dev->data->port_id;
+       rxq->queue_id = rx_queue_id;
        rxq->nb_rx_desc = nb_desc;
        iovecs = rte_zmalloc_socket(dev->device->name, sizeof(*iovecs), 0,
                                    socket_id);
@@ -1360,6 +1360,8 @@ tap_tx_queue_setup(struct rte_eth_dev *dev,
                return -1;
        dev->data->tx_queues[tx_queue_id] = &internals->txq[tx_queue_id];
        txq = dev->data->tx_queues[tx_queue_id];
+       txq->out_port = dev->data->port_id;
+       txq->queue_id = tx_queue_id;
 
        offloads = tx_conf->offloads | dev->data->dev_conf.txmode.offloads;
        txq->csum = !!(offloads &
@@ -1932,6 +1934,7 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev)
                }
                eth_dev->dev_ops = &ops;
                eth_dev->device = &dev->device;
+               rte_eth_dev_probing_finish(eth_dev);
                return 0;
        }
 
@@ -1992,8 +1995,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);
@@ -2075,7 +2077,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;