]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: bnxt: Add a helper for tx_bd_ext
authorJoe Damato <joe@dama.to>
Wed, 8 Apr 2026 23:05:52 +0000 (16:05 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sun, 12 Apr 2026 17:54:32 +0000 (10:54 -0700)
Factor out some code to setup tx_bd_exts into a helper function. This
helper will be used by SW USO implementation in the following commits.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Joe Damato <joe@dama.to>
Link: https://patch.msgid.link/20260408230607.2019402-4-joe@dama.to
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index d4288c458576b79b4c592525e9e996cbe1dde4c9..d1f0969b781c3387f290fdf7051c6e6b9b95cb5e 100644 (file)
@@ -663,10 +663,9 @@ normal_tx:
        txbd->tx_bd_opaque = SET_TX_OPAQUE(bp, txr, prod, 2 + last_frag);
 
        prod = NEXT_TX(prod);
-       txbd1 = (struct tx_bd_ext *)
-               &txr->tx_desc_ring[TX_RING(bp, prod)][TX_IDX(prod)];
+       txbd1 = bnxt_init_ext_bd(bp, txr, prod, lflags, vlan_tag_flags,
+                                cfa_action);
 
-       txbd1->tx_bd_hsize_lflags = lflags;
        if (skb_is_gso(skb)) {
                bool udp_gso = !!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4);
                u32 hdr_len;
@@ -693,7 +692,6 @@ normal_tx:
        } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
                txbd1->tx_bd_hsize_lflags |=
                        cpu_to_le32(TX_BD_FLAGS_TCP_UDP_CHKSUM);
-               txbd1->tx_bd_mss = 0;
        }
 
        length >>= 9;
@@ -706,9 +704,6 @@ normal_tx:
        flags |= bnxt_lhint_arr[length];
        txbd->tx_bd_len_flags_type = cpu_to_le32(flags);
 
-       txbd1->tx_bd_cfa_meta = cpu_to_le32(vlan_tag_flags);
-       txbd1->tx_bd_cfa_action =
-                       cpu_to_le32(cfa_action << TX_BD_CFA_ACTION_SHIFT);
        txbd0 = txbd;
        for (i = 0; i < last_frag; i++) {
                frag = &skb_shinfo(skb)->frags[i];
index 2b40a5bd57aff529b40d4c235c33894f443c0dec..83b4136ccd31d42d9f4d695087556dc037bebf77 100644 (file)
@@ -2836,6 +2836,24 @@ static inline u32 bnxt_tx_avail(struct bnxt *bp,
        return bp->tx_ring_size - (used & bp->tx_ring_mask);
 }
 
+static inline struct tx_bd_ext *
+bnxt_init_ext_bd(struct bnxt *bp, struct bnxt_tx_ring_info *txr,
+                u16 prod, __le32 lflags, u32 vlan_tag_flags,
+                u32 cfa_action)
+{
+       struct tx_bd_ext *txbd1;
+
+       txbd1 = (struct tx_bd_ext *)
+               &txr->tx_desc_ring[TX_RING(bp, prod)][TX_IDX(prod)];
+       txbd1->tx_bd_hsize_lflags = lflags;
+       txbd1->tx_bd_mss = 0;
+       txbd1->tx_bd_cfa_meta = cpu_to_le32(vlan_tag_flags);
+       txbd1->tx_bd_cfa_action =
+               cpu_to_le32(cfa_action << TX_BD_CFA_ACTION_SHIFT);
+
+       return txbd1;
+}
+
 static inline void bnxt_writeq(struct bnxt *bp, u64 val,
                               volatile void __iomem *addr)
 {