-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpf qdisc #8698
bpf qdisc #8698
Conversation
Upstream branch: a259804 |
50dba77
to
ce294a5
Compare
Upstream branch: 79db658 |
689dc28
to
33c4c57
Compare
ce294a5
to
e34fe93
Compare
Upstream branch: e16e64f |
33c4c57
to
f25e90f
Compare
e34fe93
to
8c0b07b
Compare
Rename get_ctx_arg_idx to bpf_ctx_arg_idx, and allow others to call it. No functional change. Signed-off-by: Amery Hung <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]>
The recent advancement in bpf such as allocated objects, bpf list and bpf rbtree has provided powerful and flexible building blocks to realize sophisticated packet scheduling algorithms. As struct_ops now supports core operators in Qdisc_ops, start allowing qdisc to be implemented using bpf struct_ops with this patch. Users can implement Qdisc_ops.{enqueue, dequeue, init, reset, destroy} in bpf and register the qdisc dynamically into the kernel. Co-developed-by: Cong Wang <[email protected]> Signed-off-by: Cong Wang <[email protected]> Signed-off-by: Amery Hung <[email protected]> Acked-by: Cong Wang <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]>
Add basic kfuncs for working on skb in qdisc. Both bpf_qdisc_skb_drop() and bpf_kfree_skb() can be used to release a reference to an skb. However, bpf_qdisc_skb_drop() can only be called in .enqueue where a to_free skb list is available from kernel to defer the release. bpf_kfree_skb() should be used elsewhere. It is also used in bpf_obj_free_fields() when cleaning up skb in maps and collections. bpf_skb_get_hash() returns the flow hash of an skb, which can be used to build flow-based queueing algorithms. Finally, allow users to create read-only dynptr via bpf_dynptr_from_skb(). Signed-off-by: Amery Hung <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]>
Add a watchdog timer to bpf qdisc. The watchdog can be used to schedule the execution of qdisc through kfunc, bpf_qdisc_schedule(). It can be useful for building traffic shaping scheduling algorithm, where the time the next packet will be dequeued is known. The implementation relies on struct_ops gen_prologue/epilogue to patch bpf programs provided by users. Operator specific prologue/epilogue kfuncs are introduced instead of watchdog kfuncs so that it is easier to extend prologue/epilogue in the future (writing C vs BPF bytecode). Signed-off-by: Amery Hung <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]>
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 <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]>
Do not allow users to attach bpf qdiscs to classful qdiscs. This is to prevent accidentally breaking existings classful qdiscs if they rely on some data in the child qdisc. This restriction can potentially be lifted in the future. Note that, we still allow bpf qdisc to be attached to mq. Signed-off-by: Amery Hung <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]>
Extend struct bpf_tc_hook with handle, qdisc name and a new attach type, BPF_TC_QDISC, to allow users to add or remove any qdisc specified in addition to clsact. Signed-off-by: Amery Hung <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]>
This selftest includes a bare minimum fifo qdisc, which simply enqueues sk_buffs into the back of a bpf list and dequeues from the front of the list. Signed-off-by: Amery Hung <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]>
This test implements a more sophisticated qdisc using bpf. The bpf fair- queueing (fq) qdisc gives each flow an equal chance to transmit data. It also respects the timestamp of skb for rate limiting. Signed-off-by: Amery Hung <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]>
Until we are certain that existing classful qdiscs work with bpf qdisc, make sure we don't allow attaching a bpf qdisc to non root. Meanwhile, attaching to mq is allowed. Signed-off-by: Amery Hung <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]>
Upstream branch: 51d6504 |
f25e90f
to
2028f7a
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=945729 irrelevant now. Closing PR. |
Pull request for series with
subject: bpf qdisc
version: 6
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=945729