DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] fm10k: Fix queue start twice failed
@ 2015-03-25 10:48 Michael Qiu
  2015-03-30 20:02 ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Qiu @ 2015-03-25 10:48 UTC (permalink / raw)
  To: dev

When use "port 0 rxq 0 start" in testpmd twice, the rx queue 0 on
port 0 will failed to work.

The root casue is the rxqctl enable bit need to reset if already
enabled.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
 lib/librte_pmd_fm10k/fm10k_ethdev.c | 56 +++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/lib/librte_pmd_fm10k/fm10k_ethdev.c b/lib/librte_pmd_fm10k/fm10k_ethdev.c
index 0c7a80c..0312fad 100644
--- a/lib/librte_pmd_fm10k/fm10k_ethdev.c
+++ b/lib/librte_pmd_fm10k/fm10k_ethdev.c
@@ -72,6 +72,30 @@ fm10k_mbx_unlock(struct fm10k_hw *hw)
 }
 
 /*
+ * clean queue, descriptor rings, free software buffers used when stopping
+ * device.
+ */
+static inline void
+rx_queue_clean(struct fm10k_rx_queue *q)
+{
+	union fm10k_rx_desc zero = {.q = {0, 0, 0, 0} };
+	uint32_t i;
+	PMD_INIT_FUNC_TRACE();
+
+	/* zero descriptor rings */
+	for (i = 0; i < q->nb_desc; ++i)
+		q->hw_ring[i] = zero;
+
+	/* free software buffers */
+	for (i = 0; i < q->nb_desc; ++i) {
+		if (q->sw_ring[i]) {
+			rte_pktmbuf_free_seg(q->sw_ring[i]);
+			q->sw_ring[i] = NULL;
+		}
+	}
+}
+
+/*
  * reset queue to initial state, allocate software buffers used when starting
  * device.
  * return 0 on success
@@ -85,6 +109,9 @@ rx_queue_reset(struct fm10k_rx_queue *q)
 	int i, diag;
 	PMD_INIT_FUNC_TRACE();
 
+	/* clean the memory before allocate */
+	rx_queue_clean(q);
+
 	diag = rte_mempool_get_bulk(q->mp, (void **)q->sw_ring, q->nb_desc);
 	if (diag != 0)
 		return -ENOMEM;
@@ -109,30 +136,6 @@ rx_queue_reset(struct fm10k_rx_queue *q)
 }
 
 /*
- * clean queue, descriptor rings, free software buffers used when stopping
- * device.
- */
-static inline void
-rx_queue_clean(struct fm10k_rx_queue *q)
-{
-	union fm10k_rx_desc zero = {.q = {0, 0, 0, 0} };
-	uint32_t i;
-	PMD_INIT_FUNC_TRACE();
-
-	/* zero descriptor rings */
-	for (i = 0; i < q->nb_desc; ++i)
-		q->hw_ring[i] = zero;
-
-	/* free software buffers */
-	for (i = 0; i < q->nb_desc; ++i) {
-		if (q->sw_ring[i]) {
-			rte_pktmbuf_free_seg(q->sw_ring[i]);
-			q->sw_ring[i] = NULL;
-		}
-	}
-}
-
-/*
  * free all queue memory used when releasing the queue (i.e. configure)
  */
 static inline void
@@ -492,6 +495,11 @@ fm10k_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		reg = FM10K_READ_REG(hw, FM10K_RXQCTL(rx_queue_id));
 		if (hw->mac.type == fm10k_mac_pf)
 			reg |= FM10K_RXQCTL_PF;
+
+		/* already enable? need reset to 0 */
+		if ((reg & FM10K_RXQCTL_ENABLE) == 1)
+			FM10K_WRITE_REG(hw, FM10K_RXQCTL(rx_queue_id), (reg & ~FM10K_RXQCTL_ENABLE));
+
 		reg |= FM10K_RXQCTL_ENABLE;
 		/* enable RX queue */
 		FM10K_WRITE_REG(hw, FM10K_RXQCTL(rx_queue_id), reg);
-- 
1.9.3

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

* Re: [dpdk-dev] [PATCH] fm10k: Fix queue start twice failed
  2015-03-25 10:48 [dpdk-dev] [PATCH] fm10k: Fix queue start twice failed Michael Qiu
@ 2015-03-30 20:02 ` Thomas Monjalon
  2015-03-31  6:37   ` Chen, Jing D
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Monjalon @ 2015-03-30 20:02 UTC (permalink / raw)
  To: Michael Qiu; +Cc: dev

2015-03-25 18:48, Michael Qiu:
> When use "port 0 rxq 0 start" in testpmd twice, the rx queue 0 on
> port 0 will failed to work.
> 
> The root casue is the rxqctl enable bit need to reset if already
> enabled.

Please try to reword this message to make it clear.

> Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> ---
>  lib/librte_pmd_fm10k/fm10k_ethdev.c | 56 +++++++++++++++++++++----------------
>  1 file changed, 32 insertions(+), 24 deletions(-)

Jing, should it enter in 2.0?

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

* Re: [dpdk-dev] [PATCH] fm10k: Fix queue start twice failed
  2015-03-30 20:02 ` Thomas Monjalon
@ 2015-03-31  6:37   ` Chen, Jing D
  0 siblings, 0 replies; 3+ messages in thread
From: Chen, Jing D @ 2015-03-31  6:37 UTC (permalink / raw)
  To: Thomas Monjalon, Qiu, Michael; +Cc: dev

Hi, Thomas,


> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, March 31, 2015 4:02 AM
> To: Qiu, Michael
> Cc: dev@dpdk.org; Chen, Jing D
> Subject: Re: [dpdk-dev] [PATCH] fm10k: Fix queue start twice failed
> 
> 2015-03-25 18:48, Michael Qiu:
> > When use "port 0 rxq 0 start" in testpmd twice, the rx queue 0 on
> > port 0 will failed to work.
> >
> > The root casue is the rxqctl enable bit need to reset if already
> > enabled.
> 
> Please try to reword this message to make it clear.
> 
> > Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> > ---
> >  lib/librte_pmd_fm10k/fm10k_ethdev.c | 56 +++++++++++++++++++++---
> -------------
> >  1 file changed, 32 insertions(+), 24 deletions(-)
> 
> Jing, should it enter in 2.0?

Michael and I discussed and thought it's not the best solution to fix this issue. So, we'd like postpone this fix.

Thanks!


> 

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

end of thread, other threads:[~2015-03-31  6:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25 10:48 [dpdk-dev] [PATCH] fm10k: Fix queue start twice failed Michael Qiu
2015-03-30 20:02 ` Thomas Monjalon
2015-03-31  6:37   ` Chen, Jing D

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git