From: hepeng <xnhp0320@icloud.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] [new]ixgbe:set txep.mbuf to NULL when calling ixgbe_tx_free_bufs
Date: Sat, 01 Aug 2015 09:26:34 +0800 [thread overview]
Message-ID: <1438392394-19653-1-git-send-email-xnhp0320@icloud.com> (raw)
In *ixgbe_tx_free_bufs*, after recycling some tx entries, one should set their mbuf pointers to NULL.
The first path is not correct, the txep->mbuf should be set to NULL no matter if it is recycled into mempool
Signed-off-by: hepeng <xnhp0320@icloud.com>
---
drivers/net/ixgbe/ixgbe_rxtx_vec.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec.c b/drivers/net/ixgbe/ixgbe_rxtx_vec.c
index 1c16dec..e7ce740 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec.c
@@ -612,6 +612,7 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq)
*/
txep = &txq->sw_ring_v[txq->tx_next_dd - (n - 1)];
m = __rte_pktmbuf_prefree_seg(txep[0].mbuf);
+ txep[0].mbuf = NULL;
if (likely(m != NULL)) {
free[0] = m;
nb_free = 1;
@@ -632,11 +633,21 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq)
} else {
for (i = 1; i < n; i++) {
m = __rte_pktmbuf_prefree_seg(txep[i].mbuf);
- if (m != NULL)
+ if (m != NULL) {
rte_mempool_put(m->pool, m);
+ }
}
}
+ /*
+ * No matter the mbufs have been put back to mempool or not,
+ * we should set the txep[i].mbuf to NULL
+ */
+
+ for( i = 1; i < n; i++) {
+ txep[i].mbuf = NULL;
+ }
+
/* buffers were freed, update counters */
txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + txq->tx_rs_thresh);
txq->tx_next_dd = (uint16_t)(txq->tx_next_dd + txq->tx_rs_thresh);
--
1.9.1
next reply other threads:[~2015-08-01 1:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-01 1:26 hepeng [this message]
2015-08-03 2:46 ` Lu, Wenzhuo
[not found] ` <179B898C-F03A-4250-8857-236CFC5274BA@icloud.com>
[not found] ` <6A0DE07E22DDAD4C9103DF62FEBC0909D1A59D@shsmsx102.ccr.corp.intel.com>
2015-08-03 7:09 ` HePeng
2015-08-03 8:10 ` Lu, Wenzhuo
2015-08-03 8:17 ` HePeng
2015-08-03 8:42 ` Lu, Wenzhuo
2015-08-03 9:12 ` HePeng
2015-08-03 10:16 ` Ananyev, Konstantin
2015-08-04 10:50 ` Bruce Richardson
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=1438392394-19653-1-git-send-email-xnhp0320@icloud.com \
--to=xnhp0320@icloud.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).