From patchwork Sun Nov 8 20:25:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 56158 Delivered-To: patch@linaro.org Received: by 10.112.1.169 with SMTP id 9csp122615lbn; Sun, 8 Nov 2015 12:28:59 -0800 (PST) X-Received: by 10.140.27.135 with SMTP id 7mr7667861qgx.60.1447014538915; Sun, 08 Nov 2015 12:28:58 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l136si8551896qhl.14.2015.11.08.12.28.58; Sun, 08 Nov 2015 12:28:58 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 951CD61942; Sun, 8 Nov 2015 20:28:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 432C6619CE; Sun, 8 Nov 2015 20:26:03 +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 C572D6196D; Sun, 8 Nov 2015 20:25:49 +0000 (UTC) Received: from mail-yk0-f180.google.com (mail-yk0-f180.google.com [209.85.160.180]) by lists.linaro.org (Postfix) with ESMTPS id 568846193E for ; Sun, 8 Nov 2015 20:25:47 +0000 (UTC) Received: by ykfs79 with SMTP id s79so7010722ykf.1 for ; Sun, 08 Nov 2015 12:25:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZKL2I151XpUwJYo1oW/BjzbkOqYR65CPFhLDxZY1O0E=; b=laTdKc180HgCYtX8C3A5e0VBzJwGXLaF0xBdEzECtv4ECf09Fl6JrAo9JtSAVpeJaO VlYeEDjJx8HKKV8P+uJFKLqM8VIsaeP4wRgaHiSc/VaUbHOyl98BFLEGp05PEHBW72vl 6fr6w6zGVAQcFteFrwK/OADHOd5T+bvD6eF60xQNZcCzONi/mhdivirQNUqHK82tCNLc B5Jbk1xfP8NZd/hJkNAf3blCXkLCQLugWn+rWgawzdRDGhlxloKmiTvCr9CQsEowJcO5 7LvXGyScbCtVfS5PvntZYjvlfvhYfNzf8xtalZvZ+U18phOarPsRfeMK0xI3Ls/3gODT Yzxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZKL2I151XpUwJYo1oW/BjzbkOqYR65CPFhLDxZY1O0E=; b=EA0JfJ03AHW84lsKOul2Tn9MkB70hCATrMYY3HjIOM+1G8mwSCfEjqPecnC3kOTDjf qxOKyGtj4uELgCzwnOoA1k08+pA0OK68DOsiVSaxZWF/ERWTLbacWiEzUfROxhhW1Auh kINieg9Lhqec6YQcnKkWtpGXE2fapCEmGW9csSB+fVh3wmFH2wz2+PdEiisi55gAvP4A gs2w8iLIPOl3X0VFsjcfRiJ4u8JWV7CPCTMm7RsmBXnHqe8mEOIUQrCqrDhZ3oHlVbMj fI1UWm9Kl7WqChdvPlVizdp84InGdLTPD6k0dMTfajq/5SEAaNLdp4kjzvccFmXJ0cPk SP5Q== X-Gm-Message-State: ALoCoQknhCkjXV9QJpqR3WlvNRcdf4eNSZTxeUm+mx6nbqm+Yegn+9UJBistfBc48oiZiqhTsLMI X-Received: by 10.13.192.197 with SMTP id b188mr4028344ywd.29.1447014347091; Sun, 08 Nov 2015 12:25:47 -0800 (PST) Received: from Ubuntu15.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id h83sm7362134ywc.6.2015.11.08.12.25.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Nov 2015 12:25:46 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sun, 8 Nov 2015 14:25:37 -0600 Message-Id: <1447014338-6409-6-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447014338-6409-1-git-send-email-bill.fischofer@linaro.org> References: <1447014338-6409-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 5/6] linux-generic: queue: streamline reorder_deq() routine X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" Signed-off-by: Bill Fischofer --- .../linux-generic/include/odp_queue_internal.h | 16 ++++++------- platform/linux-generic/odp_queue.c | 27 ++++++++++------------ 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 1bd365b..6120740 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -249,14 +249,13 @@ static inline void order_release(queue_entry_t *origin_qe, int count) static inline int reorder_deq(queue_entry_t *queue, queue_entry_t *origin_qe, - odp_buffer_hdr_t **reorder_buf_return, - odp_buffer_hdr_t **reorder_prev_return, + odp_buffer_hdr_t **reorder_tail_return, odp_buffer_hdr_t **placeholder_buf_return, int *release_count_return, int *placeholder_count_return) { odp_buffer_hdr_t *reorder_buf = origin_qe->s.reorder_head; - odp_buffer_hdr_t *reorder_prev = NULL; + odp_buffer_hdr_t *reorder_tail = NULL; odp_buffer_hdr_t *placeholder_buf = NULL; odp_buffer_hdr_t *next_buf; int deq_count = 0; @@ -300,9 +299,9 @@ static inline int reorder_deq(queue_entry_t *queue, while (reorder_link->next) reorder_link = reorder_link->next; reorder_link->next = next_buf; - reorder_prev = reorder_link; + reorder_tail = reorder_link; } else { - reorder_prev = reorder_buf; + reorder_tail = reorder_buf; } deq_count++; @@ -310,8 +309,8 @@ static inline int reorder_deq(queue_entry_t *queue, release_count++; reorder_buf = next_buf; } else if (!reorder_buf->target_qe) { - if (reorder_prev) - reorder_prev->next = next_buf; + if (reorder_tail) + reorder_tail->next = next_buf; else origin_qe->s.reorder_head = next_buf; @@ -325,8 +324,7 @@ static inline int reorder_deq(queue_entry_t *queue, } } - *reorder_buf_return = reorder_buf; - *reorder_prev_return = reorder_prev; + *reorder_tail_return = reorder_tail; *placeholder_buf_return = placeholder_buf; *release_count_return = release_count; *placeholder_count_return = placeholder_count; diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index d9be4b3..9cab9b2 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -428,7 +428,7 @@ int ordered_queue_enq(queue_entry_t *queue, { odp_buffer_hdr_t *reorder_buf; odp_buffer_hdr_t *next_buf; - odp_buffer_hdr_t *reorder_prev; + odp_buffer_hdr_t *reorder_tail; odp_buffer_hdr_t *placeholder_buf = NULL; int release_count, placeholder_count; int sched = 0; @@ -496,17 +496,17 @@ int ordered_queue_enq(queue_entry_t *queue, /* Pick up this element, and all others resolved by this enq, * and add them to the target queue. */ - reorder_deq(queue, origin_qe, &reorder_buf, &reorder_prev, - &placeholder_buf, &release_count, &placeholder_count); + reorder_deq(queue, origin_qe, &reorder_tail, &placeholder_buf, + &release_count, &placeholder_count); /* Move the list from the reorder queue to the target queue */ if (queue->s.head) queue->s.tail->next = origin_qe->s.reorder_head; else queue->s.head = origin_qe->s.reorder_head; - queue->s.tail = reorder_prev; - origin_qe->s.reorder_head = reorder_prev->next; - reorder_prev->next = NULL; + queue->s.tail = reorder_tail; + origin_qe->s.reorder_head = reorder_tail->next; + reorder_tail->next = NULL; /* Reflect resolved orders in the output sequence */ order_release(origin_qe, release_count + placeholder_count); @@ -847,20 +847,17 @@ int queue_pktout_enq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr, */ odp_buffer_hdr_t *reorder_buf; odp_buffer_hdr_t *next_buf; - odp_buffer_hdr_t *reorder_prev; + odp_buffer_hdr_t *reorder_tail; odp_buffer_hdr_t *xmit_buf; odp_buffer_hdr_t *placeholder_buf; - int deq_count, release_count, placeholder_count; - - deq_count = reorder_deq(queue, origin_qe, - &reorder_buf, &reorder_prev, &placeholder_buf, - &release_count, &placeholder_count); + int release_count, placeholder_count; /* Send released buffers as well */ - if (deq_count > 0) { + if (reorder_deq(queue, origin_qe, &reorder_tail, &placeholder_buf, + &release_count, &placeholder_count)) { xmit_buf = origin_qe->s.reorder_head; - origin_qe->s.reorder_head = reorder_prev->next; - reorder_prev->next = NULL; + origin_qe->s.reorder_head = reorder_tail->next; + reorder_tail->next = NULL; UNLOCK(&origin_qe->s.lock); do {