ethdev: check queue id in Rx interrupt control
authorWei Hu (Xavier) <xavier.huwei@huawei.com>
Tue, 13 Oct 2020 11:50:55 +0000 (19:50 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 16 Oct 2020 17:48:17 +0000 (19:48 +0200)
This patch add queue ID checks to Rx interrupt control routines.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/librte_ethdev/rte_ethdev.c

index 11d6d99..7817224 100644 (file)
@@ -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));