Skip to content

Commit cb53fd5

Browse files
committed
Merge branch 'net-bql-better-deal-with-GSO'
Eric Dumazet says: ==================== net: bql: better deal with GSO While BQL bulk dequeue works well for TSO packets, it is not very efficient as soon as GSO is involved. On a GSO only workload (UDP or TCP), this patch series can save about 8 % of cpu cycles on a 40Gbit mlx4 NIC, by keeping optimal batching, and avoiding expensive doorbells, qdisc requeues and reschedules. This patch series : - Add __netdev_tx_sent_queue() so that drivers can implement efficient BQL and xmit_more support. - Implement a work around in dev_hard_start_xmit() for drivers not using __netdev_tx_sent_queue() - changes mlx4 to use __netdev_tx_sent_queue() v2: Tariq and Willem feedback addressed. added __netdev_tx_sent_queue() (Willem suggestion) ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents b8a5d06 + c297344 commit cb53fd5

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

drivers/net/ethernet/mellanox/mlx4/en_tx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
10061006
ring->packets++;
10071007
}
10081008
ring->bytes += tx_info->nr_bytes;
1009-
netdev_tx_sent_queue(ring->tx_queue, tx_info->nr_bytes);
10101009
AVG_PERF_COUNTER(priv->pstats.tx_pktsz_avg, skb->len);
10111010

10121011
if (tx_info->inl)
@@ -1044,7 +1043,10 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
10441043
netif_tx_stop_queue(ring->tx_queue);
10451044
ring->queue_stopped++;
10461045
}
1047-
send_doorbell = !skb->xmit_more || netif_xmit_stopped(ring->tx_queue);
1046+
1047+
send_doorbell = __netdev_tx_sent_queue(ring->tx_queue,
1048+
tx_info->nr_bytes,
1049+
skb->xmit_more);
10481050

10491051
real_size = (real_size / 16) & 0x3f;
10501052

include/linux/netdevice.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3190,6 +3190,26 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
31903190
#endif
31913191
}
31923192

3193+
/* Variant of netdev_tx_sent_queue() for drivers that are aware
3194+
* that they should not test BQL status themselves.
3195+
* We do want to change __QUEUE_STATE_STACK_XOFF only for the last
3196+
* skb of a batch.
3197+
* Returns true if the doorbell must be used to kick the NIC.
3198+
*/
3199+
static inline bool __netdev_tx_sent_queue(struct netdev_queue *dev_queue,
3200+
unsigned int bytes,
3201+
bool xmit_more)
3202+
{
3203+
if (xmit_more) {
3204+
#ifdef CONFIG_BQL
3205+
dql_queued(&dev_queue->dql, bytes);
3206+
#endif
3207+
return netif_tx_queue_stopped(dev_queue);
3208+
}
3209+
netdev_tx_sent_queue(dev_queue, bytes);
3210+
return true;
3211+
}
3212+
31933213
/**
31943214
* netdev_sent_queue - report the number of bytes queued to hardware
31953215
* @dev: network device

net/core/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3272,7 +3272,7 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *first, struct net_device *de
32723272
}
32733273

32743274
skb = next;
3275-
if (netif_xmit_stopped(txq) && skb) {
3275+
if (netif_tx_queue_stopped(txq) && skb) {
32763276
rc = NETDEV_TX_BUSY;
32773277
break;
32783278
}

0 commit comments

Comments
 (0)