From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 68939A05FE for ; Mon, 18 Mar 2019 22:40:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E8ED4C99; Mon, 18 Mar 2019 22:40:12 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id ABB3D2BAF for ; Mon, 18 Mar 2019 22:40:06 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 14:40:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,495,1544515200"; d="scan'208";a="156145566" Received: from txasoft-yocto.an.intel.com ([10.123.72.192]) by fmsmga001.fm.intel.com with ESMTP; 18 Mar 2019 14:40:03 -0700 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, gage.eads@intel.com Date: Mon, 18 Mar 2019 16:35:51 -0500 Message-Id: <20190318213555.17345-3-gage.eads@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190318213555.17345-1-gage.eads@intel.com> References: <20190306150342.2894-1-gage.eads@intel.com> <20190318213555.17345-1-gage.eads@intel.com> Subject: [dpdk-dev] [PATCH v7 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190318213551.BRK5oAGlrnMS9egp5WEHosW50SY7TV6hxEG5W9icyvs@z> 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