Skip to content

Commit b560351

Browse files
danielj-mellanoxkuba-moo
authored andcommitted
netdev: Add queue stats for TX stop and wake
TX queue stop and wake are counted by some drivers. Support reporting these via netdev-genl queue stats. Signed-off-by: Daniel Jurgens <danielj@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Jason Xing <kerneljasonxing@gmail.com> Link: https://lore.kernel.org/r/20240510201927.1821109-2-danielj@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent c084ebd commit b560351

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

Documentation/netlink/specs/netdev.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,20 @@ attribute-sets:
439439
Number of the packets dropped by the device due to the transmit
440440
packets bitrate exceeding the device rate limit.
441441
type: uint
442+
-
443+
name: tx-stop
444+
doc: |
445+
Number of times driver paused accepting new tx packets
446+
from the stack to this queue, because the queue was full.
447+
Note that if BQL is supported and enabled on the device
448+
the networking stack will avoid queuing a lot of data at once.
449+
type: uint
450+
-
451+
name: tx-wake
452+
doc: |
453+
Number of times driver re-started accepting send
454+
requests to this queue from the stack.
455+
type: uint
442456

443457
operations:
444458
list:

include/net/netdev_queues.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ struct netdev_queue_stats_tx {
4141
u64 hw_gso_wire_bytes;
4242

4343
u64 hw_drop_ratelimits;
44+
45+
u64 stop;
46+
u64 wake;
4447
};
4548

4649
/**

include/uapi/linux/netdev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ enum {
165165
NETDEV_A_QSTATS_TX_HW_GSO_WIRE_PACKETS,
166166
NETDEV_A_QSTATS_TX_HW_GSO_WIRE_BYTES,
167167
NETDEV_A_QSTATS_TX_HW_DROP_RATELIMITS,
168+
NETDEV_A_QSTATS_TX_STOP,
169+
NETDEV_A_QSTATS_TX_WAKE,
168170

169171
__NETDEV_A_QSTATS_MAX,
170172
NETDEV_A_QSTATS_MAX = (__NETDEV_A_QSTATS_MAX - 1)

net/core/netdev-genl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,9 @@ netdev_nl_stats_write_tx(struct sk_buff *rsp, struct netdev_queue_stats_tx *tx)
517517
netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_HW_GSO_BYTES, tx->hw_gso_bytes) ||
518518
netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_HW_GSO_WIRE_PACKETS, tx->hw_gso_wire_packets) ||
519519
netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_HW_GSO_WIRE_BYTES, tx->hw_gso_wire_bytes) ||
520-
netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_HW_DROP_RATELIMITS, tx->hw_drop_ratelimits))
520+
netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_HW_DROP_RATELIMITS, tx->hw_drop_ratelimits) ||
521+
netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_STOP, tx->stop) ||
522+
netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_WAKE, tx->wake))
521523
return -EMSGSIZE;
522524
return 0;
523525
}

tools/include/uapi/linux/netdev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ enum {
165165
NETDEV_A_QSTATS_TX_HW_GSO_WIRE_PACKETS,
166166
NETDEV_A_QSTATS_TX_HW_GSO_WIRE_BYTES,
167167
NETDEV_A_QSTATS_TX_HW_DROP_RATELIMITS,
168+
NETDEV_A_QSTATS_TX_STOP,
169+
NETDEV_A_QSTATS_TX_WAKE,
168170

169171
__NETDEV_A_QSTATS_MAX,
170172
NETDEV_A_QSTATS_MAX = (__NETDEV_A_QSTATS_MAX - 1)

0 commit comments

Comments
 (0)