From 239c9b435ad4abcac89b5d2480a0c21ce8b8288f Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Thu, 22 Mar 2018 20:59:01 +0800 Subject: [PATCH] ethdev: fix queue start Device must be started before start any queue. Fixes: 0748be2cf9a2 ("ethdev: queue start and stop") Cc: stable@dpdk.org Signed-off-by: Qi Zhang Acked-by: Konstantin Ananyev --- lib/librte_ether/rte_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index aa7b4d51fb..2c74f7e049 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -736,6 +736,12 @@ rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); dev = &rte_eth_devices[port_id]; + if (!dev->data->dev_started) { + RTE_PMD_DEBUG_TRACE( + "port %d must be started before start any queue\n", port_id); + return -EINVAL; + } + if (rx_queue_id >= dev->data->nb_rx_queues) { RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id); return -EINVAL; @@ -789,6 +795,12 @@ rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); dev = &rte_eth_devices[port_id]; + if (!dev->data->dev_started) { + RTE_PMD_DEBUG_TRACE( + "port %d must be started before start any queue\n", port_id); + return -EINVAL; + } + if (tx_queue_id >= dev->data->nb_tx_queues) { RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id); return -EINVAL; -- 2.20.1