Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: net_sched: Support updating bstats

Add a kfunc to update Qdisc bstats when an skb is dequeued. The kfunc is
only available in .dequeue programs.

Signed-off-by: Amery Hung <amery.hung@bytedance.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://patch.msgid.link/20250409214606.2000194-6-ameryhung@gmail.com

authored by

Amery Hung and committed by
Martin KaFai Lau
544e0a1f 7a2dafda

+11
+11
net/sched/bpf_qdisc.c
··· 238 238 qdisc_watchdog_cancel(&q->watchdog); 239 239 } 240 240 241 + /* bpf_qdisc_bstats_update - Update Qdisc basic statistics 242 + * @sch: The qdisc from which an skb is dequeued. 243 + * @skb: The skb to be dequeued. 244 + */ 245 + __bpf_kfunc void bpf_qdisc_bstats_update(struct Qdisc *sch, const struct sk_buff *skb) 246 + { 247 + bstats_update(&sch->bstats, skb); 248 + } 249 + 241 250 __bpf_kfunc_end_defs(); 242 251 243 252 BTF_KFUNCS_START(qdisc_kfunc_ids) ··· 257 248 BTF_ID_FLAGS(func, bpf_qdisc_watchdog_schedule, KF_TRUSTED_ARGS) 258 249 BTF_ID_FLAGS(func, bpf_qdisc_init_prologue, KF_TRUSTED_ARGS) 259 250 BTF_ID_FLAGS(func, bpf_qdisc_reset_destroy_epilogue, KF_TRUSTED_ARGS) 251 + BTF_ID_FLAGS(func, bpf_qdisc_bstats_update, KF_TRUSTED_ARGS) 260 252 BTF_KFUNCS_END(qdisc_kfunc_ids) 261 253 262 254 BTF_SET_START(qdisc_common_kfunc_set) ··· 273 263 274 264 BTF_SET_START(qdisc_dequeue_kfunc_set) 275 265 BTF_ID(func, bpf_qdisc_watchdog_schedule) 266 + BTF_ID(func, bpf_qdisc_bstats_update) 276 267 BTF_SET_END(qdisc_dequeue_kfunc_set) 277 268 278 269 enum qdisc_ops_kf_flags {