From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 4FB8991C1 for ; Mon, 23 Nov 2015 15:45:42 +0100 (CET) Received: by wmvv187 with SMTP id v187so164320098wmv.1 for ; Mon, 23 Nov 2015 06:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KE+5UaOvSAkB5WGFpi1JbFNEjwzIkhP+UzLwvon4NDQ=; b=Cmhrsf9m5BvHB9VNsKIO7RZi+mz+M2PLZ+ljYgKRgmFx08trwP88BM+uTGaGQqMRzy Wnirm8+AG59GZ6s07lh66Ov767NTvCHTId0slU5WBvSKU7NPq0ZyK2A59Ln6Y355kAFH +dUpKfXxRhzhRuSPTB3uLe5r8vx1+vTtslKuTrbQaBRbxULJOVRfDEtEqE7LPcV48aiW Bbfx0uV9UybZmHMoOE1Ncasj5ukn04ackqLxb35WxTHM63XFE8P/KgxxPMEbWIN3cCH9 HkwXklsY8fT4uKivibcPCsOfKEr85EHftYvi7sLtPdQjpBErzc5M5Df+Bd82RSeGxC4v /rsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KE+5UaOvSAkB5WGFpi1JbFNEjwzIkhP+UzLwvon4NDQ=; b=jHrZlhd9ugZRoqsw5Y0Oc4GH//P6e+DAYOb1IFtA0wvArKUEtfveWIIz2p2qlKJk9W WO3B8XeNzCIqJQJDddYFAP2KqCeky1Mn5Nh4g5KgBrl3MFNkQIou9ToLzuSpS70C/KIV k2KTav/q/b5tbBzGbR8Yq5sYBn5pyO+J3IwPAt64KOD4KRzCArMYoFOExuHCZlJWVbCA Q3DcyFPSZ0ZCwvexasOFvSJZ3qt1KdWDVviz4AsavGxSDaeIRNIcRGPdILUyz3ycLMk9 kzYTwe+jImBoOF1T3nqz73ogNeEuLhDWm7usAHP3b3HD/hLz3UL73ll9IG2xbYlAj7Mj 9r0A== X-Gm-Message-State: ALoCoQnzyWY65vkKuakRMjvjHWIxmIvRqbFHwt0q0jWkqNaoYsrmrCLWmrJBXQrq8qDZLR52UpeS X-Received: by 10.194.9.104 with SMTP id y8mr31355958wja.106.1448289942203; Mon, 23 Nov 2015 06:45:42 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id uq3sm13630035wjc.10.2015.11.23.06.45.40 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Nov 2015 06:45:41 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Mon, 23 Nov 2015 15:44:44 +0100 Message-Id: <1448289889-9590-10-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1448289889-9590-1-git-send-email-adrien.mazarguil@6wind.com> References: <1448289889-9590-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 09/14] mlx5: fix memory registration for indirect mbuf data X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 14:45:42 -0000 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 Signed-off-by: Adrien Mazarguil --- 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