X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_ether%2Frte_ethdev.c;h=af990e27945c30e0863bb848819f52e40026e883;hb=c7985de0a7f0769d6e4e112b18314aceecf2642c;hp=36945d168d6c2534e0777b342435f7b78a557949;hpb=50ead110cb56e7c07d4be66e9d8acd83ce837367;p=dpdk.git diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 36945d168d..af990e2794 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -69,60 +69,6 @@ #include "rte_ether.h" #include "rte_ethdev.h" -#ifdef RTE_LIBRTE_ETHDEV_DEBUG -#define RTE_PMD_DEBUG_TRACE(fmt, args...) do { \ - RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \ - } while (0) -#else -#define RTE_PMD_DEBUG_TRACE(fmt, args...) -#endif - -/* Macros for checking for restricting functions to primary instance only */ -#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \ - RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \ - return (retval); \ - } \ -} while (0) - -#define RTE_PROC_PRIMARY_OR_RET() do { \ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \ - RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \ - return; \ - } \ -} while (0) - -/* Macros to check for invalid function pointers in dev_ops structure */ -#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \ - if ((func) == NULL) { \ - RTE_PMD_DEBUG_TRACE("Function not supported\n"); \ - return (retval); \ - } \ -} while (0) - -#define RTE_FUNC_PTR_OR_RET(func) do { \ - if ((func) == NULL) { \ - RTE_PMD_DEBUG_TRACE("Function not supported\n"); \ - return; \ - } \ -} while (0) - -/* Macros to check for valid port */ -#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \ - if (!rte_eth_dev_is_valid_port(port_id)) { \ - RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \ - return retval; \ - } \ -} while (0) - -#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \ - if (!rte_eth_dev_is_valid_port(port_id)) { \ - RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \ - return; \ - } \ -} while (0) - - static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data"; struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS]; static struct rte_eth_dev_data *rte_eth_dev_data; @@ -640,10 +586,8 @@ rte_eth_dev_attach_vdev(const char *vdevargs, uint8_t *port_id) ret = 0; end: - if (name) - free(name); - if (args) - free(args); + free(name); + free(args); if (ret < 0) RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n"); @@ -1510,6 +1454,7 @@ rte_eth_stats_reset(uint8_t port_id) RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset); (*dev->dev_ops->stats_reset)(dev); + dev->data->rx_mbuf_alloc_failed = 0; } /* retrieve ethdev extended statistics */ @@ -2505,70 +2450,6 @@ rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id) return (*dev->dev_ops->mirror_rule_reset)(dev, rule_id); } -#ifdef RTE_LIBRTE_ETHDEV_DEBUG -uint16_t -rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id, - struct rte_mbuf **rx_pkts, uint16_t nb_pkts) -{ - struct rte_eth_dev *dev; - - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0); - - dev = &rte_eth_devices[port_id]; - RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0); - if (queue_id >= dev->data->nb_rx_queues) { - RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id); - return 0; - } - return (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id], - rx_pkts, nb_pkts); -} - -uint16_t -rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id, - struct rte_mbuf **tx_pkts, uint16_t nb_pkts) -{ - struct rte_eth_dev *dev; - - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0); - - dev = &rte_eth_devices[port_id]; - - RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0); - if (queue_id >= dev->data->nb_tx_queues) { - RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id); - return 0; - } - return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], - tx_pkts, nb_pkts); -} - -uint32_t -rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id) -{ - struct rte_eth_dev *dev; - - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0); - - dev = &rte_eth_devices[port_id]; - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0); - return (*dev->dev_ops->rx_queue_count)(dev, queue_id); -} - -int -rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset) -{ - struct rte_eth_dev *dev; - - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); - - dev = &rte_eth_devices[port_id]; - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP); - return (*dev->dev_ops->rx_descriptor_done)(dev->data->rx_queues[queue_id], - offset); -} -#endif - int rte_eth_dev_callback_register(uint8_t port_id, enum rte_eth_event_type event, @@ -2723,7 +2604,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, if (mz) return mz; - if (is_xen_dom0_supported()) + if (rte_xen_dom0_supported()) return rte_memzone_reserve_bounded(z_name, size, socket_id, 0, align, RTE_PGSIZE_2M); else