From patchwork Wed Apr 6 02:53:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12803755 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 8C27AC433F5 for ; Wed, 6 Apr 2022 16:19:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237546AbiDFQVM (ORCPT ); Wed, 6 Apr 2022 12:21:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237381AbiDFQUz (ORCPT ); Wed, 6 Apr 2022 12:20:55 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4042232E97E for ; Tue, 5 Apr 2022 19:54:19 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id kw18so1265080pjb.5 for ; Tue, 05 Apr 2022 19:54:19 -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=lLM6HC2MKQ9oKpzPu1T+fLSGUfA+41Y5u/iM1NMdVfw=; b=Qq0/ZUl7kYWeJ7c4Y7/ZGro6OteJKV41OJOtnUpY8Fqgfq+qsxv5EunAxZnFatoLlL j0wOoQE1qN0KqRhxQSvB4J3HCfSxL1ryUZ1K4t+RHntpAd9fA8vjAiMuCS9sQWaPxpDu +MhmvdtroU+7hf3/l+Km0zam7C558xMCRfSXE= 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=lLM6HC2MKQ9oKpzPu1T+fLSGUfA+41Y5u/iM1NMdVfw=; b=Pf6P9Lgftpw8i5T3s9Qw9f1y8VKH/zjLf/BD5apMECejv6Sbk0Ghz/x8zT5hGefti/ Mb6bExFKnZRXgpUaGYGKDeoUnmLZifNsdVoGvvDu5l2HCmfo4dFSg5OKpQaRlHIbqaiI 7UVZ/CRgb0KkYmkfYGl/8mWn6UcMI9H0RP4IRQPQbVXx7mdK2f14z39Qr7lFchjJZ/ii AN8Z0irVggn1Jfh7MxbMZMjFPIRKN4FrtQLBTARciTXa3fhmyUtVfWeIVAqeV0d9jQyM LbdwHu4U1MLw+0POw5VkqwsYaHJnAYLuKGFjRgl5XN+H50VNhdYfjzMdVABkHlt9SQVm 77Xg== X-Gm-Message-State: AOAM533YBaQH+famvcz5GJOBEVTDgnEh1U/+noCwRmhZtN8rT1grOxmP zlTKB8O9mJBOS1yvcp8FFaErhA== X-Google-Smtp-Source: ABdhPJw0Nlbo1gKZcG9FBNyFMY8fcEgld74DrK981mn6G3YGj81sfrNgp8Nv0oD1+E0opYnyJJqBhQ== X-Received: by 2002:a17:902:c948:b0:156:c07d:8222 with SMTP id i8-20020a170902c94800b00156c07d8222mr6612935pla.30.1649213658863; Tue, 05 Apr 2022 19:54:18 -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.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Apr 2022 19:54:18 -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 02/11] bnxt: add flag to denote that an xdp program is currently attached Date: Tue, 5 Apr 2022 22:53:44 -0400 Message-Id: <1649213633-7662-3-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: 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 826d94c49d26..f6973f57ccd2 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);