From patchwork Mon Feb 24 20:39:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 183778 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp833308ile; Mon, 24 Feb 2020 12:39:50 -0800 (PST) X-Google-Smtp-Source: APXvYqz4x/MoPr5CP3M++tZjqdz8MxEtsNnP86JQGMdASJjSXf9IiMAD1zg3rgcw6cleJHS+DfZW X-Received: by 2002:a50:ed0a:: with SMTP id j10mr48944295eds.215.1582576789967; Mon, 24 Feb 2020 12:39:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582576789; cv=none; d=google.com; s=arc-20160816; b=aUDPRUqPE7AqqKx2XatgEGgpBdRiChOfH4j6hVukGYMcG6wwBOwndJmiJoU2ur9oiv i+wJqjAyD6QQOzS1c/wYR5Kix0ECT9zPlsoY2nw9hBLrDMW6LlPgnFelbel5EPfcR8Gc /NwIbXs4cfPN8VmbXvZ5eWtv9YVoYTOGZi1wlfp8s8Kq06Il4g+32NOfw+XAkpVrGaDP HEd78WQsw8MP8R/mSp0NcV/5ZNugtxv0XuDr2c1XWL0cbuUEZxV25IaE8F+TcuyHuJYj lygIui5TMuMa3RWG03usdn80PIkpNSLAuRHPx772nXQi2d4HFTF3v/0Y1Cp9QoWkkKcc 0NHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:cc:to :from; bh=zsBrFlBujvY9bxrJfXL+15VtY61/hspoa1px+3ke52Y=; b=CMf/9kAfxBDHUYH/so+F5LXdbxz6eElQNy1uidjorsZDilMeEgYe182A5XuO6V/6lk z8BipQP1ivervjeleh5jfLGnY9XcFyC8kolGRv0IgFVjMtCZXy19hTQPXH5brFXdj+jJ ec5qviaeFSul7JGuB8d8SmjQdjkAzDceHVL35ysyZ3vehJ8xm+0UI5/7IycoT4dPUUrT DN+XAOqVTp6jPpMVAnQpnm98IopwRr7dP9cr85/dLmZ7f9XX3p0t7imzvdrytGYR2WcP 5L5edKT82l085sIjWFJzCdKEUNsAf2QMybz6ULfKuhnEhaKhcO+xKc60/Xw4pRgo5ThL /hyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id c9si7286905ejs.358.2020.02.24.12.39.49; Mon, 24 Feb 2020 12:39:49 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org 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