Network programming 如何从内核管理qdisc
我很难找到内核API来启用从用户空间运行的一些qdisc策略“tc”实用程序 我在net/sched/sch.*.c中找到了这些模块,但我不知道如何使用它们 例如,如果我想启用TBF,我应该在代码中执行以下操作吗Network programming 如何从内核管理qdisc,network-programming,linux-kernel,device-driver,Network Programming,Linux Kernel,Device Driver,我很难找到内核API来启用从用户空间运行的一些qdisc策略“tc”实用程序 我在net/sched/sch.*.c中找到了这些模块,但我不知道如何使用它们 例如,如果我想启用TBF,我应该在代码中执行以下操作吗 static struct Qdisc_ops tbf_qdisc_ops __read_mostly = { .next = NULL, .cl_ops = &tbf_class_ops,
static struct Qdisc_ops tbf_qdisc_ops __read_mostly = {
.next = NULL,
.cl_ops = &tbf_class_ops,
.id = "tbf",
.priv_size = sizeof(struct tbf_sched_data),
.enqueue = tbf_enqueue,
.dequeue = tbf_dequeue,
.peek = qdisc_peek_dequeued,
.drop = tbf_drop,
.init = tbf_init,
.reset = tbf_reset,
.destroy = tbf_destroy,
.change = tbf_change,
.dump = tbf_dump,
.owner = THIS_MODULE,
});
登记qdisc(和tbf qdisc操作);
够了吗?
如何将qdisc连接到网络设备?qdisc修改仅对netlink API公开。这意味着它被设计为从用户空间更改。但是,如果qdisc是使用tc定义的,那么可以通过调用.change()函数在内核中更改其参数。如何调用文件中定义的那些函数?您知道如何调用此库中定义的函数来模拟工作示例吗?