From patchwork Sun Mar 20 19:57:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12786679 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 E710DC433EF for ; Sun, 20 Mar 2022 19:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239942AbiCTT75 (ORCPT ); Sun, 20 Mar 2022 15:59:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343620AbiCTT7z (ORCPT ); Sun, 20 Mar 2022 15:59:55 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 674BE36691 for ; Sun, 20 Mar 2022 12:58:30 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id o8so8915436pgf.9 for ; Sun, 20 Mar 2022 12:58:30 -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=dS2qQBt77o79gHfSP6/4iapkBmHSrCallbezE0k2Q5E=; b=ciqVtE8pnpdnNMCsP0KIzeYXsfWS4TEOOJn82PJ4zpDh2AqQjY/d1ETEZ6+WDvEGel DvCJIckaie5mfSupv1Dp1QP3uLe3qUfRR2PsIh7PneURdUeKKqqSEGsaKsDcJ066RsIy ctDk32itaLp+87NDDMRcKqPKdB2ojmbxdHHQo= 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=dS2qQBt77o79gHfSP6/4iapkBmHSrCallbezE0k2Q5E=; b=peG+6e0Yp0x8+VJ3GGhfEcS8FR1S1HsGdYd3siPTSsPaSrwHoY+8TW0EK/U4G+q+XH 3fGQC+tZMwTMOKRIwpgu9kARqFVUepXdVpizsCO4YQmLN3XsWk/xIu55PvftsigXJiTE GMaAXekJXynJd5eD8Zhq1bUXztKp6m7/13MnQjlZXH+ycQvXPcsLvFz9QqcwFQl+9nxF IkDFH7I9QuY4RxgDvbR3CdG8vZUiJd8dGGrgKQE12z5u3uE3gYGIdy7nM6J9hynXr5Xw 58I/VMBxTG0IRmKtOxUiCyCvspRvZwq6ju6XxefC8k5gXBtirMBjCxaTMD0LvC1w/WCH Dl5Q== X-Gm-Message-State: AOAM532Porg44E8PrFaVzrfLd/CGfOpEG2nMocljKHJ9imiJjzfH6Dw4 7NKT3kPMogwfvMytVzbvds9Zrw== X-Google-Smtp-Source: ABdhPJzg59nGh4zWK6gyaa1CONlXUkZ2wSbr3KALz+M+NrgENfQpC4Z1XlN2aCC+cP3L7JTjjOpBjg== X-Received: by 2002:a05:6a00:140a:b0:4e0:54d5:d01 with SMTP id l10-20020a056a00140a00b004e054d50d01mr20058062pfu.20.1647806309301; Sun, 20 Mar 2022 12:58:29 -0700 (PDT) Received: from localhost.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id h10-20020a056a001a4a00b004f7c76f29c3sm16418335pfv.24.2022.03.20.12.58.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Mar 2022 12:58:28 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next v2 06/11] bnxt: set xdp_buff pfmemalloc flag if needed Date: Sun, 20 Mar 2022 15:57:59 -0400 Message-Id: <1647806284-8529-7-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1647806284-8529-1-git-send-email-michael.chan@broadcom.com> References: <1647806284-8529-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 4f42efeddb32..05f4b3fbf2e3 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;