DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] Some enhancement of the tilegx mpipe driver
@ 2015-12-22 19:49 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
  2015-12-22 19:49 ` [dpdk-dev] [PATCH 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits Liming Sun
  0 siblings, 2 replies; 20+ messages in thread
From: Liming Sun @ 2015-12-22 19:49 UTC (permalink / raw)
  To: dev

1. Implement rte_vect.h and enable LPM lookup;
2. It also has some code cleanup and fixes for potential crash when quiting pmd
   under high traffic;
3. Changes have dependency on serie (http://dpdk.org/dev/patchwork/patch/9571)
   which is pending in the patchwork queue.

Liming Sun (2):
  driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  driver/net/mpipe: fix the crash/hung issue when testpmd quits

 config/defconfig_tile-tilegx-linuxapp-gcc          |    2 +-
 drivers/net/mpipe/mpipe_tilegx.c                   |   64 ++++++--------
 .../common/include/arch/tile/rte_rwlock.h          |    1 +
 lib/librte_eal/common/include/arch/tile/rte_vect.h |   93 ++++++++++++++++++++
 4 files changed, 124 insertions(+), 36 deletions(-)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_vect.h

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

* [dpdk-dev] [PATCH 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  2015-12-22 19:49 [dpdk-dev] [PATCH 0/2] Some enhancement of the tilegx mpipe driver Liming Sun
@ 2015-12-22 19:49 ` 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
  1 sibling, 1 reply; 20+ messages in thread
From: Liming Sun @ 2015-12-22 19:49 UTC (permalink / raw)
  To: dev

rte_vect.h was missing earlier thus LPM was disabled and l3fwd is
not able to compile. This commit implements the vector api and
enable LPM in the tilegx configuration by default. It also includes
a minor optimization to use __insn_fetchadd4() instead of
rte_atomic32_xxx() in mpipe_dp_enter/mpipe_dp_exit to avoid the
unnecessary memory fence.

Signed-off-by: Liming Sun <lsun@ezchip.com>
---
 config/defconfig_tile-tilegx-linuxapp-gcc          |    2 +-
 drivers/net/mpipe/mpipe_tilegx.c                   |   18 +++-
 lib/librte_eal/common/include/arch/tile/rte_vect.h |   93 ++++++++++++++++++++
 3 files changed, 107 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_vect.h

diff --git a/config/defconfig_tile-tilegx-linuxapp-gcc b/config/defconfig_tile-tilegx-linuxapp-gcc
index fb61bcd..39794f6 100644
--- a/config/defconfig_tile-tilegx-linuxapp-gcc
+++ b/config/defconfig_tile-tilegx-linuxapp-gcc
@@ -64,7 +64,7 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 
 # This following libraries are not available on the tile architecture.
 # So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
+CONFIG_RTE_LIBRTE_LPM=y
 CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 5845511..8d006fa 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -451,13 +451,13 @@ static inline void
 mpipe_dp_enter(struct mpipe_dev_priv *priv)
 {
 	__insn_mtspr(SPR_DSTREAM_PF, 0);
-	rte_atomic32_inc(&priv->dp_count);
+	__insn_fetchadd4(&priv->dp_count, 1);
 }
 
 static inline void
 mpipe_dp_exit(struct mpipe_dev_priv *priv)
 {
-	rte_atomic32_dec(&priv->dp_count);
+	__insn_fetchadd4(&priv->dp_count, -1);
 }
 
 static inline void
@@ -484,12 +484,20 @@ mpipe_recv_mbuf(struct mpipe_dev_priv *priv, gxio_mpipe_idesc_t *idesc,
 	uint16_t size = gxio_mpipe_idesc_get_xfer_size(idesc);
 	struct rte_mbuf *mbuf = RTE_PTR_SUB(va, priv->rx_offset);
 
-	rte_pktmbuf_reset(mbuf);
 	mbuf->data_off = (uintptr_t)va - (uintptr_t)mbuf->buf_addr;
-	mbuf->port     = in_port;
-	mbuf->data_len = size;
+	mbuf->nb_segs = 1;
+	mbuf->port = in_port;
+	mbuf->ol_flags = 0;
+	if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv4)
+		mbuf->packet_type = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L2_ETHER;
+	else if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv6)
+		mbuf->packet_type = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L2_ETHER;
+	else
+		mbuf->packet_type = RTE_PTYPE_UNKNOWN;
 	mbuf->pkt_len  = size;
+	mbuf->data_len = size;
 	mbuf->hash.rss = gxio_mpipe_idesc_get_flow_hash(idesc);
+	mbuf->next = NULL;
 
 	PMD_DEBUG_RX("%s: RX mbuf %p, buffer %p, buf_addr %p, size %d\n",
 		     mpipe_name(priv), mbuf, va, mbuf->buf_addr, size);
diff --git a/lib/librte_eal/common/include/arch/tile/rte_vect.h b/lib/librte_eal/common/include/arch/tile/rte_vect.h
new file mode 100644
index 0000000..32d768a
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_vect.h
@@ -0,0 +1,93 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) EZchip Semiconductor Ltd. 2015.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of EZchip Semiconductor nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_VECT_H_
+#define _RTE_VECT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef __int128 __m128i;
+
+#define	XMM_SIZE	sizeof(__m128i)
+#define	XMM_MASK	(XMM_SIZE - 1)
+
+typedef union rte_xmm {
+	__m128i x;
+	uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+	uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+} rte_xmm_t;
+
+/* Extracts the low order 64-bit integer. */
+#define _mm_cvtsi128_si64(a) ((rte_xmm_t*)&a)->u64[0]
+
+/* Sets the 2 signed 64-bit integer values. */
+#define _mm_set_epi64x(i1, i0) ({         \
+	rte_xmm_t m;                      \
+	m.u64[0] = i0;                    \
+	m.u64[1] = i1;                    \
+	(m.x);                            \
+})
+
+/* Sets the 4 signed 32-bit integer values. */
+#define _mm_set_epi32(i3, i2, i1, i0)  ({ \
+	rte_xmm_t m;                      \
+	m.u32[0] = i0;                    \
+	m.u32[1] = i1;                    \
+	m.u32[2] = i2;                    \
+	m.u32[3] = i3;                    \
+	(m.x);                            \
+})
+
+/* Shifts right the 4 32-bit integers by count bits with zeros. */
+#define _mm_srli_epi32(v, cnt) ({                  \
+	rte_xmm_t m;                                 \
+	m.u64[0] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[0], cnt); \
+	m.u64[1] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[1], cnt); \
+	(m.x);                                       \
+})
+
+/* Shifts the 128-bit value in a right by imm bytes. */
+#define _mm_srli_si128(v, imm) ((v) >> (imm * sizeof(uint8_t)))
+
+/* Bitwise AND of the 128-bit value in a and the 128-bit value in b. */
+#define _mm_and_si128(a, b) ((a) & (b))
+
+/* Loads 128-bit value. */
+#define _mm_loadu_si128(p) (*(p))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VECT_H_ */
-- 
1.7.1

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

