Skip to contentSkip to conversation

Some misc fixes and optimization for the mpipe driver

PATCH Superseded Liming Sun 4 participants 19 messages Dec 15, 2015 – Mar 8, 2016 Network drivers

lore
Share & tools
lore

Liming Sun

author
#0 lore raw

cover Some misc fixes and optimization for the mpipe driver

This patch serie includes some fixes/enhancements to the mpipe driver.
1. Support native build on the TileGx platform;
Previously only cross build was supported.

2. Optimize the mpipe buffer return mechanism by introducing a return pending counter and doing HW buffer return if pssible.

3. Move the mpipe link initialization to an earlier place to support link management APIs.

Liming Sun (3):
driver/net/mpipe: support native build on tilegx platform. driver/net/mpipe: optimize mpipe buffer return mechanism. driver/net/mpipe: fix a mpipe link initialization ordering issue

 MAINTAINERS                               |    3 +-
 config/defconfig_tile-tilegx-linuxapp-gcc |    4 ++
 drivers/net/mpipe/mpipe_tilegx.c          |   64 +++++++++++++++++++++--------
 mk/arch/tile/rte.vars.mk                  |    6 +++
 4 files changed, 59 insertions(+), 18 deletions(-)
author
#1 lore raw

PATCH 1/3 driver/net/mpipe: support native build on tilegx platform.

This submit updates the CROSS setting to support native build on TileGx platform. It also enable the combined library by default.

---
 MAINTAINERS                               |    3 ++-
 config/defconfig_tile-tilegx-linuxapp-gcc |    4 ++++
 mk/arch/tile/rte.vars.mk                  |    6 ++++++
 3 files changed, 12 insertions(+), 1 deletions(-)
MAINTAINERS +2 -1
index 3292e84..8f7e9ca 100644
@@ -138,8 +138,9 @@ M: Jianbo Liu <[email protected]>
 F: lib/librte_eal/common/include/arch/arm/*_64.h
 F: lib/librte_acl/acl_run_neon.*
 
-EZchip TILE-Gx
+EZchip TILE-Gx/Mx
 M: Zhigang Lu <[email protected]>
+M: Liming Sun <[email protected]>
 F: lib/librte_eal/common/include/arch/tile/
 F: drivers/net/mpipe/
 
config/defconfig_tile-tilegx-linuxapp-gcc +4 -0
index 9df9d7f..fb61bcd 100644
@@ -70,3 +70,7 @@ CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_TABLE=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
+CONFIG_RTE_LIBRTE_CXGBE_PMD=n
+
+# Compile combined lib by default.
+CONFIG_RTE_BUILD_COMBINE_LIBS=y
mk/arch/tile/rte.vars.mk +6 -0
index b518986..06dab18 100644
@@ -30,7 +30,13 @@
 
 
 ARCH  ?= tile
+
+HOST_ARCH := ${shell uname -m}
+ifneq ($(filter tile%,${HOST_ARCH}),)
+CROSS =
+else
 CROSS ?= tile-
+endif
 
 CPU_CFLAGS  ?=
 CPU_LDFLAGS ?=
Signature · 1 line
1.7.1
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] driver/net/mpipe: support native build on tilegx platform.

Quoted 5 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Liming Sun
Sent: Tuesday, December 15, 2015 11:37 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/3] driver/net/mpipe: support native build on

tilegx

Quoted 55 lines

platform.

This submit updates the CROSS setting to support native build on TileGx platform. It also enable the combined library by default.

---

MAINTAINERS                               |    3 ++-
config/defconfig_tile-tilegx-linuxapp-gcc |    4 ++++
mk/arch/tile/rte.vars.mk                  |    6 ++++++
3 files changed, 12 insertions(+), 1 deletions(-)
MAINTAINERS +0 -0
index 3292e84..8f7e9ca 100644
@@ -138,8 +138,9 @@ M: Jianbo Liu <[email protected]>

F: lib/librte_eal/common/include/arch/arm/*_64.h
F: lib/librte_acl/acl_run_neon.*

MAINTAINERS +1 -1
-EZchip TILE-Gx
+EZchip TILE-Gx/Mx

M: Zhigang Lu <[email protected]>
+M: Liming Sun <[email protected]>
F: lib/librte_eal/common/include/arch/tile/
F: drivers/net/mpipe/

config/defconfig_tile-tilegx-linuxapp-gcc +0 -0
index 9df9d7f..fb61bcd 100644
@@ -70,3 +70,7 @@ CONFIG_RTE_LIBRTE_SCHED=n

CONFIG_RTE_LIBRTE_PORT=n CONFIG_RTE_LIBRTE_TABLE=n CONFIG_RTE_LIBRTE_PIPELINE=n

config/defconfig_tile-tilegx-linuxapp-gcc +4 -0
+CONFIG_RTE_LIBRTE_CXGBE_PMD=n
+
+# Compile combined lib by default.
+CONFIG_RTE_BUILD_COMBINE_LIBS=y
mk/arch/tile/rte.vars.mk index renamed from mk/arch/tile/rte.vars.mk +0 -0

b518986..06dab18 100644

mk/arch/tile/rte.vars.mk +0 -0
@@ -30,7 +30,13 @@
 
 

ARCH ?= tile

mk/arch/tile/rte.vars.mk +5 -0
+
+HOST_ARCH := ${shell uname -m}
+ifneq ($(filter tile%,${HOST_ARCH}),)
+CROSS =
+else

CROSS ?= tile-
+endif

Quoted 4 lines

CPU_CFLAGS ?=
CPU_LDFLAGS ?=
--
1.7.1

author
#3 lore raw

PATCH 2/3 driver/net/mpipe: optimize mpipe buffer return mechanism.

In reply to Liming Sun

This submit has changes to optimize the mpipe buffer return. When a packet is received, instead of allocating and refilling the buffer stack right away, it tracks the number of pending buffers, and use HW buffer return as an optimization when the pending number is below certain threshold, thus save two MMIO writes and improves performance especially for bidirectional traffic case.

---
 drivers/net/mpipe/mpipe_tilegx.c |   50 ++++++++++++++++++++++++++++++-------
 1 files changed, 40 insertions(+), 10 deletions(-)
drivers/net/mpipe/mpipe_tilegx.c +40 -10
index 35134ba..be7b6f2 100644
@@ -78,6 +78,13 @@ struct mpipe_context {
 	struct mpipe_channel_config channels[MPIPE_MAX_CHANNELS];
 };
 
+/* Per-core local data. */
+struct mpipe_local {
+	int mbuf_push_debt[RTE_MAX_ETHPORTS];	/* Buffer push debt. */
+} __rte_cache_aligned;
+
+#define MPIPE_BUF_DEBT_THRESHOLD	32
+static __thread struct mpipe_local mpipe_local;
 static struct mpipe_context mpipe_contexts[GXIO_MPIPE_INSTANCE_MAX];
 static int mpipe_instances;
 static const char *drivername = "MPIPE PMD";
