From patchwork Fri Apr 8 07:59:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12806230 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 69267C4332F for ; Fri, 8 Apr 2022 08:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229710AbiDHIDG (ORCPT ); Fri, 8 Apr 2022 04:03:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbiDHIB6 (ORCPT ); Fri, 8 Apr 2022 04:01:58 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 458E65584 for ; Fri, 8 Apr 2022 00:59:47 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id h23-20020a17090a051700b001c9c1dd3acbso8936085pjh.3 for ; Fri, 08 Apr 2022 00:59:47 -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=4N8B6jfN+5pumqsdETVSP5QVVJC/QlkUObEoGqiFEgg=; b=TrAi7f/UTYGDLTBWrs4LKAS5SHEOyOzPVFh4qa34DCfLfcAOaPZrIK1vwRBoG0eHLP tkB93j0UHC2YjlIeMe85uij8xhgRmpLbo5zFgeyPLTS+QNo9N0yn/TpWtcr3htqmAxfW gS5bSahdEwow/IJvnveB10siiEU+7ViR0/n6w= 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=4N8B6jfN+5pumqsdETVSP5QVVJC/QlkUObEoGqiFEgg=; b=2e5EAaTq/0kUZw0Y+wkmKLu1OsJqtznkIz8+H61kW240q1R59qPnmJ2eU7RbrUT4JQ SE7dLCKsEHAriI2DJXuZZR8zHuoOdXh0WtJ+aLGE7CPE8RJRPaUf2T2r3+V9BssOIN5t h1viWGGgd0Wpz02j/74DL8I1W0LZq/EHSawkamos5W30TR1eUtTMxcSXaLnLk8/ISVon qe0aAW0OCYEKzR7OzonEFIy9cz0Sx6TGZ+6NA1d+Au06NsQaGqtNEVR6b8QhcDREP/nb d8ICWEuJz+wZyUDiUfgBroJqfQQ5tPpeeRy2tbmsBvYPaVsim+BYmRqIXsckXJlYWVXH OhGw== X-Gm-Message-State: AOAM531SIDsPK0YAC53viEVXN4IX/i45aNCeP5pvDUf6eCG/Og9c/Wd1 0H5LUk89YMIRG7MZ6+u7E4hTEw== X-Google-Smtp-Source: ABdhPJyeZRk9ReuVWoE6SGPgUeIexUbWLwP+Sbjv4JHkwW54MvKsP0KzOqrZcZlZUVYU0lQBtICogg== X-Received: by 2002:a17:90b:2516:b0:1ca:aa68:ca71 with SMTP id ns22-20020a17090b251600b001caaa68ca71mr20383521pjb.58.1649404785912; Fri, 08 Apr 2022 00:59:45 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id l2-20020a637c42000000b003644cfa0dd1sm20507448pgn.79.2022.04.08.00.59.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2022 00:59:45 -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 v4 06/11] bnxt: set xdp_buff pfmemalloc flag if needed Date: Fri, 8 Apr 2022 03:59:01 -0400 Message-Id: <1649404746-31033-7-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1649404746-31033-1-git-send-email-michael.chan@broadcom.com> References: <1649404746-31033-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@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;