All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] consistent PMD batching behaviour
@ 2017-02-24  8:48 Zhiyong Yang
  2017-02-24  8:48 ` [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
                   ` (4 more replies)
  0 siblings, 5 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-02-24  8:48 UTC (permalink / raw)
  To: dev

The rte_eth_tx_burst() function in the file Rte_ethdev.h is invoked to
transmit output packets on the output queue for DPDK applications as
follows.

static inline uint16_t
rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
                 struct rte_mbuf **tx_pkts, uint16_t nb_pkts);

Note: The fourth parameter nb_pkts: The number of packets to transmit.

The rte_eth_tx_burst() function returns the number of packets it actually
sent. Most of PMD drivers can support the policy "send as many packets to
transmit as possible" at the PMD level. but the few of PMDs have some sort
of artificial limits for the pkts sent successfully. For example, VHOST tx
burst size is limited to 32 packets. Some rx_burst functions have the
similar problem. The main benefit is consistent batching behavior for user
to simplify their logic and avoid misusage at the application level, there
is unified rte_eth_tx/rx_burst interface already, there is no reason for
inconsistent behaviors. 
This patchset fixes it via adding wrapper function at the PMD level.

Zhiyong Yang (5):
  net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
  net/i40e: remove limit of i40e_xmit_pkts_vec burst size
  net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
  net/vhost: remove limit of vhost TX burst size
  net/vhost: remove limit of vhost RX burst size

 drivers/net/fm10k/fm10k_ethdev.c  | 27 ++++++++++++++++++++-
 drivers/net/i40e/i40e_rxtx.c      | 27 ++++++++++++++++++++-
 drivers/net/ixgbe/ixgbe_rxtx.c    | 27 ++++++++++++++++++++-
 drivers/net/vhost/rte_eth_vhost.c | 49 +++++++++++++++++++++++++++++++++++----
 4 files changed, 122 insertions(+), 8 deletions(-)

-- 
2.7.4

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

* [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
  2017-02-24  8:48 [PATCH 0/5] consistent PMD batching behaviour Zhiyong Yang
@ 2017-02-24  8:48 ` Zhiyong Yang
  2017-02-24  9:32   ` Bruce Richardson
  2017-03-03 11:17   ` [PATCH v2 0/5] consistent PMD batching behaviour Zhiyong Yang
  2017-02-24  8:48 ` [PATCH 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size Zhiyong Yang
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-02-24  8:48 UTC (permalink / raw)
  To: dev; +Cc: Jing Chen, Zhiyong Yang

To add a wrapper function fm10k_xmit_pkts_vec_simple to remove
the limit of tx burst size. The patch makes fm10k vec function
an best effort to transmit the pkts in the consistent behavior
like fm10k_xmit_pkts does that.

Cc: Jing Chen <jing.d.chen@intel.com>

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/fm10k/fm10k_ethdev.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c4fe746..e9b6254 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2741,6 +2741,31 @@ fm10k_check_ftag(struct rte_devargs *devargs)
 	return 1;
 }
 
+static uint16_t
+fm10k_xmit_pkts_vec_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
+			   uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct fm10k_tx_queue *txq = (struct fm10k_tx_queue *)tx_queue;
+
+	if (likely(nb_pkts <= txq->rs_thresh))
+		return fm10k_xmit_pkts_vec(tx_queue, tx_pkts, nb_pkts);
+
+	/* transmit in chunks of at least txq->rs_thresh */
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->rs_thresh);
+		ret = fm10k_xmit_pkts_vec(tx_queue, &tx_pkts[nb_tx], num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+
 static void __attribute__((cold))
 fm10k_set_tx_function(struct rte_eth_dev *dev)
 {
@@ -2766,7 +2791,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
 			txq = dev->data->tx_queues[i];
 			fm10k_txq_vec_setup(txq);
 		}
-		dev->tx_pkt_burst = fm10k_xmit_pkts_vec;
+		dev->tx_pkt_burst = fm10k_xmit_pkts_vec_simple;
 		dev->tx_pkt_prepare = NULL;
 	} else {
 		dev->tx_pkt_burst = fm10k_xmit_pkts;
-- 
2.7.4

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

* [PATCH 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size
  2017-02-24  8:48 [PATCH 0/5] consistent PMD batching behaviour Zhiyong Yang
  2017-02-24  8:48 ` [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
@ 2017-02-24  8:48 ` Zhiyong Yang
  2017-02-24  8:48 ` [PATCH 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec " Zhiyong Yang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-02-24  8:48 UTC (permalink / raw)
  To: dev; +Cc: Helin Zhang, Jingjing Wu, Zhiyong Yang

To add a wrapper function i40e_xmit_pkts_vec_simple to remove the
limit of tx burst size. The patch makes i40e vec function an best
effort to transmit the pkts in the consistent behavior like
i40e_xmit_pkts_simple and i40e_xmit_pkts do that.

Cc: Helin Zhang <helin.zhang@intel.com>
Cc: Jingjing Wu <jingjing.wu@intel.com>

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/i40e/i40e_rxtx.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 48429cc..819d1d4 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1426,6 +1426,31 @@ i40e_xmit_pkts_simple(void *tx_queue,
 	return nb_tx;
 }
 
+static uint16_t
+i40e_xmit_pkts_vec_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
+			  uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
+
+	if (likely(nb_pkts <= txq->tx_rs_thresh))
+		return i40e_xmit_pkts_vec(tx_queue, tx_pkts, nb_pkts);
+
+	/* transmit in chunks of at least txq->tx_rs_thresh */
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->tx_rs_thresh);
+		ret = i40e_xmit_pkts_vec(tx_queue, &tx_pkts[nb_tx], num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+
 /*********************************************************************
  *
  *  TX prep functions
@@ -2840,7 +2865,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)
 	if (ad->tx_simple_allowed) {
 		if (ad->tx_vec_allowed) {
 			PMD_INIT_LOG(DEBUG, "Vector tx finally be used.");
-			dev->tx_pkt_burst = i40e_xmit_pkts_vec;
+			dev->tx_pkt_burst = i40e_xmit_pkts_vec_simple;
 		} else {
 			PMD_INIT_LOG(DEBUG, "Simple tx finally be used.");
 			dev->tx_pkt_burst = i40e_xmit_pkts_simple;
-- 
2.7.4

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

* [PATCH 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
  2017-02-24  8:48 [PATCH 0/5] consistent PMD batching behaviour Zhiyong Yang
  2017-02-24  8:48 ` [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
  2017-02-24  8:48 ` [PATCH 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size Zhiyong Yang
@ 2017-02-24  8:48 ` Zhiyong Yang
  2017-02-24  8:48 ` [PATCH 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
  2017-02-24  8:48 ` [PATCH 5/5] net/vhost: remove limit of vhost RX " Zhiyong Yang
  4 siblings, 0 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-02-24  8:48 UTC (permalink / raw)
  To: dev; +Cc: Helin Zhang, Konstantin Ananyev, Zhiyong Yang

To add a wrapper function ixgbe_xmit_pkts_vec_simple to remove the
limit of tx burst size and implement the "make an best effort to
transmit the pkts" policy. The patch makes ixgbe vec function work
in a consistent behavior like ixgbe_xmit_pkts_simple and ixgbe_xmit
_pkts do that.

Cc: Helin Zhang <helin.zhang@intel.com>
Cc: Konstantin Ananyev <konstantin.ananyev@intel.com>

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/ixgbe/ixgbe_rxtx.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 9502432..8b80903 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -363,6 +363,31 @@ ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
 	return nb_tx;
 }
 
+static uint16_t
+ixgbe_xmit_pkts_vec_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
+			   uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
+
+	if (likely(nb_pkts <= txq->tx_rs_thresh))
+		return ixgbe_xmit_pkts_vec(tx_queue, tx_pkts, nb_pkts);
+
+	/* transmit in chunks of at least txq->tx_rs_thresh */
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->tx_rs_thresh);
+		ret = ixgbe_xmit_pkts_vec(tx_queue, &tx_pkts[nb_tx], num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+
 static inline void
 ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq,
 		volatile struct ixgbe_adv_tx_context_desc *ctx_txd,
@@ -2355,7 +2380,7 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq)
 				(rte_eal_process_type() != RTE_PROC_PRIMARY ||
 					ixgbe_txq_vec_setup(txq) == 0)) {
 			PMD_INIT_LOG(DEBUG, "Vector tx enabled.");
-			dev->tx_pkt_burst = ixgbe_xmit_pkts_vec;
+			dev->tx_pkt_burst = ixgbe_xmit_pkts_vec_simple;
 		} else
 #endif
 		dev->tx_pkt_burst = ixgbe_xmit_pkts_simple;
-- 
2.7.4

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

