From patchwork Tue Jun 9 15:22:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 49661 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3117821419 for ; Tue, 9 Jun 2015 15:23:09 +0000 (UTC) Received: by lbcak1 with SMTP id ak1sf5525317lbc.2 for ; Tue, 09 Jun 2015 08:23:08 -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:cc: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=2Nesf1prgeJJ82Mr22LPhPPbVBJid0P5pYhHOdVp37s=; b=czWHdyvORHKLuVi46gaixAiC+tzsMLB6/lJFqqci5LFoCutl4Qo0mrDTfmu8heSWj3 t/H7A40wMzKUJ365U12gxZljjekj6CNuWphK8VLwjgpFjStYcS7hfLb1rRCW4uLzE+1J zRcvAd7z6wbT0iwvbCjUaUeLOSeyZZJrO3DJit+vbyf/UHWtvJsfAEJQt9AJXhWmL8UT ebATWx5otVJyfOAyFTU3WtCgE+jViS6KhWvbMqyClVjWjMMjynVUbrV+aYF7X+6+a5do bEKPq0/9ZI/gX9lXWR8H9c8EcyfE0aQM2XO8AF0qM+MqYSjfdJJ7RY+aspCH9BK1SHEE jQkg== X-Gm-Message-State: ALoCoQkXN+JBpLax+9vSgHe7hIlo/Gf+k2jXlED8XAuFvZtFHXMZjQzwoRat2c4Vk3kYIzRB3Rx1 X-Received: by 10.112.55.104 with SMTP id r8mr22329617lbp.18.1433863388201; Tue, 09 Jun 2015 08:23:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.105 with SMTP id lb9ls91894lab.10.gmail; Tue, 09 Jun 2015 08:23:08 -0700 (PDT) X-Received: by 10.152.164.193 with SMTP id ys1mr23094543lab.65.1433863388054; Tue, 09 Jun 2015 08:23:08 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id y2si6001402lad.132.2015.06.09.08.23.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2015 08:23:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laew7 with SMTP id w7so14959523lae.1 for ; Tue, 09 Jun 2015 08:23:08 -0700 (PDT) X-Received: by 10.152.4.137 with SMTP id k9mr22789965lak.29.1433863387928; Tue, 09 Jun 2015 08:23:07 -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.108.230 with SMTP id hn6csp2685056lbb; Tue, 9 Jun 2015 08:23:07 -0700 (PDT) X-Received: by 10.140.22.147 with SMTP id 19mr26309142qgn.52.1433863386422; Tue, 09 Jun 2015 08:23:06 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k85si5705980qhc.46.2015.06.09.08.23.05; Tue, 09 Jun 2015 08:23:06 -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 0D3F461ED8; Tue, 9 Jun 2015 15:23:05 +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 C75BE61CC5; Tue, 9 Jun 2015 15:23:02 +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 D9BF061CDE; Tue, 9 Jun 2015 15:22:54 +0000 (UTC) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by lists.linaro.org (Postfix) with ESMTPS id E5FF861CC4 for ; Tue, 9 Jun 2015 15:22:53 +0000 (UTC) Received: by labpy14 with SMTP id py14so15023917lab.0 for ; Tue, 09 Jun 2015 08:22:52 -0700 (PDT) X-Received: by 10.112.140.137 with SMTP id rg9mr23165184lbb.101.1433863372382; Tue, 09 Jun 2015 08:22:52 -0700 (PDT) Received: from erachmi-VirtualBox.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by mx.google.com with ESMTPSA id az6sm1466610lab.24.2015.06.09.08.22.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jun 2015 08:22:51 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, maxim.uvarov@linaro.org, petri.savolainen@nokia.com Date: Tue, 9 Jun 2015 17:22:33 +0200 Message-Id: <1433863353-22658-1-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH-RFC] linux-generic: pool: Fix for buffer type "casting" 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: christophe.milard@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.47 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 There seems to be an issue with the handling of completion event buffers: These are drawn from the same pool as the packet event buffers, but are re-typed as completion events. (see platform/linux-generic/odp_crypto.c:428) However, when these are freed and returned to the pool, the buffer type was not restored to packet event buffers: The code that allocates packet event buffers from the pool did not update the buffer type either, relying on all buffers in the pool already being initialized to be packet event buffers This patch resets the buffer type at release time. Signed-off-by: Christophe Milard --- platform/linux-generic/odp_pool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 35e79a0..6e65926 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -560,6 +560,9 @@ void odp_buffer_free(odp_buffer_t buf) odp_buffer_hdr_t *buf_hdr = odp_buf_to_hdr(buf); pool_entry_t *pool = odp_buf_to_pool(buf_hdr); + /* Reset packet type in case it was "casted" (e.g. crypto completions)*/ + buf_hdr->type = pool->s.params.type; + if (odp_unlikely(pool->s.low_wm_assert)) ret_buf(&pool->s, buf_hdr); else