STAT_QMAP_RX
};
+enum {
+ DEV_DETACHED = 0,
+ DEV_ATTACHED
+};
+
static inline void
rte_eth_dev_data_alloc(void)
{
{
unsigned i;
- for (i = 0; i < nb_ports; i++) {
- if (strcmp(rte_eth_devices[i].data->name, name) == 0)
+ for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+ if ((rte_eth_devices[i].attached == DEV_ATTACHED) &&
+ strcmp(rte_eth_devices[i].data->name, name) == 0)
return &rte_eth_devices[i];
}
return NULL;
}
+static uint8_t
+rte_eth_dev_find_free_port(void)
+{
+ unsigned i;
+
+ for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+ if (rte_eth_devices[i].attached == DEV_DETACHED)
+ return i;
+ }
+ return RTE_MAX_ETHPORTS;
+}
+
struct rte_eth_dev *
rte_eth_dev_allocate(const char *name)
{
+ uint8_t port_id;
struct rte_eth_dev *eth_dev;
- if (nb_ports == RTE_MAX_ETHPORTS) {
+ port_id = rte_eth_dev_find_free_port();
+ if (port_id == RTE_MAX_ETHPORTS) {
PMD_DEBUG_TRACE("Reached maximum number of Ethernet ports\n");
return NULL;
}
return NULL;
}
- eth_dev = &rte_eth_devices[nb_ports];
- eth_dev->data = &rte_eth_dev_data[nb_ports];
+ eth_dev = &rte_eth_devices[port_id];
+ eth_dev->data = &rte_eth_dev_data[port_id];
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
- eth_dev->data->port_id = nb_ports++;
+ eth_dev->data->port_id = port_id;
+ eth_dev->attached = DEV_ATTACHED;
+ nb_ports++;
return eth_dev;
}
(unsigned) pci_dev->id.device_id);
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
rte_free(eth_dev->data->dev_private);
+ eth_dev->attached = DEV_DETACHED;
nb_ports--;
return diag;
}
rte_eal_pci_register(ð_drv->pci_drv);
}
+static int
+rte_eth_dev_is_valid_port(uint8_t port_id)
+{
+ if (port_id >= RTE_MAX_ETHPORTS ||
+ rte_eth_devices[port_id].attached != DEV_ATTACHED)
+ return 0;
+ else
+ return 1;
+}
+
int
rte_eth_dev_socket_id(uint8_t port_id)
{
- if (port_id >= nb_ports)
+ if (!rte_eth_dev_is_valid_port(port_id))
return -1;
return rte_eth_devices[port_id].pci_dev->numa_node;
}
* in a multi-process setup*/
PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -EINVAL;
}
* in a multi-process setup*/
PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -EINVAL;
}
* in a multi-process setup*/
PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -EINVAL;
}
* in a multi-process setup*/
PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -EINVAL;
}
* in a multi-process setup*/
PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
- if (port_id >= nb_ports || port_id >= RTE_MAX_ETHPORTS) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-EINVAL);
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
* in a multi-process setup*/
PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
- if (port_id >= nb_ports) {
- PMD_DEBUG_TRACE("Invalid port_id=%" PRIu8 "\n", port_id);
+ if (!rte_eth_dev_is_valid_port(port_id)) {
+ PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-EINVAL);
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
* in a multi-process setup*/
PROC_PRIMARY_OR_RET();
- if (port_id >= nb_ports) {
- PMD_DEBUG_TRACE("Invalid port_id=%" PRIu8 "\n", port_id);
+ if (!rte_eth_dev_is_valid_port(port_id)) {
+ PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
* in a multi-process setup*/
PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -EINVAL;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
* in a multi-process setup*/
PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -EINVAL;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
* in a multi-process setup*/
PROC_PRIMARY_OR_RET();
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
* in a multi-process setup*/
PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-EINVAL);
}
+
dev = &rte_eth_devices[port_id];
if (rx_queue_id >= dev->data->nb_rx_queues) {
PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
* in a multi-process setup*/
PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
- if (port_id >= RTE_MAX_ETHPORTS || port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-EINVAL);
}
+
dev = &rte_eth_devices[port_id];
if (tx_queue_id >= dev->data->nb_tx_queues) {
PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_enable);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_disable);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -1;
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_enable);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_disable);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -1;
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
if (dev->data->dev_conf.intr_conf.lsc != 0)
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
if (dev->data->dev_conf.intr_conf.lsc != 0)
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
+
dev = &rte_eth_devices[port_id];
memset(stats, 0, sizeof(*stats));
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
uint64_t val;
char *stats_ptr;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -1;
}
+
dev = &rte_eth_devices[port_id];
/* implemented by the driver */
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
/* implemented by the driver */
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -ENODEV;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return;
}
+
dev = &rte_eth_devices[port_id];
ether_addr_copy(&dev->data->mac_addrs[0], mac_addr);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
int ret;
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
+
dev = &rte_eth_devices[port_id];
if (! (dev->data->dev_conf.rxmode.hw_vlan_filter)) {
PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
int mask = 0;
int cur, org = 0;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
struct rte_eth_dev *dev;
int ret = 0;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
(*dev->dev_ops->vlan_pvid_set)(dev, pvid, on);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
struct rte_eth_dev *dev;
int ret;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -ENODEV;
}
struct rte_eth_dev *dev;
uint16_t rss_hash_protos;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
+
rss_hash_protos = rss_conf->rss_hf;
if ((rss_hash_protos != 0) &&
((rss_hash_protos & ETH_RSS_PROTO_MASK) == 0)) {
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
return (*dev->dev_ops->rss_hash_conf_get)(dev, rss_conf);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -ENODEV;
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -ENODEV;
}
+
dev = &rte_eth_devices[port_id];
if (udp_tunnel == NULL) {
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
int index;
uint64_t pool_mask;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
struct rte_eth_dev *dev;
int index;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("set VF RX mode:Invalid port_id=%d\n",
port_id);
return (-ENODEV);
int ret;
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("unicast hash setting:Invalid port_id=%d\n",
port_id);
return (-ENODEV);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("unicast hash setting:Invalid port_id=%d\n",
port_id);
return (-ENODEV);
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("set pool tx:Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("VF VLAN filter:invalid port id=%d\n",
port_id);
return (-ENODEV);
struct rte_eth_dev_info dev_info;
struct rte_eth_link link;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("set queue rate limit:invalid port id=%d\n",
port_id);
return -ENODEV;
if (q_msk == 0)
return 0;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("set VF rate limit:invalid port id=%d\n",
port_id);
return -ENODEV;
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev = &rte_eth_devices[port_id];
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return 0;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
if (queue_id >= dev->data->nb_rx_queues) {
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return 0;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return 0;
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);
return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
+
dev = &rte_eth_devices[port_id];
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
return (*dev->dev_ops->rx_descriptor_done)( \
if (!cb_fn)
return (-EINVAL);
- if (port_id >= nb_ports) {
+
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-EINVAL);
}
if (!cb_fn)
return (-EINVAL);
- if (port_id >= nb_ports) {
+
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-EINVAL);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -ENODEV;
}
{
struct rte_eth_dev *dev;
- if (port_id >= nb_ports) {
+ if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -ENODEV;
}