mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
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>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
tracepoint:net:net_dev_start_xmit {
|
||||
$qm = args->queue_mapping;
|
||||
$dev = str(args->name, 15);
|
||||
$dev = str(args->name, 16);
|
||||
|
||||
@stat_txq_usage[$dev] = lhist($qm, 0,32,1);
|
||||
}
|
||||
|
@@ -70,5 +70,11 @@ int not_txq_zero (struct __sk_buff *skb)
|
||||
if (skb->queue_mapping == 1)
|
||||
skb->queue_mapping = 4;
|
||||
|
||||
/* If queue_mapping was not set by skb_record_rx_queue(),
|
||||
* e.g. locally generated traffic
|
||||
*/
|
||||
if (skb->queue_mapping == 0)
|
||||
skb->queue_mapping = 3;
|
||||
|
||||
return TC_ACT_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user