From patchwork Tue Jul 12 02:26:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12914473 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 A3627C43334 for ; Tue, 12 Jul 2022 02:26:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbiGLC0s (ORCPT ); Mon, 11 Jul 2022 22:26:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbiGLC0n (ORCPT ); Mon, 11 Jul 2022 22:26:43 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C4444507A for ; Mon, 11 Jul 2022 19:26:42 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id y9so6280925pff.12 for ; Mon, 11 Jul 2022 19:26:42 -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=5rOO7bG1oQf3dAfclpw+kv2pF1erzjKxw50DSNjDzW8=; b=dd75TGl9lff2Wt/BQBb8sNDz+jJpHETsYIEP7pykc/BOZH3DjEQRlmeLJKr17+nzoj Dn2/uyOuob10MTSnu4fdd8Qt7N99Uz+YzPYd/dbSdidL3KXWsL24Opw6XaThMCLSX55H GwpOSmmlkxXIIaHl6Q7JMsJRDkMVbj20gcKqM= 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=5rOO7bG1oQf3dAfclpw+kv2pF1erzjKxw50DSNjDzW8=; b=mqy8UBt3mvaBGb/6z1VQC6YzRrK64apFjffYWSKlOtbuQTiaYTymsWcz6EEU5q3qJu ClvrO6/lI9PCbxuxPBMyJzBQYUPzds7TF26dSsYlkt19DjPYYctHc9Y1c9bvLvSSga7b CR2ERM5x3p8AtLhVNXBMOGsbg6AdJpZ/T4MK0Iah87K9rGnRKfQFKZpMWPHNpqq4lPx7 tTj1THs/eLcnDwhNnAJJPxfrVEimUHcbAbC0cH3M/CE0Uva7jvVAD+RKj9zE7k/rqlWJ +l4uDleMZFzHPVumAWKdzutdfU2LyFo+NJQYH2H1oX8kDHJZsLRbFpScgEpaFKq84Ym3 l8qg== X-Gm-Message-State: AJIora95f0bFF+FGYLAsc4shJ4ylV8X57asd99tp2Ria/g6T2xYuE6OH Ev5JIDn5R4pI1sj/m4s5b8OUuA== X-Google-Smtp-Source: AGRyM1smLTLA06hTIcTtDZJKuFkbyXd2tNTR9XIjRHbgqRrLd1vZla8p9hDlfQ1PzrkeY84zuB3MxA== X-Received: by 2002:a05:6a00:4211:b0:52a:c86e:aba3 with SMTP id cd17-20020a056a00421100b0052ac86eaba3mr10937458pfb.41.1657592801561; Mon, 11 Jul 2022 19:26:41 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p4-20020a62d004000000b0052878f66f8asm5443049pfg.132.2022.07.11.19.26.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jul 2022 19:26:41 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net 4/5] bnxt_en: Fix and simplify XDP transmit path Date: Mon, 11 Jul 2022 22:26:17 -0400 Message-Id: <1657592778-12730-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> References: <1657592778-12730-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 Fix the missing length hint in the TX BD for the XDP transmit path. The length hint is required on legacy chips. Also, simplify the code by eliminating the first_buf local variable. tx_buf contains the same value. The opaque value only needs to be set on the first BD. Fix this also for correctness. Fixes: a7559bc8c17c ("bnxt: support transmit and free of aggregation buffers") Reviewed-by: Andy Gospodarek Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index f02fe906dedb..f53387ed0167 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -28,7 +28,7 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, struct xdp_buff *xdp) { struct skb_shared_info *sinfo; - struct bnxt_sw_tx_bd *tx_buf, *first_buf; + struct bnxt_sw_tx_bd *tx_buf; struct tx_bd *txbd; int num_frags = 0; u32 flags; @@ -43,13 +43,14 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, /* fill up the first buffer */ prod = txr->tx_prod; tx_buf = &txr->tx_buf_ring[prod]; - first_buf = tx_buf; tx_buf->nr_frags = num_frags; if (xdp) tx_buf->page = virt_to_head_page(xdp->data); txbd = &txr->tx_desc_ring[TX_RING(prod)][TX_IDX(prod)]; - flags = ((len) << TX_BD_LEN_SHIFT) | ((num_frags + 1) << TX_BD_FLAGS_BD_CNT_SHIFT); + flags = (len << TX_BD_LEN_SHIFT) | + ((num_frags + 1) << TX_BD_FLAGS_BD_CNT_SHIFT) | + bnxt_lhint_arr[len >> 9]; txbd->tx_bd_len_flags_type = cpu_to_le32(flags); txbd->tx_bd_opaque = prod; txbd->tx_bd_haddr = cpu_to_le64(mapping); @@ -82,7 +83,6 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, flags = frag_len << TX_BD_LEN_SHIFT; txbd->tx_bd_len_flags_type = cpu_to_le32(flags); - txbd->tx_bd_opaque = prod; txbd->tx_bd_haddr = cpu_to_le64(frag_mapping); len = frag_len; @@ -96,7 +96,7 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, prod = NEXT_TX(prod); txr->tx_prod = prod; - return first_buf; + return tx_buf; } static void __bnxt_xmit_xdp(struct bnxt *bp, struct bnxt_tx_ring_info *txr,