From patchwork Tue Aug 4 22:41:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 51928 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 AE39322E8E for ; Tue, 4 Aug 2015 22:54:11 +0000 (UTC) Received: by labkp1 with SMTP id kp1sf8859450lab.0 for ; Tue, 04 Aug 2015 15:54:10 -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=A+Q1Limd5tax4zA8oAUQKF6rKBaaPzxfWJA2U+/Jxuo=; b=OmMo9/O679WW53CHF6q/U2lTINgB8N6wTt2prBQmHUI4k7SnJJpV3HEObHxafmsQw/ eAM5400dcbCWTpOpcvqefGsTdaEwmGDuqQyX0V7W4quNvWzLX9yGMUAp9P/wwglhRKSa Yp1NffvA/tRAnvMVGyh90JN6HbI0+C1x1s5tnapAh+NAchI0VopttcpcLz3jSvwkuPhe ikG7RDB7Xy6Jl/LXiCUIC+PGB+TAC47962yJYIKbDm3HgHLma+oUcqA52nU4eXpTSxcs Mx2MLth2w3JcqnKZYW2V/W+v055Bu5W39UfhkTSh6oRwWeFmcC66pXESz7fYH30oyP8C 7CvA== X-Gm-Message-State: ALoCoQl/fL7dGnsL3N54EEAE27XmF6gjGaS+R+6Jap31z6Av5962kAZ8t8Mc76BXg7mBJCwDQ1nH X-Received: by 10.180.216.12 with SMTP id om12mr1837156wic.1.1438728850524; Tue, 04 Aug 2015 15:54:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.34 with SMTP id n2ls110787laj.15.gmail; Tue, 04 Aug 2015 15:54:10 -0700 (PDT) X-Received: by 10.112.46.130 with SMTP id v2mr6549929lbm.119.1438728850356; Tue, 04 Aug 2015 15:54:10 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id j10si894458lbp.23.2015.08.04.15.54.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Aug 2015 15:54:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by labow3 with SMTP id ow3so17291922lab.1 for ; Tue, 04 Aug 2015 15:54:10 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr6805468lbb.56.1438728849917; Tue, 04 Aug 2015 15:54:09 -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 l6csp36833lba; Tue, 4 Aug 2015 15:54:08 -0700 (PDT) X-Received: by 10.107.150.145 with SMTP id y139mr6545860iod.128.1438728848382; Tue, 04 Aug 2015 15:54:08 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q5si10208476igp.6.2015.08.04.15.54.07; Tue, 04 Aug 2015 15:54:08 -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 65E7461B6A; Tue, 4 Aug 2015 22:54:07 +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 19BAF61FCB; Tue, 4 Aug 2015 22:45:53 +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 D2D5C61E32; Tue, 4 Aug 2015 22:43:21 +0000 (UTC) Received: from mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180]) by lists.linaro.org (Postfix) with ESMTPS id C960161FAE for ; Tue, 4 Aug 2015 22:41:41 +0000 (UTC) Received: by obnw1 with SMTP id w1so18490792obn.3 for ; Tue, 04 Aug 2015 15:41:41 -0700 (PDT) X-Received: by 10.182.112.163 with SMTP id ir3mr5333876obb.44.1438728101417; Tue, 04 Aug 2015 15:41:41 -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 sx2sm519170obc.0.2015.08.04.15.41.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Aug 2015 15:41:40 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 4 Aug 2015 17:41:25 -0500 Message-Id: <1438728085-3240-14-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438728085-3240-1-git-send-email-bill.fischofer@linaro.org> References: <1438728085-3240-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv7 13/13] linux-generic: schedule: implement odp_schedule_order_sync() 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.48 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 Signed-off-by: Bill Fischofer --- platform/linux-generic/include/odp_queue_internal.h | 2 +- platform/linux-generic/odp_queue.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 9cca552..0f7e3ba 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -78,7 +78,7 @@ struct queue_entry_s { odp_pktio_t pktout; char name[ODP_QUEUE_NAME_LEN]; uint64_t order_in; - uint64_t order_out; + volatile uint64_t order_out; /* May be observed unlocked */ odp_buffer_hdr_t *reorder_head; odp_buffer_hdr_t *reorder_tail; }; diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index e92ef57..cfae99b 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -22,6 +22,7 @@ #include #include #include +#include #ifdef USE_TICKETLOCK #include @@ -922,3 +923,19 @@ int odp_schedule_order_copy(odp_event_t src_event, odp_event_t dst_event) UNLOCK(&origin_qe->s.lock); return 0; } + +int odp_schedule_order_sync(odp_event_t ev) +{ + odp_buffer_hdr_t *buf_hdr = odp_buf_to_hdr(odp_buffer_from_event(ev)); + queue_entry_t *origin_qe = buf_hdr->origin_qe; + + /* Can't lock if we didn't originate from an ordered queue */ + if (!origin_qe) + return -1; + + /* Wait until we are in order */ + while (buf_hdr->order > origin_qe->s.order_out) + odp_spin(); + + return 0; +}