From patchwork Tue Nov 10 04:20:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 56280 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp550522lbb; Mon, 9 Nov 2015 20:24:26 -0800 (PST) X-Received: by 10.107.165.202 with SMTP id o193mr1714930ioe.69.1447129466420; Mon, 09 Nov 2015 20:24:26 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i36si2304711ioo.118.2015.11.09.20.24.26; Mon, 09 Nov 2015 20:24:26 -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 D548161CD8; Tue, 10 Nov 2015 04:24:25 +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 D0DDA61CE3; Tue, 10 Nov 2015 04:21:26 +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 7122E61CB2; Tue, 10 Nov 2015 04:21:23 +0000 (UTC) Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by lists.linaro.org (Postfix) with ESMTPS id E0F8F61CB2 for ; Tue, 10 Nov 2015 04:20:28 +0000 (UTC) Received: by pasz6 with SMTP id z6so228054933pas.2 for ; Mon, 09 Nov 2015 20:20:28 -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=z15r1EaB4LvGwd4YwjwDoDRwiIcGng4sw6u0d4x4+8dnH3w7XXKWVFgk/A8FOo4ktE jpyJI5+oD3VVWmKIi9tGGHvqPq6kWPnRHdEFJNiR9qt+dQTVysFJp57Pk21iQkhSTvQe 4O2FqA5EHtDym8+jFIOZIc+21wS8kiwwE78eqHBAeZh7nl9Kco438nw8P18YDcxVnrKR +TKGFOjFhH9GuFEMH1VnpTbbth5HvqE68QQcGB+OvCqr3Kc5yd30CAPS3czo8dx/od9I 3G3ppg0oZ8XHs1WztzfRzxh51BlcMVnyAzFcakzDrZdUoSGQ7GIhVmYyGpKKQErrgR5U 88Fw== 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=mWFURErDJfNZI63kTErjtKYn2tK4ahwgj5rTq8lOLxmrkL0VBmrvtADuVhMf1hvWEU kSiCZsy6oTh8QUvTUgbtMqWk/bKGw8485bepAjUCMSiPm4+IxCtc5yLlYV/YRx1ekhuO GsI6P6l0q6oaigGVQaG1LG9IJ6J00/xAL4zmzrhi+9JPFKzxBzrwLlsG/xIXfUkFdT6m PEfrzHYXt0TYZFjr7u0HavHMAjwrPSFcfKn0lTgJvVspeQu1Iwouil35TLq/iQjtZ0Lz RMHxNIoVQOlCxglpjl4FX4zzm5fSiqJhzkO4OxhecPyAtRGtG/BTEs0pFlMd8BK5E23j bcDg== X-Gm-Message-State: ALoCoQkTPB4dbGceOV0Cnulxg3oevPpFIenReXFmBIyfC+s088SUa84o2CqOQ8X2QZrMMskpG98k X-Received: by 10.66.221.71 with SMTP id qc7mr2449966pac.82.1447129228230; Mon, 09 Nov 2015 20:20:28 -0800 (PST) Received: from Ubuntu15.localdomain ([40.139.248.3]) by smtp.gmail.com with ESMTPSA id fl5sm1137315pbd.70.2015.11.09.20.20.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Nov 2015 20:20:27 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Mon, 9 Nov 2015 20:20:08 -0800 Message-Id: <1447129211-9095-6-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447129211-9095-1-git-send-email-bill.fischofer@linaro.org> References: <1447129211-9095-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv3 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 {