* [dpdk-dev] [PATCH 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits
  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
@ 2015-12-22 19:49 ` Liming Sun
  2016-01-08  7:49   ` Tony Lu
  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
  1 sibling, 2 replies; 20+ messages in thread
From: Liming Sun @ 2015-12-22 19:49 UTC (permalink / raw)
  To: dev

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

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

* Re: [dpdk-dev] [PATCH 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  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
  0 siblings, 0 replies; 20+ messages in thread
From: Tony Lu @ 2016-01-08  7:41 UTC (permalink / raw)
  To: 'Liming Sun', dev

>-----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 1/2] driver/net/mpipe: add rte_vect.h and enable
>CONFIG_RTE_LIBRTE_LPM
>
>rte_vect.h was missing earlier thus LPM was disabled and l3fwd is
>not able to compile. This commit implements the vector api and
>enable LPM in the tilegx configuration by default. It also includes
>a minor optimization to use __insn_fetchadd4() instead of
>rte_atomic32_xxx() in mpipe_dp_enter/mpipe_dp_exit to avoid the
>unnecessary memory fence.
>
>Signed-off-by: Liming Sun <lsun@ezchip.com>
>---
> config/defconfig_tile-tilegx-linuxapp-gcc          |    2 +-
> drivers/net/mpipe/mpipe_tilegx.c                   |   18 +++-
> lib/librte_eal/common/include/arch/tile/rte_vect.h |   93
>++++++++++++++++++++
> 3 files changed, 107 insertions(+), 6 deletions(-)
> create mode 100644 lib/librte_eal/common/include/arch/tile/rte_vect.h
>
>diff --git a/config/defconfig_tile-tilegx-linuxapp-gcc
>b/config/defconfig_tile-tilegx-linuxapp-gcc
>index fb61bcd..39794f6 100644
>--- a/config/defconfig_tile-tilegx-linuxapp-gcc
>+++ b/config/defconfig_tile-tilegx-linuxapp-gcc
>@@ -64,7 +64,7 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
>
> # This following libraries are not available on the tile architecture.
> # So they're turned off.
>-CONFIG_RTE_LIBRTE_LPM=n
>+CONFIG_RTE_LIBRTE_LPM=y
> CONFIG_RTE_LIBRTE_ACL=n
> CONFIG_RTE_LIBRTE_SCHED=n
> CONFIG_RTE_LIBRTE_PORT=n
>diff --git a/drivers/net/mpipe/mpipe_tilegx.c
>b/drivers/net/mpipe/mpipe_tilegx.c
>index 5845511..8d006fa 100644
>--- a/drivers/net/mpipe/mpipe_tilegx.c
>+++ b/drivers/net/mpipe/mpipe_tilegx.c
>@@ -451,13 +451,13 @@ static inline void
> mpipe_dp_enter(struct mpipe_dev_priv *priv)
> {
> 	__insn_mtspr(SPR_DSTREAM_PF, 0);
>-	rte_atomic32_inc(&priv->dp_count);
>+	__insn_fetchadd4(&priv->dp_count, 1);
> }
>
> static inline void
> mpipe_dp_exit(struct mpipe_dev_priv *priv)
> {
>-	rte_atomic32_dec(&priv->dp_count);
>+	__insn_fetchadd4(&priv->dp_count, -1);
> }
>
> static inline void
>@@ -484,12 +484,20 @@ mpipe_recv_mbuf(struct mpipe_dev_priv *priv,
>gxio_mpipe_idesc_t *idesc,
> 	uint16_t size = gxio_mpipe_idesc_get_xfer_size(idesc);
> 	struct rte_mbuf *mbuf = RTE_PTR_SUB(va, priv->rx_offset);
>
>-	rte_pktmbuf_reset(mbuf);
> 	mbuf->data_off = (uintptr_t)va - (uintptr_t)mbuf->buf_addr;
>-	mbuf->port     = in_port;
>-	mbuf->data_len = size;
>+	mbuf->nb_segs = 1;
>+	mbuf->port = in_port;
>+	mbuf->ol_flags = 0;
>+	if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv4)
>+		mbuf->packet_type = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L2_ETHER;
>+	else if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv6)
>+		mbuf->packet_type = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L2_ETHER;
>+	else
>+		mbuf->packet_type = RTE_PTYPE_UNKNOWN;
> 	mbuf->pkt_len  = size;
>+	mbuf->data_len = size;
> 	mbuf->hash.rss = gxio_mpipe_idesc_get_flow_hash(idesc);
>+	mbuf->next = NULL;
>
> 	PMD_DEBUG_RX("%s: RX mbuf %p, buffer %p, buf_addr %p, size %d\n",
> 		     mpipe_name(priv), mbuf, va, mbuf->buf_addr, size);
>diff --git a/lib/librte_eal/common/include/arch/tile/rte_vect.h
>b/lib/librte_eal/common/include/arch/tile/rte_vect.h
>new file mode 100644
>index 0000000..32d768a
>--- /dev/null
>+++ b/lib/librte_eal/common/include/arch/tile/rte_vect.h
>@@ -0,0 +1,93 @@
>+/*
>+ *   BSD LICENSE
>+ *
>+ *   Copyright (C) EZchip Semiconductor Ltd. 2015.
>+ *
>+ *   Redistribution and use in source and binary forms, with or without
>+ *   modification, are permitted provided that the following conditions
>+ *   are met:
>+ *
>+ *     * Redistributions of source code must retain the above copyright
>+ *       notice, this list of conditions and the following disclaimer.
>+ *     * Redistributions in binary form must reproduce the above copyright
>+ *       notice, this list of conditions and the following disclaimer in
>+ *       the documentation and/or other materials provided with the
>+ *       distribution.
>+ *     * Neither the name of EZchip Semiconductor nor the names of its
>+ *       contributors may be used to endorse or promote products derived
>+ *       from this software without specific prior written permission.
>+ *
>+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
>CONTRIBUTORS
>+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
>NOT
>+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
>FITNESS FOR
>+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
>COPYRIGHT
>+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
>INCIDENTAL,
>+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
>NOT
>+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
>OF USE,
>+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
>AND ON ANY
>+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
>TORT
>+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
>THE USE
>+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
>DAMAGE.
>+*/
>+
>+#ifndef _RTE_VECT_H_
>+#define _RTE_VECT_H_
>+
>+#ifdef __cplusplus
>+extern "C" {
>+#endif
>+
>+typedef __int128 __m128i;
>+
>+#define	XMM_SIZE	sizeof(__m128i)
>+#define	XMM_MASK	(XMM_SIZE - 1)
>+
>+typedef union rte_xmm {
>+	__m128i x;
>+	uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
>+	uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
>+} rte_xmm_t;
>+
>+/* Extracts the low order 64-bit integer. */
>+#define _mm_cvtsi128_si64(a) ((rte_xmm_t*)&a)->u64[0]
>+
>+/* Sets the 2 signed 64-bit integer values. */
>+#define _mm_set_epi64x(i1, i0) ({         \
>+	rte_xmm_t m;                      \
>+	m.u64[0] = i0;                    \
>+	m.u64[1] = i1;                    \
>+	(m.x);                            \
>+})
>+
>+/* Sets the 4 signed 32-bit integer values. */
>+#define _mm_set_epi32(i3, i2, i1, i0)  ({ \
>+	rte_xmm_t m;                      \
>+	m.u32[0] = i0;                    \
>+	m.u32[1] = i1;                    \
>+	m.u32[2] = i2;                    \
>+	m.u32[3] = i3;                    \
>+	(m.x);                            \
>+})
>+
>+/* Shifts right the 4 32-bit integers by count bits with zeros. */
>+#define _mm_srli_epi32(v, cnt) ({                  \
>+	rte_xmm_t m;                                 \
>+	m.u64[0] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[0], cnt); \
>+	m.u64[1] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[1], cnt); \
>+	(m.x);                                       \
>+})
>+
>+/* Shifts the 128-bit value in a right by imm bytes. */
>+#define _mm_srli_si128(v, imm) ((v) >> (imm * sizeof(uint8_t)))
>+
>+/* Bitwise AND of the 128-bit value in a and the 128-bit value in b. */
>+#define _mm_and_si128(a, b) ((a) & (b))
>+
>+/* Loads 128-bit value. */
>+#define _mm_loadu_si128(p) (*(p))
>+
>+#ifdef __cplusplus
>+}
>+#endif
>+
>+#endif /* _RTE_VECT_H_ */
>--
>1.7.1

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

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

