From patchwork Sun Aug 9 01:55:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 52080 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 5C80120A60 for ; Sun, 9 Aug 2015 02:04:41 +0000 (UTC) Received: by wijp15 with SMTP id p15sf28147411wij.3 for ; Sat, 08 Aug 2015 19:04:40 -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=MugZsJTSzPQPHv9FHF1650iBrUzSZ4ngF2ZArnddAfU=; b=eOcoMlmnoaoxodKnSrLdsSDPvzBqRjS3+yJLhavn+HgFikWOE2zaTq2gr4Nqyy5Zx6 eM0u8OgukwcG6KIHhF0ioHX/+vi1deXvvZBp5Xtp1xUjghprD0WqkY1SUkx3R3FPK7P3 xY30FUJGrY+hZgWH4CdCvYg2utfleD5JDZDINwVqV6blTRNMXNCFPLRfTj3F1cXwq94o WtMEt+b/JV2rAO5DqgZXPcwCgzBjYcM9wgiuE7YzliYujLHeSjQZjZZhoLjSKRLPl50h SDRoUtR8gTfpjwmUyIDo85AnBHAvQqNhT3g/So32n3Z4qK4Kmxnc0sLb+mHadnA+KLn0 xziw== X-Gm-Message-State: ALoCoQlsSG2BgcZQXS4/8/PRdPY5+sNIycIXmSNQqhHzk+2xT4WCYwBrphUOpWGS8oVENsDNo2mH X-Received: by 10.180.11.226 with SMTP id t2mr1662405wib.0.1439085880629; Sat, 08 Aug 2015 19:04:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.233 with SMTP id e9ls297542laa.99.gmail; Sat, 08 Aug 2015 19:04:40 -0700 (PDT) X-Received: by 10.152.6.194 with SMTP id d2mr14654426laa.93.1439085880339; Sat, 08 Aug 2015 19:04:40 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id ef7si11215730lbb.44.2015.08.08.19.04.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Aug 2015 19:04:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbyj8 with SMTP id yj8so78829548lbb.0 for ; Sat, 08 Aug 2015 19:04:39 -0700 (PDT) X-Received: by 10.112.168.168 with SMTP id zx8mr2054971lbb.117.1439085879918; Sat, 08 Aug 2015 19:04:39 -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 l6csp1188938lba; Sat, 8 Aug 2015 19:04:39 -0700 (PDT) X-Received: by 10.140.82.180 with SMTP id h49mr26601742qgd.29.1439085878495; Sat, 08 Aug 2015 19:04:38 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q63si26781654qha.80.2015.08.08.19.04.37; Sat, 08 Aug 2015 19:04:38 -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 7AD5F61CDE; Sun, 9 Aug 2015 02:04:37 +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 A4CE461F12; Sun, 9 Aug 2015 02:02: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 8126E61EDB; Sun, 9 Aug 2015 01:55:34 +0000 (UTC) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by lists.linaro.org (Postfix) with ESMTPS id 3491261EDB for ; Sun, 9 Aug 2015 01:55:32 +0000 (UTC) Received: by oihn130 with SMTP id n130so73302730oih.2 for ; Sat, 08 Aug 2015 18:55:31 -0700 (PDT) X-Received: by 10.202.98.130 with SMTP id w124mr13195680oib.29.1439085331685; Sat, 08 Aug 2015 18:55:31 -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 d184sm9449191oif.9.2015.08.08.18.55.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 08 Aug 2015 18:55:31 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sat, 8 Aug 2015 20:55:14 -0500 Message-Id: <1439085315-6957-13-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439085315-6957-1-git-send-email-bill.fischofer@linaro.org> References: <1439085315-6957-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv11 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.182 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 669b630..c8ae733 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -993,3 +993,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; +}