Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp479419yba; Mon, 1 Apr 2019 10:07:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzko1c60zcRvh+Dyx9JBykmpP/n9FDlfbyJYtqgXi5iUpBrIwUWPn+TAtEpyJ9w5s2QGRj X-Received: by 2002:aa7:8145:: with SMTP id d5mr23304087pfn.215.1554138453755; Mon, 01 Apr 2019 10:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554138453; cv=none; d=google.com; s=arc-20160816; b=DsmB+DrvyblcxE2fsCqMknBrB8Zsf4vKXPfdKDXgdYXwcPobYqmE1kkZCjhdTyYLn8 /11LuPIbQLRaWw5/y10LRqJud51D/kZoPGnS8CVU2SRev3L74AOELPZaUjTjZWZkkSfV SMl9lpkB5jRrCN2XfHHyS2289RqSPK0ica0SfmU++MkpVD8WxduYSxnMPHO2WCWMO7XC QLuVYoedPv/RT8VLiHSe6so3yUiIjVaj/qOfBvi7TrQHe9npSynritdfdDbBvAGIH6vS lCi4sbqaoA91d341KNoUxAfqX3YEUQUyqzEkRbrVlaDSy6SGvcAsHl9BXDd7arhBSu5Z IcmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9DQweaJH7SVGiWihFMbdkUa/G0vocIChwlDuZpX9QqA=; b=vvqBKpC5J2zOITA7ApPCqpnndMPokXij3kLScFkU1ZFZm8/si+Zpi1UpgER+x1FO0h vlVFKXz92NMaRa2YZeHDapreSFSnIRKSyPQf6sBsCWEJ/lNq3QIsvF7MwjvRSIk/Mb3o jHLXdrHL5ytb3JrKBB0RACtMjCWv50zWe6O1Qn2tobfuvzE6ToKUtiFLRuF7v9LMjlCN GP1+tFJKjGNZ+L2/RZE5yxyHJfrlxPZrNIs4BG0vvVeqx5bMUUoHTD4emFADqgKZDcEh 9t/f0ou16ELQuavRLYaRFedb38zbcNSVVuvCzI0rDh3jIjTE5kgTpDfY3gtLCMRY7iL7 9Bfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bYFh6dZ6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b16si6151353pgb.501.2019.04.01.10.07.18; Mon, 01 Apr 2019 10:07:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bYFh6dZ6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728896AbfDARFN (ORCPT + 99 others); Mon, 1 Apr 2019 13:05:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:50230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728870AbfDARFM (ORCPT ); Mon, 1 Apr 2019 13:05:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D659521929; Mon, 1 Apr 2019 17:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554138312; bh=5mP3b2kp+cqkPYAR54+7mfB7xtIHdYPhjA9ttitFgT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bYFh6dZ6Kmi/NnvbdeFdeG9Lql1AHHNW7b7UnNria3XKVTq2vxbAj1NiXELhaIOuF M55xon3VBndEhgWszLc28QHIyupucnvHnKVr4NrN4HmLuSmXxmlPHH3Ovu1fesq6T3 q95DZ/vzfvhhDlGPR/Jn81DV5906gB71KolHX7VI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dean Nelson , "David S. Miller" Subject: [PATCH 5.0 029/146] thunderx: enable page recycling for non-XDP case Date: Mon, 1 Apr 2019 19:00:41 +0200 Message-Id: <20190401170051.011312735@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401170048.449559024@linuxfoundation.org> References: <20190401170048.449559024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 5.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dean Nelson [ Upstream commit b3e208069477588c06f4d5d986164b435bb06e6d ] Commit 773225388dae15e72790 ("net: thunderx: Optimize page recycling for XDP") added code to nicvf_alloc_page() that inadvertently disables receive buffer page recycling for the non-XDP case by always NULL'ng the page pointer. This patch corrects two if-conditionals to allow for the recycling of non-XDP mode pages by only setting the page pointer to NULL when the page is not ready for recycling. Fixes: 773225388dae ("net: thunderx: Optimize page recycling for XDP") Signed-off-by: Dean Nelson Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 23 ++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c @@ -105,20 +105,19 @@ static inline struct pgcache *nicvf_allo /* Check if page can be recycled */ if (page) { ref_count = page_ref_count(page); - /* Check if this page has been used once i.e 'put_page' - * called after packet transmission i.e internal ref_count - * and page's ref_count are equal i.e page can be recycled. + /* This page can be recycled if internal ref_count and page's + * ref_count are equal, indicating that the page has been used + * once for packet transmission. For non-XDP mode, internal + * ref_count is always '1'. */ - if (rbdr->is_xdp && (ref_count == pgcache->ref_count)) - pgcache->ref_count--; - else - page = NULL; - - /* In non-XDP mode, page's ref_count needs to be '1' for it - * to be recycled. - */ - if (!rbdr->is_xdp && (ref_count != 1)) + if (rbdr->is_xdp) { + if (ref_count == pgcache->ref_count) + pgcache->ref_count--; + else + page = NULL; + } else if (ref_count != 1) { page = NULL; + } } if (!page) {