* Re: [dpdk-dev] [PATCH 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits
  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
  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
  1 sibling, 0 replies; 20+ messages in thread
From: Tony Lu @ 2016-01-08  7:49 UTC (permalink / raw)
  To: 'Liming Sun', dev

>-----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>

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

* [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  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
@ 2016-01-08 14:39   ` 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
                       ` (3 more replies)
  1 sibling, 4 replies; 20+ messages in thread
From: Liming Sun @ 2016-01-08 14:39 UTC (permalink / raw)
  To: dev

rte_vect.h was missing earlier thus LPM was disabled and l3fwd is
not able to compile. This commit implements the vector api and
enable LPM in the tilegx configuration by default. It also includes
a minor optimization to use __insn_fetchadd4() instead of
rte_atomic32_xxx() in mpipe_dp_enter/mpipe_dp_exit to avoid the
unnecessary memory fence.

Signed-off-by: Liming Sun <lsun@ezchip.com>
Acked-by: Zhigang Lu <zlu@ezchip.com>
---
 config/defconfig_tile-tilegx-linuxapp-gcc          |  2 +-
 drivers/net/mpipe/mpipe_tilegx.c                   | 18 +++--
 lib/librte_eal/common/include/arch/tile/rte_vect.h | 93 ++++++++++++++++++++++
 3 files changed, 107 insertions(+), 6 deletions(-)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_vect.h

diff --git a/config/defconfig_tile-tilegx-linuxapp-gcc b/config/defconfig_tile-tilegx-linuxapp-gcc
index fb61bcd..39794f6 100644
--- a/config/defconfig_tile-tilegx-linuxapp-gcc
+++ b/config/defconfig_tile-tilegx-linuxapp-gcc
@@ -64,7 +64,7 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 
 # This following libraries are not available on the tile architecture.
 # So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
+CONFIG_RTE_LIBRTE_LPM=y
 CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 5845511..8d006fa 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -451,13 +451,13 @@ static inline void
 mpipe_dp_enter(struct mpipe_dev_priv *priv)
 {
 	__insn_mtspr(SPR_DSTREAM_PF, 0);
-	rte_atomic32_inc(&priv->dp_count);
+	__insn_fetchadd4(&priv->dp_count, 1);
 }
 
 static inline void
 mpipe_dp_exit(struct mpipe_dev_priv *priv)
 {
-	rte_atomic32_dec(&priv->dp_count);
+	__insn_fetchadd4(&priv->dp_count, -1);
 }
 
 static inline void
@@ -484,12 +484,20 @@ mpipe_recv_mbuf(struct mpipe_dev_priv *priv, gxio_mpipe_idesc_t *idesc,
 	uint16_t size = gxio_mpipe_idesc_get_xfer_size(idesc);
 	struct rte_mbuf *mbuf = RTE_PTR_SUB(va, priv->rx_offset);
 
-	rte_pktmbuf_reset(mbuf);
 	mbuf->data_off = (uintptr_t)va - (uintptr_t)mbuf->buf_addr;
-	mbuf->port     = in_port;
-	mbuf->data_len = size;
+	mbuf->nb_segs = 1;
+	mbuf->port = in_port;
+	mbuf->ol_flags = 0;
+	if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv4)
+		mbuf->packet_type = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L2_ETHER;
+	else if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv6)
+		mbuf->packet_type = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L2_ETHER;
+	else
+		mbuf->packet_type = RTE_PTYPE_UNKNOWN;
 	mbuf->pkt_len  = size;
+	mbuf->data_len = size;
 	mbuf->hash.rss = gxio_mpipe_idesc_get_flow_hash(idesc);
+	mbuf->next = NULL;
 
 	PMD_DEBUG_RX("%s: RX mbuf %p, buffer %p, buf_addr %p, size %d\n",
 		     mpipe_name(priv), mbuf, va, mbuf->buf_addr, size);
diff --git a/lib/librte_eal/common/include/arch/tile/rte_vect.h b/lib/librte_eal/common/include/arch/tile/rte_vect.h
new file mode 100644
index 0000000..32d768a
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_vect.h
@@ -0,0 +1,93 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) EZchip Semiconductor Ltd. 2015.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of EZchip Semiconductor nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_VECT_H_
+#define _RTE_VECT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef __int128 __m128i;
+
+#define	XMM_SIZE	sizeof(__m128i)
+#define	XMM_MASK	(XMM_SIZE - 1)
+
+typedef union rte_xmm {
+	__m128i x;
+	uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+	uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+} rte_xmm_t;
+
+/* Extracts the low order 64-bit integer. */
+#define _mm_cvtsi128_si64(a) ((rte_xmm_t*)&a)->u64[0]
+
+/* Sets the 2 signed 64-bit integer values. */
+#define _mm_set_epi64x(i1, i0) ({         \
+	rte_xmm_t m;                      \
+	m.u64[0] = i0;                    \
+	m.u64[1] = i1;                    \
+	(m.x);                            \
+})
+
+/* Sets the 4 signed 32-bit integer values. */
+#define _mm_set_epi32(i3, i2, i1, i0)  ({ \
+	rte_xmm_t m;                      \
+	m.u32[0] = i0;                    \
+	m.u32[1] = i1;                    \
+	m.u32[2] = i2;                    \
+	m.u32[3] = i3;                    \
+	(m.x);                            \
+})
+
+/* Shifts right the 4 32-bit integers by count bits with zeros. */
+#define _mm_srli_epi32(v, cnt) ({                  \
+	rte_xmm_t m;                                 \
+	m.u64[0] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[0], cnt); \
+	m.u64[1] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[1], cnt); \
+	(m.x);                                       \
+})
+
+/* Shifts the 128-bit value in a right by imm bytes. */
+#define _mm_srli_si128(v, imm) ((v) >> (imm * sizeof(uint8_t)))
+
+/* Bitwise AND of the 128-bit value in a and the 128-bit value in b. */
+#define _mm_and_si128(a, b) ((a) & (b))
+
+/* Loads 128-bit value. */
+#define _mm_loadu_si128(p) (*(p))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VECT_H_ */
-- 
1.8.3.1

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

