Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ interface/device properties:
- "options": STRING
CAKE options for ingress + egress

- "multiqueue": BOOL
Use cake_mq instead of cake


Mapping file syntax:

Expand Down
9 changes: 8 additions & 1 deletion interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct qosify_iface_config {
bool nat;
bool host_isolate;
bool autorate_ingress;
bool multiqueue;

const char *bandwidth_up;
const char *bandwidth_down;
Expand Down Expand Up @@ -78,6 +79,7 @@ enum {
IFACE_ATTR_INGRESS_OPTS,
IFACE_ATTR_EGRESS_OPTS,
IFACE_ATTR_OPTS,
IFACE_ATTR_MULTIQUEUE,
__IFACE_ATTR_MAX
};

Expand All @@ -101,6 +103,7 @@ iface_config_parse(struct blob_attr *attr, struct blob_attr **tb)
[IFACE_ATTR_INGRESS_OPTS] = { "ingress_options", BLOBMSG_TYPE_STRING },
[IFACE_ATTR_EGRESS_OPTS] = { "egress_options", BLOBMSG_TYPE_STRING },
[IFACE_ATTR_OPTS] = { "options", BLOBMSG_TYPE_STRING },
[IFACE_ATTR_MULTIQUEUE] = { "multiqueue", BLOBMSG_TYPE_BOOL },
};

blobmsg_parse(policy, __IFACE_ATTR_MAX, tb, blobmsg_data(attr), blobmsg_len(attr));
Expand Down Expand Up @@ -160,6 +163,7 @@ iface_config_set(struct qosify_iface *iface, struct blob_attr *attr)
cfg->host_isolate = true;
cfg->autorate_ingress = false;
cfg->nat = !iface->device;
cfg->multiqueue = false;

if ((cur = tb[IFACE_ATTR_BW_UP]) != NULL)
cfg->bandwidth_up = check_str(cur);
Expand All @@ -183,6 +187,8 @@ iface_config_set(struct qosify_iface *iface, struct blob_attr *attr)
cfg->host_isolate = blobmsg_get_bool(cur);
if ((cur = tb[IFACE_ATTR_AUTORATE_IN]) != NULL)
cfg->autorate_ingress = blobmsg_get_bool(cur);
if ((cur = tb[IFACE_ATTR_MULTIQUEUE]) != NULL)
cfg->multiqueue = blobmsg_get_bool(cur);
}

static const char *
Expand Down Expand Up @@ -267,13 +273,14 @@ cmd_add_qdisc(struct qosify_iface *iface, const char *ifname, bool egress, bool
struct qosify_iface_config *cfg = &iface->config;
const char *bw = egress ? cfg->bandwidth_up : cfg->bandwidth_down;
const char *dir_opts = egress ? cfg->egress_opts : cfg->ingress_opts;
const char *cake = cfg->multiqueue ? "root cake_mq" : "root cake";
char buf[512];
int ofs;

ofs = prepare_qdisc_cmd(buf, sizeof(buf), ifname, true, "clsact");
qosify_run_cmd(buf, true);

ofs = prepare_qdisc_cmd(buf, sizeof(buf), ifname, true, "root cake");
ofs = prepare_qdisc_cmd(buf, sizeof(buf), ifname, true, cake);
if (bw)
APPEND(buf, ofs, " bandwidth %s", bw);

Expand Down