From: Wei Hu (Xavier) Date: Tue, 13 Oct 2020 11:50:55 +0000 (+0800) Subject: ethdev: check queue id in Rx interrupt control X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ee7a8fafbaf44cd25af61e86f7a7351111eb64a0;p=dpdk.git ethdev: check queue id in Rx interrupt control This patch add queue ID checks to Rx interrupt control routines. Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) Signed-off-by: Chengwen Feng Acked-by: Stephen Hemminger Reviewed-by: Kalesh AP Reviewed-by: Ferruh Yigit --- diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 11d6d993f5..7817224c4f 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -4510,11 +4510,16 @@ rte_eth_dev_rx_intr_enable(uint16_t port_id, uint16_t queue_id) { struct rte_eth_dev *dev; + int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; + ret = eth_dev_validate_rx_queue(dev, queue_id); + if (ret != 0) + return ret; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP); return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id)); @@ -4525,11 +4530,16 @@ rte_eth_dev_rx_intr_disable(uint16_t port_id, uint16_t queue_id) { struct rte_eth_dev *dev; + int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; + ret = eth_dev_validate_rx_queue(dev, queue_id); + if (ret != 0) + return ret; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP); return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id));