From patchwork Fri Oct 27 23:22:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13439306 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91C173FE4F for ; Fri, 27 Oct 2023 23:23:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="ZeO5tS+n" Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 619271BC for ; Fri, 27 Oct 2023 16:23:43 -0700 (PDT) Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-773ac11de71so188027885a.2 for ; Fri, 27 Oct 2023 16:23:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1698449022; x=1699053822; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ecdJ+JYBkGY/KAPnjcLYSSzGJJXCleUf/hIGMY6bwdA=; b=ZeO5tS+nolmkJVrGJvLDb7tpGjY9UUcpaR1cv+lr7sAI8QReIlaSsHd6MuuiN3Iv0s ofUEeA+wk11pP3h0AGASHXj6qLKlaxpqPxHuC1OQqd+FRZ+pxklUfafZNapLMfzNt39t KKcqI8xXajJVRy7oomJfZsy7/GPC6PjG+C8KE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698449022; x=1699053822; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ecdJ+JYBkGY/KAPnjcLYSSzGJJXCleUf/hIGMY6bwdA=; b=q4g3yKG2lgFoJBBOqNrHmyRqIygpXhjX7YUTFNnO+Qa31OdTa3xkxnSacimjIp+Hp2 OV9amDR5Sm5Q8Hu+ZPYZS0lhUwEwMYLP9gc2Ak4yOPJ9mf9gs8NORMlJxyntb3JqlA5E vZBtXp9+70e91+6IoWf1GNT2JKkjtZIop5HoMKaZdi9voUtI9yTH6mSgpB+M9mTuGxT4 FW7qvo0I3pt+yFweJ2SP7y2yi1A8XCVdONb7rYTAjJyXg1FD0W2PB4HvZ03syw6NM873 g/tdWmBeWT7KdUczuZmO8gY2k5cGO5E7kz5E5CYiUx8fTbBJ/n8fWEc1yGRfbszsZcmQ OX6A== X-Gm-Message-State: AOJu0Yw2Nu0cwENR0vgLk4QnHPVBP4ckBYJp5cEP7FlbNQPHDOk2TCj/ BPzzAW0IxIdTQ2A+2XqFdUXh2rF/MFQ4BBIWae0= X-Google-Smtp-Source: AGHT+IGSfbxsqTuyWelbeB7l5Mt4H5IlMMJM1iYYul7teDKYRxwXYdTr1NE/4EA5BfmsJT3ii2XCwg== X-Received: by 2002:a05:620a:28d0:b0:772:553d:a49e with SMTP id l16-20020a05620a28d000b00772553da49emr4525471qkp.18.1698449022403; Fri, 27 Oct 2023 16:23:42 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id y27-20020a05620a09db00b007742ad3047asm984169qky.54.2023.10.27.16.23.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2023 16:23:41 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, gospo@broadcom.com, Andy Gospodarek Subject: [PATCH net-next 07/13] bnxt_en: New encoding for the TX opaque field Date: Fri, 27 Oct 2023 16:22:46 -0700 Message-Id: <20231027232252.36111-8-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231027232252.36111-1-michael.chan@broadcom.com> References: <20231027232252.36111-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org In order to support multiple TX rings on the same MSIX, we'll use the upper byte of the TX opaque field to store the ring index in the new tx_napi_idx field. This tx_napi_idx field is currently always 0 until more infrastructure is added in later patches. Reviewed-by: Andy Gospodarek Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++-- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 10 ++++++++-- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index ad56ca9d3ceb..1a7f14d086f7 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -517,7 +517,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) txbd->tx_bd_len_flags_type = tx_push->tx_bd_len_flags_type; txbd->tx_bd_haddr = txr->data_mapping; - txbd->tx_bd_opaque = SET_TX_OPAQUE(bp, prod, 2); + txbd->tx_bd_opaque = SET_TX_OPAQUE(bp, txr, prod, 2); prod = NEXT_TX(prod); tx_push->tx_bd_opaque = txbd->tx_bd_opaque; txbd = &txr->tx_desc_ring[TX_RING(prod)][TX_IDX(prod)]; @@ -562,7 +562,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) ((last_frag + 2) << TX_BD_FLAGS_BD_CNT_SHIFT); txbd->tx_bd_haddr = cpu_to_le64(mapping); - txbd->tx_bd_opaque = SET_TX_OPAQUE(bp, prod, 2 + last_frag); + txbd->tx_bd_opaque = SET_TX_OPAQUE(bp, txr, prod, 2 + last_frag); prod = NEXT_TX(prod); txbd1 = (struct tx_bd_ext *) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index efb0db54575b..430538844178 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -64,11 +64,16 @@ struct tx_bd { #define TX_OPAQUE_IDX_MASK 0x0000ffff #define TX_OPAQUE_BDS_MASK 0x00ff0000 #define TX_OPAQUE_BDS_SHIFT 16 +#define TX_OPAQUE_RING_MASK 0xff000000 +#define TX_OPAQUE_RING_SHIFT 24 -#define SET_TX_OPAQUE(bp, idx, bds) \ - (((bds) << TX_OPAQUE_BDS_SHIFT) | ((idx) & (bp)->tx_ring_mask)) +#define SET_TX_OPAQUE(bp, txr, idx, bds) \ + (((txr)->tx_napi_idx << TX_OPAQUE_RING_SHIFT) | \ + ((bds) << TX_OPAQUE_BDS_SHIFT) | ((idx) & (bp)->tx_ring_mask)) #define TX_OPAQUE_IDX(opq) ((opq) & TX_OPAQUE_IDX_MASK) +#define TX_OPAQUE_RING(opq) (((opq) & TX_OPAQUE_RING_MASK) >> \ + TX_OPAQUE_RING_SHIFT) #define TX_OPAQUE_BDS(opq) (((opq) & TX_OPAQUE_BDS_MASK) >> \ TX_OPAQUE_BDS_SHIFT) #define TX_OPAQUE_PROD(bp, opq) ((TX_OPAQUE_IDX(opq) + TX_OPAQUE_BDS(opq)) &\ @@ -824,6 +829,7 @@ struct bnxt_tx_ring_info { u16 tx_cons; u16 tx_hw_cons; u16 txq_index; + u8 tx_napi_idx; u8 kick_pending; struct bnxt_db_info tx_db; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index 23476100fad2..3515a12a6fea 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -52,7 +52,7 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, ((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 = SET_TX_OPAQUE(bp, prod, 1 + num_frags); + txbd->tx_bd_opaque = SET_TX_OPAQUE(bp, txr, prod, 1 + num_frags); txbd->tx_bd_haddr = cpu_to_le64(mapping); /* now let us fill up the frags into the next buffers */