Skip to content

Commit ba2c114

Browse files
committed
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>
1 parent a3af1bb commit ba2c114

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

tc-policy/monitor_txq_usage.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
tracepoint:net:net_dev_start_xmit {
99
$qm = args->queue_mapping;
10-
$dev = str(args->name, 15);
10+
$dev = str(args->name, 16);
1111

1212
@stat_txq_usage[$dev] = lhist($qm, 0,32,1);
1313
}

tc-policy/tc_txq_policy_kern.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,11 @@ int not_txq_zero (struct __sk_buff *skb)
7070
if (skb->queue_mapping == 1)
7171
skb->queue_mapping = 4;
7272

73+
/* If queue_mapping was not set by skb_record_rx_queue(),
74+
* e.g. locally generated traffic
75+
*/
76+
if (skb->queue_mapping == 0)
77+
skb->queue_mapping = 3;
78+
7379
return TC_ACT_OK;
7480
}

0 commit comments

Comments
 (0)