12 #include <netlink/cli/utils.h> 13 #include <netlink/cli/tc.h> 14 #include <netlink/route/qdisc/fq_codel.h> 16 static void print_usage(
void)
19 "Usage: nl-qdisc-add [...] fq_codel [OPTIONS]...\n" 22 " --help Show this help text.\n" 23 " --limit=LIMIT Maximum queue length in number of bytes.\n" 24 " --quantum=SIZE Amount of bytes to serve at once.\n" 25 " --flows=N Number of flows.\n" 26 " --interval=N The interval in usec.\n" 27 " --target=N The minimum delay in usec.\n" 30 " # Attach fq_codel with a 4096 packets limit to eth1\n" 31 " nl-qdisc-add --dev=eth1 --parent=root fq_codel --limit=4096\n");
34 static void fq_codel_parse_argv(
struct rtnl_tc *tc,
int argc,
char **argv)
36 struct rtnl_qdisc *qdisc = (
struct rtnl_qdisc *) tc;
38 uint32_t quantum, target, interval;
49 static struct option long_opts[] = {
50 {
"help", 0, 0,
'h' },
51 {
"limit", 1, 0, ARG_LIMIT },
52 {
"quantum", 1, 0, ARG_QUANTUM },
53 {
"flows", 1, 0, ARG_FLOWS},
54 {
"interval", 1, 0, ARG_INTERVAL},
55 {
"target", 1, 0, ARG_TARGET},
59 c = getopt_long(argc, argv,
"h", long_opts, &optidx);
99 .tm_name =
"fq_codel",
100 .tm_type = RTNL_TC_TYPE_QDISC,
101 .tm_parse_argv = fq_codel_parse_argv,
104 static void __init fq_codel_init(
void)
106 nl_cli_tc_register(&fq_codel_module);
109 static void __exit fq_codel_exit(
void)
111 nl_cli_tc_unregister(&fq_codel_module);
int rtnl_qdisc_fq_codel_set_target(struct rtnl_qdisc *qdisc, uint32_t target)
Set target of fq_codel qdisc.
int rtnl_qdisc_fq_codel_set_flows(struct rtnl_qdisc *qdisc, int flows)
Set flows of fq_codel qdisc.
int rtnl_qdisc_fq_codel_set_quantum(struct rtnl_qdisc *qdisc, uint32_t quantum)
Set quantum of fq_codel qdisc.
uint32_t nl_cli_parse_u32(const char *arg)
Parse a text based 32 bit unsigned integer argument.
int rtnl_qdisc_fq_codel_set_interval(struct rtnl_qdisc *qdisc, uint32_t interval)
Set interval of fq_codel qdisc.
int rtnl_qdisc_fq_codel_set_limit(struct rtnl_qdisc *qdisc, int limit)
Set limit of fq_codel qdisc.