Files
xdp-project-bpf-examples/tc-policy/monitor_txq_usage.bt
Jesper Dangaard Brouer ba2c114db0 tc-policy: Take into account locally generated traffic
The BPF-prog "not_txq_zero" also needed to take into account
that skb->queue_mapping usually isn't set for locally
generated traffic.

I worry that sockets can set another queue id that could
override our (BPF choice) in netdev_pick_tx().
See sk_tx_queue_set() and sk_tx_queue_get().

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2022-02-01 13:28:20 +01:00

27 lines
527 B
Plaintext
Executable File

#!/usr/bin/bpftrace
//BEGIN {
// printf("Monitor TXQ usage\n");
// printf(" - Remember: BPF set queue_mapping is one-less here (zero-indexed)\n");
//}
tracepoint:net:net_dev_start_xmit {
$qm = args->queue_mapping;
$dev = str(args->name, 16);
@stat_txq_usage[$dev] = lhist($qm, 0,32,1);
}
/* Periodically print stats */
interval:s:3
{
printf("\nPeriodic show stats - time: ");
time();
print(@stat_txq_usage);
}
/* Default bpftrace will print all remaining maps at END */
//END {
// printf("END stats:\n");
//}