* [dpdk-dev] [PATCH v2 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits
  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     ` Liming Sun
  2016-02-09 15:59       ` Bruce Richardson
  2016-02-10  5:15       ` [dpdk-dev] [PATCH v3] " Liming Sun
  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
                       ` (2 subsequent siblings)
  3 siblings, 2 replies; 20+ messages in thread
From: Liming Sun @ 2016-01-08 14:39 UTC (permalink / raw)
  To: dev

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>
Acked-by: Zhigang Lu <zlu@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.8.3.1

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

* Re: [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  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:55     ` 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  4:04     ` [dpdk-dev] [PATCH v4 1/2] eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM Liming Sun
  3 siblings, 2 replies; 20+ messages in thread
From: Bruce Richardson @ 2016-02-09 15:55 UTC (permalink / raw)
  To: Liming Sun; +Cc: dev

On Fri, Jan 08, 2016 at 09:39:07AM -0500, Liming Sun wrote:
> rte_vect.h was missing earlier thus LPM was disabled and l3fwd is
> not able to compile. This commit implements the vector api and
> enable LPM in the tilegx configuration by default. It also includes
> a minor optimization to use __insn_fetchadd4() instead of
> rte_atomic32_xxx() in mpipe_dp_enter/mpipe_dp_exit to avoid the
> unnecessary memory fence.

This looks like it should be two patches to me. One patch to add the missing
dependency and get lpm to work. The second patch should then contain the driver
optimization. Do you agree?

/Bruce

PS: the commit title prefix for the first patch should probably be "eal/tile"
rather than mpipe, since it's not directly affecting the mpipe driver.

> 
> Signed-off-by: Liming Sun <lsun@ezchip.com>
> Acked-by: Zhigang Lu <zlu@ezchip.com>
> ---
>  config/defconfig_tile-tilegx-linuxapp-gcc          |  2 +-
>  drivers/net/mpipe/mpipe_tilegx.c                   | 18 +++--
>  lib/librte_eal/common/include/arch/tile/rte_vect.h | 93 ++++++++++++++++++++++
>  3 files changed, 107 insertions(+), 6 deletions(-)
>  create mode 100644 lib/librte_eal/common/include/arch/tile/rte_vect.h
> 
[snip]
>+	mbuf->next = NULL;
>  
>  	PMD_DEBUG_RX("%s: RX mbuf %p, buffer %p, buf_addr %p, size %d\n",
>  		     mpipe_name(priv), mbuf, va, mbuf->buf_addr, size);
> diff --git a/lib/librte_eal/common/include/arch/tile/rte_vect.h b/lib/librte_eal/common/include/arch/tile/rte_vect.h
> new file mode 100644
> index 0000000..32d768a
> --- /dev/null
> +++ b/lib/librte_eal/common/include/arch/tile/rte_vect.h
> @@ -0,0 +1,93 @@
> +/*
> + *   BSD LICENSE
> + *
> + *   Copyright (C) EZchip Semiconductor Ltd. 2015.

Maybe update the copyright year?

> + *
> + *   Redistribution and use in source and binary forms, with or without
> + *   modification, are permitted provided that the following conditions
[snip]

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

* Re: [dpdk-dev] [PATCH v2 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits
  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
  1 sibling, 1 reply; 20+ messages in thread
From: Bruce Richardson @ 2016-02-09 15:59 UTC (permalink / raw)
  To: Liming Sun; +Cc: dev

On Fri, Jan 08, 2016 at 09:39:08AM -0500, Liming Sun wrote:
> 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.
> 

Again, with two issues being solved, this looks like two patches. Can you
also describe exactly the causes of the individual issues in each patch and how
the patch fixes them. 
Please also include a fixes line for each patch as described here:

http://dpdk.org/doc/guides/contributing/patches.html#commit-messages-body

Thanks,
/Bruce

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

* Re: [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  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
  1 sibling, 0 replies; 20+ messages in thread
From: Liming Sun @ 2016-02-09 18:40 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

Make sense. I'll split them into different patches.

Thanks!
Liming

-----Original Message-----
From: Bruce Richardson [mailto:bruce.richardson@intel.com] 
Sent: Tuesday, February 09, 2016 10:56 AM
To: Liming Sun
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM

On Fri, Jan 08, 2016 at 09:39:07AM -0500, Liming Sun wrote:
> rte_vect.h was missing earlier thus LPM was disabled and l3fwd is not 
> able to compile. This commit implements the vector api and enable LPM 
> in the tilegx configuration by default. It also includes a minor 
> optimization to use __insn_fetchadd4() instead of
> rte_atomic32_xxx() in mpipe_dp_enter/mpipe_dp_exit to avoid the 
> unnecessary memory fence.

This looks like it should be two patches to me. One patch to add the missing dependency and get lpm to work. The second patch should then contain the driver optimization. Do you agree?

/Bruce

PS: the commit title prefix for the first patch should probably be "eal/tile"
rather than mpipe, since it's not directly affecting the mpipe driver.

> 
> Signed-off-by: Liming Sun <lsun@ezchip.com>
> Acked-by: Zhigang Lu <zlu@ezchip.com>
> ---
>  config/defconfig_tile-tilegx-linuxapp-gcc          |  2 +-
>  drivers/net/mpipe/mpipe_tilegx.c                   | 18 +++--
>  lib/librte_eal/common/include/arch/tile/rte_vect.h | 93 
> ++++++++++++++++++++++
>  3 files changed, 107 insertions(+), 6 deletions(-)  create mode 
> 100644 lib/librte_eal/common/include/arch/tile/rte_vect.h
> 
[snip]
>+	mbuf->next = NULL;
>  
>  	PMD_DEBUG_RX("%s: RX mbuf %p, buffer %p, buf_addr %p, size %d\n",
>  		     mpipe_name(priv), mbuf, va, mbuf->buf_addr, size); diff --git 
> a/lib/librte_eal/common/include/arch/tile/rte_vect.h 
> b/lib/librte_eal/common/include/arch/tile/rte_vect.h
> new file mode 100644
> index 0000000..32d768a
> --- /dev/null
> +++ b/lib/librte_eal/common/include/arch/tile/rte_vect.h
> @@ -0,0 +1,93 @@
> +/*
> + *   BSD LICENSE
> + *
> + *   Copyright (C) EZchip Semiconductor Ltd. 2015.

Maybe update the copyright year?

> + *
> + *   Redistribution and use in source and binary forms, with or without
> + *   modification, are permitted provided that the following conditions
[snip]

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

* [dpdk-dev] [PATCH v3 1/2] eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  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:55     ` [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM Bruce Richardson
@ 2016-02-10  3:46     ` 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
  3 siblings, 1 reply; 20+ messages in thread
From: Liming Sun @ 2016-02-10  3:46 UTC (permalink / raw)
  To: dev

rte_vect.h was missing earlier thus LPM was disabled and l3fwd is
not able to compile. This commit implements the vector api and
enable LPM in the tilegx configuration by default.

Signed-off-by: Liming Sun <lsun@ezchip.com>
Acked-by: Zhigang Lu <zlu@ezchip.com>
---
 config/defconfig_tile-tilegx-linuxapp-gcc          |  2 +-
 lib/librte_eal/common/include/arch/tile/rte_vect.h | 93 ++++++++++++++++++++++
 2 files changed, 94 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_vect.h

diff --git a/config/defconfig_tile-tilegx-linuxapp-gcc b/config/defconfig_tile-tilegx-linuxapp-gcc
index fb61bcd..39794f6 100644
--- a/config/defconfig_tile-tilegx-linuxapp-gcc
+++ b/config/defconfig_tile-tilegx-linuxapp-gcc
@@ -64,7 +64,7 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 
 # This following libraries are not available on the tile architecture.
 # So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
+CONFIG_RTE_LIBRTE_LPM=y
 CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
diff --git a/lib/librte_eal/common/include/arch/tile/rte_vect.h b/lib/librte_eal/common/include/arch/tile/rte_vect.h
new file mode 100644
index 0000000..9afee70
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_vect.h
@@ -0,0 +1,93 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) EZchip Semiconductor Ltd. 2016.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of EZchip Semiconductor nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_VECT_H_
+#define _RTE_VECT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef __int128 __m128i;
+
+#define	XMM_SIZE	sizeof(__m128i)
+#define	XMM_MASK	(XMM_SIZE - 1)
+
+typedef union rte_xmm {
+	__m128i x;
+	uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+	uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+} rte_xmm_t;
+
+/* Extracts the low order 64-bit integer. */
+#define _mm_cvtsi128_si64(a) ((rte_xmm_t*)&a)->u64[0]
+
+/* Sets the 2 signed 64-bit integer values. */
+#define _mm_set_epi64x(i1, i0) ({         \
+	rte_xmm_t m;                      \
+	m.u64[0] = i0;                    \
+	m.u64[1] = i1;                    \
+	(m.x);                            \
+})
+
+/* Sets the 4 signed 32-bit integer values. */
+#define _mm_set_epi32(i3, i2, i1, i0)  ({ \
+	rte_xmm_t m;                      \
+	m.u32[0] = i0;                    \
+	m.u32[1] = i1;                    \
+	m.u32[2] = i2;                    \
+	m.u32[3] = i3;                    \
+	(m.x);                            \
+})
+
+/* Shifts right the 4 32-bit integers by count bits with zeros. */
+#define _mm_srli_epi32(v, cnt) ({                  \
+	rte_xmm_t m;                                 \
+	m.u64[0] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[0], cnt); \
+	m.u64[1] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[1], cnt); \
+	(m.x);                                       \
+})
+
+/* Shifts the 128-bit value in a right by imm bytes. */
+#define _mm_srli_si128(v, imm) ((v) >> (imm * sizeof(uint8_t)))
+
+/* Bitwise AND of the 128-bit value in a and the 128-bit value in b. */
+#define _mm_and_si128(a, b) ((a) & (b))
+
+/* Loads 128-bit value. */
+#define _mm_loadu_si128(p) (*(p))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VECT_H_ */
-- 
1.8.3.1

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

