From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7DF82A0524; Mon, 24 Feb 2020 21:39:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 65C012C39; Mon, 24 Feb 2020 21:39:48 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 62A031F1C for ; Mon, 24 Feb 2020 21:39:47 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BA6D230E; Mon, 24 Feb 2020 12:39:46 -0800 (PST) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.14.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A86523F534; Mon, 24 Feb 2020 12:39:46 -0800 (PST) From: Honnappa Nagarahalli To: olivier.matz@6wind.com, konstantin.ananyev@intel.com Cc: honnappa.nagarahalli@arm.com, gavin.hu@arm.com, dev@dpdk.org, nd@arm.com Date: Mon, 24 Feb 2020 14:39:30 -0600 Message-Id: <20200224203931.21256-1-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [RFC 0/1] lib/ring: add scatter gather and serial dequeue APIs 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" Cover-letter: RCU defer queue (DQ) APIs place 3 requirements on rte_ring library. 1) Multiple entities are responsible for providing/consuming the data in a single element of the DQ. Existing rte_ring APIs require an intermediate memcpy in such cases. RCU DQ API, rte_rcu_qsbr_dq_enqueue, has to store the token (generated by the RCU DQ APIs) and the application data (provided by the application) in each element of the DQ. 2) Dequeue the data from DQ only if it meets certain criteria. i.e. data needs to be accessed before it can be dequeued. RCU DQ API, rte_rcu_qsbr_dq_reclaim, can dequeue the element from DQ, only if the token at the head of the DQ can be reclaimed. If the token cannot be reclaimed the reserved elements need to be discarded. 3) While dequeuing from DQ, only one thread should be allowed to reserve elements. In order to make rte_rcu_qsbr_dq_reclaim API lock free, the 'reserve elements in DQ, reclaim the token and revert/commit elements in DQ' process needs to be atomic. The first requirement is satisfied by providing scatter-gather APIs in rte_ring library. The enqueue/dequeue operations are split into 3 parts: a) Move produer's/consumer's head index. i.e. reserve elements in the ring and return the pointer in the ring to where the data needs to be copied to/from. b) The application copies the data to/from the pointer. c) Move producer's/consumer's tail index. i.e. indicate that the reserved elements are successfully consumed. RCU DQ APIs require single element, multiple producer enqueue operations. 'rte_ring_mp_enqueue_elem_reserve' and 'rte_ring_mp_enqueue_elem_commit' APIs are provided to address these requirements. The second and third requirements are satisfied by providing rte_ring APIs for: a) Move consumer's head index only if there are no elements reserved on the ring. b) Reset the consumer's head index to its original value. i.e. discard the reserved elements. In this case, RCU DQ APIs require single element, single consumer dequeue operations. 'rte_ring_dequeue_elem_reserve_serial', 'rte_ring_dequeue_elem_commit' and 'rte_ring_dequeue_elem_revert_serial' APIs are provided to address these requirements. Honnappa Nagarahalli (1): lib/ring: add scatter gather and serial dequeue APIs lib/librte_ring/Makefile | 1 + lib/librte_ring/meson.build | 1 + lib/librte_ring/rte_ring_c11_mem.h | 98 +++++++ lib/librte_ring/rte_ring_elem_sg.h | 417 +++++++++++++++++++++++++++++ lib/librte_ring/rte_ring_generic.h | 93 +++++++ 5 files changed, 610 insertions(+) create mode 100644 lib/librte_ring/rte_ring_elem_sg.h -- 2.17.1