@@ -137,7 +144,7 @@ struct mpipe_dev_priv {
 	int first_bucket;		/* mPIPE bucket start index. */
 	int first_ring;			/* mPIPE notif ring start index. */
 	int notif_group;		/* mPIPE notif group. */
-	rte_atomic32_t dp_count;	/* Active datapath thread count. */
+	rte_atomic32_t dp_count __rte_cache_aligned;	/* DP Entry count. */
 	int tx_stat_mapping[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	int rx_stat_mapping[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 };
@@ -461,6 +468,14 @@ mpipe_dp_wait(struct mpipe_dev_priv *priv)
 	}
 }
 
+static inline int
+mpipe_mbuf_stack_index(struct mpipe_dev_priv *priv, struct rte_mbuf *mbuf)
+{
+	return (mbuf->port < RTE_MAX_ETHPORTS)?
+		mpipe_priv(&rte_eth_devices[mbuf->port])->stack :
+		priv->stack;
+}
+
 static inline struct rte_mbuf *
 mpipe_recv_mbuf(struct mpipe_dev_priv *priv, gxio_mpipe_idesc_t *idesc,
 		int in_port)
@@ -1267,6 +1282,7 @@ mpipe_do_xmit(struct mpipe_tx_queue *tx_queue, struct rte_mbuf **tx_pkts,
 	unsigned nb_bytes = 0;
 	unsigned nb_sent = 0;
 	int nb_slots, i;
+	uint8_t port_id;
 
 	PMD_DEBUG_TX("Trying to transmit %d packets on %s:%d.\n",
 		     nb_pkts, mpipe_name(tx_queue->q.priv),
@@ -1315,14 +1331,23 @@ mpipe_do_xmit(struct mpipe_tx_queue *tx_queue, struct rte_mbuf **tx_pkts,
 			if (priv->tx_comps[idx])
 				rte_pktmbuf_free_seg(priv->tx_comps[idx]);
 
+			port_id = (mbuf->port < RTE_MAX_ETHPORTS)?
+						mbuf->port : priv->port_id;
 			desc = (gxio_mpipe_edesc_t) { {
 				.va        = rte_pktmbuf_mtod(mbuf, uintptr_t),
 				.xfer_size = rte_pktmbuf_data_len(mbuf),
 				.bound     = next ? 0 : 1,
+				.stack_idx = mpipe_mbuf_stack_index(priv, mbuf),
 			} };
+			if (mpipe_local.mbuf_push_debt[port_id] > 0) {
+				mpipe_local.mbuf_push_debt[port_id]--;
+				desc.hwb = 1;
+				priv->tx_comps[idx] = NULL;
+			}
+			else
+				priv->tx_comps[idx] = mbuf;
 
 			nb_bytes += mbuf->data_len;
-			priv->tx_comps[idx] = mbuf;
 			gxio_mpipe_equeue_put_at(equeue, desc, slot + i);
 
 			PMD_DEBUG_TX("%s:%d: Sending packet %p, len %d\n",
@@ -1443,17 +1468,22 @@ mpipe_do_recv(struct mpipe_rx_queue *rx_queue, struct rte_mbuf **rx_pkts,
 				continue;
 			}
 
-			mbuf = __rte_mbuf_raw_alloc(priv->rx_mpool);
-			if (unlikely(!mbuf)) {
-				nb_nomem++;
-				gxio_mpipe_iqueue_drop(iqueue, idesc);
-				PMD_DEBUG_RX("%s:%d: RX alloc failure\n",
+			if (mpipe_local.mbuf_push_debt[in_port] <
+					MPIPE_BUF_DEBT_THRESHOLD)
+				mpipe_local.mbuf_push_debt[in_port]++;
+			else {
+				mbuf = __rte_mbuf_raw_alloc(priv->rx_mpool);
+				if (unlikely(!mbuf)) {
+					nb_nomem++;
+					gxio_mpipe_iqueue_drop(iqueue, idesc);
+					PMD_DEBUG_RX("%s:%d: alloc failure\n",
 					     mpipe_name(rx_queue->q.priv),
 					     rx_queue->q.queue_idx);
-				continue;
-			}
+					continue;
+				}
 
-			mpipe_recv_push(priv, mbuf);
+				mpipe_recv_push(priv, mbuf);
+			}
 
 			/* Get and setup the mbuf for the received packet. */
 			mbuf = mpipe_recv_mbuf(priv, idesc, in_port);
Signature · 1 line
1.7.1
Acked-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] driver/net/mpipe: optimize mpipe buffer return mechanism.

Quoted 5 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Liming Sun
Sent: Tuesday, December 15, 2015 11:38 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH 2/3] driver/net/mpipe: optimize mpipe buffer

return

Quoted 35 lines

mechanism.

This submit has changes to optimize the mpipe buffer return. When a packet is received, instead of allocating and refilling the buffer stack right away, it tracks the number of pending buffers, and use HW buffer return as an optimization when the pending number is below certain threshold, thus save two MMIO writes and improves performance especially for bidirectional traffic case.

---
drivers/net/mpipe/mpipe_tilegx.c | 50
++++++++++++++++++++++++++++++-------

1 files changed, 40 insertions(+), 10 deletions(-)
drivers/net/mpipe/mpipe_tilegx.c +7 -0
index 35134ba..be7b6f2 100644
@@ -78,6 +78,13 @@ struct mpipe_context {
 	struct mpipe_channel_config channels[MPIPE_MAX_CHANNELS];
 };
 
+/* Per-core local data. */
+struct mpipe_local {
+	int mbuf_push_debt[RTE_MAX_ETHPORTS];	/* Buffer push debt. */
+} __rte_cache_aligned;
+
+#define MPIPE_BUF_DEBT_THRESHOLD	32
+static __thread struct mpipe_local mpipe_local;
 static struct mpipe_context mpipe_contexts[GXIO_MPIPE_INSTANCE_MAX];
 static int mpipe_instances;
 static const char *drivername = "MPIPE PMD";

drivers/net/mpipe/mpipe_tilegx.c struct mpipe_dev_priv { · line 147

Quoted 5 lines
drivers/net/mpipe/mpipe_tilegx.c +1 -1
@@ -137,7 +144,7 @@ struct mpipe_dev_priv {
 	int first_bucket;		/* mPIPE bucket start index. */
 	int first_ring;			/* mPIPE notif ring start index. */
 	int notif_group;		/* mPIPE notif group. */
-	rte_atomic32_t dp_count;	/* Active datapath thread count. */
+	rte_atomic32_t dp_count __rte_cache_aligned;	/* DP Entry count.

*/

Quoted 28 lines
drivers/net/mpipe/mpipe_tilegx.c +8 -0
 	int tx_stat_mapping[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	int rx_stat_mapping[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 };
@@ -461,6 +468,14 @@ mpipe_dp_wait(struct mpipe_dev_priv *priv)
 	}
 }
 
+static inline int
+mpipe_mbuf_stack_index(struct mpipe_dev_priv *priv, struct rte_mbuf *mbuf)
+{
+	return (mbuf->port < RTE_MAX_ETHPORTS)?
+		mpipe_priv(&rte_eth_devices[mbuf->port])->stack :
+		priv->stack;
+}
+

static inline struct rte_mbuf *
mpipe_recv_mbuf(struct mpipe_dev_priv *priv, gxio_mpipe_idesc_t *idesc,
int in_port)

drivers/net/mpipe/mpipe_tilegx.c +1 -0
@@ -1267,6 +1282,7 @@ mpipe_do_xmit(struct mpipe_tx_queue *tx_queue,
 struct rte_mbuf **tx_pkts,
 	unsigned nb_bytes = 0;
 	unsigned nb_sent = 0;
 	int nb_slots, i;
+	uint8_t port_id;
 
 	PMD_DEBUG_TX("Trying to transmit %d packets on %s:%d.\n",
		     nb_pkts, mpipe_name(tx_queue->q.priv),

drivers/net/mpipe/mpipe_tilegx.c mpipe_do_xmit(struct mpipe_tx_queue *tx_queue, · line 1338

Quoted 8 lines
drivers/net/mpipe/mpipe_tilegx.c +2 -0
@@ -1315,14 +1331,23 @@ mpipe_do_xmit(struct mpipe_tx_queue *tx_queue,
 struct rte_mbuf **tx_pkts,
 			if (priv->tx_comps[idx])
 				rte_pktmbuf_free_seg(priv->tx_comps[idx]);
 
+			port_id = (mbuf->port < RTE_MAX_ETHPORTS)?
+						mbuf->port : priv->port_id;
 			desc = (gxio_mpipe_edesc_t) { {
 				.va        = rte_pktmbuf_mtod(mbuf,

uintptr_t),

drivers/net/mpipe/mpipe_tilegx.c mpipe_do_xmit(struct mpipe_tx_queue *tx_queue, struct rte_mbuf **tx_pkts,

Quoted 3 lines
drivers/net/mpipe/mpipe_tilegx.c +1 -0
 				.xfer_size = rte_pktmbuf_data_len(mbuf),
 				.bound     = next ? 0 : 1,
+				.stack_idx = mpipe_mbuf_stack_index(priv,

mbuf),

Quoted 22 lines
drivers/net/mpipe/mpipe_tilegx.c +7 -1
 			} };
+			if (mpipe_local.mbuf_push_debt[port_id] > 0) {
+				mpipe_local.mbuf_push_debt[port_id]--;
+				desc.hwb = 1;
+				priv->tx_comps[idx] = NULL;
+			}
+			else
+				priv->tx_comps[idx] = mbuf;
 
 			nb_bytes += mbuf->data_len;
-			priv->tx_comps[idx] = mbuf;
 			gxio_mpipe_equeue_put_at(equeue, desc, slot + i);
 
			PMD_DEBUG_TX("%s:%d: Sending packet %p, len %d\n",
drivers/net/mpipe/mpipe_tilegx.c +0 -3
@@ -1443,17 +1468,22 @@ mpipe_do_recv(struct mpipe_rx_queue *rx_queue,
 struct rte_mbuf **rx_pkts,
 				continue;
 			}
 
-			mbuf = __rte_mbuf_raw_alloc(priv->rx_mpool);
-			if (unlikely(!mbuf)) {
-				nb_nomem++;

drivers/net/mpipe/mpipe_tilegx.c mpipe_do_recv(struct mpipe_rx_queue *rx_queue, · line 1479

Quoted 10 lines
drivers/net/mpipe/mpipe_tilegx.c +8 -2
-				gxio_mpipe_iqueue_drop(iqueue, idesc);
-				PMD_DEBUG_RX("%s:%d: RX alloc failure\n",
+			if (mpipe_local.mbuf_push_debt[in_port] <
+					MPIPE_BUF_DEBT_THRESHOLD)
+				mpipe_local.mbuf_push_debt[in_port]++;
+			else {
+				mbuf = __rte_mbuf_raw_alloc(priv->rx_mpool);
+				if (unlikely(!mbuf)) {
+					nb_nomem++;
+					gxio_mpipe_iqueue_drop(iqueue,

idesc);

drivers/net/mpipe/mpipe_tilegx.c mpipe_do_recv(struct mpipe_rx_queue *rx_queue, · line 1480

Quoted 1 line
drivers/net/mpipe/mpipe_tilegx.c +1 -0
+					PMD_DEBUG_RX("%s:%d: alloc

failure\n",

drivers/net/mpipe/mpipe_tilegx.c mpipe_do_recv(struct mpipe_rx_queue *rx_queue, struct rte_mbuf **rx_pkts,

Quoted 12 lines
drivers/net/mpipe/mpipe_tilegx.c +4 -3
 					     mpipe_name(rx_queue->q.priv),
 					     rx_queue->q.queue_idx);
-				continue;
-			}
+					continue;
+				}
 
-			mpipe_recv_push(priv, mbuf);
+				mpipe_recv_push(priv, mbuf);
+			}
 
 			/* Get and setup the mbuf for the received packet.

*/

Quoted 3 lines
			mbuf = mpipe_recv_mbuf(priv, idesc, in_port);

--
1.7.1

author
#5 lore raw

PATCH 3/3 driver/net/mpipe: fix a mpipe link initialization ordering issue

In reply to Liming Sun

Mpipe link structure is initialized in function mpipe_link_init(). Currently it's only called from the eth_dev_ops.dev_start, which caused crashes when link mgmt APIs (like promiscuous_enable) was called before eth_dev_ops.dev_start(). This submit fixed it by calling mpipe_link_init() in rte_pmd_mpipe_devinit().

---
 drivers/net/mpipe/mpipe_tilegx.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/mpipe/mpipe_tilegx.c +7 -7
index be7b6f2..5845511 100644
@@ -752,13 +752,6 @@ mpipe_init(struct mpipe_dev_priv *priv)
 	if (priv->initialized)
 		return 0;
 
-	rc = mpipe_link_init(priv);
-	if (rc < 0) {
-		RTE_LOG(ERR, PMD, "%s: Failed to init link.\n",
-			mpipe_name(priv));
-		return rc;
-	}
-
 	rc = mpipe_recv_init(priv);
 	if (rc < 0) {
 		RTE_LOG(ERR, PMD, "%s: Failed to init rx.\n",
@@ -1633,6 +1626,13 @@ rte_pmd_mpipe_devinit(const char *ifname,
 	eth_dev->rx_pkt_burst = &mpipe_recv_pkts;
 	eth_dev->tx_pkt_burst = &mpipe_xmit_pkts;
 
+	rc = mpipe_link_init(priv);
+	if (rc < 0) {
+		RTE_LOG(ERR, PMD, "%s: Failed to init link.\n",
+			mpipe_name(priv));
+		return rc;
+	}
+
 	return 0;
 }
 
Signature · 1 line
1.7.1
Acked-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] driver/net/mpipe: fix a mpipe link initialization ordering issue

Quoted 5 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Liming Sun
Sent: Tuesday, December 15, 2015 11:38 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH 3/3] driver/net/mpipe: fix a mpipe link

initialization

Quoted 47 lines

ordering issue

Mpipe link structure is initialized in function mpipe_link_init(). Currently it's only called from the eth_dev_ops.dev_start, which caused crashes when link mgmt APIs (like promiscuous_enable) was called before eth_dev_ops.dev_start(). This submit fixed it by calling mpipe_link_init() in rte_pmd_mpipe_devinit().

---
drivers/net/mpipe/mpipe_tilegx.c | 14 +++++++-------

1 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/mpipe/mpipe_tilegx.c +7 -8
index be7b6f2..5845511 100644
@@ -752,13 +752,6 @@ mpipe_init(struct mpipe_dev_priv *priv)
 	if (priv->initialized)
 		return 0;
 
-	rc = mpipe_link_init(priv);
-	if (rc < 0) {
-		RTE_LOG(ERR, PMD, "%s: Failed to init link.\n",
-			mpipe_name(priv));
-		return rc;
-	}
-
 	rc = mpipe_recv_init(priv);
 	if (rc < 0) {
 		RTE_LOG(ERR, PMD, "%s: Failed to init rx.\n",
@@ -1633,6 +1626,13 @@ rte_pmd_mpipe_devinit(const char *ifname,
 	eth_dev->rx_pkt_burst = &mpipe_recv_pkts;
 	eth_dev->tx_pkt_burst = &mpipe_xmit_pkts;
 
+	rc = mpipe_link_init(priv);
+	if (rc < 0) {
+		RTE_LOG(ERR, PMD, "%s: Failed to init link.\n",
+			mpipe_name(priv));
+		return rc;
+	}
+
 	return 0;
 }
 
--
Quoted 1 line

1.7.1

author
#7 lore raw

PATCH v2 1/3 driver/net/mpipe: support native build on tilegx platform.

In reply to Liming Sun

This submit updates the CROSS setting to support native build on TileGx platform. It also enable the combined library by default.

---
 MAINTAINERS                               | 3 ++-
 config/defconfig_tile-tilegx-linuxapp-gcc | 4 ++++
 mk/arch/tile/rte.vars.mk                  | 6 ++++++
 3 files changed, 12 insertions(+), 1 deletion(-)
MAINTAINERS +2 -1
index 3292e84..8f7e9ca 100644
@@ -138,8 +138,9 @@ M: Jianbo Liu <[email protected]>
 F: lib/librte_eal/common/include/arch/arm/*_64.h
 F: lib/librte_acl/acl_run_neon.*
 
-EZchip TILE-Gx
+EZchip TILE-Gx/Mx
 M: Zhigang Lu <[email protected]>
+M: Liming Sun <[email protected]>
 F: lib/librte_eal/common/include/arch/tile/
 F: drivers/net/mpipe/
 
config/defconfig_tile-tilegx-linuxapp-gcc +4 -0
index 9df9d7f..fb61bcd 100644
@@ -70,3 +70,7 @@ CONFIG_RTE_LIBRTE_SCHED=n
 CONFIG_RTE_LIBRTE_PORT=n
 CONFIG_RTE_LIBRTE_TABLE=n
 CONFIG_RTE_LIBRTE_PIPELINE=n
+CONFIG_RTE_LIBRTE_CXGBE_PMD=n
+
+# Compile combined lib by default.
+CONFIG_RTE_BUILD_COMBINE_LIBS=y
mk/arch/tile/rte.vars.mk +6 -0
index b518986..06dab18 100644
@@ -30,7 +30,13 @@
 
 
 ARCH  ?= tile
+
+HOST_ARCH := ${shell uname -m}
+ifneq ($(filter tile%,${HOST_ARCH}),)
+CROSS =
+else
 CROSS ?= tile-
+endif
 
 CPU_CFLAGS  ?=
 CPU_LDFLAGS ?=
Signature · 1 line
1.8.3.1
author
#8 lore raw

PATCH v2 2/3 driver/net/mpipe: optimize mpipe buffer return mechanism.

This submit has changes to optimize the mpipe buffer return. When a packet is received, instead of allocating and refilling the buffer stack right away, it tracks the number of pending buffers, and use HW buffer return as an optimization when the pending number is below certain threshold, thus save two MMIO writes and improves performance especially for bidirectional traffic case.

---
 drivers/net/mpipe/mpipe_tilegx.c | 50 ++++++++++++++++++++++++++++++++--------
 1 file changed, 40 insertions(+), 10 deletions(-)
drivers/net/mpipe/mpipe_tilegx.c +40 -10
index 35134ba..be7b6f2 100644
@@ -78,6 +78,13 @@ struct mpipe_context {
 	struct mpipe_channel_config channels[MPIPE_MAX_CHANNELS];
 };
 
+/* Per-core local data. */
+struct mpipe_local {
+	int mbuf_push_debt[RTE_MAX_ETHPORTS];	/* Buffer push debt. */
+} __rte_cache_aligned;
+
+#define MPIPE_BUF_DEBT_THRESHOLD	32
+static __thread struct mpipe_local mpipe_local;
 static struct mpipe_context mpipe_contexts[GXIO_MPIPE_INSTANCE_MAX];
 static int mpipe_instances;
 static const char *drivername = "MPIPE PMD";
@@ -137,7 +144,7 @@ struct mpipe_dev_priv {
 	int first_bucket;		/* mPIPE bucket start index. */
 	int first_ring;			/* mPIPE notif ring start index. */
 	int notif_group;		/* mPIPE notif group. */
-	rte_atomic32_t dp_count;	/* Active datapath thread count. */
+	rte_atomic32_t dp_count __rte_cache_aligned;	/* DP Entry count. */
 	int tx_stat_mapping[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 	int rx_stat_mapping[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 };
@@ -461,6 +468,14 @@ mpipe_dp_wait(struct mpipe_dev_priv *priv)
 	}
 }
 
+static inline int
+mpipe_mbuf_stack_index(struct mpipe_dev_priv *priv, struct rte_mbuf *mbuf)
+{
+	return (mbuf->port < RTE_MAX_ETHPORTS)?
+		mpipe_priv(&rte_eth_devices[mbuf->port])->stack :
+		priv->stack;
+}
+
 static inline struct rte_mbuf *
 mpipe_recv_mbuf(struct mpipe_dev_priv *priv, gxio_mpipe_idesc_t *idesc,
 		int in_port)
@@ -1267,6 +1282,7 @@ mpipe_do_xmit(struct mpipe_tx_queue *tx_queue, struct rte_mbuf **tx_pkts,
 	unsigned nb_bytes = 0;
 	unsigned nb_sent = 0;
 	int nb_slots, i;
+	uint8_t port_id;
 
 	PMD_DEBUG_TX("Trying to transmit %d packets on %s:%d.\n",
 		     nb_pkts, mpipe_name(tx_queue->q.priv),
@@ -1315,14 +1331,23 @@ mpipe_do_xmit(struct mpipe_tx_queue *tx_queue, struct rte_mbuf **tx_pkts,
 			if (priv->tx_comps[idx])
 				rte_pktmbuf_free_seg(priv->tx_comps[idx]);
 
+			port_id = (mbuf->port < RTE_MAX_ETHPORTS)?
+						mbuf->port : priv->port_id;
 			desc = (gxio_mpipe_edesc_t) { {
 				.va        = rte_pktmbuf_mtod(mbuf, uintptr_t),
 				.xfer_size = rte_pktmbuf_data_len(mbuf),
 				.bound     = next ? 0 : 1,
+				.stack_idx = mpipe_mbuf_stack_index(priv, mbuf),
 			} };
+			if (mpipe_local.mbuf_push_debt[port_id] > 0) {
+				mpipe_local.mbuf_push_debt[port_id]--;
+				desc.hwb = 1;
+				priv->tx_comps[idx] = NULL;
+			}
+			else
+				priv->tx_comps[idx] = mbuf;
 
 			nb_bytes += mbuf->data_len;
-			priv->tx_comps[idx] = mbuf;
 			gxio_mpipe_equeue_put_at(equeue, desc, slot + i);
 
 			PMD_DEBUG_TX("%s:%d: Sending packet %p, len %d\n",
@@ -1443,17 +1468,22 @@ mpipe_do_recv(struct mpipe_rx_queue *rx_queue, struct rte_mbuf **rx_pkts,
 				continue;
 			}
 
-			mbuf = __rte_mbuf_raw_alloc(priv->rx_mpool);
-			if (unlikely(!mbuf)) {
-				nb_nomem++;
-				gxio_mpipe_iqueue_drop(iqueue, idesc);
-				PMD_DEBUG_RX("%s:%d: RX alloc failure\n",
+			if (mpipe_local.mbuf_push_debt[in_port] <
+					MPIPE_BUF_DEBT_THRESHOLD)
+				mpipe_local.mbuf_push_debt[in_port]++;
+			else {
+				mbuf = __rte_mbuf_raw_alloc(priv->rx_mpool);
+				if (unlikely(!mbuf)) {
+					nb_nomem++;
+					gxio_mpipe_iqueue_drop(iqueue, idesc);
+					PMD_DEBUG_RX("%s:%d: alloc failure\n",
 					     mpipe_name(rx_queue->q.priv),
 					     rx_queue->q.queue_idx);
-				continue;
-			}
+					continue;
+				}
 
-			mpipe_recv_push(priv, mbuf);
+				mpipe_recv_push(priv, mbuf);
+			}
 
 			/* Get and setup the mbuf for the received packet. */
 			mbuf = mpipe_recv_mbuf(priv, idesc, in_port);
Signature · 1 line
1.8.3.1
author
#9 lore raw

PATCH v2 3/3 driver/net/mpipe: fix a mpipe link initialization ordering issue

In reply to Liming Sun

Mpipe link structure is initialized in function mpipe_link_init(). Currently it's only called from the eth_dev_ops.dev_start, which caused crashes when link mgmt APIs (like promiscuous_enable) was called before eth_dev_ops.dev_start(). This submit fixed it by calling mpipe_link_init() in rte_pmd_mpipe_devinit().

---
 drivers/net/mpipe/mpipe_tilegx.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/mpipe/mpipe_tilegx.c +7 -7
index be7b6f2..5845511 100644
@@ -752,13 +752,6 @@ mpipe_init(struct mpipe_dev_priv *priv)
 	if (priv->initialized)
 		return 0;
 
-	rc = mpipe_link_init(priv);
-	if (rc < 0) {
-		RTE_LOG(ERR, PMD, "%s: Failed to init link.\n",
-			mpipe_name(priv));
-		return rc;
-	}
-
 	rc = mpipe_recv_init(priv);
 	if (rc < 0) {
 		RTE_LOG(ERR, PMD, "%s: Failed to init rx.\n",
@@ -1633,6 +1626,13 @@ rte_pmd_mpipe_devinit(const char *ifname,
 	eth_dev->rx_pkt_burst = &mpipe_recv_pkts;
 	eth_dev->tx_pkt_burst = &mpipe_xmit_pkts;
 
+	rc = mpipe_link_init(priv);
+	if (rc < 0) {
+		RTE_LOG(ERR, PMD, "%s: Failed to init link.\n",
+			mpipe_name(priv));
+		return rc;
+	}
+
 	return 0;
 }
 
Signature · 1 line
1.8.3.1
#11 lore raw

Re: [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

In reply to Liming Sun

Hi,

Sorry for being late for commenting.

2016-01-08 09:30, Liming Sun:

MAINTAINERS M: Jianbo Liu <[email protected]> · line 141

Quoted 2 lines
MAINTAINERS +1 -1
-EZchip TILE-Gx
+EZchip TILE-Gx/Mx

A comment about the TILE-Mx would be welcome.
Is it supported currently?
Isn't it an ARM arch?

Quoted 4 lines

M: Zhigang Lu <[email protected]>
+M: Liming Sun <[email protected]>
F: lib/librte_eal/common/include/arch/tile/
F: drivers/net/mpipe/

[...]

config/defconfig_tile-tilegx-linuxapp-gcc CONFIG_RTE_LIBRTE_SCHED=n · line 76

Quoted 2 lines
config/defconfig_tile-tilegx-linuxapp-gcc +2 -0
+# Compile combined lib by default.
+CONFIG_RTE_BUILD_COMBINE_LIBS=y

Why forcing this option in the defconfig file?

[...]

mk/arch/tile/rte.vars.mk line 39

Quoted 8 lines

ARCH ?= tile

mk/arch/tile/rte.vars.mk +6 -0
+
+HOST_ARCH := ${shell uname -m}
+ifneq ($(filter tile%,${HOST_ARCH}),)
+CROSS =
+else
 CROSS ?= tile-
+endif

I don't think the CROSS variable should have a default value. It really depends on the toolchain.

Talking about the toolchain, is it possible to build DPDK with the provided binary toolchain http://www.tilera.com/scm/tilegx-x86_64.tar.bz2 ? This is the Tilera Open Source page: http://www.tilera.com/scm/

author
#12 lore raw

Re: [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

Thanks Thomas for the comments.
Please see the response inline.

Thanks,
Liming

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, February 09, 2016 11:16 AM
To: Liming Sun
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

Hi,

Sorry for being late for commenting.

2016-01-08 09:30, Liming Sun:

MAINTAINERS M: Jianbo Liu <[email protected]> · line 141

Quoted 2 lines
MAINTAINERS +1 -1
-EZchip TILE-Gx
+EZchip TILE-Gx/Mx

A comment about the TILE-Mx would be welcome.
Is it supported currently?
Isn't it an ARM arch?

[lsun] Yes, it's ARM arch, but with similar mpipe driver.
It's not fully supported yet. I'll remove this change and add it in a different serie when it's ready.

Quoted 4 lines

M: Zhigang Lu <[email protected]>
+M: Liming Sun <[email protected]>
F: lib/librte_eal/common/include/arch/tile/
F: drivers/net/mpipe/

[...]

config/defconfig_tile-tilegx-linuxapp-gcc CONFIG_RTE_LIBRTE_SCHED=n · line 76

Quoted 2 lines
config/defconfig_tile-tilegx-linuxapp-gcc +2 -0
+# Compile combined lib by default.
+CONFIG_RTE_BUILD_COMBINE_LIBS=y

Why forcing this option in the defconfig file?

[lsun] It's just trying to make it handy for other applications like OVS or ODP on top of DPDK. However we could remove this change if it's not the recommended way.

[...]

mk/arch/tile/rte.vars.mk line 39

Quoted 6 lines

ARCH ?= tile

mk/arch/tile/rte.vars.mk +4 -0
+
+HOST_ARCH := ${shell uname -m}
+ifneq ($(filter tile%,${HOST_ARCH}),) CROSS = else
 CROSS ?= tile-
+endif

I don't think the CROSS variable should have a default value. It really depends on the toolchain.

[lsun] Make sense. The current code (before the change) has default value 'CROSS ?= tile-' defined, which cause some issue when doing native build. Another way is to define it as "CROSS ?=" just like other platforms. So when doing cross-compile, we could pass " CROSS=tile-" .

Talking about the toolchain, is it possible to build DPDK with the provided binary toolchain http://www.tilera.com/scm/tilegx-x86_64.tar.bz2 ? This is the Tilera Open Source page: http://www.tilera.com/scm/

[lsun] I tried it just now. The gcc appears ok. But this tarball lacks of some header files and libraries to compile DPDK. We're looking into it to see whether it can be easily fixed.

#13 lore raw

Re: [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

2016-02-09 18:37, Liming Sun:

Quoted 7 lines

From: Thomas Monjalon [mailto:[email protected]] A comment about the TILE-Mx would be welcome. Is it supported currently?
Isn't it an ARM arch?

[lsun] Yes, it's ARM arch, but with similar mpipe driver.
It's not fully supported yet. I'll remove this change and add it in a different serie when it's ready.

OK
So we'll discuss how to integrate it later.

Quoted 6 lines

config/defconfig_tile-tilegx-linuxapp-gcc CONFIG_RTE_LIBRTE_SCHED=n · line 76

Quoted 2 lines
config/defconfig_tile-tilegx-linuxapp-gcc +2 -0
+# Compile combined lib by default.
+CONFIG_RTE_BUILD_COMBINE_LIBS=y

Why forcing this option in the defconfig file?

[lsun] It's just trying to make it handy for other applications like OVS or ODP on top of DPDK. However we could remove this change if it's not the recommended way.

Yes please remove it.

Quoted 11 lines

mk/arch/tile/rte.vars.mk line 39

Quoted 6 lines

ARCH ?= tile

mk/arch/tile/rte.vars.mk +4 -0
+
+HOST_ARCH := ${shell uname -m}
+ifneq ($(filter tile%,${HOST_ARCH}),) CROSS = else
 CROSS ?= tile-
+endif

I don't think the CROSS variable should have a default value. It really depends on the toolchain.

[lsun] Make sense. The current code (before the change) has default value 'CROSS ?= tile-' defined, which cause some issue when doing native build. Another way is to define it as "CROSS ?=" just like other platforms. So when doing cross-compile, we could pass " CROSS=tile-" .

No need to keep a "CROSS ?=" line.
The variables defined in the command line get the priority.

Quoted 4 lines

Talking about the toolchain, is it possible to build DPDK with the provided binary toolchain http://www.tilera.com/scm/tilegx-x86_64.tar.bz2 ? This is the Tilera Open Source page: http://www.tilera.com/scm/

[lsun] I tried it just now. The gcc appears ok. But this tarball lacks of some header files and libraries to compile DPDK.

Yes that's what I've experienced.

Quoted 1 line

We're looking into it to see whether it can be easily fixed.

Please keep us informed when the toolchain is ready. Thanks

author
#14 lore raw

Re: [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

Looks like this patch serie has been merged into dpdk-next-net/rel_16_04.
What would be the usual way to submit changes for new comments? Would it be incremental changes (new commit) based on previous one? Thanks.
________________________________________
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, February 9, 2016 3:33 PM
To: Liming Sun
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

2016-02-09 18:37, Liming Sun:

Quoted 7 lines

From: Thomas Monjalon [mailto:[email protected]] A comment about the TILE-Mx would be welcome. Is it supported currently?
Isn't it an ARM arch?

[lsun] Yes, it's ARM arch, but with similar mpipe driver.
It's not fully supported yet. I'll remove this change and add it in a different serie when it's ready.

OK
So we'll discuss how to integrate it later.

Quoted 6 lines

config/defconfig_tile-tilegx-linuxapp-gcc CONFIG_RTE_LIBRTE_SCHED=n · line 76

Quoted 2 lines
config/defconfig_tile-tilegx-linuxapp-gcc +2 -0
+# Compile combined lib by default.
+CONFIG_RTE_BUILD_COMBINE_LIBS=y

Why forcing this option in the defconfig file?

[lsun] It's just trying to make it handy for other applications like OVS or ODP on top of DPDK. However we could remove this change if it's not the recommended way.

Yes please remove it.

Quoted 11 lines

mk/arch/tile/rte.vars.mk line 39

Quoted 6 lines

ARCH ?= tile

mk/arch/tile/rte.vars.mk +4 -0
+
+HOST_ARCH := ${shell uname -m}
+ifneq ($(filter tile%,${HOST_ARCH}),) CROSS = else
 CROSS ?= tile-
+endif

I don't think the CROSS variable should have a default value. It really depends on the toolchain.

[lsun] Make sense. The current code (before the change) has default value 'CROSS ?= tile-' defined, which cause some issue when doing native build. Another way is to define it as "CROSS ?=" just like other platforms. So when doing cross-compile, we could pass " CROSS=tile-" .

No need to keep a "CROSS ?=" line.
The variables defined in the command line get the priority.

Quoted 4 lines

Talking about the toolchain, is it possible to build DPDK with the provided binary toolchain http://www.tilera.com/scm/tilegx-x86_64.tar.bz2 ? This is the Tilera Open Source page: http://www.tilera.com/scm/

[lsun] I tried it just now. The gcc appears ok. But this tarball lacks of some header files and libraries to compile DPDK.

Yes that's what I've experienced.

Quoted 1 line

We're looking into it to see whether it can be easily fixed.

Please keep us informed when the toolchain is ready. Thanks

#15 lore raw

Re: [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

2016-02-09 21:15, Liming Sun:

Quoted 2 lines

Looks like this patch serie has been merged into dpdk-next-net/rel_16_04.
What would be the usual way to submit changes for new comments? Would it be incremental changes (new commit) based on previous one? Thanks.

Good question.
I think it's better if Bruce drops or reverts the commits from dpdk-next-net to let you re-submit a better new version.
Bruce, do you agree?

#16 lore raw

Re: [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

Quoted 8 lines · Thomas Monjalon

2016-02-09 21:15, Liming Sun:

Quoted 2 lines

Looks like this patch serie has been merged into dpdk-next-net/rel_16_04.
What would be the usual way to submit changes for new comments? Would it be incremental changes (new commit) based on previous one? Thanks.

Good question.
I think it's better if Bruce drops or reverts the commits from dpdk-next-net to let you re-submit a better new version.
Bruce, do you agree?

Unless there is something actually broken - that was previously working - by this patchset I'd rather not revert it. This patch was sitting acked for a month which is a reasonable time for comments before applying it. Allowing people to step up post-apply and look for patches being reverted is not something we want to encourage IMHO. There are already too many reviews being done at the last minute, and allowing reverts may make that situation worse, while applying acked patches within a reasonable time - irrespective of whether people subsequently find issues with them - should encourage earlier reviews, and makes it easier on contributors.

Therefore I'd rather see any additional enhancements or changes done as incremental patches on top of this set.

Regards,
/Bruce

#17 lore raw

Re: [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

2016-02-10 09:49, Bruce Richardson:

Quoted 10 lines · Thomas Monjalon
Quoted 8 lines

2016-02-09 21:15, Liming Sun:

Quoted 2 lines

Looks like this patch serie has been merged into dpdk-next-net/rel_16_04.
What would be the usual way to submit changes for new comments? Would it be incremental changes (new commit) based on previous one? Thanks.

Good question.
I think it's better if Bruce drops or reverts the commits from dpdk-next-net to let you re-submit a better new version.
Bruce, do you agree?

Quoted 9 lines

Unless there is something actually broken - that was previously working - by this patchset I'd rather not revert it. This patch was sitting acked for a month which is a reasonable time for comments before applying it. Allowing people to step up post-apply and look for patches being reverted is not something we want to encourage IMHO. There are already too many reviews being done at the last minute, and allowing reverts may make that situation worse, while applying acked patches within a reasonable time - irrespective of whether people subsequently find issues with them - should encourage earlier reviews, and makes it easier on contributors.

Yes you are right.

Quoted 6 lines

Therefore I'd rather see any additional enhancements or changes done as incremental patches on top of this set.

Regards,
/Bruce

#18 lore raw

Re: [PATCH v2 1/3] driver/net/mpipe: support native build on tilegx platform.

In reply to Thomas Monjalon

Hi,

2016-02-09 21:33, Thomas Monjalon:

Quoted 31 lines

2016-02-09 18:37, Liming Sun:

Quoted 7 lines

From: Thomas Monjalon [mailto:[email protected]] A comment about the TILE-Mx would be welcome. Is it supported currently?
Isn't it an ARM arch?

[lsun] Yes, it's ARM arch, but with similar mpipe driver.
It's not fully supported yet. I'll remove this change and add it in a different serie when it's ready.

OK
So we'll discuss how to integrate it later.

Quoted 6 lines

config/defconfig_tile-tilegx-linuxapp-gcc CONFIG_RTE_LIBRTE_SCHED=n · line 76

Quoted 2 lines
config/defconfig_tile-tilegx-linuxapp-gcc +2 -0
+# Compile combined lib by default.
+CONFIG_RTE_BUILD_COMBINE_LIBS=y

Why forcing this option in the defconfig file?

[lsun] It's just trying to make it handy for other applications like OVS or ODP on top of DPDK. However we could remove this change if it's not the recommended way.

Yes please remove it.

Quoted 10 lines

mk/arch/tile/rte.vars.mk line 39

Quoted 6 lines

ARCH ?= tile

mk/arch/tile/rte.vars.mk +4 -0
+
+HOST_ARCH := ${shell uname -m}
+ifneq ($(filter tile%,${HOST_ARCH}),) CROSS = else
 CROSS ?= tile-
+endif

I don't think the CROSS variable should have a default value. It really depends on the toolchain.

Quoted 4 lines
Quoted 1 line

[lsun] Make sense. The current code (before the change) has default value 'CROSS ?= tile-' defined, which cause some issue when doing native build. Another way is to define it as "CROSS ?=" just like other platforms. So when doing cross-compile, we could pass " CROSS=tile-" .

No need to keep a "CROSS ?=" line.
The variables defined in the command line get the priority.

I have not seen patches to address these comments. Anything pending?

Quoted 10 lines
Quoted 4 lines

Talking about the toolchain, is it possible to build DPDK with the provided binary toolchain http://www.tilera.com/scm/tilegx-x86_64.tar.bz2 ? This is the Tilera Open Source page: http://www.tilera.com/scm/

[lsun] I tried it just now. The gcc appears ok. But this tarball lacks of some header files and libraries to compile DPDK.

Yes that's what I've experienced.

Quoted 1 line

We're looking into it to see whether it can be easily fixed.

Please keep us informed when the toolchain is ready. Thanks

Any news about the ready-to-use toolchain?