From: John Daley <johndale@cisco.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, olivier.matz@6wind.com,
John Daley <johndale@cisco.com>
Subject: [dpdk-dev] [PATCH v2] net/enic: decrement Tx mbuf reference count before recycling
Date: Mon, 11 Jul 2016 12:45:01 -0700 [thread overview]
Message-ID: <1468266301-2762-1-git-send-email-johndale@cisco.com> (raw)
In-Reply-To: <1ca338a4-a8fe-8149-2373-d02fee3199cb@6wind.com>
In the burst Tx cleanup function, the reference count in mbufs
returned to the pool should to be decremented before they are
returned. Decrementing is not done by rte_mempool_put_bulk()
so it must be done separately using __rte_pktmbuf_prefree_seg().
Also when returning unsent buffers when the device is stopped
use rte_mbuf_free_seg() instead of rte_mempool_put() so that
reference counts are properly decremented.
Fixes: 36935afbc53c ("net/enic: refactor Tx mbuf recycling")
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
---
v2: Use rte_pktmbuf_free_seg when returning mbufs when the device is
stoped. Suggested by Olivier Matz <olivier.matz@6wind.com>.
drivers/net/enic/enic_main.c | 2 +-
drivers/net/enic/enic_rxtx.c | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index d8669cc..54aaa25 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -106,7 +106,7 @@ static void enic_free_wq_buf(struct vnic_wq_buf *buf)
{
struct rte_mbuf *mbuf = (struct rte_mbuf *)buf->mb;
- rte_mempool_put(mbuf->pool, mbuf);
+ rte_pktmbuf_free_seg(mbuf);
buf->mb = NULL;
}
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index 2f4a08c..845a8e6 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -398,7 +398,14 @@ static inline void enic_free_wq_bufs(struct vnic_wq *wq, u16 completed_index)
pool = ((struct rte_mbuf *)buf->mb)->pool;
for (i = 0; i < nb_to_free; i++) {
buf = &wq->bufs[tail_idx];
- m = (struct rte_mbuf *)(buf->mb);
+ m = __rte_pktmbuf_prefree_seg((struct rte_mbuf *)(buf->mb));
+ buf->mb = NULL;
+
+ if (unlikely(m == NULL)) {
+ tail_idx = enic_ring_incr(desc_count, tail_idx);
+ continue;
+ }
+
if (likely(m->pool == pool)) {
RTE_ASSERT(nb_free < ENIC_MAX_WQ_DESCS);
free[nb_free++] = m;
@@ -409,7 +416,6 @@ static inline void enic_free_wq_bufs(struct vnic_wq *wq, u16 completed_index)
pool = m->pool;
}
tail_idx = enic_ring_incr(desc_count, tail_idx);
- buf->mb = NULL;
}
rte_mempool_put_bulk(pool, (void **)free, nb_free);
--
2.7.0
next prev parent reply other threads:[~2016-07-11 19:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-08 22:22 [dpdk-dev] [PATCH] " John Daley
2016-07-08 22:22 ` [dpdk-dev] [PATCH] net/enic: increment filter failure counter John Daley
2016-07-15 21:26 ` Thomas Monjalon
2016-07-11 10:04 ` [dpdk-dev] [PATCH] net/enic: decrement Tx mbuf reference count before recycling Olivier Matz
2016-07-11 19:41 ` John Daley (johndale)
2016-07-11 19:45 ` John Daley [this message]
2016-07-15 21:27 ` [dpdk-dev] [PATCH v2] " 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=1468266301-2762-1-git-send-email-johndale@cisco.com \
--to=johndale@cisco.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.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).