Re: [PATCH net-next v6 2/5] veth: implement Byte Queue Limits (BQL) for latency reduction

From: Jesper Dangaard Brouer

Date: Wed Jun 10 2026 - 08:27:00 EST




On 04/06/2026 10.19, Paolo Abeni wrote:
On 5/27/26 3:54 PM, hawk@xxxxxxxxxx wrote:
@@ -348,10 +381,11 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct veth_priv *rcv_priv, *priv = netdev_priv(dev);
struct veth_rq *rq = NULL;
- struct netdev_queue *txq;
+ struct netdev_queue *txq = NULL;

Minor nit: please fix the variables declaration order above.

@@ -1092,6 +1137,24 @@ static void veth_napi_del_range(struct net_device *dev, int start, int end)
ptr_ring_cleanup(&rq->xdp_ring, veth_ptr_free);
}
+ /* Reset BQL and wake stopped peer txqs. A concurrent veth_xmit()
+ * may have set DRV_XOFF between rcu_assign_pointer(napi, NULL) and
+ * synchronize_net(), and NAPI can no longer clear it.
+ * Only wake when the device is still up.
+ */
+ peer = rtnl_dereference(priv->peer);
+ if (peer) {
+ int peer_end = min_t(int, end, peer->real_num_tx_queues);

Sashiko noted you may need to additionally complete/reset the tx queue
in the <old_real_num_tx_queues> .. <new_real_num_tx_queue> range, and I
think it's right.


Trying a new approach in V7, that avoids calling reset. Instead, before
ptr_ring_cleanup(), consume any remaining packets and do the correct BQL
accounting. Lets see if that pleases Sashiko ;-)

--Jesper