* [dpdk-dev] [PATCH v3 2/2] driver/net/mpipe: some code optimization
  2016-02-10  3:46     ` [dpdk-dev] [PATCH v3 1/2] eal/tile: " Liming Sun
@ 2016-02-10  3:47       ` Liming Sun
  0 siblings, 0 replies; 20+ messages in thread
From: Liming Sun @ 2016-02-10  3:47 UTC (permalink / raw)
  To: dev

This commit includes two small code optimization.
1. use __insn_fetchadd4() instead of rte_atomic32_xxx() in
   mpipe_dp_enter/mpipe_dp_exit to avoid the nnecessary memory
   fence.
2. replace the calling of rte_pktmbuf_reset() in mpipe_recv_mbuf()
   with specific code to avoid some duplicated initializations.
---
 drivers/net/mpipe/mpipe_tilegx.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 5845511..8d006fa 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -451,13 +451,13 @@ static inline void
 mpipe_dp_enter(struct mpipe_dev_priv *priv)
 {
 	__insn_mtspr(SPR_DSTREAM_PF, 0);
-	rte_atomic32_inc(&priv->dp_count);
+	__insn_fetchadd4(&priv->dp_count, 1);
 }
 
 static inline void
 mpipe_dp_exit(struct mpipe_dev_priv *priv)
 {
-	rte_atomic32_dec(&priv->dp_count);
+	__insn_fetchadd4(&priv->dp_count, -1);
 }
 
 static inline void
