From patchwork Wed Apr 6 02:53:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12802733 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A12AC433FE for ; Wed, 6 Apr 2022 09:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235578AbiDFJCI (ORCPT ); Wed, 6 Apr 2022 05:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453006AbiDFI6k (ORCPT ); Wed, 6 Apr 2022 04:58:40 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D6DB26FEBC for ; Tue, 5 Apr 2022 19:54:34 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d15so781144pll.10 for ; Tue, 05 Apr 2022 19:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=exVIOR4rhrcMttIo9P5cZ+zOix6lExvHHIS0ZjmC7Ec=; b=I7FrHzfokyRUioQwIe4bsSjcP4msOwSTlcuhuGmlzEjuFu/5SI7gS169Aznmy6AWaF wDavpFpWFJjxoYq44Lm8KO2HFFh57eMd+a//qTbNZ8pfYoTScekmtr6s87tKWlWpMUTg 5nbPTRc2gHVqe16CYwNVhlJF+NRr7GMqjBb+o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=exVIOR4rhrcMttIo9P5cZ+zOix6lExvHHIS0ZjmC7Ec=; b=Wsz+7q316AUKEhhgeGGTSqjzMoCa9icixZtV4k7W/OqKidLBz++8lgho3PXrF5LcVW eHi3CksdKE7i15DdONI0RI10vdm0GiyIjIxqp3XnZlcv7M4s/6tmNeoBrNp53B9Z/X6F 3goZDPHQZ4FoU6CGfqxpq869BapI65r/B1w0UYWhPnUc0/q9GJnHzivl8sD0KbA5NYko 36VfiblpvyuPokHVggAEkcYBpW2cH6clGqihUosgeKkCkGqWzM/HFyLhmIltFM9rUKG7 A6oW93DkVOgPV2AXOxviSSB6ims6IUuUPRHNOpjORPvzSnahtE32ydiSsEQFufmxzhGG qayQ== X-Gm-Message-State: AOAM5314PQqhr8Yr1zZZve758m2ED0QGLEzWAUYJa7xSRFHIr2X/zQAg 90c/xcRNtV0okWY2c+InWQ/dUmYiBjdw7A== X-Google-Smtp-Source: ABdhPJwPcQJwG10QYxOSEK3taodsLbfWgNEfMDiZbg9qui/XCxwMrEYTS3/mMJ1k8mbtLszzNgoiiA== X-Received: by 2002:a17:903:1249:b0:154:c472:de6b with SMTP id u9-20020a170903124900b00154c472de6bmr6662849plh.38.1649213664716; Tue, 05 Apr 2022 19:54:24 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x9-20020a17090a970900b001ca6c59b350sm3395111pjo.2.2022.04.05.19.54.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Apr 2022 19:54:24 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, bpf@vger.kernel.org, john.fastabend@gmail.com, toke@redhat.com, lorenzo@kernel.org, ast@kernel.org, daniel@iogearbox.net, echaudro@redhat.com, pabeni@redhat.com Subject: [PATCH net-next v3 06/11] bnxt: set xdp_buff pfmemalloc flag if needed Date: Tue, 5 Apr 2022 22:53:48 -0400 Message-Id: <1649213633-7662-7-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1649213633-7662-1-git-send-email-michael.chan@broadcom.com> References: <1649213633-7662-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Andy Gospodarek Set the pfmemaloc flag in the xdp buff so that this can be copied to the skb if needed for an XDP_PASS action. Signed-off-by: Andy Gospodarek Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 65992a33b973..6e1d43410e8c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1041,7 +1041,8 @@ static struct sk_buff *bnxt_rx_skb(struct bnxt *bp, static u32 __bnxt_rx_agg_pages(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, struct skb_shared_info *shinfo, - u16 idx, u32 agg_bufs, bool tpa) + u16 idx, u32 agg_bufs, bool tpa, + struct xdp_buff *xdp) { struct bnxt_napi *bnapi = cpr->bnapi; struct pci_dev *pdev = bp->pdev; @@ -1084,6 +1085,9 @@ static u32 __bnxt_rx_agg_pages(struct bnxt *bp, page = cons_rx_buf->page; cons_rx_buf->page = NULL; + if (xdp && page_is_pfmemalloc(page)) + xdp_buff_set_frag_pfmemalloc(xdp); + if (bnxt_alloc_rx_page(bp, rxr, prod, GFP_ATOMIC) != 0) { unsigned int nr_frags; @@ -1118,8 +1122,8 @@ static struct sk_buff *bnxt_rx_agg_pages_skb(struct bnxt *bp, struct skb_shared_info *shinfo = skb_shinfo(skb); u32 total_frag_len = 0; - total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo, idx, agg_bufs, tpa); - + total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo, idx, + agg_bufs, tpa, NULL); if (!total_frag_len) { dev_kfree_skb(skb); return NULL; @@ -1142,8 +1146,8 @@ static u32 bnxt_rx_agg_pages_xdp(struct bnxt *bp, if (!xdp_buff_has_frags(xdp)) shinfo->nr_frags = 0; - total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo, idx, agg_bufs, tpa); - + total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo, + idx, agg_bufs, tpa, xdp); if (total_frag_len) { xdp_buff_set_frags_flag(xdp); shinfo->nr_frags = agg_bufs;