[dpdk-dev] ethdev: fix queue start

Message ID 20180322125901.37141-1-qi.z.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Qi Zhang March 22, 2018, 12:59 p.m. UTC
  Device must be started before start any queue.

Fixes: 0748be2cf9a2 ("ethdev: queue start and stop")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Comments

Ananyev, Konstantin March 24, 2018, 12:06 p.m. UTC | #1
> 
> Device must be started before start any queue.
> 
> Fixes: 0748be2cf9a2 ("ethdev: queue start and stop")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
>  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 0590f0c10..7aa404fa5 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -732,6 +732,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;
> @@ -785,6 +791,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;
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.13.6
  
Ferruh Yigit March 27, 2018, 7:10 p.m. UTC | #2
On 3/24/2018 12:06 PM, Ananyev, Konstantin wrote:
> 
> 
>>
>> Device must be started before start any queue.
>>
>> Fixes: 0748be2cf9a2 ("ethdev: queue start and stop")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>

> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 0590f0c10..7aa404fa5 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -732,6 +732,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;
@@ -785,6 +791,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;