Some enhancement of the tilegx mpipe driver
cover Some enhancement of the tilegx mpipe driver
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
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.
--- 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
config/defconfig_tile-tilegx-linuxapp-gcc +1 -1
@@ -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
drivers/net/mpipe/mpipe_tilegx.c +13 -5
@@ -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);
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 2/2 driver/net/mpipe: fix the crash/hung issue when testpmd quits
In reply to Liming Sun1. 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.
--- drivers/net/mpipe/mpipe_tilegx.c | 46 +++++++------------- .../common/include/arch/tile/rte_rwlock.h | 1 + 2 files changed, 17 insertions(+), 30 deletions(-)
drivers/net/mpipe/mpipe_tilegx.c +16 -30
@@ -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]--;
lib/librte_eal/common/include/arch/tile/rte_rwlock.h +1 -0
@@ -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)
Signature · 1 line
1.7.1
Re: [PATCH 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
In reply to Liming SunQuoted 195 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Liming Sun
Sent: Wednesday, December 23, 2015 3:50 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/2] driver/net/mpipe: addrte_vect.hand enableCONFIG_RTE_LIBRTE_LPM
rte_vect.hwas 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 ofrte_atomic32_xxx()in mpipe_dp_enter/mpipe_dp_exit to avoid the unnecessary memory fence.Signed-off-by Liming Sun <[email protected]>---
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.hconfig/defconfig_tile-tilegx-linuxapp-gcc +1
-1@@ -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=nCONFIG_RTE_LIBRTE_SCHED=nCONFIG_RTE_LIBRTE_PORT=ndrivers/net/mpipe/mpipe_tilegx.c +1
-1@@ -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)
{drivers/net/mpipe/mpipe_tilegx.c +1
-1-rte_atomic32_dec (&priv->dp_count); +__insn_fetchadd4 (&priv->dp_count,-1 );}
static inline void
drivers/net/mpipe/mpipe_tilegx.c +11
-3@@ -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);lib/librte_eal/common/include/arch/tile/rte_vect.h new file +20
-0@@ -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.lib/librte_eal/common/include/arch/tile/rte_vect.h new file +63
-1+*/ + +#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_ */ --
Quoted 1 line
1.7.1
Re: [PATCH 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits
In reply to Liming SunQuoted 5 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Liming Sun
Sent: Wednesday, December 23, 2015 3:50 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH 2/2] driver/net/mpipe: fix the crash/hung issue
when
Quoted 66 lines
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 <[email protected]>---
drivers/net/mpipe/mpipe_tilegx.c| 46
+++++++-------------.../common/include/arch/tile/rte_rwlock.h| 1 +2 files changed, 17 insertions(+), 30 deletions(-)drivers/net/mpipe/mpipe_tilegx.c +1
-8@@ -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
drivers/net/mpipe/mpipe_tilegx.c +0
-1@@ -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 ;
drivers/net/mpipe/mpipe_tilegx.c mpipe_recv_flush(struct mpipe_dev_priv *priv) · line 1259
Quoted 10 lines
drivers/net/mpipe/mpipe_tilegx.c +0
-8unsigned 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) {
drivers/net/mpipe/mpipe_tilegx.c mpipe_recv_flush(struct mpipe_dev_priv *priv) · line 1260
Quoted 1 line
drivers/net/mpipe/mpipe_tilegx.c +0
-1- mbuf = mpipe_recv_mbuf(priv, &idesc,
in_port);
Quoted 31 lines
drivers/net/mpipe/mpipe_tilegx.c +14
-12-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); } }
drivers/net/mpipe/mpipe_tilegx.c mpipe_do_xmit(struct mpipe_tx_queue *tx_queue, · line 1327
Quoted 4 lines
drivers/net/mpipe/mpipe_tilegx.c +0
-0@@ -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),
Quoted 15 lines
drivers/net/mpipe/mpipe_tilegx.c +1
-0+ .size = priv->rx_size_code, } };if (mpipe_local.mbuf_push_debt[port_id] >0 ) {mpipe_local.mbuf_push_debt[port_id]--;lib/librte_eal/common/include/arch/tile/rte_rwlock.h +1
-0@@ -38,6 +38,7 @@ extern "C" {#endif #include "generic/rte_rwlock.h" +#include <rte_spinlock.h>
Quoted 4 lines
static inline void
rte_rwlock_read_lock_tm(rte_rwlock_t *rwl)
--
1.7.1
PATCH v2 1/2 driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
In reply to Liming Sunrte_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.
--- 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
config/defconfig_tile-tilegx-linuxapp-gcc +1 -1
@@ -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
drivers/net/mpipe/mpipe_tilegx.c +13 -5
@@ -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);
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 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.
--- drivers/net/mpipe/mpipe_tilegx.c | 46 ++++++++-------------- .../common/include/arch/tile/rte_rwlock.h | 1 + 2 files changed, 17 insertions(+), 30 deletions(-)
drivers/net/mpipe/mpipe_tilegx.c +16 -30
@@ -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]--;
lib/librte_eal/common/include/arch/tile/rte_rwlock.h +1 -0
@@ -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)
Signature · 1 line
1.8.3.1
Re: [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
In reply to Liming SunQuoted 6 lines · Liming Sun
rte_vect.hwas 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 ofrte_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.
Quoted 10 lines
Signed-off-by Liming Sun <[email protected]>Acked-by Zhigang Lu <[email protected]>--- 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]
Quoted 10 lines
drivers/net/mpipe/mpipe_tilegx.c +1
-0+ 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);lib/librte_eal/common/include/arch/tile/rte_vect.h new file +0
-0
lib/librte_eal/common/include/arch/tile/rte_vect.h line 4
Quoted 4 lines
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +4
-0@@ -0,0 +1,93 @@ +/* +* BSD LICENSE +* +* Copyright (C) EZchip Semiconductor Ltd. 2015.
Maybe update the copyright year?
Quoted 3 lines
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +3
-0+* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions
[snip]
Re: [PATCH v2 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits
In reply to Liming SunQuoted 7 lines · Liming Sun
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
Re: [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
In reply to Bruce RichardsonMake sense. I'll split them into different patches.
Thanks!
Liming
-----Original Message-----
From: Bruce Richardson [mailto:[email protected]]
Sent: Tuesday, February 09, 2016 10:56 AM
To: Liming Sun
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
Quoted 6 lines · Liming Sun
rte_vect.hwas 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 ofrte_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.
Quoted 11 lines
Signed-off-by Liming Sun <[email protected]>Acked-by Zhigang Lu <[email protected]>--- 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 mode100644
lib/librte_eal/common/include/arch/tile/rte_vect.h
[snip]
Quoted 11 lines
drivers/net/mpipe/mpipe_tilegx.c +1
-0+ 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.hb/lib/librte_eal/common/include/arch/tile/rte_vect.hnew file mode 100644
index 0000000..32d768a
lib/librte_eal/common/include/arch/tile/rte_vect.h line 4
Quoted 4 lines
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +4
-0@@ -0,0 +1,93 @@ +/* +* BSD LICENSE +* +* Copyright (C) EZchip Semiconductor Ltd. 2015.
Maybe update the copyright year?
Quoted 3 lines
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +3
-0+* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions
[snip]
PATCH v3 1/2 eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
In reply to Liming Sunrte_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.
--- 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
config/defconfig_tile-tilegx-linuxapp-gcc +1 -1
@@ -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
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 2/2 driver/net/mpipe: some code optimization
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(-)
drivers/net/mpipe/mpipe_tilegx.c +13 -5
@@ -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);
Signature · 1 line
1.8.3.1
PATCH v4 1/2 eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
In reply to Liming Sunrte_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.
--- 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
config/defconfig_tile-tilegx-linuxapp-gcc +1 -1
@@ -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
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v4 2/2 driver/net/mpipe: some code optimization
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(-)
drivers/net/mpipe/mpipe_tilegx.c +13 -5
@@ -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);
Signature · 1 line
1.8.3.1
PATCH v3 1/1 driver/net/mpipe: fix the crash/hung issue when testpmd quits
In reply to Liming SunFixes: 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.
--- drivers/net/mpipe/mpipe_tilegx.c | 46 ++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 30 deletions(-)
drivers/net/mpipe/mpipe_tilegx.c +16 -30
@@ -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]--;
Signature · 1 line
1.8.3.1
Re: [PATCH v2 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits
In reply to Bruce RichardsonI 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:[email protected]]
Sent: Tuesday, February 09, 2016 10:59 AM
To: Liming Sun
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits
Quoted 7 lines · Liming Sun
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
Re: [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
In reply to Bruce RichardsonThanks 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:[email protected]]
Sent: Tuesday, February 09, 2016 10:56 AM
To: Liming Sun
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
Quoted 6 lines · Liming Sun
rte_vect.hwas 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 ofrte_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.
Quoted 11 lines
Signed-off-by Liming Sun <[email protected]>Acked-by Zhigang Lu <[email protected]>--- 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 mode100644
lib/librte_eal/common/include/arch/tile/rte_vect.h
[snip]
Quoted 11 lines
drivers/net/mpipe/mpipe_tilegx.c +1
-0+ 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.hb/lib/librte_eal/common/include/arch/tile/rte_vect.hnew file mode 100644
index 0000000..32d768a
lib/librte_eal/common/include/arch/tile/rte_vect.h line 4
Quoted 4 lines
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +4
-0@@ -0,0 +1,93 @@ +/* +* BSD LICENSE +* +* Copyright (C) EZchip Semiconductor Ltd. 2015.
Maybe update the copyright year?
Quoted 3 lines
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +3
-0+* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions
[snip]
Bruce Richardson
AppliedRe: [PATCH v3] driver/net/mpipe: fix the crash/hung issue when testpmd quits
In reply to Liming SunQuoted 10 lines · Liming Sun
Fixes: the hung/crash issue when quitting testpmd under high traffic rate. The following issue were found and fixed.
1.edesc->sizeis not initialized properly inmpipe_do_xmit()and could cause buffer leak or corruption when HW buffer return is used.
2. Check the 'idesc.be' error bit inmpipe_recv_flush()to make sure buffer is valid before releasing it. This is to avoid issues when running out of buffers.
3.priv->rx_bufferscounter is not accurate when HW buffer return is used. Remove this counter to simplify the code.
Quoted 3 lines
Signed-off-by Liming Sun <[email protected]>Acked-by Zhigang Lu <[email protected]>---
Applied to dpdk-next-net/rel_16_04
/Bruce
Re: [PATCH v4 1/2] eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
In reply to Liming Sun2016-02-09 23:04, Liming Sun:
Quoted 6 lines
rte_vect.hwas 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 <[email protected]>Acked-by Zhigang Lu <[email protected]>
[...]
config/defconfig_tile-tilegx-linuxapp-gcc CONFIG_RTE_LIBRTE_ENIC_PMD=n · line 67
Quoted 4 lines
# This following libraries are not available on the tile architecture. # So they're turned off.
config/defconfig_tile-tilegx-linuxapp-gcc +1
-1-CONFIG_RTE_LIBRTE_LPM=n +CONFIG_RTE_LIBRTE_LPM=y
You just have to remove the disabling line.
lib/librte_eal/common/include/arch/tile/rte_vect.h line 49
Quoted 5 lines
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +5
-0+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?
lib/librte_eal/common/include/arch/tile/rte_vect.h line 78
Quoted 7 lines
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +7
-0+/* 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/
Re: [PATCH v4 1/2] eal/tile: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM
Any news? a v5 could be part of the RC2.
2016-03-08 20:59, Thomas Monjalon:
Quoted 34 lines
2016-02-09 23:04, Liming Sun:
Quoted 6 lines
rte_vect.hwas 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 <[email protected]>Acked-by Zhigang Lu <[email protected]>[...]
config/defconfig_tile-tilegx-linuxapp-gcc CONFIG_RTE_LIBRTE_ENIC_PMD=n · line 67
Quoted 4 lines
# This following libraries are not available on the tile architecture. # So they're turned off.
config/defconfig_tile-tilegx-linuxapp-gcc +1
-1-CONFIG_RTE_LIBRTE_LPM=n +CONFIG_RTE_LIBRTE_LPM=yYou just have to remove the disabling line.
lib/librte_eal/common/include/arch/tile/rte_vect.h line 49
Quoted 5 lines
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +5
-0+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?
lib/librte_eal/common/include/arch/tile/rte_vect.h line 78
Quoted 7 lines
lib/librte_eal/common/include/arch/tile/rte_vect.h new file +7
-0+/* 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/