X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Flibrte_pmd_af_packet%2Frte_eth_af_packet.c;h=80e9bdf7f819e4cac5a08a814b225a927d71f6a5;hb=8210ec2572ae887f76a3dff1e44f2c253d8e5616;hp=ad7242cd6dca3a98491197af55624cbbccfe88a0;hpb=b5af5c7967150fc541dba541c1ad8dc8aa642bff;p=dpdk.git diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c b/lib/librte_pmd_af_packet/rte_eth_af_packet.c index ad7242cd6d..80e9bdf7f8 100644 --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c @@ -285,8 +285,6 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats) unsigned long rx_total = 0, tx_total = 0, tx_err_total = 0; const struct pmd_internals *internal = dev->data->dev_private; - memset(igb_stats, 0, sizeof(*igb_stats)); - imax = (internal->nb_queues < RTE_ETHDEV_QUEUE_STAT_CNTRS ? internal->nb_queues : RTE_ETHDEV_QUEUE_STAT_CNTRS); for (i = 0; i < imax; i++) { @@ -481,6 +479,11 @@ rte_pmd_init_internals(const char *name, if (*internals == NULL) goto error; + for (q = 0; q < nb_queues; q++) { + (*internals)->rx_queue[q].map = MAP_FAILED; + (*internals)->tx_queue[q].map = MAP_FAILED; + } + req = &((*internals)->req); req->tp_block_size = blocksize; @@ -603,6 +606,8 @@ rte_pmd_init_internals(const char *name, rdsize = req->tp_frame_nr * sizeof(*(rx_queue->rd)); rx_queue->rd = rte_zmalloc_socket(name, rdsize, 0, numa_node); + if (rx_queue->rd == NULL) + goto error; for (i = 0; i < req->tp_frame_nr; ++i) { rx_queue->rd[i].iov_base = rx_queue->map + (i * framesize); rx_queue->rd[i].iov_len = req->tp_frame_size; @@ -615,6 +620,8 @@ rte_pmd_init_internals(const char *name, tx_queue->map = rx_queue->map + req->tp_block_size * req->tp_block_nr; tx_queue->rd = rte_zmalloc_socket(name, rdsize, 0, numa_node); + if (tx_queue->rd == NULL) + goto error; for (i = 0; i < req->tp_frame_nr; ++i) { tx_queue->rd[i].iov_base = tx_queue->map + (i * framesize); tx_queue->rd[i].iov_len = req->tp_frame_size; @@ -642,7 +649,7 @@ rte_pmd_init_internals(const char *name, } /* reserve an ethdev entry */ - *eth_dev = rte_eth_dev_allocate(name); + *eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL); if (*eth_dev == NULL) goto error; @@ -678,6 +685,8 @@ error: rte_free(pci_dev); if (*internals) { for (q = 0; q < nb_queues; q++) { + munmap((*internals)->rx_queue[q].map, + 2 * req->tp_block_size * req->tp_block_nr); if ((*internals)->rx_queue[q].rd) rte_free((*internals)->rx_queue[q].rd); if ((*internals)->tx_queue[q].rd)