DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/enic: fix Tx and Rx queue stop and start
@ 2016-07-12 19:24 John Daley
  2016-07-15 21:30 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: John Daley @ 2016-07-12 19:24 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, John Daley

The exported device start and stop functions where not setting the queue
states to RTE_ETH_QUEUE_STATE_STARTED and RTE_ETH_QUEUE_STATE_STOPPED.
After starting the device, the RTE queue stop function would not call
the enic queue stop function since queue was already marked as stopped.

Put queue state updates in the lower level queue start/stop functions
which are called by both device and queue start/stop functions.

Fixes: fefed3d1e62c ("enic: new driver")

Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic_ethdev.c |  6 ------
 drivers/net/enic/enic_main.c   | 22 ++++++++++++++++++----
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 3c87b49..f410f84 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -196,7 +196,6 @@ static int enicpmd_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
 	ENICPMD_FUNC_TRACE();
 
 	enic_start_wq(enic, queue_idx);
-	eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
 
 	return 0;
 }
@@ -212,8 +211,6 @@ static int enicpmd_dev_tx_queue_stop(struct rte_eth_dev *eth_dev,
 	ret = enic_stop_wq(enic, queue_idx);
 	if (ret)
 		dev_err(enic, "error in stopping wq %d\n", queue_idx);
-	else
-		eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
 
 	return ret;
 }
@@ -226,7 +223,6 @@ static int enicpmd_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
 	ENICPMD_FUNC_TRACE();
 
 	enic_start_rq(enic, queue_idx);
-	eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
 
 	return 0;
 }
@@ -242,8 +238,6 @@ static int enicpmd_dev_rx_queue_stop(struct rte_eth_dev *eth_dev,
 	ret = enic_stop_rq(enic, queue_idx);
 	if (ret)
 		dev_err(enic, "error in stopping rq %d\n", queue_idx);
-	else
-		eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
 
 	return ret;
 }
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index d8669cc..425f55d 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -518,30 +518,41 @@ void enic_free_rq(void *rxq)
 
 void enic_start_wq(struct enic *enic, uint16_t queue_idx)
 {
+	struct rte_eth_dev *eth_dev = enic->rte_dev;
 	vnic_wq_enable(&enic->wq[queue_idx]);
+	eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
 }
 
 int enic_stop_wq(struct enic *enic, uint16_t queue_idx)
 {
-	return vnic_wq_disable(&enic->wq[queue_idx]);
+	struct rte_eth_dev *eth_dev = enic->rte_dev;
+	int ret;
+
+	ret = vnic_wq_disable(&enic->wq[queue_idx]);
+	if (ret)
+		return ret;
+
+	eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
+	return 0;
 }
 
 void enic_start_rq(struct enic *enic, uint16_t queue_idx)
 {
 	struct vnic_rq *rq_sop = &enic->rq[enic_sop_rq(queue_idx)];
 	struct vnic_rq *rq_data = &enic->rq[rq_sop->data_queue_idx];
+	struct rte_eth_dev *eth_dev = enic->rte_dev;
 
 	if (rq_data->in_use)
 		vnic_rq_enable(rq_data);
 	rte_mb();
 	vnic_rq_enable(rq_sop);
-
+	eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
 }
 
 int enic_stop_rq(struct enic *enic, uint16_t queue_idx)
 {
 	int ret1 = 0, ret2 = 0;
-
+	struct rte_eth_dev *eth_dev = enic->rte_dev;
 	struct vnic_rq *rq_sop = &enic->rq[enic_sop_rq(queue_idx)];
 	struct vnic_rq *rq_data = &enic->rq[rq_sop->data_queue_idx];
 
@@ -552,8 +563,11 @@ int enic_stop_rq(struct enic *enic, uint16_t queue_idx)
 
 	if (ret2)
 		return ret2;
-	else
+	else if (ret1)
 		return ret1;
+
+	eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
+	return 0;
 }
 
 int enic_alloc_rq(struct enic *enic, uint16_t queue_idx,
-- 
2.7.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/enic: fix Tx and Rx queue stop and start
  2016-07-12 19:24 [dpdk-dev] [PATCH] net/enic: fix Tx and Rx queue stop and start John Daley
@ 2016-07-15 21:30 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2016-07-15 21:30 UTC (permalink / raw)
  To: John Daley; +Cc: dev, bruce.richardson

2016-07-12 12:24, John Daley:
> The exported device start and stop functions where not setting the queue
> states to RTE_ETH_QUEUE_STATE_STARTED and RTE_ETH_QUEUE_STATE_STOPPED.
> After starting the device, the RTE queue stop function would not call
> the enic queue stop function since queue was already marked as stopped.
> 
> Put queue state updates in the lower level queue start/stop functions
> which are called by both device and queue start/stop functions.
> 
> Fixes: fefed3d1e62c ("enic: new driver")
> 
> Reviewed-by: Nelson Escobar <neescoba@cisco.com>
> Signed-off-by: John Daley <johndale@cisco.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-15 21:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-12 19:24 [dpdk-dev] [PATCH] net/enic: fix Tx and Rx queue stop and start John Daley
2016-07-15 21:30 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).