From patchwork Sun Mar 20 19:57:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12786677 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 154EAC433EF for ; Sun, 20 Mar 2022 19:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343624AbiCTT74 (ORCPT ); Sun, 20 Mar 2022 15:59:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343612AbiCTT7t (ORCPT ); Sun, 20 Mar 2022 15:59:49 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A48834666 for ; Sun, 20 Mar 2022 12:58:26 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id n7-20020a17090aab8700b001c6aa871860so6624281pjq.2 for ; Sun, 20 Mar 2022 12:58:26 -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=b3T5k9pbqsFN2prQf906cYSu78f4XZFiBwUhmvbzzGw=; b=QVZHfzs4fGmLnXqZLrJn5IphA2mriMn0k7F1lRLYQld/DgyLRde03zA3pOPScA6iE3 JMi71mV3z5F2C14P7XgJ+NZuKDMOdOStRLFTRCNiCBXqj8KYlocywmbFfgK/83Q/6C3Z O9zD7RmEvVmyEqc3XGnMe8TGMjivAmc2fEzes= 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=b3T5k9pbqsFN2prQf906cYSu78f4XZFiBwUhmvbzzGw=; b=OD9mgwPftUC/80KnKiyPz4lWN+HXUy9UNQYPY61NmnXou9YtM9hg3hKgPkobq3vS/q Wk3xuSraPROsmfsJh4vwCUKI2BMUxErneP6wsUNC4wjYsyav2LSZWhqh4dM0XVvP/VCx Ifv6GQUBDO4BV0B/nwVE2qN9Gtf3HJ2NtUzU0CENbr0/mDYXYmp3y01htKVSsRuqIZu0 sydlXg3IssXbbhUkGQeiFj79RuFGiyYz+3VTUrNOue0gQCz1nfwNY6u1MtR6NHbBq3x4 OrR/fIh6/4Kb3jEWCYOtHIbVhRsd0zWtmOWGk6PIjIuR88YPNR+AcOpyjSSF98i16a9y VsDw== X-Gm-Message-State: AOAM532PWk9/lNulgyXJ56dGssP783o9AxI9GY/ZZRoGkjt1hLpJmwoA eqJfP21ui9pAhNzqFBuGRd81uA== X-Google-Smtp-Source: ABdhPJzc14qB9AkCQZyDVUYfip7rbk3vAQjILxvCqpGprsd9OjSTJvSC6EdAv6WiQwuKphuw8s+BsA== X-Received: by 2002:a17:90a:1b65:b0:1c6:5bc5:99b4 with SMTP id q92-20020a17090a1b6500b001c65bc599b4mr25618649pjq.177.1647806305319; Sun, 20 Mar 2022 12:58:25 -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.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Mar 2022 12:58:24 -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 02/11] bnxt: add flag to denote that an xdp program is currently attached Date: Sun, 20 Mar 2022 15:57:55 -0400 Message-Id: <1647806284-8529-3-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 This will be used to determine if bnxt_rx_xdp should be called rather than calling it every time. Signed-off-by: Andy Gospodarek Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 21d5c76b1e70..b7d7ee775fdc 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1729,6 +1729,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, struct bnxt_sw_rx_bd *rx_buf; unsigned int len; u8 *data_ptr, agg_bufs, cmp_type; + bool xdp_active = false; dma_addr_t dma_addr; struct sk_buff *skb; struct xdp_buff xdp; @@ -1842,11 +1843,17 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, if (bnxt_xdp_attached(bp, rxr)) { bnxt_xdp_buff_init(bp, rxr, cons, &data_ptr, &len, &xdp); + xdp_active = true; + } + + /* skip running XDP prog if there are aggregation bufs */ + if (!agg_bufs && xdp_active) { if (bnxt_rx_xdp(bp, rxr, cons, xdp, data, &len, event)) { rc = 1; goto next_rx; } } + if (len <= bp->rx_copy_thresh) { skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr); bnxt_reuse_rx_data(rxr, cons, data);