@@ -484,12 +484,20 @@ mpipe_recv_mbuf(struct mpipe_dev_priv *priv, gxio_mpipe_idesc_t *idesc,
 	uint16_t size = gxio_mpipe_idesc_get_xfer_size(idesc);
 	struct rte_mbuf *mbuf = RTE_PTR_SUB(va, priv->rx_offset);
 
-	rte_pktmbuf_reset(mbuf);
 	mbuf->data_off = (uintptr_t)va - (uintptr_t)mbuf->buf_addr;
-	mbuf->port     = in_port;
-	mbuf->data_len = size;
+	mbuf->nb_segs = 1;
+	mbuf->port = in_port;
+	mbuf->ol_flags = 0;
+	if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv4)
+		mbuf->packet_type = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L2_ETHER;
+	else if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv6)
+		mbuf->packet_type = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L2_ETHER;
+	else
+		mbuf->packet_type = RTE_PTYPE_UNKNOWN;
 	mbuf->pkt_len  = size;
+	mbuf->data_len = size;
 	mbuf->hash.rss = gxio_mpipe_idesc_get_flow_hash(idesc);
+	mbuf->next = NULL;
 
 	PMD_DEBUG_RX("%s: RX mbuf %p, buffer %p, buf_addr %p, size %d\n",
 		     mpipe_name(priv), mbuf, va, mbuf->buf_addr, size);
-- 
1.8.3.1

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

* [dpdk-dev] [PATCH v4 1/2] eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  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
                       ` (2 preceding siblings ...)
  2016-02-10  3:46     ` [dpdk-dev] [PATCH v3 1/2] eal/tile: " Liming Sun
@ 2016-02-10  4:04     ` 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
  3 siblings, 2 replies; 20+ messages in thread
From: Liming Sun @ 2016-02-10  4:04 UTC (permalink / raw)
  To: dev

rte_vect.h was missing earlier thus LPM was disabled and l3fwd is
not able to compile. This commit implements the vector api and
enable LPM in the tilegx configuration by default.

Signed-off-by: Liming Sun <lsun@ezchip.com>
Acked-by: Zhigang Lu <zlu@ezchip.com>
---
 config/defconfig_tile-tilegx-linuxapp-gcc          |  2 +-
 lib/librte_eal/common/include/arch/tile/rte_vect.h | 93 ++++++++++++++++++++++
 2 files changed, 94 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/common/include/arch/tile/rte_vect.h

diff --git a/config/defconfig_tile-tilegx-linuxapp-gcc b/config/defconfig_tile-tilegx-linuxapp-gcc
index fb61bcd..39794f6 100644
--- a/config/defconfig_tile-tilegx-linuxapp-gcc
+++ b/config/defconfig_tile-tilegx-linuxapp-gcc
@@ -64,7 +64,7 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 
 # This following libraries are not available on the tile architecture.
 # So they're turned off.
-CONFIG_RTE_LIBRTE_LPM=n
+CONFIG_RTE_LIBRTE_LPM=y
 CONFIG_RTE_LIBRTE_ACL=n
 CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
diff --git a/lib/librte_eal/common/include/arch/tile/rte_vect.h b/lib/librte_eal/common/include/arch/tile/rte_vect.h
new file mode 100644
index 0000000..9afee70
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/tile/rte_vect.h
@@ -0,0 +1,93 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) EZchip Semiconductor Ltd. 2016.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of EZchip Semiconductor nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _RTE_VECT_H_
+#define _RTE_VECT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef __int128 __m128i;
+
+#define	XMM_SIZE	sizeof(__m128i)
+#define	XMM_MASK	(XMM_SIZE - 1)
+
+typedef union rte_xmm {
+	__m128i x;
+	uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+	uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+} rte_xmm_t;
+
+/* Extracts the low order 64-bit integer. */
+#define _mm_cvtsi128_si64(a) ((rte_xmm_t*)&a)->u64[0]
+
+/* Sets the 2 signed 64-bit integer values. */
+#define _mm_set_epi64x(i1, i0) ({         \
+	rte_xmm_t m;                      \
+	m.u64[0] = i0;                    \
+	m.u64[1] = i1;                    \
+	(m.x);                            \
+})
+
+/* Sets the 4 signed 32-bit integer values. */
+#define _mm_set_epi32(i3, i2, i1, i0)  ({ \
+	rte_xmm_t m;                      \
+	m.u32[0] = i0;                    \
+	m.u32[1] = i1;                    \
+	m.u32[2] = i2;                    \
+	m.u32[3] = i3;                    \
+	(m.x);                            \
+})
+
+/* Shifts right the 4 32-bit integers by count bits with zeros. */
+#define _mm_srli_epi32(v, cnt) ({                  \
+	rte_xmm_t m;                                 \
+	m.u64[0] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[0], cnt); \
+	m.u64[1] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[1], cnt); \
+	(m.x);                                       \
+})
+
+/* Shifts the 128-bit value in a right by imm bytes. */
+#define _mm_srli_si128(v, imm) ((v) >> (imm * sizeof(uint8_t)))
+
+/* Bitwise AND of the 128-bit value in a and the 128-bit value in b. */
+#define _mm_and_si128(a, b) ((a) & (b))
+
+/* Loads 128-bit value. */
+#define _mm_loadu_si128(p) (*(p))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_VECT_H_ */
-- 
1.8.3.1

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

* [dpdk-dev] [PATCH v4 2/2] driver/net/mpipe: some code optimization
  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       ` 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
  1 sibling, 0 replies; 20+ messages in thread
