mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
bnxt_en: Add helper to fill SW USO payload BDs
Move the code that fills a payload BD and its software ring entry in bnxt_sw_udp_gso_xmit() into a helper, bnxt_sw_gso_data_bd(). No functional change. A following patch uses the helper to add a pad BD to short SW USO segments. Reviewed-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: Joe Damato <joe@dama.to> Link: https://patch.msgid.link/20261009215426.2377946-2-joe@dama.to Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
73022f605c
commit
70f63dc608
|
|
@ -31,6 +31,26 @@ static u32 bnxt_sw_gso_lhint(unsigned int len)
|
|||
return TX_BD_FLAGS_LHINT_2048_AND_LARGER;
|
||||
}
|
||||
|
||||
static struct tx_bd *bnxt_sw_gso_data_bd(struct bnxt *bp,
|
||||
struct bnxt_tx_ring_info *txr,
|
||||
u16 prod, dma_addr_t addr,
|
||||
unsigned int len)
|
||||
{
|
||||
struct tx_bd *txbd = &txr->tx_desc_ring[TX_RING(bp, prod)][TX_IDX(prod)];
|
||||
struct bnxt_sw_tx_bd *tx_buf = &txr->tx_buf_ring[RING_TX(bp, prod)];
|
||||
|
||||
txbd->tx_bd_haddr = cpu_to_le64(addr);
|
||||
txbd->tx_bd_len_flags_type = cpu_to_le32(len << TX_BD_LEN_SHIFT);
|
||||
txbd->tx_bd_opaque = 0;
|
||||
|
||||
dma_unmap_addr_set(tx_buf, mapping, addr);
|
||||
dma_unmap_len_set(tx_buf, len, 0);
|
||||
tx_buf->skb = NULL;
|
||||
tx_buf->is_sw_gso = 0;
|
||||
|
||||
return txbd;
|
||||
}
|
||||
|
||||
/* Transmit an skb requiring software UDP segmentation.
|
||||
*
|
||||
* Returns 1 if the skb was queued and new BDs were produced, 0 if the skb
|
||||
|
|
@ -181,15 +201,10 @@ int bnxt_sw_udp_gso_xmit(struct bnxt *bp, struct bnxt_tx_ring_info *txr,
|
|||
while (tso_dma_map_next(&map, &dma_addr, &chunk_len,
|
||||
&mapping_len, seg_payload)) {
|
||||
prod = NEXT_TX(prod);
|
||||
txbd = &txr->tx_desc_ring[TX_RING(bp, prod)][TX_IDX(prod)];
|
||||
txbd = bnxt_sw_gso_data_bd(bp, txr, prod, dma_addr,
|
||||
chunk_len);
|
||||
tx_buf = &txr->tx_buf_ring[RING_TX(bp, prod)];
|
||||
|
||||
txbd->tx_bd_haddr = cpu_to_le64(dma_addr);
|
||||
dma_unmap_addr_set(tx_buf, mapping, dma_addr);
|
||||
dma_unmap_len_set(tx_buf, len, 0);
|
||||
tx_buf->skb = NULL;
|
||||
tx_buf->is_sw_gso = 0;
|
||||
|
||||
if (mapping_len) {
|
||||
if (last_unmap_buf) {
|
||||
dma_unmap_addr_set(last_unmap_buf,
|
||||
|
|
@ -204,10 +219,6 @@ int bnxt_sw_udp_gso_xmit(struct bnxt *bp, struct bnxt_tx_ring_info *txr,
|
|||
}
|
||||
last_unmap_buf = tx_buf;
|
||||
|
||||
flags = chunk_len << TX_BD_LEN_SHIFT;
|
||||
txbd->tx_bd_len_flags_type = cpu_to_le32(flags);
|
||||
txbd->tx_bd_opaque = 0;
|
||||
|
||||
seg_payload -= chunk_len;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user