ethdev: get rid of device type
[dpdk.git] / drivers / net / null / rte_eth_null.c
index 5e8e203..42ec107 100644 (file)
@@ -69,6 +69,7 @@ struct null_queue {
 struct pmd_internals {
        unsigned packet_size;
        unsigned packet_copy;
+       uint8_t port_id;
 
        struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT];
        struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT];
@@ -114,6 +115,7 @@ eth_null_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
                bufs[i]->pkt_len = packet_size;
                bufs[i]->nb_segs = 1;
                bufs[i]->next = NULL;
+               bufs[i]->port = h->internals->port_id;
        }
 
        rte_atomic64_add(&(h->rx_pkts), i);
@@ -142,6 +144,7 @@ eth_null_copy_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
                bufs[i]->pkt_len = packet_size;
                bufs[i]->nb_segs = 1;
                bufs[i]->next = NULL;
+               bufs[i]->port = h->internals->port_id;
        }
 
        rte_atomic64_add(&(h->rx_pkts), i);
@@ -514,7 +517,7 @@ eth_dev_null_create(const char *name,
                goto error;
 
        /* reserve an ethdev entry */
-       eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
+       eth_dev = rte_eth_dev_allocate(name);
        if (eth_dev == NULL)
                goto error;
 
@@ -529,6 +532,7 @@ eth_dev_null_create(const char *name,
 
        internals->packet_size = packet_size;
        internals->packet_copy = packet_copy;
+       internals->port_id = eth_dev->data->port_id;
 
        internals->flow_type_rss_offloads =  ETH_RSS_PROTO_MASK;
        internals->reta_size = RTE_DIM(internals->reta_conf) * RTE_RETA_GROUP_SIZE;
@@ -683,10 +687,12 @@ rte_pmd_null_devuninit(const char *name)
 }
 
 static struct rte_driver pmd_null_drv = {
-       .name = "eth_null",
        .type = PMD_VDEV,
        .init = rte_pmd_null_devinit,
        .uninit = rte_pmd_null_devuninit,
 };
 
-PMD_REGISTER_DRIVER(pmd_null_drv);
+PMD_REGISTER_DRIVER(pmd_null_drv, net_null);
+DRIVER_REGISTER_PARAM_STRING(net_null,
+       "size=<int> "
+       "copy=<int>");