From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 09/14] mlx5: fix memory registration for indirect mbuf data
Date: Mon, 23 Nov 2015 15:44:44 +0100 [thread overview]
Message-ID: <1448289889-9590-10-git-send-email-adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <1448289889-9590-1-git-send-email-adrien.mazarguil@6wind.com>
Indirect mbuf data may come from a different mempool which must be
registered separately as another memory region, otherwise such mbufs cannot
be sent.
Fixes: 2e22920b85d9 ("mlx5: support non-scattered Tx and Rx")
Signed-off-by: Jesper Wramberg <jesper.wramberg@gmail.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx5/mlx5_rxtx.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index db2ac03..4c6ed32 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -115,6 +115,24 @@ txq_complete(struct txq *txq)
}
/**
+ * Get Memory Pool (MP) from mbuf. If mbuf is indirect, the pool from which
+ * the cloned mbuf is allocated is returned instead.
+ *
+ * @param buf
+ * Pointer to mbuf.
+ *
+ * @return
+ * Memory pool where data is located for given mbuf.
+ */
+static struct rte_mempool *
+txq_mb2mp(struct rte_mbuf *buf)
+{
+ if (unlikely(RTE_MBUF_INDIRECT(buf)))
+ return rte_mbuf_from_indirect(buf)->pool;
+ return buf->pool;
+}
+
+/**
* Get Memory Region (MR) <-> Memory Pool (MP) association from txq->mp2mr[].
* Add MP to txq->mp2mr[] if it's not registered yet. If mp2mr[] is full,
* remove an entry first.
@@ -254,7 +272,7 @@ tx_burst_sg(struct txq *txq, unsigned int segs, struct txq_elt *elt,
uint32_t lkey;
/* Retrieve Memory Region key for this memory pool. */
- lkey = txq_mp2mr(txq, buf->pool);
+ lkey = txq_mp2mr(txq, txq_mb2mp(buf));
if (unlikely(lkey == (uint32_t)-1)) {
/* MR does not exist. */
DEBUG("%p: unable to get MP <-> MR association",
@@ -410,7 +428,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
addr = rte_pktmbuf_mtod(buf, uintptr_t);
length = DATA_LEN(buf);
/* Retrieve Memory Region key for this memory pool. */
- lkey = txq_mp2mr(txq, buf->pool);
+ lkey = txq_mp2mr(txq, txq_mb2mp(buf));
if (unlikely(lkey == (uint32_t)-1)) {
/* MR does not exist. */
DEBUG("%p: unable to get MP <-> MR"
--
2.1.0
next prev parent reply other threads:[~2015-11-23 14:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 14:44 [dpdk-dev] [PATCH 00/14] Fixes for mlx4 and mlx5 Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 01/14] mlx4: fix possible crash when clearing device statistics Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 02/14] mlx4: fix memory registration for indirect mbuf data Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 03/14] mlx4: fix TX for scattered mbufs with too many segments Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 04/14] mlx4: fix TX packet loss after initialization Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 05/14] mlx4: fix local protection error when TX MP to MR cache is full Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 06/14] mlx4: fix available entries in TX rings Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 07/14] mlx4: allow operation in secondary processes Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 08/14] mlx5: fix possible crash when clearing device statistics Adrien Mazarguil
2015-11-23 14:44 ` Adrien Mazarguil [this message]
2015-11-23 14:44 ` [dpdk-dev] [PATCH 10/14] mlx5: fix TX for scattered mbufs with too many segments Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 11/14] mlx5: fix TX packet loss after initialization Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 12/14] mlx5: fix local protection error when TX MP to MR cache is full Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 13/14] mlx5: fix available entries in TX rings Adrien Mazarguil
2015-11-23 14:44 ` [dpdk-dev] [PATCH 14/14] mlx5: add environment variables section to documentation Adrien Mazarguil
2015-11-24 16:32 ` [dpdk-dev] [PATCH 00/14] Fixes for mlx4 and mlx5 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=1448289889-9590-10-git-send-email-adrien.mazarguil@6wind.com \
--to=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
/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).