From: Keith Wiles Date: Thu, 26 Feb 2015 14:00:32 +0000 (-0600) Subject: ethdev: fix hotplug check for Rx and Tx callbacks X-Git-Tag: spdx-start~9490 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d8b8517893910a1136abbe761b44583b00596d5d;p=dpdk.git ethdev: fix hotplug check for Rx and Tx callbacks Some checks with rte_eth_dev_is_valid_port() were missed when merging hotplug and callbacks features. Fixes: c282abd2a6cd ("ethdev: remove assumption that port will not be detached") Signed-off-by: Keith Wiles Acked-by: John McNamara --- diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 6ea7a17eef..f70fc7525f 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -3541,7 +3541,7 @@ rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id, return NULL; #endif /* check input parameters */ - if (port_id >= nb_ports || fn == NULL || + if (!rte_eth_dev_is_valid_port(port_id) || fn == NULL || queue_id >= rte_eth_devices[port_id].data->nb_rx_queues) { rte_errno = EINVAL; return NULL; @@ -3570,7 +3570,7 @@ rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id, return NULL; #endif /* check input parameters */ - if (port_id >= nb_ports || fn == NULL || + if (!rte_eth_dev_is_valid_port(port_id) || fn == NULL || queue_id >= rte_eth_devices[port_id].data->nb_tx_queues) { rte_errno = EINVAL; return NULL; @@ -3598,7 +3598,7 @@ rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id, return (-ENOTSUP); #endif /* Check input parameters. */ - if (port_id >= nb_ports || user_cb == NULL || + if (!rte_eth_dev_is_valid_port(port_id) || user_cb == NULL || queue_id >= rte_eth_devices[port_id].data->nb_rx_queues) { return (-EINVAL); } @@ -3637,7 +3637,7 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id, return (-ENOTSUP); #endif /* Check input parameters. */ - if (port_id >= nb_ports || user_cb == NULL || + if (!rte_eth_dev_is_valid_port(port_id) || user_cb == NULL || queue_id >= rte_eth_devices[port_id].data->nb_tx_queues) { return (-EINVAL); }