From patchwork Sun Aug 9 16:54:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 52121 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 68C432152A for ; Sun, 9 Aug 2015 17:05:34 +0000 (UTC) Received: by wilj18 with SMTP id j18sf31124847wil.0 for ; Sun, 09 Aug 2015 10:05:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=dz+Dj/rmyH9MuZzR98lGew3l9TQKLnM6cVh0XPTIisM=; b=BlqSKIWi5Odr1+I26Z9roFALaimcP/YjURE3MzjYc0cvueztwkAoKUYrtaUnhvnduB pPyi6Hp5PHKWdGLh4LP53zuYif3oCKYR028+gpA9Ert7L8mpBmF2vmIchiRYLW0z3exE vFK+cEh41bC/+yYaAWyibasjmAWu9/7Biimq5VDe51LaenDeJLMnK9TnKDDOll+Oz0xA tYTqLAh+9Jd+YnNodoIdFNH4gQlqYJrMfSTO9p6a4SX79cKaV73AiOK8J+Y4I3VyO+Jr A4HW8Fe+zb5kyU1gKzHgmgENcxo6UPRXfAV/FrkQl29gIA93ioGb5WyH7wCBGn+AeK/D nytw== X-Gm-Message-State: ALoCoQkALbD3gep5PU+Wp68FzSXlxRoKG15jRuq2DUzXy8q49xpQNYJZl40NDks5f+9rpQB+cp1o X-Received: by 10.152.9.99 with SMTP id y3mr5101452laa.10.1439139933690; Sun, 09 Aug 2015 10:05:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.102 with SMTP id r6ls673538lah.100.gmail; Sun, 09 Aug 2015 10:05:33 -0700 (PDT) X-Received: by 10.152.204.196 with SMTP id la4mr17120052lac.124.1439139933537; Sun, 09 Aug 2015 10:05:33 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id o10si12332828laj.148.2015.08.09.10.05.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Aug 2015 10:05:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lagz9 with SMTP id z9so43316726lag.3 for ; Sun, 09 Aug 2015 10:05:33 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr17223748lbb.56.1439139933443; Sun, 09 Aug 2015 10:05:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1514214lba; Sun, 9 Aug 2015 10:05:32 -0700 (PDT) X-Received: by 10.55.19.97 with SMTP id d94mr27645491qkh.55.1439139932007; Sun, 09 Aug 2015 10:05:32 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j67si29404296qhc.87.2015.08.09.10.05.31; Sun, 09 Aug 2015 10:05:31 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 2269E61D40; Sun, 9 Aug 2015 17:05:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 0F27761E08; Sun, 9 Aug 2015 17:00:43 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 5712461E16; Sun, 9 Aug 2015 16:56:28 +0000 (UTC) Received: from mail-ob0-f171.google.com (mail-ob0-f171.google.com [209.85.214.171]) by lists.linaro.org (Postfix) with ESMTPS id 7698E61E0C for ; Sun, 9 Aug 2015 16:54:49 +0000 (UTC) Received: by obbfr1 with SMTP id fr1so72396380obb.1 for ; Sun, 09 Aug 2015 09:54:49 -0700 (PDT) X-Received: by 10.182.73.170 with SMTP id m10mr15840353obv.22.1439139288971; Sun, 09 Aug 2015 09:54:48 -0700 (PDT) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by smtp.gmail.com with ESMTPSA id x69sm199357oif.5.2015.08.09.09.54.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 09 Aug 2015 09:54:48 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sun, 9 Aug 2015 11:54:32 -0500 Message-Id: <1439139273-22438-13-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439139273-22438-1-git-send-email-bill.fischofer@linaro.org> References: <1439139273-22438-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv14 12/13] linux-generic: schedule: implement order insertion routines X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bill.fischofer@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Implement the odp_schedule_order_copy(), odp_schedule_sustain(), and odp_schedule_sustain_set(), which together permit events to be inserted into an ordered flow. Signed-off-by: Bill Fischofer --- platform/linux-generic/odp_queue.c | 27 +++++++++++++++++++++++++++ platform/linux-generic/odp_schedule.c | 24 ++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index a3091e2..6f96304 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -985,3 +985,30 @@ int odp_schedule_release_ordered(odp_event_t ev) UNLOCK(&origin_qe->s.lock); return 0; } + +int odp_schedule_order_copy(odp_event_t src_event, odp_event_t dst_event) +{ + odp_buffer_hdr_t *src = + odp_buf_to_hdr(odp_buffer_from_event(src_event)); + odp_buffer_hdr_t *dst = + odp_buf_to_hdr(odp_buffer_from_event(dst_event)); + queue_entry_t *origin_qe = src->origin_qe; + + if (!origin_qe || dst->origin_qe) + return -1; + + LOCK(&origin_qe->s.lock); + + if (src->origin_qe != origin_qe) { + UNLOCK(&origin_qe->s.lock); + return -1; + } + + dst->origin_qe = origin_qe; + dst->order = src->order; + dst->sync = src->sync; + src->flags.sustain = 1; + + UNLOCK(&origin_qe->s.lock); + return 0; +} diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index a0dc156..bdd795a 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -752,3 +752,27 @@ int odp_schedule_group_count(odp_schedule_group_t group) void odp_schedule_prefetch(int num ODP_UNUSED) { } + +int odp_schedule_order_sustain(odp_event_t ev) +{ + odp_buffer_hdr_t *buf_hdr = + odp_buf_to_hdr(odp_buffer_from_event(ev)); + + if (buf_hdr->origin_qe) + return buf_hdr->flags.sustain; + + return -1; +} + +int odp_schedule_order_sustain_set(odp_event_t ev, odp_bool_t sustain) +{ + odp_buffer_hdr_t *buf_hdr = + odp_buf_to_hdr(odp_buffer_from_event(ev)); + + if (buf_hdr->origin_qe && (sustain & 1) == sustain) { + buf_hdr->flags.sustain = sustain; + return 0; + } + + return -1; +}