DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: dev@dpdk.org
Cc: Yongseok Koh <yskoh@mellanox.com>
Subject: [dpdk-dev] [PATCH 3/5] net/mlx5: avoid reusing old queue's mbuf on reconfigure
Date: Tue,  1 Aug 2017 10:05:33 +0200	[thread overview]
Message-ID: <460b903b24c7faf37c721c4e39b83bfdedf3357c.1501574380.git.nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <cover.1501574380.git.nelio.laranjeiro@6wind.com>
In-Reply-To: <cover.1501574380.git.nelio.laranjeiro@6wind.com>

This patch prepare the merge of fake mbuf allocation needed by the vector
code with rxq_alloc_elts() where all mbuf of the queues should be
allocated.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 118a2d9..b54d7b0 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -675,16 +675,12 @@ rxq_trim_elts(struct rxq *rxq)
  *   Pointer to RX queue structure.
  * @param elts_n
  *   Number of elements to allocate.
- * @param[in] pool
- *   If not NULL, fetch buffers from this array instead of allocating them
- *   with rte_pktmbuf_alloc().
  *
  * @return
  *   0 on success, errno value on failure.
  */
 static int
-rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n,
-	       struct rte_mbuf *(*pool)[])
+rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n)
 {
 	const unsigned int sges_n = 1 << rxq_ctrl->rxq.sges_n;
 	unsigned int i;
@@ -696,15 +692,8 @@ rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n,
 		volatile struct mlx5_wqe_data_seg *scat =
 			&(*rxq_ctrl->rxq.wqes)[i];
 
-		if (pool != NULL) {
-			buf = (*pool)[i];
-			assert(buf != NULL);
-			rte_pktmbuf_reset(buf);
-			rte_pktmbuf_refcnt_update(buf, 1);
-		} else
-			buf = rte_pktmbuf_alloc(rxq_ctrl->rxq.mp);
+		buf = rte_pktmbuf_alloc(rxq_ctrl->rxq.mp);
 		if (buf == NULL) {
-			assert(pool == NULL);
 			ERROR("%p: empty mbuf pool", (void *)rxq_ctrl);
 			ret = ENOMEM;
 			goto error;
@@ -736,7 +725,6 @@ rxq_alloc_elts(struct rxq_ctrl *rxq_ctrl, unsigned int elts_n,
 	assert(ret == 0);
 	return 0;
 error:
-	assert(pool == NULL);
 	elts_n = i;
 	for (i = 0; (i != elts_n); ++i) {
 		if ((*rxq_ctrl->rxq.elts)[i] != NULL)
@@ -1074,15 +1062,14 @@ rxq_ctrl_setup(struct rte_eth_dev *dev, struct rxq_ctrl *rxq_ctrl,
 		      (void *)dev, strerror(ret));
 		goto error;
 	}
-	/* Reuse buffers from original queue if possible. */
 	if (rxq_ctrl->rxq.elts_n) {
 		assert(1 << rxq_ctrl->rxq.elts_n == desc);
 		assert(rxq_ctrl->rxq.elts != tmpl.rxq.elts);
 		ret = rxq_trim_elts(&rxq_ctrl->rxq);
 		if (!ret)
-			ret = rxq_alloc_elts(&tmpl, desc, rxq_ctrl->rxq.elts);
+			ret = rxq_alloc_elts(&tmpl, desc);
 	} else
-		ret = rxq_alloc_elts(&tmpl, desc, NULL);
+		ret = rxq_alloc_elts(&tmpl, desc);
 	if (ret) {
 		ERROR("%p: RXQ allocation failed: %s",
 		      (void *)dev, strerror(ret));
-- 
2.1.4

  parent reply	other threads:[~2017-08-01  8:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01  8:05 [dpdk-dev] [PATCH 0/5] net/mlx5: enable/disable vPMD and some cleanups Nelio Laranjeiro
2017-08-01  8:05 ` [dpdk-dev] [PATCH 1/5] net/mlx5: warn which Tx/Rx burst function is selected Nelio Laranjeiro
2017-08-01  8:05 ` [dpdk-dev] [PATCH 2/5] net/mlx5: add parameters to enable/disable vector code Nelio Laranjeiro
2017-08-01  8:05 ` Nelio Laranjeiro [this message]
2017-08-01  8:05 ` [dpdk-dev] [PATCH 4/5] net/mlx5: prepare vector Rx ring at setup time Nelio Laranjeiro
2017-08-01  8:05 ` [dpdk-dev] [PATCH 5/5] net/mlx5: cleanup Rx ring in free functions Nelio Laranjeiro
2017-08-02 15:32 ` [dpdk-dev] [PATCH v2] net/mlx5: enable/disable vPMD and some cleanups Nelio Laranjeiro
2017-08-02 15:32 ` [dpdk-dev] [PATCH v2] net/mlx5: add parameters to enable/disable vector code Nelio Laranjeiro
2017-08-03 21:36   ` Thomas Monjalon

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=460b903b24c7faf37c721c4e39b83bfdedf3357c.1501574380.git.nelio.laranjeiro@6wind.com \
    --to=nelio.laranjeiro@6wind.com \
    --cc=dev@dpdk.org \
    --cc=yskoh@mellanox.com \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).