From patchwork Wed Nov 30 23:08:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 85930 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp449474qgi; Wed, 30 Nov 2016 15:08:59 -0800 (PST) X-Received: by 10.55.122.134 with SMTP id v128mr28929797qkc.111.1480547339837; Wed, 30 Nov 2016 15:08:59 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a187si38836424qkd.275.2016.11.30.15.08.59; Wed, 30 Nov 2016 15:08:59 -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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 4E08A60D14; Wed, 30 Nov 2016 23:08:59 +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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2 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 472FD60C1A; Wed, 30 Nov 2016 23:08:55 +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 C7E9260C5F; Wed, 30 Nov 2016 23:08:52 +0000 (UTC) Received: from mail-io0-f171.google.com (mail-io0-f171.google.com [209.85.223.171]) by lists.linaro.org (Postfix) with ESMTPS id CF9FB60C0D for ; Wed, 30 Nov 2016 23:08:51 +0000 (UTC) Received: by mail-io0-f171.google.com with SMTP id j65so379176432iof.0 for ; Wed, 30 Nov 2016 15:08:51 -0800 (PST) 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; bh=PHCQLZljN0QpoLB6zFgP/Dlftqhq7hqi/O+WKEJ4xU0=; b=X0XGHYd15T0KBkK86vyJMq2m8z77XLz0WUM1aLMrUvvcyXXQcIRd9OgVltQvANvWbN LMdpfk80KSRoeTi0KsvWpweWVVqKk0qs1qtIZOJYSyfIwFVisAJBPXyrEk4MP3rhXPc6 O6qkj7aWWViXZn7o97r05TTdkjWRZHliwL50qCpHa2crgtDGHHKecuY9k3UbqN4I6b+1 iT2vbjrKtDj6HbnBuB3nF77Ig/DAV1m4nbG2vgRLH3dmkp/fakUdJkR7L271M0Jsxihx ng8L4z19Ugq/6l3qELxCOusWFK5XToGHiwpd5ayTaVnMoJSpSfpMa8gRNjlAdNiZZ6Fq 6Dyw== X-Gm-Message-State: AKaTC019XTxVc1HeXEy7/ojk/sD9xlhwCwylaWB5NyXVFqXmobhQrR4d1GVmteg0FPHQKDvIELw= X-Received: by 10.202.44.202 with SMTP id s193mr17629098ois.5.1480547330857; Wed, 30 Nov 2016 15:08:50 -0800 (PST) Received: from localhost.localdomain (cpe-70-121-83-241.austin.res.rr.com. [70.121.83.241]) by smtp.gmail.com with ESMTPSA id u33sm21323795otu.13.2016.11.30.15.08.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Nov 2016 15:08:50 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 30 Nov 2016 17:08:48 -0600 Message-Id: <1480547328-24996-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [lng-odp] [API-NEXT PATCHv2] linux-generic: pool: reset origin_qe on buffer allocation 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2622 by re-initializing origin_qe to NULL when a buffer is allocated. This step was omitted in the switch to ring pool allocation introduced in commit ID c8cf1d87783d4b4c628f219803b78731b8d4ade4 Signed-off-by: Bill Fischofer --- Changes in v2: - Review comments from Maxim. Move init to earlier loops for completeness and efficiency. platform/linux-generic/odp_pool.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 4be3827..8c38c93 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -588,6 +588,7 @@ int buffer_alloc_multi(pool_t *pool, odp_buffer_t buf[], uint32_t mask, i; pool_cache_t *cache; uint32_t cache_num, num_ch, num_deq, burst; + odp_buffer_hdr_t *hdr; ring = &pool->ring.hdr; mask = pool->ring_mask; @@ -608,8 +609,13 @@ int buffer_alloc_multi(pool_t *pool, odp_buffer_t buf[], } /* Get buffers from the cache */ - for (i = 0; i < num_ch; i++) + for (i = 0; i < num_ch; i++) { buf[i] = cache->buf[cache_num - num_ch + i]; + hdr = buf_hdl_to_hdr(buf[i]); + hdr->origin_qe = NULL; + if (buf_hdr) + buf_hdr[i] = hdr; + } /* If needed, get more from the global pool */ if (odp_unlikely(num_deq)) { @@ -629,9 +635,11 @@ int buffer_alloc_multi(pool_t *pool, odp_buffer_t buf[], uint32_t idx = num_ch + i; buf[idx] = (odp_buffer_t)(uintptr_t)data[i]; + hdr = buf_hdl_to_hdr(buf[idx]); + hdr->origin_qe = NULL; if (buf_hdr) { - buf_hdr[idx] = buf_hdl_to_hdr(buf[idx]); + buf_hdr[idx] = hdr; /* Prefetch newly allocated and soon to be used * buffer headers. */ odp_prefetch(buf_hdr[idx]); @@ -648,11 +656,6 @@ int buffer_alloc_multi(pool_t *pool, odp_buffer_t buf[], cache->num = cache_num - num_ch; } - if (buf_hdr) { - for (i = 0; i < num_ch; i++) - buf_hdr[i] = buf_hdl_to_hdr(buf[i]); - } - return num_ch + num_deq; }