From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 2352F8DB0 for ; Wed, 30 Sep 2015 14:12:24 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 30 Sep 2015 05:12:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,612,1437462000"; d="scan'208";a="780860903" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 30 Sep 2015 05:12:23 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t8UCCMfO014984; Wed, 30 Sep 2015 13:12:22 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t8UCCMjU024430; Wed, 30 Sep 2015 13:12:22 +0100 Received: (from bricha3@localhost) by sivswdev01.ir.intel.com with id t8UCCMrK024426; Wed, 30 Sep 2015 13:12:22 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Wed, 30 Sep 2015 13:12:20 +0100 Message-Id: <1443615142-24381-3-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1443615142-24381-1-git-send-email-bruce.richardson@intel.com> References: <1443615142-24381-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 2/4] rte_ring: store memzone pointer inside ring 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: Wed, 30 Sep 2015 12:12:25 -0000 Add a new field to the rte_ring structure to store the memzone pointer which contains the ring. For rings created using rte_ring_create(), the field will be set automatically. This new field will allow users of the ring to query the numa node a ring is allocated on, or to get the physical address of the ring, if so needed. The rte_ring structure will also maintain ABI compatibility, as the structure members, after the new one, are set to be cache line aligned, so leaving a space. Signed-off-by: Bruce Richardson --- lib/librte_ring/rte_ring.c | 1 + lib/librte_ring/rte_ring.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c index c9e59d4..4e78e14 100644 --- a/lib/librte_ring/rte_ring.c +++ b/lib/librte_ring/rte_ring.c @@ -196,6 +196,7 @@ rte_ring_create(const char *name, unsigned count, int socket_id, rte_ring_init(r, name, count, flags); te->data = (void *) r; + r->memzone = mz; TAILQ_INSERT_TAIL(ring_list, te, next); } else { diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index af68888..df45f3f 100644 --- a/lib/librte_ring/rte_ring.h +++ b/lib/librte_ring/rte_ring.h @@ -134,6 +134,8 @@ struct rte_ring_debug_stats { * if RTE_RING_PAUSE_REP not defined. */ #endif +struct rte_memzone; /* forward declaration, so as not to require memzone.h */ + /** * An RTE ring structure. * @@ -147,6 +149,8 @@ struct rte_ring_debug_stats { struct rte_ring { char name[RTE_RING_NAMESIZE]; /**< Name of the ring. */ int flags; /**< Flags supplied at creation. */ + const struct rte_memzone *memzone; + /**< Memzone, if any, containing the rte_ring */ /** Ring producer status. */ struct prod { -- 2.4.3