* [PATCH 4/5] net/vhost: remove limit of vhost TX burst size
  2017-02-24  8:48 [PATCH 0/5] consistent PMD batching behaviour Zhiyong Yang
                   ` (2 preceding siblings ...)
  2017-02-24  8:48 ` [PATCH 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec " Zhiyong Yang
@ 2017-02-24  8:48 ` Zhiyong Yang
  2017-02-24 11:08   ` Kevin Traynor
  2017-03-01  9:44   ` Maxime Coquelin
  2017-02-24  8:48 ` [PATCH 5/5] net/vhost: remove limit of vhost RX " Zhiyong Yang
  4 siblings, 2 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-02-24  8:48 UTC (permalink / raw)
  To: dev; +Cc: yuanhan.liu, maxime.coquelin, Zhiyong Yang

vhost removes limit of TX burst size(32 pkts) and supports to make
an best effort to transmit pkts.

Cc: yuanhan.liu@linux.intel.com
Cc: maxime.coquelin@redhat.com

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index e98cffd..1e1fa34 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -52,6 +52,7 @@
 #define ETH_VHOST_QUEUES_ARG		"queues"
 #define ETH_VHOST_CLIENT_ARG		"client"
 #define ETH_VHOST_DEQUEUE_ZERO_COPY	"dequeue-zero-copy"
+#define VHOST_MAX_PKT_BURST 32
 
 static const char *valid_arguments[] = {
 	ETH_VHOST_IFACE_ARG,
@@ -434,8 +435,27 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 		goto out;
 
 	/* Enqueue packets to guest RX queue */
-	nb_tx = rte_vhost_enqueue_burst(r->vid,
-			r->virtqueue_id, bufs, nb_bufs);
+	if (likely(nb_bufs <= VHOST_MAX_PKT_BURST))
+		nb_tx = rte_vhost_enqueue_burst(r->vid, r->virtqueue_id,
+						bufs, nb_bufs);
+	else {
+		uint16_t nb_send = nb_bufs;
+
+		while (nb_send) {
+			uint16_t nb_pkts;
+			uint16_t num = (uint16_t)RTE_MIN(nb_send,
+					VHOST_MAX_PKT_BURST);
+
+			nb_pkts = rte_vhost_enqueue_burst(r->vid,
+							  r->virtqueue_id,
+							  &bufs[nb_tx], num);
+
+			nb_tx += nb_pkts;
+			nb_send -= nb_pkts;
+			if (nb_pkts < num)
+				break;
+		}
+	}
 
 	r->stats.pkts += nb_tx;
 	r->stats.missed_pkts += nb_bufs - nb_tx;
-- 
2.7.4

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

* [PATCH 5/5] net/vhost: remove limit of vhost RX burst size
  2017-02-24  8:48 [PATCH 0/5] consistent PMD batching behaviour Zhiyong Yang
                   ` (3 preceding siblings ...)
  2017-02-24  8:48 ` [PATCH 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
@ 2017-02-24  8:48 ` Zhiyong Yang
  2017-02-24 11:41   ` Kevin Traynor
  4 siblings, 1 reply; 36+ messages in thread
From: Zhiyong Yang @ 2017-02-24  8:48 UTC (permalink / raw)
  To: dev; +Cc: yuanhan.liu, maxime.coquelin, Zhiyong Yang

vhost removes limit of RX burst size(32 pkts) and supports to make
an best effort to receive pkts.

Cc: yuanhan.liu@linux.intel.com
Cc: maxime.coquelin@redhat.com

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 1e1fa34..8a97c2a 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -402,9 +402,28 @@ eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 		goto out;
 
 	/* Dequeue packets from guest TX queue */
-	nb_rx = rte_vhost_dequeue_burst(r->vid,
-			r->virtqueue_id, r->mb_pool, bufs, nb_bufs);
+	if (likely(nb_bufs <= VHOST_MAX_PKT_BURST))
+		nb_rx = rte_vhost_dequeue_burst(r->vid, r->virtqueue_id,
+						r->mb_pool, bufs, nb_bufs);
+	else {
+		uint16_t nb_receive = nb_bufs;
+
+		while (nb_receive) {
+			uint16_t nb_pkts;
+			uint16_t num = (uint16_t)RTE_MIN(nb_receive,
+					VHOST_MAX_PKT_BURST);
 
+			nb_pkts = rte_vhost_dequeue_burst(r->vid,
+							  r->virtqueue_id,
+							  r->mb_pool,
+							  &bufs[nb_rx], num);
+
+			nb_rx += nb_pkts;
+			nb_receive -= nb_pkts;
+			if (nb_pkts < num)
+				break;
+		}
+	}
 	r->stats.pkts += nb_rx;
 
 	for (i = 0; likely(i < nb_rx); i++) {
-- 
2.7.4

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

* Re: [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
  2017-02-24  8:48 ` [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
@ 2017-02-24  9:32   ` Bruce Richardson
  2017-02-24  9:36     ` Bruce Richardson
  2017-03-03 11:17   ` [PATCH v2 0/5] consistent PMD batching behaviour Zhiyong Yang
  1 sibling, 1 reply; 36+ messages in thread
From: Bruce Richardson @ 2017-02-24  9:32 UTC (permalink / raw)
  To: Zhiyong Yang; +Cc: dev, Jing Chen

On Fri, Feb 24, 2017 at 04:48:17PM +0800, Zhiyong Yang wrote:
> To add a wrapper function fm10k_xmit_pkts_vec_simple to remove
> the limit of tx burst size. The patch makes fm10k vec function
> an best effort to transmit the pkts in the consistent behavior
> like fm10k_xmit_pkts does that.
> 
> Cc: Jing Chen <jing.d.chen@intel.com>
> 
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> ---
>  drivers/net/fm10k/fm10k_ethdev.c | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
> index c4fe746..e9b6254 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -2741,6 +2741,31 @@ fm10k_check_ftag(struct rte_devargs *devargs)
>  	return 1;
>  }
>  
> +static uint16_t
> +fm10k_xmit_pkts_vec_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
> +			   uint16_t nb_pkts)
> +{
> +	uint16_t nb_tx = 0;
> +	struct fm10k_tx_queue *txq = (struct fm10k_tx_queue *)tx_queue;
> +
> +	if (likely(nb_pkts <= txq->rs_thresh))
> +		return fm10k_xmit_pkts_vec(tx_queue, tx_pkts, nb_pkts);
> +
> +	/* transmit in chunks of at least txq->rs_thresh */
> +	while (nb_pkts) {
> +		uint16_t ret, num;
> +
> +		num = (uint16_t)RTE_MIN(nb_pkts, txq->rs_thresh);
> +		ret = fm10k_xmit_pkts_vec(tx_queue, &tx_pkts[nb_tx], num);
> +		nb_tx += ret;
> +		nb_pkts -= ret;
> +		if (ret < num)
> +			break;
> +	}
> +
> +	return nb_tx;
> +}
> +
>  static void __attribute__((cold))
>  fm10k_set_tx_function(struct rte_eth_dev *dev)
>  {
> @@ -2766,7 +2791,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
>  			txq = dev->data->tx_queues[i];
>  			fm10k_txq_vec_setup(txq);
>  		}
> -		dev->tx_pkt_burst = fm10k_xmit_pkts_vec;
> +		dev->tx_pkt_burst = fm10k_xmit_pkts_vec_simple;
>  		dev->tx_pkt_prepare = NULL;
>  	} else {

The names of the functions do not look right to me. I don't think the
suffic "_simple" is suitable for describing the functionality of the
wrapper function vs the original function. I think instead that the
original function should be renamed to indicate that it is only handles
a fixed size burst of pkts, and the new wrapper function takes the
original name. For example:

	fm10k_xmit_fixed_burst_vec (original fn)
	fm10k_xmit_pkts_vec (new fn)

Regards,
/Bruce

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

* Re: [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
  2017-02-24  9:32   ` Bruce Richardson
@ 2017-02-24  9:36     ` Bruce Richardson
  2017-02-24  9:48       ` Yang, Zhiyong
  0 siblings, 1 reply; 36+ messages in thread
From: Bruce Richardson @ 2017-02-24  9:36 UTC (permalink / raw)
  To: Zhiyong Yang; +Cc: dev, Jing Chen

On Fri, Feb 24, 2017 at 09:32:56AM +0000, Bruce Richardson wrote:
> On Fri, Feb 24, 2017 at 04:48:17PM +0800, Zhiyong Yang wrote:
> > To add a wrapper function fm10k_xmit_pkts_vec_simple to remove
> > the limit of tx burst size. The patch makes fm10k vec function
> > an best effort to transmit the pkts in the consistent behavior
> > like fm10k_xmit_pkts does that.
> > 
> > Cc: Jing Chen <jing.d.chen@intel.com>
> > 
> > Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> > ---
> >  drivers/net/fm10k/fm10k_ethdev.c | 27 ++++++++++++++++++++++++++-
> >  1 file changed, 26 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
> > index c4fe746..e9b6254 100644
> > --- a/drivers/net/fm10k/fm10k_ethdev.c
> > +++ b/drivers/net/fm10k/fm10k_ethdev.c
> > @@ -2741,6 +2741,31 @@ fm10k_check_ftag(struct rte_devargs *devargs)
> >  	return 1;
> >  }
> >  
> > +static uint16_t
> > +fm10k_xmit_pkts_vec_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
> > +			   uint16_t nb_pkts)
> > +{
> > +	uint16_t nb_tx = 0;
> > +	struct fm10k_tx_queue *txq = (struct fm10k_tx_queue *)tx_queue;
> > +
> > +	if (likely(nb_pkts <= txq->rs_thresh))
> > +		return fm10k_xmit_pkts_vec(tx_queue, tx_pkts, nb_pkts);
> > +
> > +	/* transmit in chunks of at least txq->rs_thresh */
> > +	while (nb_pkts) {
> > +		uint16_t ret, num;
> > +
> > +		num = (uint16_t)RTE_MIN(nb_pkts, txq->rs_thresh);
> > +		ret = fm10k_xmit_pkts_vec(tx_queue, &tx_pkts[nb_tx], num);
> > +		nb_tx += ret;
> > +		nb_pkts -= ret;
> > +		if (ret < num)
> > +			break;
> > +	}
> > +
> > +	return nb_tx;
> > +}
> > +
> >  static void __attribute__((cold))
> >  fm10k_set_tx_function(struct rte_eth_dev *dev)
> >  {
> > @@ -2766,7 +2791,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
> >  			txq = dev->data->tx_queues[i];
> >  			fm10k_txq_vec_setup(txq);
> >  		}
> > -		dev->tx_pkt_burst = fm10k_xmit_pkts_vec;
> > +		dev->tx_pkt_burst = fm10k_xmit_pkts_vec_simple;
> >  		dev->tx_pkt_prepare = NULL;
> >  	} else {
> 
> The names of the functions do not look right to me. I don't think the
> suffic "_simple" is suitable for describing the functionality of the
> wrapper function vs the original function. I think instead that the
> original function should be renamed to indicate that it is only handles
> a fixed size burst of pkts, and the new wrapper function takes the
> original name. For example:
> 
> 	fm10k_xmit_fixed_burst_vec (original fn)
> 	fm10k_xmit_pkts_vec (new fn)
>
This comment applies for the other patches in the set too.

/Bruce

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

* Re: [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
  2017-02-24  9:36     ` Bruce Richardson
@ 2017-02-24  9:48       ` Yang, Zhiyong
  0 siblings, 0 replies; 36+ messages in thread
From: Yang, Zhiyong @ 2017-02-24  9:48 UTC (permalink / raw)
  To: Richardson, Bruce; +Cc: dev, Chen, Jing D, Zhang, Helin, Wu, Jingjing

Hi, Bruce:

> -----Original Message-----
> From: Richardson, Bruce
> Sent: Friday, February 24, 2017 5:36 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>
> Cc: dev@dpdk.org; Chen, Jing D <jing.d.chen@intel.com>
> Subject: Re: [dpdk-dev] [PATCH 1/5] net/fm10k: remove limit of
> fm10k_xmit_pkts_vec burst size
> 
> On Fri, Feb 24, 2017 at 09:32:56AM +0000, Bruce Richardson wrote:
> > On Fri, Feb 24, 2017 at 04:48:17PM +0800, Zhiyong Yang wrote:
> > > To add a wrapper function fm10k_xmit_pkts_vec_simple to remove the
> > > limit of tx burst size. The patch makes fm10k vec function an best
> > > effort to transmit the pkts in the consistent behavior like
> > > fm10k_xmit_pkts does that.
> > >
> > > Cc: Jing Chen <jing.d.chen@intel.com>
> > >
> > > Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> > > ---
> > >  drivers/net/fm10k/fm10k_ethdev.c | 27
> ++++++++++++++++++++++++++-
> > >  1 file changed, 26 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> > > b/drivers/net/fm10k/fm10k_ethdev.c
> > > index c4fe746..e9b6254 100644
> > > --- a/drivers/net/fm10k/fm10k_ethdev.c
> > > +++ b/drivers/net/fm10k/fm10k_ethdev.c
> > > @@ -2741,6 +2741,31 @@ fm10k_check_ftag(struct rte_devargs
> *devargs)
> > >  	return 1;
> > >  }
> > >
> > > +static uint16_t
> > > +fm10k_xmit_pkts_vec_simple(void *tx_queue, struct rte_mbuf
> **tx_pkts,
> > > +			   uint16_t nb_pkts)
> > > +{
> > > +	uint16_t nb_tx = 0;
> > > +	struct fm10k_tx_queue *txq = (struct fm10k_tx_queue *)tx_queue;
> > > +
> > > +	if (likely(nb_pkts <= txq->rs_thresh))
> > > +		return fm10k_xmit_pkts_vec(tx_queue, tx_pkts, nb_pkts);
> > > +
> > > +	/* transmit in chunks of at least txq->rs_thresh */
> > > +	while (nb_pkts) {
> > > +		uint16_t ret, num;
> > > +
> > > +		num = (uint16_t)RTE_MIN(nb_pkts, txq->rs_thresh);
> > > +		ret = fm10k_xmit_pkts_vec(tx_queue, &tx_pkts[nb_tx],
> num);
> > > +		nb_tx += ret;
> > > +		nb_pkts -= ret;
> > > +		if (ret < num)
> > > +			break;
> > > +	}
> > > +
> > > +	return nb_tx;
> > > +}
> > > +
> > >  static void __attribute__((cold))
> > >  fm10k_set_tx_function(struct rte_eth_dev *dev)  { @@ -2766,7
> > > +2791,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
> > >  			txq = dev->data->tx_queues[i];
> > >  			fm10k_txq_vec_setup(txq);
> > >  		}
> > > -		dev->tx_pkt_burst = fm10k_xmit_pkts_vec;
> > > +		dev->tx_pkt_burst = fm10k_xmit_pkts_vec_simple;
> > >  		dev->tx_pkt_prepare = NULL;
> > >  	} else {
> >
> > The names of the functions do not look right to me. I don't think the
> > suffic "_simple" is suitable for describing the functionality of the
> > wrapper function vs the original function. I think instead that the
> > original function should be renamed to indicate that it is only
> > handles a fixed size burst of pkts, and the new wrapper function takes
> > the original name. For example:
> >
> > 	fm10k_xmit_fixed_burst_vec (original fn)
> > 	fm10k_xmit_pkts_vec (new fn)
> >
> This comment applies for the other patches in the set too.

I use the suffix  "_simple" only because I see the similar wrapper function
i40e_xmit_pkts_simple,  Your suggestion looks better obviously.

Thanks
Zhiyong

> 
> /Bruce

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

* Re: [PATCH 4/5] net/vhost: remove limit of vhost TX burst size
  2017-02-24  8:48 ` [PATCH 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
@ 2017-02-24 11:08   ` Kevin Traynor
  2017-02-24 13:04     ` Bruce Richardson
  2017-03-01  9:44   ` Maxime Coquelin
  1 sibling, 1 reply; 36+ messages in thread
From: Kevin Traynor @ 2017-02-24 11:08 UTC (permalink / raw)
  To: Zhiyong Yang, dev; +Cc: yuanhan.liu, maxime.coquelin

On 02/24/2017 08:48 AM, Zhiyong Yang wrote:
> vhost removes limit of TX burst size(32 pkts) and supports to make
> an best effort to transmit pkts.
> 
> Cc: yuanhan.liu@linux.intel.com
> Cc: maxime.coquelin@redhat.com
> 
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index e98cffd..1e1fa34 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -52,6 +52,7 @@
>  #define ETH_VHOST_QUEUES_ARG		"queues"
>  #define ETH_VHOST_CLIENT_ARG		"client"
>  #define ETH_VHOST_DEQUEUE_ZERO_COPY	"dequeue-zero-copy"
> +#define VHOST_MAX_PKT_BURST 32
>  
>  static const char *valid_arguments[] = {
>  	ETH_VHOST_IFACE_ARG,
> @@ -434,8 +435,27 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
>  		goto out;
>  
>  	/* Enqueue packets to guest RX queue */
> -	nb_tx = rte_vhost_enqueue_burst(r->vid,
> -			r->virtqueue_id, bufs, nb_bufs);
> +	if (likely(nb_bufs <= VHOST_MAX_PKT_BURST))
> +		nb_tx = rte_vhost_enqueue_burst(r->vid, r->virtqueue_id,
> +						bufs, nb_bufs);
> +	else {
> +		uint16_t nb_send = nb_bufs;
> +
> +		while (nb_send) {
> +			uint16_t nb_pkts;
> +			uint16_t num = (uint16_t)RTE_MIN(nb_send,
> +					VHOST_MAX_PKT_BURST);
> +
> +			nb_pkts = rte_vhost_enqueue_burst(r->vid,
> +							  r->virtqueue_id,
> +							  &bufs[nb_tx], num);
> +
> +			nb_tx += nb_pkts;
> +			nb_send -= nb_pkts;
> +			if (nb_pkts < num)
> +				break;
> +		}

In the code above,
- if the VM does not service the queue, this will spin forever
- if the queue is almost full, it will be very slow

In the example of OVS, other ports being serviced by the same core would
stop being serviced or drop a lot of packets.

If you want to remove the 32 pkt limitation, the
rte_vhost_enqueue_burst() api limitation needs to be changed first. It
doesn't make sense to put retry code in eth_vhost_tx() fn, the
application can retry if it wants to.

> +	}
>  
>  	r->stats.pkts += nb_tx;
>  	r->stats.missed_pkts += nb_bufs - nb_tx;
> 

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

* Re: [PATCH 5/5] net/vhost: remove limit of vhost RX burst size
  2017-02-24  8:48 ` [PATCH 5/5] net/vhost: remove limit of vhost RX " Zhiyong Yang
@ 2017-02-24 11:41   ` Kevin Traynor
  0 siblings, 0 replies; 36+ messages in thread
From: Kevin Traynor @ 2017-02-24 11:41 UTC (permalink / raw)
  To: Zhiyong Yang, dev; +Cc: yuanhan.liu, maxime.coquelin

On 02/24/2017 08:48 AM, Zhiyong Yang wrote:
> vhost removes limit of RX burst size(32 pkts) and supports to make
> an best effort to receive pkts.
> 
> Cc: yuanhan.liu@linux.intel.com
> Cc: maxime.coquelin@redhat.com
> 
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index 1e1fa34..8a97c2a 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -402,9 +402,28 @@ eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
>  		goto out;
>  
>  	/* Dequeue packets from guest TX queue */
> -	nb_rx = rte_vhost_dequeue_burst(r->vid,
> -			r->virtqueue_id, r->mb_pool, bufs, nb_bufs);
> +	if (likely(nb_bufs <= VHOST_MAX_PKT_BURST))
> +		nb_rx = rte_vhost_dequeue_burst(r->vid, r->virtqueue_id,
> +						r->mb_pool, bufs, nb_bufs);
> +	else {
> +		uint16_t nb_receive = nb_bufs;
> +
> +		while (nb_receive) {
> +			uint16_t nb_pkts;
> +			uint16_t num = (uint16_t)RTE_MIN(nb_receive,
> +					VHOST_MAX_PKT_BURST);
>  
> +			nb_pkts = rte_vhost_dequeue_burst(r->vid,
> +							  r->virtqueue_id,
> +							  r->mb_pool,
> +							  &bufs[nb_rx], num);
> +
> +			nb_rx += nb_pkts;
> +			nb_receive -= nb_pkts;
> +			if (nb_pkts < num)
> +				break;
> +		}

Similar comment for this as for vhost tx

> +	}
>  	r->stats.pkts += nb_rx;
>  
>  	for (i = 0; likely(i < nb_rx); i++) {
> 

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

* Re: [PATCH 4/5] net/vhost: remove limit of vhost TX burst size
  2017-02-24 11:08   ` Kevin Traynor
@ 2017-02-24 13:04     ` Bruce Richardson
  2017-02-24 13:33       ` Kevin Traynor
  0 siblings, 1 reply; 36+ messages in thread
From: Bruce Richardson @ 2017-02-24 13:04 UTC (permalink / raw)
  To: Kevin Traynor; +Cc: Zhiyong Yang, dev, yuanhan.liu, maxime.coquelin

On Fri, Feb 24, 2017 at 11:08:56AM +0000, Kevin Traynor wrote:
> On 02/24/2017 08:48 AM, Zhiyong Yang wrote:
> > vhost removes limit of TX burst size(32 pkts) and supports to make
> > an best effort to transmit pkts.
> > 
> > Cc: yuanhan.liu@linux.intel.com
> > Cc: maxime.coquelin@redhat.com
> > 
> > Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> > ---
> >  drivers/net/vhost/rte_eth_vhost.c | 24 ++++++++++++++++++++++--
> >  1 file changed, 22 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> > index e98cffd..1e1fa34 100644
> > --- a/drivers/net/vhost/rte_eth_vhost.c
> > +++ b/drivers/net/vhost/rte_eth_vhost.c
> > @@ -52,6 +52,7 @@
> >  #define ETH_VHOST_QUEUES_ARG		"queues"
> >  #define ETH_VHOST_CLIENT_ARG		"client"
> >  #define ETH_VHOST_DEQUEUE_ZERO_COPY	"dequeue-zero-copy"
> > +#define VHOST_MAX_PKT_BURST 32
> >  
> >  static const char *valid_arguments[] = {
> >  	ETH_VHOST_IFACE_ARG,
> > @@ -434,8 +435,27 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
> >  		goto out;
> >  
> >  	/* Enqueue packets to guest RX queue */
> > -	nb_tx = rte_vhost_enqueue_burst(r->vid,
> > -			r->virtqueue_id, bufs, nb_bufs);
> > +	if (likely(nb_bufs <= VHOST_MAX_PKT_BURST))
> > +		nb_tx = rte_vhost_enqueue_burst(r->vid, r->virtqueue_id,
> > +						bufs, nb_bufs);
> > +	else {
> > +		uint16_t nb_send = nb_bufs;
> > +
> > +		while (nb_send) {
> > +			uint16_t nb_pkts;
> > +			uint16_t num = (uint16_t)RTE_MIN(nb_send,
> > +					VHOST_MAX_PKT_BURST);
> > +
> > +			nb_pkts = rte_vhost_enqueue_burst(r->vid,
> > +							  r->virtqueue_id,
> > +							  &bufs[nb_tx], num);
> > +
> > +			nb_tx += nb_pkts;
> > +			nb_send -= nb_pkts;
> > +			if (nb_pkts < num)
> > +				break;
> > +		}
> 
> In the code above,
> - if the VM does not service the queue, this will spin forever
I don't think that is the case. As soon as the enqueue stops sending a
full burst of (presumably 32) pkts, it will hit the break condition and
quit. If it does send the full burst, it makes good forward progress
until it runs out of packets to send and then quits.

> - if the queue is almost full, it will be very slow
Again, should not be the case. As soon as a full burst is not full
enqueued the logic quits the loop.

/Bruce

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

* Re: [PATCH 4/5] net/vhost: remove limit of vhost TX burst size
  2017-02-24 13:04     ` Bruce Richardson
@ 2017-02-24 13:33       ` Kevin Traynor
  0 siblings, 0 replies; 36+ messages in thread
From: Kevin Traynor @ 2017-02-24 13:33 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Zhiyong Yang, dev, yuanhan.liu, maxime.coquelin

On 02/24/2017 01:04 PM, Bruce Richardson wrote:
> On Fri, Feb 24, 2017 at 11:08:56AM +0000, Kevin Traynor wrote:
>> On 02/24/2017 08:48 AM, Zhiyong Yang wrote:
>>> vhost removes limit of TX burst size(32 pkts) and supports to make
>>> an best effort to transmit pkts.
>>>
>>> Cc: yuanhan.liu@linux.intel.com
>>> Cc: maxime.coquelin@redhat.com
>>>
>>> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
>>> ---
>>>  drivers/net/vhost/rte_eth_vhost.c | 24 ++++++++++++++++++++++--
>>>  1 file changed, 22 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
>>> index e98cffd..1e1fa34 100644
>>> --- a/drivers/net/vhost/rte_eth_vhost.c
>>> +++ b/drivers/net/vhost/rte_eth_vhost.c
>>> @@ -52,6 +52,7 @@
>>>  #define ETH_VHOST_QUEUES_ARG		"queues"
>>>  #define ETH_VHOST_CLIENT_ARG		"client"
>>>  #define ETH_VHOST_DEQUEUE_ZERO_COPY	"dequeue-zero-copy"
>>> +#define VHOST_MAX_PKT_BURST 32
>>>  
>>>  static const char *valid_arguments[] = {
>>>  	ETH_VHOST_IFACE_ARG,
>>> @@ -434,8 +435,27 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
>>>  		goto out;
>>>  
>>>  	/* Enqueue packets to guest RX queue */
>>> -	nb_tx = rte_vhost_enqueue_burst(r->vid,
>>> -			r->virtqueue_id, bufs, nb_bufs);
>>> +	if (likely(nb_bufs <= VHOST_MAX_PKT_BURST))
>>> +		nb_tx = rte_vhost_enqueue_burst(r->vid, r->virtqueue_id,
>>> +						bufs, nb_bufs);
>>> +	else {
>>> +		uint16_t nb_send = nb_bufs;
>>> +
>>> +		while (nb_send) {
>>> +			uint16_t nb_pkts;
>>> +			uint16_t num = (uint16_t)RTE_MIN(nb_send,
>>> +					VHOST_MAX_PKT_BURST);
>>> +
>>> +			nb_pkts = rte_vhost_enqueue_burst(r->vid,
>>> +							  r->virtqueue_id,
>>> +							  &bufs[nb_tx], num);
>>> +
>>> +			nb_tx += nb_pkts;
>>> +			nb_send -= nb_pkts;
>>> +			if (nb_pkts < num)
>>> +				break;
>>> +		}
>>
>> In the code above,
>> - if the VM does not service the queue, this will spin forever
> I don't think that is the case. As soon as the enqueue stops sending a
> full burst of (presumably 32) pkts, it will hit the break condition and
> quit. If it does send the full burst, it makes good forward progress
> until it runs out of packets to send and then quits.
> 
>> - if the queue is almost full, it will be very slow
> Again, should not be the case. As soon as a full burst is not full
> enqueued the logic quits the loop.
> 

My bad - you are of course correct. In that case it makes sense, as the
retries are just enough to allow all packets a chance to be sent but not
to retry when packets fail to send.

thanks,
Kevin.

> /Bruce
> 

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

* Re: [PATCH 4/5] net/vhost: remove limit of vhost TX burst size
  2017-02-24  8:48 ` [PATCH 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
  2017-02-24 11:08   ` Kevin Traynor
@ 2017-03-01  9:44   ` Maxime Coquelin
  2017-03-01 13:24     ` Yang, Zhiyong
  1 sibling, 1 reply; 36+ messages in thread
From: Maxime Coquelin @ 2017-03-01  9:44 UTC (permalink / raw)
  To: Zhiyong Yang, dev; +Cc: yuanhan.liu



On 02/24/2017 09:48 AM, Zhiyong Yang wrote:
> vhost removes limit of TX burst size(32 pkts) and supports to make
> an best effort to transmit pkts.
>
> Cc: yuanhan.liu@linux.intel.com
> Cc: maxime.coquelin@redhat.com
>
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index e98cffd..1e1fa34 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -52,6 +52,7 @@
>  #define ETH_VHOST_QUEUES_ARG		"queues"
>  #define ETH_VHOST_CLIENT_ARG		"client"
>  #define ETH_VHOST_DEQUEUE_ZERO_COPY	"dequeue-zero-copy"
> +#define VHOST_MAX_PKT_BURST 32
>
>  static const char *valid_arguments[] = {
>  	ETH_VHOST_IFACE_ARG,
> @@ -434,8 +435,27 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
>  		goto out;
>
>  	/* Enqueue packets to guest RX queue */
> -	nb_tx = rte_vhost_enqueue_burst(r->vid,
> -			r->virtqueue_id, bufs, nb_bufs);
> +	if (likely(nb_bufs <= VHOST_MAX_PKT_BURST))
> +		nb_tx = rte_vhost_enqueue_burst(r->vid, r->virtqueue_id,
> +						bufs, nb_bufs);
> +	else {
> +		uint16_t nb_send = nb_bufs;
> +
> +		while (nb_send) {
> +			uint16_t nb_pkts;
> +			uint16_t num = (uint16_t)RTE_MIN(nb_send,
> +					VHOST_MAX_PKT_BURST);
> +
> +			nb_pkts = rte_vhost_enqueue_burst(r->vid,
> +							  r->virtqueue_id,
> +							  &bufs[nb_tx], num);
> +
> +			nb_tx += nb_pkts;
> +			nb_send -= nb_pkts;
> +			if (nb_pkts < num)
> +				break;
> +		}
> +	}
It looks like the if/else could be avoided, but maybe you did so for
performance reason?
If this is the case, maybe you could add a comment or at least state
this in the commit message.

Thanks,
Maxime
>
>  	r->stats.pkts += nb_tx;
>  	r->stats.missed_pkts += nb_bufs - nb_tx;
>

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

* Re: [PATCH 4/5] net/vhost: remove limit of vhost TX burst size
  2017-03-01  9:44   ` Maxime Coquelin
@ 2017-03-01 13:24     ` Yang, Zhiyong
  0 siblings, 0 replies; 36+ messages in thread
From: Yang, Zhiyong @ 2017-03-01 13:24 UTC (permalink / raw)
  To: Maxime Coquelin, dev; +Cc: yuanhan.liu

Hi, Maxime:

> -----Original Message-----
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Wednesday, March 1, 2017 5:44 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>; dev@dpdk.org
> Cc: yuanhan.liu@linux.intel.com
> Subject: Re: [PATCH 4/5] net/vhost: remove limit of vhost TX burst size
> 
> 
> 
> On 02/24/2017 09:48 AM, Zhiyong Yang wrote:
> > vhost removes limit of TX burst size(32 pkts) and supports to make an
> > best effort to transmit pkts.
> >
> > Cc: yuanhan.liu@linux.intel.com
> > Cc: maxime.coquelin@redhat.com
> >
> > Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> > ---
> >  drivers/net/vhost/rte_eth_vhost.c | 24 ++++++++++++++++++++++--
> >  1 file changed, 22 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/vhost/rte_eth_vhost.c
> > b/drivers/net/vhost/rte_eth_vhost.c
> > index e98cffd..1e1fa34 100644
> > --- a/drivers/net/vhost/rte_eth_vhost.c
> > +++ b/drivers/net/vhost/rte_eth_vhost.c
> > @@ -52,6 +52,7 @@
> >  #define ETH_VHOST_QUEUES_ARG		"queues"
> >  #define ETH_VHOST_CLIENT_ARG		"client"
> >  #define ETH_VHOST_DEQUEUE_ZERO_COPY	"dequeue-zero-copy"
> > +#define VHOST_MAX_PKT_BURST 32
> >
> >  static const char *valid_arguments[] = {
> >  	ETH_VHOST_IFACE_ARG,
> > @@ -434,8 +435,27 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs,
> uint16_t nb_bufs)
> >  		goto out;
> >
> >  	/* Enqueue packets to guest RX queue */
> > -	nb_tx = rte_vhost_enqueue_burst(r->vid,
> > -			r->virtqueue_id, bufs, nb_bufs);
> > +	if (likely(nb_bufs <= VHOST_MAX_PKT_BURST))
> > +		nb_tx = rte_vhost_enqueue_burst(r->vid, r->virtqueue_id,
> > +						bufs, nb_bufs);
> > +	else {
> > +		uint16_t nb_send = nb_bufs;
> > +
> > +		while (nb_send) {
> > +			uint16_t nb_pkts;
> > +			uint16_t num = (uint16_t)RTE_MIN(nb_send,
> > +					VHOST_MAX_PKT_BURST);
> > +
> > +			nb_pkts = rte_vhost_enqueue_burst(r->vid,
> > +							  r->virtqueue_id,
> > +							  &bufs[nb_tx], num);
> > +
> > +			nb_tx += nb_pkts;
> > +			nb_send -= nb_pkts;
> > +			if (nb_pkts < num)
> > +				break;
> > +		}
> > +	}
> It looks like the if/else could be avoided, but maybe you did so for
> performance reason?
> If this is the case, maybe you could add a comment or at least state this in the
> commit message.

Yes, you are right.
if/else can be avoided and code will  look more clean.
I  choose performance between them. 
Comments will be added in V2 here.

Thanks
Zhiyong

> 
> Thanks,
> Maxime
> >
> >  	r->stats.pkts += nb_tx;
> >  	r->stats.missed_pkts += nb_bufs - nb_tx;
> >

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

* [PATCH v2 0/5] consistent PMD batching behaviour
  2017-02-24  8:48 ` [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
  2017-02-24  9:32   ` Bruce Richardson
@ 2017-03-03 11:17   ` Zhiyong Yang
  2017-03-03 11:17     ` [PATCH v2 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
                       ` (6 more replies)
  1 sibling, 7 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-03 11:17 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson

The rte_eth_tx_burst() function in the file Rte_ethdev.h is invoked to
transmit output packets on the output queue for DPDK applications as
follows.

static inline uint16_t
rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
                 struct rte_mbuf **tx_pkts, uint16_t nb_pkts);

Note: The fourth parameter nb_pkts: The number of packets to transmit.

The rte_eth_tx_burst() function returns the number of packets it actually
sent. Most of PMD drivers can support the policy "send as many packets to
transmit as possible" at the PMD level. but the few of PMDs have some sort
of artificial limits for the pkts sent successfully. For example, VHOST tx
burst size is limited to 32 packets. Some rx_burst functions have the
similar problem. The main benefit is consistent batching behavior for user
to simplify their logic and avoid misusage at the application level, there
is unified rte_eth_tx/rx_burst interface already, there is no reason for
inconsistent behaviors. 
This patchset fixes it via adding wrapper function at the PMD level.

Changes in V2:
1. rename ixgbe, i40e and fm10k vec function XXX_xmit_pkts_vec to new name
XXX_xmit_fixed_burst_vec, new wrapper functions use original name
XXX_xmit_pkts_vec according to Bruce's suggestion.

2. simplify the code to avoid the if or if/else.

Zhiyong Yang (5):
  net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
  net/i40e: remove limit of i40e_xmit_pkts_vec burst size
  net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
  net/vhost: remove limit of vhost TX burst size
  net/vhost: remove limit of vhost RX burst size

 drivers/net/fm10k/fm10k.h               |  4 ++--
 drivers/net/fm10k/fm10k_ethdev.c        | 28 ++++++++++++++++++++++++---
 drivers/net/fm10k/fm10k_rxtx_vec.c      |  4 ++--
 drivers/net/i40e/i40e_rxtx.c            | 28 ++++++++++++++++++++++++---
 drivers/net/i40e/i40e_rxtx.h            |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_neon.c   |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_sse.c    |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx.c          | 29 ++++++++++++++++++++++++++++
 drivers/net/ixgbe/ixgbe_rxtx.h          |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c  |  4 ++--
 drivers/net/vhost/rte_eth_vhost.c       | 34 +++++++++++++++++++++++++++++----
 12 files changed, 125 insertions(+), 26 deletions(-)

-- 
2.7.4

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

* [PATCH v2 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
  2017-03-03 11:17   ` [PATCH v2 0/5] consistent PMD batching behaviour Zhiyong Yang
@ 2017-03-03 11:17     ` Zhiyong Yang
  2017-03-29  7:16       ` [PATCH v3 0/5] consistent PMD batching behaviour Zhiyong Yang
  2017-03-03 11:17     ` [PATCH v2 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size Zhiyong Yang
                       ` (5 subsequent siblings)
  6 siblings, 1 reply; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-03 11:17 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Jing Chen, Zhiyong Yang

To add a wrapper function to remove the limit of tx burst size.
The patch makes fm10k vec function an best effort to transmit
pkts in the consistent behavior like fm10k_xmit_pkts does that.

Cc: Jing Chen <jing.d.chen@intel.com>
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/fm10k/fm10k.h          |  4 ++--
 drivers/net/fm10k/fm10k_ethdev.c   | 28 +++++++++++++++++++++++++---
 drivers/net/fm10k/fm10k_rxtx_vec.c |  4 ++--
 3 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index c6fed21..8e1a950 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -368,8 +368,8 @@ void fm10k_rx_queue_release_mbufs_vec(struct fm10k_rx_queue *rxq);
 uint16_t fm10k_recv_pkts_vec(void *, struct rte_mbuf **, uint16_t);
 uint16_t fm10k_recv_scattered_pkts_vec(void *, struct rte_mbuf **,
 					uint16_t);
-uint16_t fm10k_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		uint16_t nb_pkts);
+uint16_t fm10k_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+				    uint16_t nb_pkts);
 void fm10k_txq_vec_setup(struct fm10k_tx_queue *txq);
 int fm10k_tx_vec_condition_check(struct fm10k_tx_queue *txq);
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c4fe746..dd4ea80 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -197,9 +197,9 @@ fm10k_tx_vec_condition_check(__rte_unused struct fm10k_tx_queue *txq)
 }
 
 uint16_t __attribute__((weak))
-fm10k_xmit_pkts_vec(__rte_unused void *tx_queue,
-		__rte_unused struct rte_mbuf **tx_pkts,
-		__rte_unused uint16_t nb_pkts)
+fm10k_xmit_fixed_burst_vec(__rte_unused void *tx_queue,
+			   __rte_unused struct rte_mbuf **tx_pkts,
+			   __rte_unused uint16_t nb_pkts)
 {
 	return 0;
 }
@@ -2741,6 +2741,28 @@ fm10k_check_ftag(struct rte_devargs *devargs)
 	return 1;
 }
 
+static uint16_t
+fm10k_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+		    uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct fm10k_tx_queue *txq = (struct fm10k_tx_queue *)tx_queue;
+
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->rs_thresh);
+		ret = fm10k_xmit_fixed_burst_vec(tx_queue, &tx_pkts[nb_tx],
+						 num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+
 static void __attribute__((cold))
 fm10k_set_tx_function(struct rte_eth_dev *dev)
 {
diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 27f3e43..ab87206 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -800,8 +800,8 @@ tx_backlog_entry(struct rte_mbuf **txep,
 }
 
 uint16_t
-fm10k_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-			uint16_t nb_pkts)
+fm10k_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			   uint16_t nb_pkts)
 {
 	struct fm10k_tx_queue *txq = (struct fm10k_tx_queue *)tx_queue;
 	volatile struct fm10k_tx_desc *txdp;
-- 
2.7.4

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

* [PATCH v2 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size
  2017-03-03 11:17   ` [PATCH v2 0/5] consistent PMD batching behaviour Zhiyong Yang
  2017-03-03 11:17     ` [PATCH v2 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
@ 2017-03-03 11:17     ` Zhiyong Yang
  2017-03-24 14:03       ` Ferruh Yigit
  2017-03-03 11:17     ` [PATCH v2 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec " Zhiyong Yang
                       ` (4 subsequent siblings)
  6 siblings, 1 reply; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-03 11:17 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Helin Zhang, Jingjing Wu, Zhiyong Yang

To add a wrapper function to remove the limit of tx burst size. The patch
makes i40e vec function an best effort to transmit the pkts in the
consistent behavior like i40e_xmit_pkts_simple and i40e_xmit_pkts do that.

Cc: Helin Zhang <helin.zhang@intel.com>
Cc: Jingjing Wu <jingjing.wu@intel.com>
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/i40e/i40e_rxtx.c          | 28 +++++++++++++++++++++++++---
 drivers/net/i40e/i40e_rxtx.h          |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_neon.c |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_sse.c  |  4 ++--
 4 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 48429cc..85d4194 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1426,6 +1426,28 @@ i40e_xmit_pkts_simple(void *tx_queue,
 	return nb_tx;
 }
 
+static uint16_t
+i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+		   uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
+
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->tx_rs_thresh);
+		ret = i40e_xmit_fixed_burst_vec(tx_queue, &tx_pkts[nb_tx],
+						num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+
 /*********************************************************************
  *
  *  TX prep functions
@@ -2897,9 +2919,9 @@ i40e_rx_queue_release_mbufs_vec(struct i40e_rx_queue __rte_unused*rxq)
 }
 
 uint16_t __attribute__((weak))
-i40e_xmit_pkts_vec(void __rte_unused *tx_queue,
-		   struct rte_mbuf __rte_unused **tx_pkts,
-		   uint16_t __rte_unused nb_pkts)
+i40e_xmit_fixed_burst_vec(void __rte_unused *tx_queue,
+			  struct rte_mbuf __rte_unused **tx_pkts,
+			  uint16_t __rte_unused nb_pkts)
 {
 	return 0;
 }
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index 9df8a56..d27ef45 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -256,8 +256,8 @@ int i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);
 int i40e_rxq_vec_setup(struct i40e_rx_queue *rxq);
 int i40e_txq_vec_setup(struct i40e_tx_queue *txq);
 void i40e_rx_queue_release_mbufs_vec(struct i40e_rx_queue *rxq);
-uint16_t i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-			    uint16_t nb_pkts);
+uint16_t i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+				   uint16_t nb_pkts);
 void i40e_set_rx_function(struct rte_eth_dev *dev);
 void i40e_set_tx_function_flag(struct rte_eth_dev *dev,
 			       struct i40e_tx_queue *txq);
diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index 011c54e..fc69852 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -523,8 +523,8 @@ vtx(volatile struct i40e_tx_desc *txdp,
 }
 
 uint16_t
-i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		   uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			  uint16_t nb_pkts)
 {
 	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
 	volatile struct i40e_tx_desc *txdp;
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index b95cc8e..deed7e2 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -536,8 +536,8 @@ vtx(volatile struct i40e_tx_desc *txdp,
 }
 
 uint16_t
-i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		   uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			  uint16_t nb_pkts)
 {
 	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
 	volatile struct i40e_tx_desc *txdp;
-- 
2.7.4

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

* [PATCH v2 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
  2017-03-03 11:17   ` [PATCH v2 0/5] consistent PMD batching behaviour Zhiyong Yang
  2017-03-03 11:17     ` [PATCH v2 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
  2017-03-03 11:17     ` [PATCH v2 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size Zhiyong Yang
@ 2017-03-03 11:17     ` Zhiyong Yang
  2017-03-03 11:17     ` [PATCH v2 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
                       ` (3 subsequent siblings)
  6 siblings, 0 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-03 11:17 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, Helin Zhang, Konstantin Ananyev, Zhiyong Yang

To add a wrapper function to remove the limit of tx burst size and
implement the "make an best effort to transmit the pkts" policy.
The patch makes ixgbe vec function work in a consistent behavior
like ixgbe_xmit_pkts_simple and ixgbe_xmit_pkts do that.

Cc: Helin Zhang <helin.zhang@intel.com>
Cc: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/ixgbe/ixgbe_rxtx.c          | 29 +++++++++++++++++++++++++++++
 drivers/net/ixgbe/ixgbe_rxtx.h          |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c  |  4 ++--
 4 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 9502432..6068b11 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -111,6 +111,11 @@
 #define rte_ixgbe_prefetch(p)   do {} while (0)
 #endif
 
+#ifdef RTE_IXGBE_INC_VECTOR
+uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+				    uint16_t nb_pkts);
+#endif
+
 /*********************************************************************
  *
  *  TX functions
@@ -363,6 +368,30 @@ ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
 	return nb_tx;
 }
 
+#ifdef RTE_IXGBE_INC_VECTOR
+static uint16_t
+ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+		    uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
+
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->tx_rs_thresh);
+		ret = ixgbe_xmit_fixed_burst_vec(tx_queue, &tx_pkts[nb_tx],
+						 num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+#endif
+
 static inline void
 ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq,
 		volatile struct ixgbe_adv_tx_context_desc *ctx_txd,
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h
index 739fd19..1ffab4c 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx.h
@@ -311,8 +311,8 @@ void ixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);
 
 #ifdef RTE_IXGBE_INC_VECTOR
 
-uint16_t ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		uint16_t nb_pkts);
+uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+				    uint16_t nb_pkts);
 int ixgbe_txq_vec_setup(struct ixgbe_tx_queue *txq);
 
 #endif /* RTE_IXGBE_INC_VECTOR */
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
index e2715cb..5930aa1 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
@@ -451,8 +451,8 @@ vtx(volatile union ixgbe_adv_tx_desc *txdp,
 }
 
 uint16_t
-ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		       uint16_t nb_pkts)
+ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			   uint16_t nb_pkts)
 {
 	struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
 	volatile union ixgbe_adv_tx_desc *txdp;
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index abbf284..0861d91 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -537,8 +537,8 @@ vtx(volatile union ixgbe_adv_tx_desc *txdp,
 }
 
 uint16_t
-ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		       uint16_t nb_pkts)
+ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			   uint16_t nb_pkts)
 {
 	struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
 	volatile union ixgbe_adv_tx_desc *txdp;
-- 
2.7.4

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

* [PATCH v2 4/5] net/vhost: remove limit of vhost TX burst size
  2017-03-03 11:17   ` [PATCH v2 0/5] consistent PMD batching behaviour Zhiyong Yang
                       ` (2 preceding siblings ...)
  2017-03-03 11:17     ` [PATCH v2 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec " Zhiyong Yang
@ 2017-03-03 11:17     ` Zhiyong Yang
  2017-03-03 11:17     ` [PATCH v2 5/5] net/vhost: remove limit of vhost RX " Zhiyong Yang
                       ` (2 subsequent siblings)
  6 siblings, 0 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-03 11:17 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, yuanhan.liu, maxime.coquelin, Zhiyong Yang

vhost removes limit of TX burst size(32 pkts) and supports to make
an best effort to transmit pkts.

Cc: yuanhan.liu@linux.intel.com
Cc: maxime.coquelin@redhat.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index e98cffd..603b84d 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -52,6 +52,7 @@
 #define ETH_VHOST_QUEUES_ARG		"queues"
 #define ETH_VHOST_CLIENT_ARG		"client"
 #define ETH_VHOST_DEQUEUE_ZERO_COPY	"dequeue-zero-copy"
+#define VHOST_MAX_PKT_BURST 32
 
 static const char *valid_arguments[] = {
 	ETH_VHOST_IFACE_ARG,
@@ -424,6 +425,7 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 {
 	struct vhost_queue *r = q;
 	uint16_t i, nb_tx = 0;
+	uint16_t nb_send = nb_bufs;
 
 	if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0))
 		return 0;
@@ -434,8 +436,19 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 		goto out;
 
 	/* Enqueue packets to guest RX queue */
-	nb_tx = rte_vhost_enqueue_burst(r->vid,
-			r->virtqueue_id, bufs, nb_bufs);
+	while (nb_send) {
+		uint16_t nb_pkts;
+		uint16_t num = (uint16_t)RTE_MIN(nb_send,
+						 VHOST_MAX_PKT_BURST);
+
+		nb_pkts = rte_vhost_enqueue_burst(r->vid, r->virtqueue_id,
+						  &bufs[nb_tx], num);
+
+		nb_tx += nb_pkts;
+		nb_send -= nb_pkts;
+		if (nb_pkts < num)
+			break;
+	}
 
 	r->stats.pkts += nb_tx;
 	r->stats.missed_pkts += nb_bufs - nb_tx;
-- 
2.7.4

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

* [PATCH v2 5/5] net/vhost: remove limit of vhost RX burst size
  2017-03-03 11:17   ` [PATCH v2 0/5] consistent PMD batching behaviour Zhiyong Yang
                       ` (3 preceding siblings ...)
  2017-03-03 11:17     ` [PATCH v2 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
@ 2017-03-03 11:17     ` Zhiyong Yang
  2017-03-05 13:02     ` [PATCH v2 0/5] consistent PMD batching behaviour Ananyev, Konstantin
  2017-03-24 14:02     ` Ferruh Yigit
  6 siblings, 0 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-03 11:17 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, yuanhan.liu, maxime.coquelin, Zhiyong Yang

vhost removes limit of RX burst size(32 pkts) and supports to make
an best effort to receive pkts.

Cc: yuanhan.liu@linux.intel.com
Cc: maxime.coquelin@redhat.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 603b84d..e0048fa 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -392,6 +392,7 @@ eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 {
 	struct vhost_queue *r = q;
 	uint16_t i, nb_rx = 0;
+	uint16_t nb_receive = nb_bufs;
 
 	if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0))
 		return 0;
@@ -402,8 +403,20 @@ eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 		goto out;
 
 	/* Dequeue packets from guest TX queue */
-	nb_rx = rte_vhost_dequeue_burst(r->vid,
-			r->virtqueue_id, r->mb_pool, bufs, nb_bufs);
+	while (nb_receive) {
+		uint16_t nb_pkts;
+		uint16_t num = (uint16_t)RTE_MIN(nb_receive,
+						 VHOST_MAX_PKT_BURST);
+
+		nb_pkts = rte_vhost_dequeue_burst(r->vid, r->virtqueue_id,
+						  r->mb_pool, &bufs[nb_rx],
+						  num);
+
+		nb_rx += nb_pkts;
+		nb_receive -= nb_pkts;
+		if (nb_pkts < num)
+			break;
+	}
 
 	r->stats.pkts += nb_rx;
 
-- 
2.7.4

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

* Re: [PATCH v2 0/5] consistent PMD batching behaviour
  2017-03-03 11:17   ` [PATCH v2 0/5] consistent PMD batching behaviour Zhiyong Yang
                       ` (4 preceding siblings ...)
  2017-03-03 11:17     ` [PATCH v2 5/5] net/vhost: remove limit of vhost RX " Zhiyong Yang
@ 2017-03-05 13:02     ` Ananyev, Konstantin
  2017-03-06  2:13       ` Yang, Zhiyong
  2017-03-24 14:02     ` Ferruh Yigit
  6 siblings, 1 reply; 36+ messages in thread
From: Ananyev, Konstantin @ 2017-03-05 13:02 UTC (permalink / raw)
  To: Yang, Zhiyong, dev; +Cc: Richardson, Bruce


> The rte_eth_tx_burst() function in the file Rte_ethdev.h is invoked to
> transmit output packets on the output queue for DPDK applications as
> follows.
> 
> static inline uint16_t
> rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
>                  struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
> 
> Note: The fourth parameter nb_pkts: The number of packets to transmit.
> 
> The rte_eth_tx_burst() function returns the number of packets it actually
> sent. Most of PMD drivers can support the policy "send as many packets to
> transmit as possible" at the PMD level. but the few of PMDs have some sort
> of artificial limits for the pkts sent successfully. For example, VHOST tx
> burst size is limited to 32 packets. Some rx_burst functions have the
> similar problem. The main benefit is consistent batching behavior for user
> to simplify their logic and avoid misusage at the application level, there
> is unified rte_eth_tx/rx_burst interface already, there is no reason for
> inconsistent behaviors.
> This patchset fixes it via adding wrapper function at the PMD level.
> 
> Changes in V2:
> 1. rename ixgbe, i40e and fm10k vec function XXX_xmit_pkts_vec to new name
> XXX_xmit_fixed_burst_vec, new wrapper functions use original name
> XXX_xmit_pkts_vec according to Bruce's suggestion.
> 
> 2. simplify the code to avoid the if or if/else.
> 
> Zhiyong Yang (5):
>   net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
>   net/i40e: remove limit of i40e_xmit_pkts_vec burst size
>   net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
>   net/vhost: remove limit of vhost TX burst size
>   net/vhost: remove limit of vhost RX burst size
> 
>  drivers/net/fm10k/fm10k.h               |  4 ++--
>  drivers/net/fm10k/fm10k_ethdev.c        | 28 ++++++++++++++++++++++++---
>  drivers/net/fm10k/fm10k_rxtx_vec.c      |  4 ++--
>  drivers/net/i40e/i40e_rxtx.c            | 28 ++++++++++++++++++++++++---
>  drivers/net/i40e/i40e_rxtx.h            |  4 ++--
>  drivers/net/i40e/i40e_rxtx_vec_neon.c   |  4 ++--
>  drivers/net/i40e/i40e_rxtx_vec_sse.c    |  4 ++--
>  drivers/net/ixgbe/ixgbe_rxtx.c          | 29 ++++++++++++++++++++++++++++
>  drivers/net/ixgbe/ixgbe_rxtx.h          |  4 ++--
>  drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c |  4 ++--
>  drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c  |  4 ++--
>  drivers/net/vhost/rte_eth_vhost.c       | 34 +++++++++++++++++++++++++++++----
>  12 files changed, 125 insertions(+), 26 deletions(-)
> 

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> --
> 2.7.4

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

* Re: [PATCH v2 0/5] consistent PMD batching behaviour
  2017-03-05 13:02     ` [PATCH v2 0/5] consistent PMD batching behaviour Ananyev, Konstantin
@ 2017-03-06  2:13       ` Yang, Zhiyong
  0 siblings, 0 replies; 36+ messages in thread
From: Yang, Zhiyong @ 2017-03-06  2:13 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev; +Cc: Richardson, Bruce

Thanks, Konstantin.

--Zhiyong

> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Sunday, March 5, 2017 9:03 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>; dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v2 0/5] consistent PMD batching behaviour
> 
> 
> > The rte_eth_tx_burst() function in the file Rte_ethdev.h is invoked to
> > transmit output packets on the output queue for DPDK applications as
> > follows.
> >
> > static inline uint16_t
> > rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
> >                  struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
> >
> > Note: The fourth parameter nb_pkts: The number of packets to transmit.
> >
> > The rte_eth_tx_burst() function returns the number of packets it
> > actually sent. Most of PMD drivers can support the policy "send as
> > many packets to transmit as possible" at the PMD level. but the few of
> > PMDs have some sort of artificial limits for the pkts sent
> > successfully. For example, VHOST tx burst size is limited to 32
> > packets. Some rx_burst functions have the similar problem. The main
> > benefit is consistent batching behavior for user to simplify their
> > logic and avoid misusage at the application level, there is unified
> > rte_eth_tx/rx_burst interface already, there is no reason for inconsistent
> behaviors.
> > This patchset fixes it via adding wrapper function at the PMD level.
> >
> > Changes in V2:
> > 1. rename ixgbe, i40e and fm10k vec function XXX_xmit_pkts_vec to new
> > name XXX_xmit_fixed_burst_vec, new wrapper functions use original
> name
> > XXX_xmit_pkts_vec according to Bruce's suggestion.
> >
> > 2. simplify the code to avoid the if or if/else.
> >
> > Zhiyong Yang (5):
> >   net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
> >   net/i40e: remove limit of i40e_xmit_pkts_vec burst size
> >   net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
> >   net/vhost: remove limit of vhost TX burst size
> >   net/vhost: remove limit of vhost RX burst size
> >
> >  drivers/net/fm10k/fm10k.h               |  4 ++--
> >  drivers/net/fm10k/fm10k_ethdev.c        | 28
> ++++++++++++++++++++++++---
> >  drivers/net/fm10k/fm10k_rxtx_vec.c      |  4 ++--
> >  drivers/net/i40e/i40e_rxtx.c            | 28 ++++++++++++++++++++++++---
> >  drivers/net/i40e/i40e_rxtx.h            |  4 ++--
> >  drivers/net/i40e/i40e_rxtx_vec_neon.c   |  4 ++--
> >  drivers/net/i40e/i40e_rxtx_vec_sse.c    |  4 ++--
> >  drivers/net/ixgbe/ixgbe_rxtx.c          | 29
> ++++++++++++++++++++++++++++
> >  drivers/net/ixgbe/ixgbe_rxtx.h          |  4 ++--
> >  drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c |  4 ++--
> > drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c  |  4 ++--
> >  drivers/net/vhost/rte_eth_vhost.c       | 34
> +++++++++++++++++++++++++++++----
> >  12 files changed, 125 insertions(+), 26 deletions(-)
> >
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 
> > --
> > 2.7.4

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

* Re: [PATCH v2 0/5] consistent PMD batching behaviour
  2017-03-03 11:17   ` [PATCH v2 0/5] consistent PMD batching behaviour Zhiyong Yang
                       ` (5 preceding siblings ...)
  2017-03-05 13:02     ` [PATCH v2 0/5] consistent PMD batching behaviour Ananyev, Konstantin
@ 2017-03-24 14:02     ` Ferruh Yigit
  2017-03-25  6:29       ` Yang, Zhiyong
  2017-03-28 10:00       ` Yang, Zhiyong
  6 siblings, 2 replies; 36+ messages in thread
From: Ferruh Yigit @ 2017-03-24 14:02 UTC (permalink / raw)
  To: Zhiyong Yang, dev; +Cc: bruce.richardson

On 3/3/2017 11:17 AM, Zhiyong Yang wrote:
> The rte_eth_tx_burst() function in the file Rte_ethdev.h is invoked to
> transmit output packets on the output queue for DPDK applications as
> follows.
> 
> static inline uint16_t
> rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
>                  struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
> 
> Note: The fourth parameter nb_pkts: The number of packets to transmit.
> 
> The rte_eth_tx_burst() function returns the number of packets it actually
> sent. Most of PMD drivers can support the policy "send as many packets to
> transmit as possible" at the PMD level. but the few of PMDs have some sort
> of artificial limits for the pkts sent successfully. For example, VHOST tx
> burst size is limited to 32 packets. Some rx_burst functions have the
> similar problem. The main benefit is consistent batching behavior for user
> to simplify their logic and avoid misusage at the application level, there
> is unified rte_eth_tx/rx_burst interface already, there is no reason for
> inconsistent behaviors. 
> This patchset fixes it via adding wrapper function at the PMD level.
> 
> Changes in V2:
> 1. rename ixgbe, i40e and fm10k vec function XXX_xmit_pkts_vec to new name
> XXX_xmit_fixed_burst_vec, new wrapper functions use original name
> XXX_xmit_pkts_vec according to Bruce's suggestion.
> 
> 2. simplify the code to avoid the if or if/else.
> 
> Zhiyong Yang (5):
>   net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
>   net/i40e: remove limit of i40e_xmit_pkts_vec burst size
>   net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
>   net/vhost: remove limit of vhost TX burst size
>   net/vhost: remove limit of vhost RX burst size

Can you please update release notes (release_17_05.rst) with this feature?

This patch changes the PMD behavior for the user, that is why it would
be nice to mention from this change in release notes.


Also i40e_rxtx_vec_altivec.c needs to be updated in patch 2/5.


You can keep Konstantin's ack in next patchset.

Thanks,
ferruh

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

* Re: [PATCH v2 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size
  2017-03-03 11:17     ` [PATCH v2 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size Zhiyong Yang
@ 2017-03-24 14:03       ` Ferruh Yigit
  0 siblings, 0 replies; 36+ messages in thread
From: Ferruh Yigit @ 2017-03-24 14:03 UTC (permalink / raw)
  To: Zhiyong Yang, dev; +Cc: bruce.richardson, Helin Zhang, Jingjing Wu

On 3/3/2017 11:17 AM, Zhiyong Yang wrote:
> To add a wrapper function to remove the limit of tx burst size. The patch
> makes i40e vec function an best effort to transmit the pkts in the
> consistent behavior like i40e_xmit_pkts_simple and i40e_xmit_pkts do that.
> 
> Cc: Helin Zhang <helin.zhang@intel.com>
> Cc: Jingjing Wu <jingjing.wu@intel.com>
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>

patch is giving following checkpatch warning:

CHECK:SPACING: spaces preferred around that '*' (ctx:WxV)
#71: FILE: drivers/net/i40e/i40e_rxtx.c:2922:
+i40e_xmit_fixed_burst_vec(void __rte_unused *tx_queue,
                                             ^

CHECK:SPACING: spaces preferred around that '*' (ctx:WxO)
#72: FILE: drivers/net/i40e/i40e_rxtx.c:2923:
+                         struct rte_mbuf __rte_unused **tx_pkts,
                                                       ^

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

* Re: [PATCH v2 0/5] consistent PMD batching behaviour
  2017-03-24 14:02     ` Ferruh Yigit
@ 2017-03-25  6:29       ` Yang, Zhiyong
  2017-03-28 10:00       ` Yang, Zhiyong
  1 sibling, 0 replies; 36+ messages in thread
From: Yang, Zhiyong @ 2017-03-25  6:29 UTC (permalink / raw)
  To: Yigit, Ferruh, dev; +Cc: Richardson, Bruce, Ananyev, Konstantin

Hi, Ferruh:
	I will update release note and fix the 2/5 checkpath warnings. send V3 later.  

Thanks
Zhiyong 

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Friday, March 24, 2017 10:02 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>; dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 0/5] consistent PMD batching behaviour

> Can you please update release notes (release_17_05.rst) with this feature?
> 
> This patch changes the PMD behavior for the user, that is why it would be nice
> to mention from this change in release notes.
> 
> 
> Also i40e_rxtx_vec_altivec.c needs to be updated in patch 2/5.
> 
> 
> You can keep Konstantin's ack in next patchset.
> 
> Thanks,
> ferruh

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

* Re: [PATCH v2 0/5] consistent PMD batching behaviour
  2017-03-24 14:02     ` Ferruh Yigit
  2017-03-25  6:29       ` Yang, Zhiyong
@ 2017-03-28 10:00       ` Yang, Zhiyong
  2017-03-28 10:05         ` Ferruh Yigit
  1 sibling, 1 reply; 36+ messages in thread
From: Yang, Zhiyong @ 2017-03-28 10:00 UTC (permalink / raw)
  To: Yigit, Ferruh, dev

Hi, Ferruh;

> Also i40e_rxtx_vec_altivec.c needs to be updated in patch 2/5.
Where is the file?   I don't find it in git master branch.

Thanks
Zhiyong

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Friday, March 24, 2017 10:02 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>; dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 0/5] consistent PMD batching behaviour
> 
> On 3/3/2017 11:17 AM, Zhiyong Yang wrote:
> Can you please update release notes (release_17_05.rst) with this feature?
> 
> This patch changes the PMD behavior for the user, that is why it would be nice
> to mention from this change in release notes.
> 
> 
> Also i40e_rxtx_vec_altivec.c needs to be updated in patch 2/5.
> 
> 
> You can keep Konstantin's ack in next patchset.
> 
> Thanks,
> ferruh

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

* Re: [PATCH v2 0/5] consistent PMD batching behaviour
  2017-03-28 10:00       ` Yang, Zhiyong
@ 2017-03-28 10:05         ` Ferruh Yigit
  0 siblings, 0 replies; 36+ messages in thread
From: Ferruh Yigit @ 2017-03-28 10:05 UTC (permalink / raw)
  To: Yang, Zhiyong, dev

On 3/28/2017 11:00 AM, Yang, Zhiyong wrote:
> Hi, Ferruh;
> 
>> Also i40e_rxtx_vec_altivec.c needs to be updated in patch 2/5.
> Where is the file?   I don't find it in git master branch.

It is in next-net tree, driver patches patches should be on top of this
next-net.

> 
> Thanks
> Zhiyong
> 
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Friday, March 24, 2017 10:02 PM
>> To: Yang, Zhiyong <zhiyong.yang@intel.com>; dev@dpdk.org
>> Cc: Richardson, Bruce <bruce.richardson@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v2 0/5] consistent PMD batching behaviour
>>
>> On 3/3/2017 11:17 AM, Zhiyong Yang wrote:
>> Can you please update release notes (release_17_05.rst) with this feature?
>>
>> This patch changes the PMD behavior for the user, that is why it would be nice
>> to mention from this change in release notes.
>>
>>
>> Also i40e_rxtx_vec_altivec.c needs to be updated in patch 2/5.
>>
>>
>> You can keep Konstantin's ack in next patchset.
>>
>> Thanks,
>> ferruh

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

* [PATCH v3 0/5] consistent PMD batching behaviour
  2017-03-03 11:17     ` [PATCH v2 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
@ 2017-03-29  7:16       ` Zhiyong Yang
  2017-03-29  7:16         ` [PATCH v3 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
                           ` (5 more replies)
  0 siblings, 6 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-29  7:16 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, konstantin.ananyev, bruce.richardson

The rte_eth_tx_burst() function in the file Rte_ethdev.h is invoked to
transmit output packets on the output queue for DPDK applications as
follows.

static inline uint16_t
rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
                 struct rte_mbuf **tx_pkts, uint16_t nb_pkts);

Note: The fourth parameter nb_pkts: The number of packets to transmit.

The rte_eth_tx_burst() function returns the number of packets it actually
sent. Most of PMD drivers can support the policy "send as many packets to
transmit as possible" at the PMD level. but the few of PMDs have some sort
of artificial limits for the pkts sent successfully. For example, VHOST tx
burst size is limited to 32 packets. Some rx_burst functions have the
similar problem. The main benefit is consistent batching behavior for user
to simplify their logic and avoid misusage at the application level, there
is unified rte_eth_tx/rx_burst interface already, there is no reason for
inconsistent behaviors. 
This patchset fixes it via adding wrapper function at the PMD level.

Changes in V3:

1. Updated release_17_05 in patch 5/5
2. Rebase on top of next net tree. i40e_rxtx_vec_altivec.c is updated in
patch 2/5.
3. fix one checkpatch issue in 2/5. 

Changes in V2:
1. rename ixgbe, i40e and fm10k vec function XXX_xmit_pkts_vec to new name
XXX_xmit_fixed_burst_vec, new wrapper functions use original name
XXX_xmit_pkts_vec according to Bruce's suggestion.
2. simplify the code to avoid the if or if/else.

Zhiyong Yang (5):
  net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
  net/i40e: remove limit of i40e_xmit_pkts_vec burst size
  net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
  net/vhost: remove limit of vhost TX burst size
  net/vhost: remove limit of vhost RX burst size

 doc/guides/rel_notes/release_17_05.rst   |  4 ++++
 drivers/net/fm10k/fm10k.h                |  4 ++--
 drivers/net/fm10k/fm10k_ethdev.c         | 28 +++++++++++++++++++++++---
 drivers/net/fm10k/fm10k_rxtx_vec.c       |  4 ++--
 drivers/net/i40e/i40e_rxtx.c             | 28 +++++++++++++++++++++++---
 drivers/net/i40e/i40e_rxtx.h             |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_altivec.c |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_neon.c    |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_sse.c     |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx.c           | 29 +++++++++++++++++++++++++++
 drivers/net/ixgbe/ixgbe_rxtx.h           |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c  |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c   |  4 ++--
 drivers/net/vhost/rte_eth_vhost.c        | 34 ++++++++++++++++++++++++++++----
 14 files changed, 131 insertions(+), 28 deletions(-)

-- 
2.7.4

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

* [PATCH v3 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
  2017-03-29  7:16       ` [PATCH v3 0/5] consistent PMD batching behaviour Zhiyong Yang
@ 2017-03-29  7:16         ` Zhiyong Yang
  2017-03-29  7:16         ` [PATCH v3 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec " Zhiyong Yang
                           ` (4 subsequent siblings)
  5 siblings, 0 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-29  7:16 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, konstantin.ananyev, bruce.richardson, Jing Chen,
	Zhiyong Yang

To add a wrapper function to remove the limit of tx burst size.
The patch makes fm10k vec function an best effort to transmit
pkts in the consistent behavior like fm10k_xmit_pkts does that.

Cc: Jing Chen <jing.d.chen@intel.com>
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/fm10k/fm10k.h          |  4 ++--
 drivers/net/fm10k/fm10k_ethdev.c   | 28 +++++++++++++++++++++++++---
 drivers/net/fm10k/fm10k_rxtx_vec.c |  4 ++--
 3 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index c6fed21..8e1a950 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -368,8 +368,8 @@ void fm10k_rx_queue_release_mbufs_vec(struct fm10k_rx_queue *rxq);
 uint16_t fm10k_recv_pkts_vec(void *, struct rte_mbuf **, uint16_t);
 uint16_t fm10k_recv_scattered_pkts_vec(void *, struct rte_mbuf **,
 					uint16_t);
-uint16_t fm10k_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		uint16_t nb_pkts);
+uint16_t fm10k_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+				    uint16_t nb_pkts);
 void fm10k_txq_vec_setup(struct fm10k_tx_queue *txq);
 int fm10k_tx_vec_condition_check(struct fm10k_tx_queue *txq);
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c4fe746..dd4ea80 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -197,9 +197,9 @@ fm10k_tx_vec_condition_check(__rte_unused struct fm10k_tx_queue *txq)
 }
 
 uint16_t __attribute__((weak))
-fm10k_xmit_pkts_vec(__rte_unused void *tx_queue,
-		__rte_unused struct rte_mbuf **tx_pkts,
-		__rte_unused uint16_t nb_pkts)
+fm10k_xmit_fixed_burst_vec(__rte_unused void *tx_queue,
+			   __rte_unused struct rte_mbuf **tx_pkts,
+			   __rte_unused uint16_t nb_pkts)
 {
 	return 0;
 }
@@ -2741,6 +2741,28 @@ fm10k_check_ftag(struct rte_devargs *devargs)
 	return 1;
 }
 
+static uint16_t
+fm10k_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+		    uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct fm10k_tx_queue *txq = (struct fm10k_tx_queue *)tx_queue;
+
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->rs_thresh);
+		ret = fm10k_xmit_fixed_burst_vec(tx_queue, &tx_pkts[nb_tx],
+						 num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+
 static void __attribute__((cold))
 fm10k_set_tx_function(struct rte_eth_dev *dev)
 {
diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 27f3e43..ab87206 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -800,8 +800,8 @@ tx_backlog_entry(struct rte_mbuf **txep,
 }
 
 uint16_t
-fm10k_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-			uint16_t nb_pkts)
+fm10k_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			   uint16_t nb_pkts)
 {
 	struct fm10k_tx_queue *txq = (struct fm10k_tx_queue *)tx_queue;
 	volatile struct fm10k_tx_desc *txdp;
-- 
2.7.4

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

* [PATCH v3 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size
  2017-03-29  7:16       ` [PATCH v3 0/5] consistent PMD batching behaviour Zhiyong Yang
  2017-03-29  7:16         ` [PATCH v3 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
@ 2017-03-29  7:16         ` Zhiyong Yang
  2017-03-29  7:16         ` [PATCH v3 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec " Zhiyong Yang
                           ` (3 subsequent siblings)
  5 siblings, 0 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-29  7:16 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, konstantin.ananyev, bruce.richardson, Helin Zhang,
	Jingjing Wu, Zhiyong Yang

To add a wrapper function to remove the limit of tx burst size. The patch
makes i40e vec function an best effort to transmit the pkts in the
consistent behavior like i40e_xmit_pkts_simple and i40e_xmit_pkts do that.

Cc: Helin Zhang <helin.zhang@intel.com>
Cc: Jingjing Wu <jingjing.wu@intel.com>
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/i40e/i40e_rxtx.c             | 28 +++++++++++++++++++++++++---
 drivers/net/i40e/i40e_rxtx.h             |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_altivec.c |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_neon.c    |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_sse.c     |  4 ++--
 5 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 02367b7..db160a1 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1420,6 +1420,28 @@ i40e_xmit_pkts_simple(void *tx_queue,
 	return nb_tx;
 }
 
+static uint16_t
+i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+		   uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
+
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->tx_rs_thresh);
+		ret = i40e_xmit_fixed_burst_vec(tx_queue, &tx_pkts[nb_tx],
+						num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+
 /*********************************************************************
  *
  *  TX prep functions
@@ -2886,9 +2908,9 @@ i40e_rx_queue_release_mbufs_vec(struct i40e_rx_queue __rte_unused*rxq)
 }
 
 uint16_t __attribute__((weak))
-i40e_xmit_pkts_vec(void __rte_unused *tx_queue,
-		   struct rte_mbuf __rte_unused **tx_pkts,
-		   uint16_t __rte_unused nb_pkts)
+i40e_xmit_fixed_burst_vec(void __rte_unused * tx_queue,
+			  struct rte_mbuf __rte_unused **tx_pkts,
+			  uint16_t __rte_unused nb_pkts)
 {
 	return 0;
 }
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index a87bdb0..cd39208 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -246,8 +246,8 @@ int i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);
 int i40e_rxq_vec_setup(struct i40e_rx_queue *rxq);
 int i40e_txq_vec_setup(struct i40e_tx_queue *txq);
 void i40e_rx_queue_release_mbufs_vec(struct i40e_rx_queue *rxq);
-uint16_t i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-			    uint16_t nb_pkts);
+uint16_t i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+				   uint16_t nb_pkts);
 void i40e_set_rx_function(struct rte_eth_dev *dev);
 void i40e_set_tx_function_flag(struct rte_eth_dev *dev,
 			       struct i40e_tx_queue *txq);
diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
index 40d1929..2f6f70a 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
@@ -562,8 +562,8 @@ vtx(volatile struct i40e_tx_desc *txdp,
 }
 
 uint16_t
-i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		   uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			  uint16_t nb_pkts)
 {
 	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
 	volatile struct i40e_tx_desc *txdp;
diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index d235daa..bd7239b 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -523,8 +523,8 @@ vtx(volatile struct i40e_tx_desc *txdp,
 }
 
 uint16_t
-i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		   uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			  uint16_t nb_pkts)
 {
 	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
 	volatile struct i40e_tx_desc *txdp;
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index b95cc8e..deed7e2 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -536,8 +536,8 @@ vtx(volatile struct i40e_tx_desc *txdp,
 }
 
 uint16_t
-i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		   uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			  uint16_t nb_pkts)
 {
 	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
 	volatile struct i40e_tx_desc *txdp;
-- 
2.7.4

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

* [PATCH v3 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
  2017-03-29  7:16       ` [PATCH v3 0/5] consistent PMD batching behaviour Zhiyong Yang
  2017-03-29  7:16         ` [PATCH v3 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
  2017-03-29  7:16         ` [PATCH v3 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec " Zhiyong Yang
@ 2017-03-29  7:16         ` Zhiyong Yang
  2017-03-29  7:16         ` [PATCH v3 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
                           ` (2 subsequent siblings)
  5 siblings, 0 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-29  7:16 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, konstantin.ananyev, bruce.richardson, Helin Zhang,
	Zhiyong Yang

To add a wrapper function to remove the limit of tx burst size and
implement the "make an best effort to transmit the pkts" policy.
The patch makes ixgbe vec function work in a consistent behavior
like ixgbe_xmit_pkts_simple and ixgbe_xmit_pkts do that.

Cc: Helin Zhang <helin.zhang@intel.com>
Cc: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/ixgbe/ixgbe_rxtx.c          | 29 +++++++++++++++++++++++++++++
 drivers/net/ixgbe/ixgbe_rxtx.h          |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c |  4 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c  |  4 ++--
 4 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index c080566..8541b14 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -111,6 +111,11 @@
 #define rte_ixgbe_prefetch(p)   do {} while (0)
 #endif
 
+#ifdef RTE_IXGBE_INC_VECTOR
+uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+				    uint16_t nb_pkts);
+#endif
+
 /*********************************************************************
  *
  *  TX functions
@@ -363,6 +368,30 @@ ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
 	return nb_tx;
 }
 
+#ifdef RTE_IXGBE_INC_VECTOR
+static uint16_t
+ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+		    uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
+
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->tx_rs_thresh);
+		ret = ixgbe_xmit_fixed_burst_vec(tx_queue, &tx_pkts[nb_tx],
+						 num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+#endif
+
 static inline void
 ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq,
 		volatile struct ixgbe_adv_tx_context_desc *ctx_txd,
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h
index 739fd19..1ffab4c 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx.h
@@ -311,8 +311,8 @@ void ixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq);
 
 #ifdef RTE_IXGBE_INC_VECTOR
 
-uint16_t ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		uint16_t nb_pkts);
+uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+				    uint16_t nb_pkts);
 int ixgbe_txq_vec_setup(struct ixgbe_tx_queue *txq);
 
 #endif /* RTE_IXGBE_INC_VECTOR */
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
index e2715cb..5930aa1 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
@@ -451,8 +451,8 @@ vtx(volatile union ixgbe_adv_tx_desc *txdp,
 }
 
 uint16_t
-ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		       uint16_t nb_pkts)
+ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			   uint16_t nb_pkts)
 {
 	struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
 	volatile union ixgbe_adv_tx_desc *txdp;
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index abbf284..0861d91 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -537,8 +537,8 @@ vtx(volatile union ixgbe_adv_tx_desc *txdp,
 }
 
 uint16_t
-ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-		       uint16_t nb_pkts)
+ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
+			   uint16_t nb_pkts)
 {
 	struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
 	volatile union ixgbe_adv_tx_desc *txdp;
-- 
2.7.4

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

* [PATCH v3 4/5] net/vhost: remove limit of vhost TX burst size
  2017-03-29  7:16       ` [PATCH v3 0/5] consistent PMD batching behaviour Zhiyong Yang
                           ` (2 preceding siblings ...)
  2017-03-29  7:16         ` [PATCH v3 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec " Zhiyong Yang
@ 2017-03-29  7:16         ` Zhiyong Yang
  2017-03-29  7:16         ` [PATCH v3 5/5] net/vhost: remove limit of vhost RX " Zhiyong Yang
  2017-03-30 12:54         ` [PATCH v3 0/5] consistent PMD batching behaviour Ferruh Yigit
  5 siblings, 0 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-29  7:16 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, konstantin.ananyev, bruce.richardson, yuanhan.liu,
	maxime.coquelin, Zhiyong Yang

vhost removes limit of TX burst size(32 pkts) and supports to make
an best effort to transmit pkts.

Cc: yuanhan.liu@linux.intel.com
Cc: maxime.coquelin@redhat.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index abe91c7..2a38b19 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -52,6 +52,7 @@
 #define ETH_VHOST_QUEUES_ARG		"queues"
 #define ETH_VHOST_CLIENT_ARG		"client"
 #define ETH_VHOST_DEQUEUE_ZERO_COPY	"dequeue-zero-copy"
+#define VHOST_MAX_PKT_BURST 32
 
 static const char *valid_arguments[] = {
 	ETH_VHOST_IFACE_ARG,
@@ -424,6 +425,7 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 {
 	struct vhost_queue *r = q;
 	uint16_t i, nb_tx = 0;
+	uint16_t nb_send = nb_bufs;
 
 	if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0))
 		return 0;
@@ -434,8 +436,19 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 		goto out;
 
 	/* Enqueue packets to guest RX queue */
-	nb_tx = rte_vhost_enqueue_burst(r->vid,
-			r->virtqueue_id, bufs, nb_bufs);
+	while (nb_send) {
+		uint16_t nb_pkts;
+		uint16_t num = (uint16_t)RTE_MIN(nb_send,
+						 VHOST_MAX_PKT_BURST);
+
+		nb_pkts = rte_vhost_enqueue_burst(r->vid, r->virtqueue_id,
+						  &bufs[nb_tx], num);
+
+		nb_tx += nb_pkts;
+		nb_send -= nb_pkts;
+		if (nb_pkts < num)
+			break;
+	}
 
 	r->stats.pkts += nb_tx;
 	r->stats.missed_pkts += nb_bufs - nb_tx;
-- 
2.7.4

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

* [PATCH v3 5/5] net/vhost: remove limit of vhost RX burst size
  2017-03-29  7:16       ` [PATCH v3 0/5] consistent PMD batching behaviour Zhiyong Yang
                           ` (3 preceding siblings ...)
  2017-03-29  7:16         ` [PATCH v3 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
@ 2017-03-29  7:16         ` Zhiyong Yang
  2017-03-30 12:54         ` [PATCH v3 0/5] consistent PMD batching behaviour Ferruh Yigit
  5 siblings, 0 replies; 36+ messages in thread
From: Zhiyong Yang @ 2017-03-29  7:16 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, konstantin.ananyev, bruce.richardson, yuanhan.liu,
	maxime.coquelin, Zhiyong Yang

vhost removes limit of RX burst size(32 pkts) and supports to make
an best effort to receive pkts.

Cc: yuanhan.liu@linux.intel.com
Cc: maxime.coquelin@redhat.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 doc/guides/rel_notes/release_17_05.rst |  4 ++++
 drivers/net/vhost/rte_eth_vhost.c      | 17 +++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_17_05.rst b/doc/guides/rel_notes/release_17_05.rst
index 0c33f7b..226ecd6 100644
--- a/doc/guides/rel_notes/release_17_05.rst
+++ b/doc/guides/rel_notes/release_17_05.rst
@@ -127,6 +127,10 @@ New Features
   performance enhancements viz. configurable TX data ring, Receive
   Data Ring, ability to register memory regions.
 
+* **Kept consistent PMD batching behaviour.**
+
+  Removed the limit of fm10k/i40e/ixgbe TX burst size and vhost RX/TX burst size in
+  order to support the same policy "make an best effort to RX/TX pkts" for PMDs.
 
 Resolved Issues
 ---------------
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 2a38b19..7f5cd7e 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -392,6 +392,7 @@ eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 {
 	struct vhost_queue *r = q;
 	uint16_t i, nb_rx = 0;
+	uint16_t nb_receive = nb_bufs;
 
 	if (unlikely(rte_atomic32_read(&r->allow_queuing) == 0))
 		return 0;
@@ -402,8 +403,20 @@ eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
 		goto out;
 
 	/* Dequeue packets from guest TX queue */
-	nb_rx = rte_vhost_dequeue_burst(r->vid,
-			r->virtqueue_id, r->mb_pool, bufs, nb_bufs);
+	while (nb_receive) {
+		uint16_t nb_pkts;
+		uint16_t num = (uint16_t)RTE_MIN(nb_receive,
+						 VHOST_MAX_PKT_BURST);
+
+		nb_pkts = rte_vhost_dequeue_burst(r->vid, r->virtqueue_id,
+						  r->mb_pool, &bufs[nb_rx],
+						  num);
+
+		nb_rx += nb_pkts;
+		nb_receive -= nb_pkts;
+		if (nb_pkts < num)
+			break;
+	}
 
 	r->stats.pkts += nb_rx;
 
-- 
2.7.4

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

* Re: [PATCH v3 0/5] consistent PMD batching behaviour
  2017-03-29  7:16       ` [PATCH v3 0/5] consistent PMD batching behaviour Zhiyong Yang
                           ` (4 preceding siblings ...)
  2017-03-29  7:16         ` [PATCH v3 5/5] net/vhost: remove limit of vhost RX " Zhiyong Yang
@ 2017-03-30 12:54         ` Ferruh Yigit
  2017-03-31  7:00           ` Yao, Lei A
  5 siblings, 1 reply; 36+ messages in thread
From: Ferruh Yigit @ 2017-03-30 12:54 UTC (permalink / raw)
  To: Zhiyong Yang, dev; +Cc: konstantin.ananyev, bruce.richardson

On 3/29/2017 8:16 AM, Zhiyong Yang wrote:
> The rte_eth_tx_burst() function in the file Rte_ethdev.h is invoked to
> transmit output packets on the output queue for DPDK applications as
> follows.
> 
> static inline uint16_t
> rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
>                  struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
> 
> Note: The fourth parameter nb_pkts: The number of packets to transmit.
> 
> The rte_eth_tx_burst() function returns the number of packets it actually
> sent. Most of PMD drivers can support the policy "send as many packets to
> transmit as possible" at the PMD level. but the few of PMDs have some sort
> of artificial limits for the pkts sent successfully. For example, VHOST tx
> burst size is limited to 32 packets. Some rx_burst functions have the
> similar problem. The main benefit is consistent batching behavior for user
> to simplify their logic and avoid misusage at the application level, there
> is unified rte_eth_tx/rx_burst interface already, there is no reason for
> inconsistent behaviors. 
> This patchset fixes it via adding wrapper function at the PMD level.
> 
> Changes in V3:
> 
> 1. Updated release_17_05 in patch 5/5
> 2. Rebase on top of next net tree. i40e_rxtx_vec_altivec.c is updated in
> patch 2/5.
> 3. fix one checkpatch issue in 2/5. 
> 
> Changes in V2:
> 1. rename ixgbe, i40e and fm10k vec function XXX_xmit_pkts_vec to new name
> XXX_xmit_fixed_burst_vec, new wrapper functions use original name
> XXX_xmit_pkts_vec according to Bruce's suggestion.
> 2. simplify the code to avoid the if or if/else.
> 
> Zhiyong Yang (5):
>   net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
>   net/i40e: remove limit of i40e_xmit_pkts_vec burst size
>   net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
>   net/vhost: remove limit of vhost TX burst size
>   net/vhost: remove limit of vhost RX burst size

Series applied to dpdk-next-net/master, thanks.

(doc patch exported into separate patch)

This is the PMD update on fast path, effected PMDs, can you please
confirm the performance after test?

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

* Re: [PATCH v3 0/5] consistent PMD batching behaviour
  2017-03-30 12:54         ` [PATCH v3 0/5] consistent PMD batching behaviour Ferruh Yigit
@ 2017-03-31  7:00           ` Yao, Lei A
  0 siblings, 0 replies; 36+ messages in thread
From: Yao, Lei A @ 2017-03-31  7:00 UTC (permalink / raw)
  To: Yigit, Ferruh, Yang, Zhiyong, dev; +Cc: Ananyev, Konstantin, Richardson, Bruce



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Thursday, March 30, 2017 8:55 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>; dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Richardson,
> Bruce <bruce.richardson@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v3 0/5] consistent PMD batching behaviour
> 
> On 3/29/2017 8:16 AM, Zhiyong Yang wrote:
> > The rte_eth_tx_burst() function in the file Rte_ethdev.h is invoked to
> > transmit output packets on the output queue for DPDK applications as
> > follows.
> >
> > static inline uint16_t
> > rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
> >                  struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
> >
> > Note: The fourth parameter nb_pkts: The number of packets to transmit.
> >
> > The rte_eth_tx_burst() function returns the number of packets it actually
> > sent. Most of PMD drivers can support the policy "send as many packets to
> > transmit as possible" at the PMD level. but the few of PMDs have some
> sort
> > of artificial limits for the pkts sent successfully. For example, VHOST tx
> > burst size is limited to 32 packets. Some rx_burst functions have the
> > similar problem. The main benefit is consistent batching behavior for user
> > to simplify their logic and avoid misusage at the application level, there
> > is unified rte_eth_tx/rx_burst interface already, there is no reason for
> > inconsistent behaviors.
> > This patchset fixes it via adding wrapper function at the PMD level.
> >
> > Changes in V3:
> >
> > 1. Updated release_17_05 in patch 5/5
> > 2. Rebase on top of next net tree. i40e_rxtx_vec_altivec.c is updated in
> > patch 2/5.
> > 3. fix one checkpatch issue in 2/5.
> >
> > Changes in V2:
> > 1. rename ixgbe, i40e and fm10k vec function XXX_xmit_pkts_vec to new
> name
> > XXX_xmit_fixed_burst_vec, new wrapper functions use original name
> > XXX_xmit_pkts_vec according to Bruce's suggestion.
> > 2. simplify the code to avoid the if or if/else.
> >
> > Zhiyong Yang (5):
> >   net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size
> >   net/i40e: remove limit of i40e_xmit_pkts_vec burst size
> >   net/ixgbe: remove limit of ixgbe_xmit_pkts_vec burst size
> >   net/vhost: remove limit of vhost TX burst size
> >   net/vhost: remove limit of vhost RX burst size
> 
> Series applied to dpdk-next-net/master, thanks.
> 
> (doc patch exported into separate patch)
> 
> This is the PMD update on fast path, effected PMDs, can you please
> confirm the performance after test?
Hi, 

I have compare the vhost PVP performance with and without Zhiyong's 
Patch. Almost no performance drop
Mergeable path: -0.2%
Normal Path: -0.73%
Vector Path : -0.55%

Test bench:
Ubutnu16.04
Kernal:  4.4.0
gcc : 5.4.0

BRs
Lei

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

end of thread, other threads:[~2017-03-31  7:00 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-24  8:48 [PATCH 0/5] consistent PMD batching behaviour Zhiyong Yang
2017-02-24  8:48 ` [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
2017-02-24  9:32   ` Bruce Richardson
2017-02-24  9:36     ` Bruce Richardson
2017-02-24  9:48       ` Yang, Zhiyong
2017-03-03 11:17   ` [PATCH v2 0/5] consistent PMD batching behaviour Zhiyong Yang
2017-03-03 11:17     ` [PATCH v2 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
2017-03-29  7:16       ` [PATCH v3 0/5] consistent PMD batching behaviour Zhiyong Yang
2017-03-29  7:16         ` [PATCH v3 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size Zhiyong Yang
2017-03-29  7:16         ` [PATCH v3 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec " Zhiyong Yang
2017-03-29  7:16         ` [PATCH v3 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec " Zhiyong Yang
2017-03-29  7:16         ` [PATCH v3 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
2017-03-29  7:16         ` [PATCH v3 5/5] net/vhost: remove limit of vhost RX " Zhiyong Yang
2017-03-30 12:54         ` [PATCH v3 0/5] consistent PMD batching behaviour Ferruh Yigit
2017-03-31  7:00           ` Yao, Lei A
2017-03-03 11:17     ` [PATCH v2 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size Zhiyong Yang
2017-03-24 14:03       ` Ferruh Yigit
2017-03-03 11:17     ` [PATCH v2 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec " Zhiyong Yang
2017-03-03 11:17     ` [PATCH v2 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
2017-03-03 11:17     ` [PATCH v2 5/5] net/vhost: remove limit of vhost RX " Zhiyong Yang
2017-03-05 13:02     ` [PATCH v2 0/5] consistent PMD batching behaviour Ananyev, Konstantin
2017-03-06  2:13       ` Yang, Zhiyong
2017-03-24 14:02     ` Ferruh Yigit
2017-03-25  6:29       ` Yang, Zhiyong
2017-03-28 10:00       ` Yang, Zhiyong
2017-03-28 10:05         ` Ferruh Yigit
2017-02-24  8:48 ` [PATCH 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size Zhiyong Yang
2017-02-24  8:48 ` [PATCH 3/5] net/ixgbe: remove limit of ixgbe_xmit_pkts_vec " Zhiyong Yang
2017-02-24  8:48 ` [PATCH 4/5] net/vhost: remove limit of vhost TX " Zhiyong Yang
2017-02-24 11:08   ` Kevin Traynor
2017-02-24 13:04     ` Bruce Richardson
2017-02-24 13:33       ` Kevin Traynor
2017-03-01  9:44   ` Maxime Coquelin
2017-03-01 13:24     ` Yang, Zhiyong
2017-02-24  8:48 ` [PATCH 5/5] net/vhost: remove limit of vhost RX " Zhiyong Yang
2017-02-24 11:41   ` Kevin Traynor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.