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:
Jesper Dangaard Brouer
2022-02-01 13:28:20 +01:00
parent a3af1bb99c
commit ba2c114db0
2 changed files with 7 additions and 1 deletions

View File

@@ -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);
}

View File

@@ -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;
}