From: Liming Sun @ 2016-02-10  4:04 UTC (permalink / raw)
  To: dev

This commit includes two small code optimization.
1. use __insn_fetchadd4() instead of rte_atomic32_xxx() in
   mpipe_dp_enter/mpipe_dp_exit to avoid the nnecessary memory
   fence.
2. replace the calling of rte_pktmbuf_reset() in mpipe_recv_mbuf()
   with specific code to avoid some duplicated initializations.

Signed-off-by: Liming Sun <lsun@ezchip.com>
Acked-by: Zhigang Lu <zlu@ezchip.com>
---
 drivers/net/mpipe/mpipe_tilegx.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index 5845511..8d006fa 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -451,13 +451,13 @@ static inline void
 mpipe_dp_enter(struct mpipe_dev_priv *priv)
 {
 	__insn_mtspr(SPR_DSTREAM_PF, 0);
-	rte_atomic32_inc(&priv->dp_count);
+	__insn_fetchadd4(&priv->dp_count, 1);
 }
 
 static inline void
 mpipe_dp_exit(struct mpipe_dev_priv *priv)
 {
-	rte_atomic32_dec(&priv->dp_count);
+	__insn_fetchadd4(&priv->dp_count, -1);
 }
 
 static inline void
@@ -484,12 +484,20 @@ mpipe_recv_mbuf(struct mpipe_dev_priv *priv, gxio_mpipe_idesc_t *idesc,
 	uint16_t size = gxio_mpipe_idesc_get_xfer_size(idesc);
 	struct rte_mbuf *mbuf = RTE_PTR_SUB(va, priv->rx_offset);
 
-	rte_pktmbuf_reset(mbuf);
 	mbuf->data_off = (uintptr_t)va - (uintptr_t)mbuf->buf_addr;
-	mbuf->port     = in_port;
-	mbuf->data_len = size;
+	mbuf->nb_segs = 1;
+	mbuf->port = in_port;
+	mbuf->ol_flags = 0;
+	if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv4)
+		mbuf->packet_type = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L2_ETHER;
+	else if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv6)
+		mbuf->packet_type = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L2_ETHER;
+	else
+		mbuf->packet_type = RTE_PTYPE_UNKNOWN;
 	mbuf->pkt_len  = size;
+	mbuf->data_len = size;
 	mbuf->hash.rss = gxio_mpipe_idesc_get_flow_hash(idesc);
+	mbuf->next = NULL;
 
 	PMD_DEBUG_RX("%s: RX mbuf %p, buffer %p, buf_addr %p, size %d\n",
 		     mpipe_name(priv), mbuf, va, mbuf->buf_addr, size);
-- 
1.8.3.1

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

* [dpdk-dev] [PATCH v3] driver/net/mpipe: fix the crash/hung issue when testpmd quits
  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  5:15       ` Liming Sun
  2016-02-26 17:35         ` Bruce Richardson
  1 sibling, 1 reply; 20+ messages in thread
From: Liming Sun @ 2016-02-10  5:15 UTC (permalink / raw)
  To: dev

Fixes: the hung/crash issue when quitting testpmd under high
traffic rate. The following issue were found and fixed.
1. edesc->size is not initialized properly in mpipe_do_xmit() and could
   cause buffer leak or corruption when HW buffer return is used.
2. Check the 'idesc.be' error bit in mpipe_recv_flush() to make sure
   buffer is valid before releasing it. This is to avoid issues when
   running out of buffers.
3. priv->rx_buffers counter is not accurate when HW buffer return is
   used. Remove this counter to simplify the code.

Signed-off-by: Liming Sun <lsun@ezchip.com>
Acked-by: Zhigang Lu <zlu@ezchip.com>
---
 drivers/net/mpipe/mpipe_tilegx.c | 46 ++++++++++++++--------------------------
 1 file changed, 16 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]--;
-- 
1.8.3.1

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

