From patchwork Fri Apr 8 07:58:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12806226 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 76788C433F5 for ; Fri, 8 Apr 2022 08:00:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230385AbiDHICJ (ORCPT ); Fri, 8 Apr 2022 04:02:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230164AbiDHIBp (ORCPT ); Fri, 8 Apr 2022 04:01:45 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0311139CD9 for ; Fri, 8 Apr 2022 00:59:40 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id ku13-20020a17090b218d00b001ca8fcd3adeso11239920pjb.2 for ; Fri, 08 Apr 2022 00:59:40 -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=Fj/3/20YgqdFK+FdN2ttm4aVseWMOVFdXEYly6wcM38=; b=URkwBx6jB/GXTuQA0W0VZsksRDS+Du51dvUBJPFxSKN7ixpM/SVTR9VR3E30Uj+awV j0XTmlnC7/kAWsl0l9ywwnqUWWxxTKev9v3bJNdrU1qlqk3spNmOWPb4lCCJphIry/Cp WmCCHd8CpYKIyTzHN+erU3da1AYtDpdodni0I= 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=Fj/3/20YgqdFK+FdN2ttm4aVseWMOVFdXEYly6wcM38=; b=BBBl+MdBt4K9/p2lcilUoFxASELKrgvEk/TJ17SilQAQ1YIt/visQvjuXUYF6eFO+d eUHrxSfRzOKs0z2AxigTjIdVmD7xbqkth/K71dfpc+8TMIXrlQz+DEb6B3/h79qudVv9 FfBBC/4J65AzDhbYN8tifQAlI3c4jAFJoEvcnAkAuE3eLn45uBYhbR7P470RSsn8EdHI GUDpyguKspkmp2lHVUeDRzRoaJcbrI/8LkkxS/RUl1Oezy6NOw866umrd9beELWC0LWD o8vPUoVSeozBi5ieYhf/L0wHb7NVXa87scPmMxCMsw0IwjVgcCJ6Rz9+gz3AsYfd+08V JH6w== X-Gm-Message-State: AOAM533urlRKf/9cJvd++7VeJdJFNbq6jMjzweDFT1ddtayqOlCKPVED biooq6ytSG7mZNaHrBeWjvv1zw== X-Google-Smtp-Source: ABdhPJw4MNVAaZ0bJScpZXNEM97evt4PweNLjZEvlN7EBcCQs6Jdbgl/PzTLfQoLGwqZFjcjc1biWQ== X-Received: by 2002:a17:90a:94c7:b0:1ca:a0e3:356d with SMTP id j7-20020a17090a94c700b001caa0e3356dmr20357424pjw.171.1649404779404; Fri, 08 Apr 2022 00:59:39 -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.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2022 00:59:39 -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 02/11] bnxt: add flag to denote that an xdp program is currently attached Date: Fri, 8 Apr 2022 03:58:57 -0400 Message-Id: <1649404746-31033-3-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 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);