Re: [PATCH net-next v3 4/6] net: bcmgenet: add XDP_TX support

From: Nicolai Buchwitz

Date: Mon Mar 30 2026 - 17:28:33 EST


On 30.3.2026 20:15, Mohsin Bashir wrote:
+static bool
+bcmgenet_xdp_xmit_frame(struct bcmgenet_priv *priv,
+ struct xdp_frame *xdpf, bool dma_map)
+{
+ struct bcmgenet_tx_ring *ring = &priv->tx_rings[DESC_INDEX];
+ struct device *kdev = &priv->pdev->dev;
+ struct enet_cb *tx_cb_ptr;
+ dma_addr_t mapping;
+ unsigned int dma_len;
+ u32 len_stat;
+
+ spin_lock(&ring->lock);
+

So we acquire lock on per-packet basis on the XDP_TX path? Do you think we can batch this?

Patch 4 only has one caller so the lock inside was fine. Patch 5
adds ndo_xdp_xmit which needs batching, so it moves the lock out
to the callers. XDP_TX processes one frame at a time in NAPI context
so batching doesn't apply there.

Note: v5 of this series was posted two days ago [1].

[1] https://lore.kernel.org/netdev/20260328230513.415790-1-nb@xxxxxxxxxxx/

Thanks
Nicolai