DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tony Lu <zlu@ezchip.com>
To: 'Liming Sun' <lsun@ezchip.com>, <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 2/2] driver/net/mpipe: fix the crash/hung issue	when testpmd quits
Date: Fri, 8 Jan 2016 15:49:28 +0800	[thread overview]
Message-ID: <004b01d149e9$27c3dc50$774b94f0$@com> (raw)
In-Reply-To: <1450813790-11874-3-git-send-email-lsun@ezchip.com>

>-----Original Message-----
>From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Liming Sun
>Sent: Wednesday, December 23, 2015 3:50 AM
>To: dev@dpdk.org
>Subject: [dpdk-dev] [PATCH 2/2] driver/net/mpipe: fix the crash/hung issue
when
>testpmd quits
>
>1. Fixed the compiling issue of the ethtool example on tilegx
>   platform.
>2. Fixed the hung/crash issue when quitting testpmd under high
>   traffic rate. The buffer error bit needs to be checked before
>   processing the idesc and releasing the buffer. Code logic is
>   also simplified.
>
>Signed-off-by: Liming Sun <lsun@ezchip.com>
>---
> drivers/net/mpipe/mpipe_tilegx.c                   |   46
>+++++++-------------
> .../common/include/arch/tile/rte_rwlock.h          |    1 +
> 2 files changed, 17 insertions(+), 30 deletions(-)
>
>diff --git a/drivers/net/mpipe/mpipe_tilegx.c
>b/drivers/net/mpipe/mpipe_tilegx.c
>index 8d006fa..4cb54c3 100644
>--- a/drivers/net/mpipe/mpipe_tilegx.c
>+++ b/drivers/net/mpipe/mpipe_tilegx.c
>@@ -134,7 +134,6 @@ struct mpipe_dev_priv {
> 	struct rte_mempool *rx_mpool;	/* mpool used by the rx queues. */
> 	unsigned rx_offset;		/* Receive head room. */
> 	unsigned rx_size_code;		/* mPIPE rx buffer size code. */
>-	unsigned rx_buffers;		/* receive buffers on stack. */
> 	int is_xaui:1,			/* Is this an xgbe or gbe? */
> 	    initialized:1,		/* Initialized port? */
> 	    running:1;			/* Running port? */
>@@ -529,7 +528,6 @@ mpipe_recv_fill_stack(struct mpipe_dev_priv *priv, int
>count)
> 		mpipe_recv_push(priv, mbuf);
> 	}
>
>-	priv->rx_buffers += count;
> 	PMD_DEBUG_RX("%s: Filled %d/%d buffers\n", mpipe_name(priv), i,
>count);  }
>
>@@ -539,10 +537,9 @@ mpipe_recv_flush_stack(struct mpipe_dev_priv *priv)
> 	const int offset = priv->rx_offset & ~RTE_MEMPOOL_ALIGN_MASK;
> 	uint8_t in_port = priv->port_id;
> 	struct rte_mbuf *mbuf;
>-	unsigned count;
> 	void *va;
>
>-	for (count = 0; count < priv->rx_buffers; count++) {
>+	while (1) {
> 		va = gxio_mpipe_pop_buffer(priv->context, priv->stack);
> 		if (!va)
> 			break;
>@@ -561,10 +558,6 @@ mpipe_recv_flush_stack(struct mpipe_dev_priv *priv)
>
> 		__rte_mbuf_raw_free(mbuf);
> 	}
>-
>-	PMD_DEBUG_RX("%s: Returned %d/%d buffers\n",
>-		     mpipe_name(priv), count, priv->rx_buffers);
>-	priv->rx_buffers -= count;
> }
>
> static void
>@@ -1246,31 +1239,23 @@ mpipe_recv_flush(struct mpipe_dev_priv *priv)
> 	gxio_mpipe_iqueue_t *iqueue;
> 	gxio_mpipe_idesc_t idesc;
> 	struct rte_mbuf *mbuf;
>-	int retries = 0;
> 	unsigned queue;
>
>-	do {
>-		mpipe_recv_flush_stack(priv);
>-
>-		/* Flush packets sitting in recv queues. */
>-		for (queue = 0; queue < priv->nb_rx_queues; queue++) {
>-			rx_queue = mpipe_rx_queue(priv, queue);
>-			iqueue = &rx_queue->iqueue;
>-			while (gxio_mpipe_iqueue_try_get(iqueue, &idesc) >=
0) {
>-				mbuf = mpipe_recv_mbuf(priv, &idesc,
in_port);
>-				rte_pktmbuf_free(mbuf);
>-				priv->rx_buffers--;
>-			}
>-			rte_free(rx_queue->rx_ring_mem);
>-		}
>-	} while (retries++ < 10 && priv->rx_buffers);
>+	/* Release packets on the buffer stack. */
>+	mpipe_recv_flush_stack(priv);
>
>-	if (priv->rx_buffers) {
>-		RTE_LOG(ERR, PMD, "%s: Leaked %d receive buffers.\n",
>-			mpipe_name(priv), priv->rx_buffers);
>-	} else {
>-		PMD_DEBUG_RX("%s: Returned all receive buffers.\n",
>-			     mpipe_name(priv));
>+	/* Flush packets sitting in recv queues. */
>+	for (queue = 0; queue < priv->nb_rx_queues; queue++) {
>+		rx_queue = mpipe_rx_queue(priv, queue);
>+		iqueue = &rx_queue->iqueue;
>+		while (gxio_mpipe_iqueue_try_get(iqueue, &idesc) >= 0) {
>+			/* Skip idesc with the 'buffer error' bit set. */
>+			if (idesc.be)
>+				continue;
>+			mbuf = mpipe_recv_mbuf(priv, &idesc, in_port);
>+			rte_pktmbuf_free(mbuf);
>+		}
>+		rte_free(rx_queue->rx_ring_mem);
> 	}
> }
>
>@@ -1339,6 +1324,7 @@ mpipe_do_xmit(struct mpipe_tx_queue *tx_queue,
>struct rte_mbuf **tx_pkts,
> 				.xfer_size = rte_pktmbuf_data_len(mbuf),
> 				.bound     = next ? 0 : 1,
> 				.stack_idx = mpipe_mbuf_stack_index(priv,
mbuf),
>+				.size      = priv->rx_size_code,
> 			} };
> 			if (mpipe_local.mbuf_push_debt[port_id] > 0) {
> 				mpipe_local.mbuf_push_debt[port_id]--;
>diff --git a/lib/librte_eal/common/include/arch/tile/rte_rwlock.h
>b/lib/librte_eal/common/include/arch/tile/rte_rwlock.h
>index 8f67a19..6d609e8 100644
>--- a/lib/librte_eal/common/include/arch/tile/rte_rwlock.h
>+++ b/lib/librte_eal/common/include/arch/tile/rte_rwlock.h
>@@ -38,6 +38,7 @@ extern "C" {
> #endif
>
> #include "generic/rte_rwlock.h"
>+#include <rte_spinlock.h>
>
> static inline void
> rte_rwlock_read_lock_tm(rte_rwlock_t *rwl)
>--
>1.7.1

Acked-by: Zhigang Lu <zlu@ezchip.com>

  reply	other threads:[~2016-01-08  7:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 19:49 [dpdk-dev] [PATCH 0/2] Some enhancement of the tilegx mpipe driver Liming Sun
2015-12-22 19:49 ` [dpdk-dev] [PATCH 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM Liming Sun
2016-01-08  7:41   ` Tony Lu
2015-12-22 19:49 ` [dpdk-dev] [PATCH 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits Liming Sun
2016-01-08  7:49   ` Tony Lu [this message]
2016-01-08 14:39   ` [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM Liming Sun
2016-01-08 14:39     ` [dpdk-dev] [PATCH v2 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits Liming Sun
2016-02-09 15:59       ` Bruce Richardson
2016-02-10 14:50         ` Liming Sun
2016-02-10  5:15       ` [dpdk-dev] [PATCH v3] " Liming Sun
2016-02-26 17:35         ` Bruce Richardson
2016-02-09 15:55     ` [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM Bruce Richardson
2016-02-09 18:40       ` Liming Sun
2016-02-10 14:52       ` Liming Sun
2016-02-10  3:46     ` [dpdk-dev] [PATCH v3 1/2] eal/tile: " Liming Sun
2016-02-10  3:47       ` [dpdk-dev] [PATCH v3 2/2] driver/net/mpipe: some code optimization Liming Sun
2016-02-10  4:04     ` [dpdk-dev] [PATCH v4 1/2] eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM Liming Sun
2016-02-10  4:04       ` [dpdk-dev] [PATCH v4 2/2] driver/net/mpipe: some code optimization Liming Sun
2016-03-08 19:59       ` [dpdk-dev] [PATCH v4 1/2] eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM Thomas Monjalon
2016-03-17 14:04         ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='004b01d149e9$27c3dc50$774b94f0$@com' \
    --to=zlu@ezchip.com \
    --cc=dev@dpdk.org \
    --cc=lsun@ezchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).