8#include <netlink/cli/utils.h>
9#include <netlink/cli/tc.h>
10#include <netlink/route/qdisc/fq_codel.h>
12static void print_usage(
void)
15"Usage: nl-qdisc-add [...] fq_codel [OPTIONS]...\n"
18" --help Show this help text.\n"
19" --limit=LIMIT Maximum queue length in number of bytes.\n"
20" --quantum=SIZE Amount of bytes to serve at once.\n"
21" --flows=N Number of flows.\n"
22" --interval=N The interval in usec.\n"
23" --target=N The minimum delay in usec.\n"
26" # Attach fq_codel with a 4096 packets limit to eth1\n"
27" nl-qdisc-add --dev=eth1 --parent=root fq_codel --limit=4096\n");
30static void fq_codel_parse_argv(
struct rtnl_tc *tc,
int argc,
char **argv)
34 uint32_t quantum, target, interval;
45 static struct option long_opts[] = {
46 {
"help", 0, 0,
'h' },
47 {
"limit", 1, 0, ARG_LIMIT },
48 {
"quantum", 1, 0, ARG_QUANTUM },
49 {
"flows", 1, 0, ARG_FLOWS},
50 {
"interval", 1, 0, ARG_INTERVAL},
51 {
"target", 1, 0, ARG_TARGET},
55 c = getopt_long(argc, argv,
"h", long_opts, &optidx);
95 .tm_name =
"fq_codel",
96 .tm_type = RTNL_TC_TYPE_QDISC,
97 .tm_parse_argv = fq_codel_parse_argv,
100static void _nl_init fq_codel_init(
void)
102 nl_cli_tc_register(&fq_codel_module);
105static void _nl_exit fq_codel_exit(
void)
107 nl_cli_tc_unregister(&fq_codel_module);
uint32_t nl_cli_parse_u32(const char *arg)
Parse a text based 32 bit unsigned integer argument.
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_interval(struct rtnl_qdisc *qdisc, uint32_t interval)
Set interval 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.
int rtnl_qdisc_fq_codel_set_limit(struct rtnl_qdisc *qdisc, int limit)
Set limit of fq_codel qdisc.