From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 9EF662BAC for ; Wed, 6 Mar 2019 16:04:09 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2019 07:04:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,448,1544515200"; d="scan'208";a="139634867" Received: from txasoft-yocto.an.intel.com ([10.123.72.192]) by orsmga002.jf.intel.com with ESMTP; 06 Mar 2019 07:04:06 -0800 From: Gage Eads To: dev@dpdk.org Cc: olivier.matz@6wind.com, arybchenko@solarflare.com, bruce.richardson@intel.com, konstantin.ananyev@intel.com, stephen@networkplumber.org, jerinj@marvell.com, mczekaj@marvell.com, nd@arm.com, Ola.Liljedahl@arm.com Date: Wed, 6 Mar 2019 09:03:38 -0600 Message-Id: <20190306150342.2894-3-gage.eads@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190306150342.2894-1-gage.eads@intel.com> References: <20190305174019.9693-1-gage.eads@intel.com> <20190306150342.2894-1-gage.eads@intel.com> Subject: [dpdk-dev] [PATCH v6 2/6] ring: add a ring start marker X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2019 15:04:10 -0000 This marker allows us to replace "&r[1]" with "&r->ring" to locate the start of the ring. Signed-off-by: Gage Eads --- lib/librte_ring/rte_ring.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index c78db6916..f16d77b8a 100644 --- a/lib/librte_ring/rte_ring.h +++ b/lib/librte_ring/rte_ring.h @@ -118,6 +118,7 @@ struct rte_ring { struct rte_ring_headtail_ptr cons_ptr __rte_cache_aligned; }; char pad2 __rte_cache_aligned; /**< empty cache line */ + void *ring[] __rte_cache_aligned; /**< empty marker for ring start */ }; #define RING_F_SP_ENQ 0x0001 /**< The default enqueue is "single-producer". */ @@ -361,7 +362,7 @@ __rte_ring_do_enqueue(struct rte_ring *r, void * const *obj_table, if (n == 0) goto end; - ENQUEUE_PTRS(r, &r[1], prod_head, obj_table, n, void *); + ENQUEUE_PTRS(r, &r->ring, prod_head, obj_table, n, void *); update_tail(&r->prod, prod_head, prod_next, is_sp, 1); end: @@ -403,7 +404,7 @@ __rte_ring_do_dequeue(struct rte_ring *r, void **obj_table, if (n == 0) goto end; - DEQUEUE_PTRS(r, &r[1], cons_head, obj_table, n, void *); + DEQUEUE_PTRS(r, &r->ring, cons_head, obj_table, n, void *); update_tail(&r->cons, cons_head, cons_next, is_sc, 0); -- 2.13.6