X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fnull%2Frte_eth_null.c;h=2adc43e6bb5273c609b1576bf53f96d964bc7e21;hb=d10798072c5cb3ed4a7c636a003285120b2f3ce7;hp=1c354ad226f9b829605c42b2ee999977534eeb62;hpb=c9634e44d1d38cf402bcd12295ccdab6f0dc45a8;p=dpdk.git diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 1c354ad226..2adc43e6bb 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include @@ -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]; @@ -89,9 +90,10 @@ struct pmd_internals { static struct ether_addr eth_addr = { .addr_bytes = {0} }; static const char *drivername = "Null PMD"; static struct rte_eth_link pmd_link = { - .link_speed = 10000, + .link_speed = ETH_SPEED_NUM_10G, .link_duplex = ETH_LINK_FULL_DUPLEX, - .link_status = 0 + .link_status = ETH_LINK_DOWN, + .link_autoneg = ETH_LINK_SPEED_AUTONEG, }; static uint16_t @@ -113,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); @@ -141,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); @@ -199,7 +203,7 @@ eth_dev_start(struct rte_eth_dev *dev) if (dev == NULL) return -EINVAL; - dev->data->dev_link.link_status = 1; + dev->data->dev_link.link_status = ETH_LINK_UP; return 0; } @@ -209,7 +213,7 @@ eth_dev_stop(struct rte_eth_dev *dev) if (dev == NULL) return; - dev->data->dev_link.link_status = 0; + dev->data->dev_link.link_status = ETH_LINK_DOWN; } static int @@ -513,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; @@ -528,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; @@ -681,11 +686,12 @@ rte_pmd_null_devuninit(const char *name) return 0; } -static struct rte_driver pmd_null_drv = { - .name = "eth_null", - .type = PMD_VDEV, +static struct rte_vdev_driver pmd_null_drv = { .init = rte_pmd_null_devinit, .uninit = rte_pmd_null_devuninit, }; -PMD_REGISTER_DRIVER(pmd_null_drv); +DRIVER_REGISTER_VDEV(net_null, pmd_null_drv); +DRIVER_REGISTER_PARAM_STRING(net_null, + "size= " + "copy=");