mirror of
				https://github.com/xdp-project/bpf-examples.git
				synced 2024-05-06 15:54:53 +00:00 
			
		
		
		
	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>
		
			
				
	
	
		
			27 lines
		
	
	
		
			527 B
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			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");
 | |
| //}
 |