From patchwork Tue Sep 23 11:08:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 457 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 8300058FE; Tue, 23 Sep 2014 13:02:39 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id AF4B758FE for ; Tue, 23 Sep 2014 13:02:36 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 23 Sep 2014 03:59:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="390290432" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 23 Sep 2014 04:02:28 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s8NB8Imj012720; Tue, 23 Sep 2014 12:08:18 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s8NB8IHm010419; Tue, 23 Sep 2014 12:08:18 +0100 Received: (from bricha3@localhost) by sivswdev02.ir.intel.com with id s8NB8IHg010415; Tue, 23 Sep 2014 12:08:18 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Tue, 23 Sep 2014 12:08:13 +0100 Message-Id: <1411470497-10209-2-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1411470497-10209-1-git-send-email-bruce.richardson@intel.com> References: <1410948102-12740-1-git-send-email-bruce.richardson@intel.com> <1411470497-10209-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH v2 1/5] mbuf: ensure next pointer is set to null on free 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The receive functions for packets do not modify the next pointer so the next pointer should always be cleared on mbuf free, just in case. The slow-path TX needs to clear it, and the standard mbuf free function also needs to clear it. Fast path TX does not handle chained mbufs so is unaffected Changes in V2: * None Signed-off-by: Bruce Richardson --- lib/librte_mbuf/rte_mbuf.h | 4 +++- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 1c6e115..8e27d2e 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -682,8 +682,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 a80cade..6f702b3 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; }