From patchwork Tue Nov 10 14:46:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 56331 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp814924lbb; Tue, 10 Nov 2015 06:52:48 -0800 (PST) X-Received: by 10.140.17.8 with SMTP id 8mr4713208qgc.80.1447167168244; Tue, 10 Nov 2015 06:52:48 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e109si3198340qga.15.2015.11.10.06.52.47; Tue, 10 Nov 2015 06:52:48 -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 AEEC561D19; Tue, 10 Nov 2015 14:52:47 +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=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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 A676A61CE8; Tue, 10 Nov 2015 14:49:44 +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 C480F61D25; Tue, 10 Nov 2015 14:49:39 +0000 (UTC) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by lists.linaro.org (Postfix) with ESMTPS id EAF8261D18 for ; Tue, 10 Nov 2015 14:47:11 +0000 (UTC) Received: by pacdm15 with SMTP id dm15so212136084pac.3 for ; Tue, 10 Nov 2015 06:47:11 -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=MaMirBCbaEZCXI1YQdjmQgdBaP4usEuZvF5EyacI1cJpJTEIvve/yU/XmtjiXsnRen k/0Qo/eiVFiKv4UoBPfW4GOriUhicrZk7/6Gd+xIOb2Hs1nQUtH6IcrgpO41nwzzITHP HS17n5SHGoFTSe5gAamCsQsNxvNrq/WIryPZN6yHrnyqfmwFjqM+7aOvKJTRqZdP4Rtu +Ph9jyUt+Ld7zhFm1yYuoVlqWly1UHVAg5l/vpdBrs460u6fKIahO1gGaku44FdFRRK6 RvV9w7j4WBOgneadYfglyiR65D0uRdKKOn3kUx6haeZ+9LYQ4uA9aW0Xcau6C96/EBfS XNsw== 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=gX9pMFFzPrStMQRyrQ7vAQgl6n2TILx6YokIs6+hZkfeeN1pXziHi2ECEH7S00ZXJV jkvuwqLIQUiCd9OFHuEcUJrPXbY+hRHIUCmk9LWIV8+kxQNtynyRbl9ma9iC0HFP+ANR seVrre3+ibwZ6n7UXlJkOoAy5A0QmLBau7CcfuKoqvVR9/D7HpRgkiD1fRStaYjhW5/O Zu5hDJsWwXvSHF7Uhjs30V+Ds7rr7ORIxQqQI+8bpwkrMVzJpB+Pux6Kgn2PZUQf8iaJ 1CE2o0H9tVkC+rMBIZFV2yf2f1J1LBjrwFCLuegd5ARcwkA7xkcBDTOuV9H3yjUJhITi CCpw== X-Gm-Message-State: ALoCoQkiyQbWu0dL0h1gPtAXKJIbDTCA7ygnYodTN03aHasgV8KZe744PaVhHsvoigJM8ov6ILvr X-Received: by 10.69.4.5 with SMTP id ca5mr6101987pbd.149.1447166831303; Tue, 10 Nov 2015 06:47:11 -0800 (PST) Received: from Ubuntu15.localdomain ([40.139.248.3]) by smtp.gmail.com with ESMTPSA id w11sm4531237pbs.87.2015.11.10.06.47.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Nov 2015 06:47:10 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 10 Nov 2015 06:46:58 -0800 Message-Id: <1447166821-24585-6-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447166821-24585-1-git-send-email-bill.fischofer@linaro.org> References: <1447166821-24585-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv4 5/8] 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 {