* Re: [dpdk-dev] [PATCH v2 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits
  2016-02-09 15:59       ` Bruce Richardson
@ 2016-02-10 14:50         ` Liming Sun
  0 siblings, 0 replies; 20+ messages in thread
From: Liming Sun @ 2016-02-10 14:50 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

I split the change and resubmitted it as v3 http://dpdk.org/dev/patchwork/patch/10456/
It includes one of the two fixes. The other one is optional for now and could be submitted separately later.

Thanks,
Liming

-----Original Message-----
From: Bruce Richardson [mailto:bruce.richardson@intel.com] 
Sent: Tuesday, February 09, 2016 10:59 AM
To: Liming Sun
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits

On Fri, Jan 08, 2016 at 09:39:08AM -0500, Liming Sun wrote:
> 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.
> 

Again, with two issues being solved, this looks like two patches. Can you also describe exactly the causes of the individual issues in each patch and how the patch fixes them. 
Please also include a fixes line for each patch as described here:

http://dpdk.org/doc/guides/contributing/patches.html#commit-messages-body

Thanks,
/Bruce

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

* Re: [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  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
  1 sibling, 0 replies; 20+ messages in thread
From: Liming Sun @ 2016-02-10 14:52 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

Thanks Bruce. I split the changes as suggested and resubmitted as below.

http://dpdk.org/dev/patchwork/patch/10454/
http://dpdk.org/dev/patchwork/patch/10455/

- Liming

-----Original Message-----
From: Bruce Richardson [mailto:bruce.richardson@intel.com] 
Sent: Tuesday, February 09, 2016 10:56 AM
To: Liming Sun
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM

On Fri, Jan 08, 2016 at 09:39:07AM -0500, Liming Sun wrote:
> rte_vect.h was missing earlier thus LPM was disabled and l3fwd is not 
> able to compile. This commit implements the vector api and enable LPM 
> in the tilegx configuration by default. It also includes a minor 
> optimization to use __insn_fetchadd4() instead of
> rte_atomic32_xxx() in mpipe_dp_enter/mpipe_dp_exit to avoid the 
> unnecessary memory fence.

This looks like it should be two patches to me. One patch to add the missing dependency and get lpm to work. The second patch should then contain the driver optimization. Do you agree?

/Bruce

PS: the commit title prefix for the first patch should probably be "eal/tile"
rather than mpipe, since it's not directly affecting the mpipe driver.

> 
> Signed-off-by: Liming Sun <lsun@ezchip.com>
> Acked-by: Zhigang Lu <zlu@ezchip.com>
> ---
>  config/defconfig_tile-tilegx-linuxapp-gcc          |  2 +-
>  drivers/net/mpipe/mpipe_tilegx.c                   | 18 +++--
>  lib/librte_eal/common/include/arch/tile/rte_vect.h | 93 
> ++++++++++++++++++++++
>  3 files changed, 107 insertions(+), 6 deletions(-)  create mode 
> 100644 lib/librte_eal/common/include/arch/tile/rte_vect.h
> 
[snip]
>+	mbuf->next = NULL;
>  
>  	PMD_DEBUG_RX("%s: RX mbuf %p, buffer %p, buf_addr %p, size %d\n",
>  		     mpipe_name(priv), mbuf, va, mbuf->buf_addr, size); diff --git 
> a/lib/librte_eal/common/include/arch/tile/rte_vect.h 
> b/lib/librte_eal/common/include/arch/tile/rte_vect.h
> new file mode 100644
> index 0000000..32d768a
> --- /dev/null
> +++ b/lib/librte_eal/common/include/arch/tile/rte_vect.h
> @@ -0,0 +1,93 @@
> +/*
> + *   BSD LICENSE
> + *
> + *   Copyright (C) EZchip Semiconductor Ltd. 2015.

Maybe update the copyright year?

> + *
> + *   Redistribution and use in source and binary forms, with or without
> + *   modification, are permitted provided that the following conditions
[snip]

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

* Re: [dpdk-dev] [PATCH v3] driver/net/mpipe: fix the crash/hung issue when testpmd quits
  2016-02-10  5:15       ` [dpdk-dev] [PATCH v3] " Liming Sun
@ 2016-02-26 17:35         ` Bruce Richardson
  0 siblings, 0 replies; 20+ messages in thread
From: Bruce Richardson @ 2016-02-26 17:35 UTC (permalink / raw)
  To: Liming Sun; +Cc: dev

On Wed, Feb 10, 2016 at 12:15:21AM -0500, Liming Sun wrote:
> Fixes: the hung/crash issue when quitting testpmd under high
> traffic rate. The following issue were found and fixed.
> 1. edesc->size is not initialized properly in mpipe_do_xmit() and could
>    cause buffer leak or corruption when HW buffer return is used.
> 2. Check the 'idesc.be' error bit in mpipe_recv_flush() to make sure
>    buffer is valid before releasing it. This is to avoid issues when
>    running out of buffers.
> 3. priv->rx_buffers counter is not accurate when HW buffer return is
>    used. Remove this counter to simplify the code.
> 
> Signed-off-by: Liming Sun <lsun@ezchip.com>
> Acked-by: Zhigang Lu <zlu@ezchip.com>
> ---

Applied to dpdk-next-net/rel_16_04

/Bruce

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

* Re: [dpdk-dev] [PATCH v4 1/2] eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  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       ` Thomas Monjalon
  2016-03-17 14:04         ` Thomas Monjalon
  1 sibling, 1 reply; 20+ messages in thread
From: Thomas Monjalon @ 2016-03-08 19:59 UTC (permalink / raw)
  To: Liming Sun; +Cc: dev

2016-02-09 23:04, Liming Sun:
> rte_vect.h was missing earlier thus LPM was disabled and l3fwd is
> not able to compile. This commit implements the vector api and
> enable LPM in the tilegx configuration by default.
> 
> Signed-off-by: Liming Sun <lsun@ezchip.com>
> Acked-by: Zhigang Lu <zlu@ezchip.com>
[...]
>  # This following libraries are not available on the tile architecture.
>  # So they're turned off.
> -CONFIG_RTE_LIBRTE_LPM=n
> +CONFIG_RTE_LIBRTE_LPM=y

You just have to remove the disabling line.

> +typedef union rte_xmm {
> +	__m128i x;
> +	uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
> +	uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
> +} rte_xmm_t;

Why do you mimic SSE?

> +/* Shifts right the 4 32-bit integers by count bits with zeros. */
> +#define _mm_srli_epi32(v, cnt) ({                  \
> +	rte_xmm_t m;                                 \
> +	m.u64[0] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[0], cnt); \
> +	m.u64[1] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[1], cnt); \
> +	(m.x);                                       \
> +})

Please check the work in progress to have arch-specific implementation
of rte_lpm_lookupx4():
	http://dpdk.org/dev/patchwork/patch/10478/

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

* Re: [dpdk-dev] [PATCH v4 1/2] eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
  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
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Monjalon @ 2016-03-17 14:04 UTC (permalink / raw)
  To: Liming Sun; +Cc: dev, Zhigang Lu

Any news? a v5 could be part of the RC2.

2016-03-08 20:59, Thomas Monjalon:
> 2016-02-09 23:04, Liming Sun:
> > rte_vect.h was missing earlier thus LPM was disabled and l3fwd is
> > not able to compile. This commit implements the vector api and
> > enable LPM in the tilegx configuration by default.
> > 
> > Signed-off-by: Liming Sun <lsun@ezchip.com>
> > Acked-by: Zhigang Lu <zlu@ezchip.com>
> [...]
> >  # This following libraries are not available on the tile architecture.
> >  # So they're turned off.
> > -CONFIG_RTE_LIBRTE_LPM=n
> > +CONFIG_RTE_LIBRTE_LPM=y
> 
> You just have to remove the disabling line.
> 
> > +typedef union rte_xmm {
> > +	__m128i x;
> > +	uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
> > +	uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
> > +} rte_xmm_t;
> 
> Why do you mimic SSE?
> 
> > +/* Shifts right the 4 32-bit integers by count bits with zeros. */
> > +#define _mm_srli_epi32(v, cnt) ({                  \
> > +	rte_xmm_t m;                                 \
> > +	m.u64[0] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[0], cnt); \
> > +	m.u64[1] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[1], cnt); \
> > +	(m.x);                                       \
> > +})
> 
> Please check the work in progress to have arch-specific implementation
> of rte_lpm_lookupx4():
> 	http://dpdk.org/dev/patchwork/patch/10478/

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

end of thread, other threads:[~2016-03-17 14:06 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).