dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [RFC PATCH 10/14] mbuf: set next pointer to NULL on mbuf free.
Date: Mon, 11 Aug 2014 21:44:46 +0100	[thread overview]
Message-ID: <1407789890-17355-11-git-send-email-bruce.richardson@intel.com> (raw)
In-Reply-To: <1407789890-17355-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Previously we set the next pointer to NULL on allocation, we now set it
to NULL on free, as the next pointer is on a second cache line.

Signed-off-by: Bruce Richardson <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 lib/librte_mbuf/rte_mbuf.h        |  4 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 18 +++++++++---------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index a3e3e4f..01d4f6e 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -629,8 +629,10 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
 static inline void __attribute__((always_inline))
 rte_pktmbuf_free_seg(struct rte_mbuf *m)
 {
-	if (likely(NULL != (m = __rte_pktmbuf_prefree_seg(m))))
+	if (likely(NULL != (m = __rte_pktmbuf_prefree_seg(m)))) {
+		m->next = NULL;
 		__rte_mbuf_raw_free(m);
+	}
 }
 
 /**
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index fa3b357..f9cc352 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -145,6 +145,7 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq)
 	/* free buffers one at a time */
 	if ((txq->txq_flags & (uint32_t)ETH_TXQ_FLAGS_NOREFCOUNT) != 0) {
 		for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
+			txep->mbuf->next = NULL;
 			rte_mempool_put(txep->mbuf->pool, txep->mbuf);
 			txep->mbuf = NULL;
 		}
@@ -250,6 +251,14 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile union ixgbe_adv_tx_desc *tx_r = txq->tx_ring;
 	uint16_t n = 0;
 
+	/*
+	 * Begin scanning the H/W ring for done descriptors when the
+	 * number of available descriptors drops below tx_free_thresh.  For
+	 * each done descriptor, free the associated buffer.
+	 */
+	if (txq->nb_tx_free < txq->tx_free_thresh)
+		ixgbe_tx_free_bufs(txq);
+
 	/* Only use descriptors that are available */
 	nb_pkts = (uint16_t)RTE_MIN(txq->nb_tx_free, nb_pkts);
 	if (unlikely(nb_pkts == 0))
@@ -313,15 +322,6 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	if (txq->tx_tail >= txq->nb_tx_desc)
 		txq->tx_tail = 0;
 
-	/*
-	 * Begin scanning the H/W ring for done descriptors when the
-	 * number of available descriptors drops below tx_free_thresh.  For
-	 * each done descriptor, free the associated buffer.
-	 */
-	if (txq->nb_tx_free < txq->tx_free_thresh)
-		ixgbe_tx_free_bufs(txq);
-
-
 	/* update tail pointer */
 	rte_wmb();
 	IXGBE_PCI_REG_WRITE(txq->tdt_reg_addr, txq->tx_tail);
-- 
1.9.3

  parent reply	other threads:[~2014-08-11 20:44 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11 20:44 [RFC PATCH 00/14] Extend the mbuf structure Bruce Richardson
     [not found] ` <1407789890-17355-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-11 20:44   ` [RFC PATCH 01/14] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT Bruce Richardson
     [not found]     ` <1407789890-17355-2-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-11 21:45       ` Stephen Hemminger
     [not found]         ` <20140811144521.21058e5b-a7a0dvSY7KrRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org>
2014-08-12  7:59           ` Olivier MATZ
     [not found]             ` <53E9C96F.6050904-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-08-12 16:25               ` Richardson, Bruce
2014-08-11 20:44   ` [RFC PATCH 02/14] mbuf: remove rte_ctrlmbuf Bruce Richardson
     [not found]     ` <1407789890-17355-3-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-12  8:27       ` Olivier MATZ
2014-08-11 20:44   ` [RFC PATCH 03/14] mbuf: remove the rte_pktmbuf structure Bruce Richardson
     [not found]     ` <1407789890-17355-4-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-12  8:38       ` Olivier MATZ
2014-08-11 20:44   ` [RFC PATCH 04/14] mbuf: replace data pointer by an offset Bruce Richardson
     [not found]     ` <1407789890-17355-5-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-12  8:55       ` Olivier MATZ
2014-08-11 20:44   ` [RFC PATCH 05/14] mbuf: rename in_port to just port Bruce Richardson
     [not found]     ` <1407789890-17355-6-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-12  9:00       ` Olivier MATZ
2014-08-11 20:44   ` [RFC PATCH 06/14] mbuf: reorder fields by time-of-use Bruce Richardson
     [not found]     ` <1407789890-17355-7-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-12 10:03       ` Olivier MATZ
2014-08-11 20:44   ` [RFC PATCH 07/14] ixgbe: rework vector pmd following mbuf changes Bruce Richardson
2014-08-11 20:44   ` [RFC PATCH 08/14] mbuf: split mbuf across two cache lines Bruce Richardson
2014-08-11 20:44   ` [RFC PATCH 09/14] Fix performance regression due to moved pool ptr Bruce Richardson
     [not found]     ` <1407789890-17355-10-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-12 11:28       ` Olivier MATZ
2014-08-11 20:44   ` Bruce Richardson [this message]
2014-08-11 20:44   ` [RFC PATCH 11/14] ixgbe: make mbuf_initializer queue variable global Bruce Richardson
     [not found]     ` <1407789890-17355-12-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-11 21:47       ` Stephen Hemminger
     [not found]         ` <20140811144737.3ef08d36-a7a0dvSY7KrRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org>
2014-08-11 22:03           ` Richardson, Bruce
2014-08-11 20:44   ` [RFC PATCH 12/14] ixgbe: Make vector stores unaligned Bruce Richardson
2014-08-11 20:44   ` [RFC PATCH 13/14] mbuf: cleanup + added in additional mbuf fields Bruce Richardson
     [not found]     ` <1407789890-17355-14-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-12 14:18       ` Olivier MATZ
2014-08-11 20:44   ` [RFC PATCH 14/14] ixgbe: Allow vector RX of scattered packets Bruce Richardson
2014-08-12 14:43   ` [RFC PATCH 00/14] Extend the mbuf structure Olivier MATZ
     [not found]     ` <53EA2828.7080005-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-08-20 12:22       ` Richardson, Bruce
2014-08-20  7:08   ` Cao, Min
     [not found]     ` <B6059B2012717B4390714544B1F509E110D591C2-0J0gbvR4kTggGBtAFL8yw7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-08-20 11:11       ` Richardson, Bruce

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=1407789890-17355-11-git-send-email-bruce.richardson@intel.com \
    --to=bruce.richardson-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.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).