From patchwork Sun Aug 9 13:24:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 52106 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 230252152A for ; Sun, 9 Aug 2015 13:34:31 +0000 (UTC) Received: by lagz9 with SMTP id z9sf33875779lag.3 for ; Sun, 09 Aug 2015 06:34:30 -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=K+Iv+w0zIC5dblfS0BvP+l5/o42/ETQ3KBXANn09h3Q=; b=S+3zr7pWe7jQdiU9RFrHm21PZWB6Hy3B8Gomsv46gG4IYeTKEy/A/4LSSx+jWhFe0O hqD0e0moNLph3uznyto4zAtNzHO19h1LJe4yqyc25jqYzyeyHANVjOx0F8SgkQs5W+Kd POchf78bd+CYt1PSfIGQMdH4v5nA7AUbT/7xamBR991uNgVWSDB8OwBr2bDXKodlMDJA EthL08YJxaJ2fVv9IjWY8bea1W/fDYT7tf1sdlJaNa6KBeuj2QZkcz2igFXG9tL6gksz 1Jsrwn2nbUVuzgidwNJYLlSNIhSK/1A7b+auSScXRJ/CnEdUn2YfHMaxI48MFu0krZRJ bQsg== X-Gm-Message-State: ALoCoQnJD/H9VU0yOuYic4uDErbKgFAlrnW6AnrJudOLuGXw3/YzgInHoi/RRMv9mmh8qGiN/VPp X-Received: by 10.180.160.133 with SMTP id xk5mr2278026wib.1.1439127270098; Sun, 09 Aug 2015 06:34:30 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.232 with SMTP id d8ls625609lab.13.gmail; Sun, 09 Aug 2015 06:34:29 -0700 (PDT) X-Received: by 10.152.4.98 with SMTP id j2mr15995278laj.67.1439127269932; Sun, 09 Aug 2015 06:34:29 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id eq12si12017484lac.171.2015.08.09.06.34.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Aug 2015 06:34:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbpu9 with SMTP id pu9so55118028lbb.3 for ; Sun, 09 Aug 2015 06:34:29 -0700 (PDT) X-Received: by 10.112.160.42 with SMTP id xh10mr16401016lbb.88.1439127269514; Sun, 09 Aug 2015 06:34:29 -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 l6csp1431388lba; Sun, 9 Aug 2015 06:34:28 -0700 (PDT) X-Received: by 10.140.218.139 with SMTP id o133mr31883669qhb.69.1439127268072; Sun, 09 Aug 2015 06:34:28 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k9si28842361qgk.87.2015.08.09.06.34.27; Sun, 09 Aug 2015 06:34:28 -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 6972C61CE9; Sun, 9 Aug 2015 13:34:27 +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_H3, RCVD_IN_MSPIKE_WL, 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 0005361F77; Sun, 9 Aug 2015 13:27:09 +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 E9813620AE; Sun, 9 Aug 2015 13:27:00 +0000 (UTC) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by lists.linaro.org (Postfix) with ESMTPS id F250761F6B for ; Sun, 9 Aug 2015 13:25:02 +0000 (UTC) Received: by obbop1 with SMTP id op1so107723680obb.2 for ; Sun, 09 Aug 2015 06:25:02 -0700 (PDT) X-Received: by 10.60.128.200 with SMTP id nq8mr15102061oeb.54.1439126702490; Sun, 09 Aug 2015 06:25:02 -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 rg1sm10096074oeb.11.2015.08.09.06.25.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 09 Aug 2015 06:25:01 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sun, 9 Aug 2015 08:24:46 -0500 Message-Id: <1439126687-19932-13-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439126687-19932-1-git-send-email-bill.fischofer@linaro.org> References: <1439126687-19932-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv13 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.217.169 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 518df0f..99829b9 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -980,3 +980,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 4d594a0..548ed25 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -746,3 +746,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; +}