mirror of
https://github.com/systemd/systemd.git
synced 2025-02-22 09:57:34 +03:00
network: tc/cake: introduce AutoRateIngress= setting
This commit is contained in:
parent
69978eb910
commit
025cd94e1c
@ -3472,6 +3472,16 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>AutoRateIngress=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes a boolean value. Enables automatic capacity estimation based on traffic arriving
|
||||
at this qdisc. This is most likely to be useful with cellular links, which tend to change
|
||||
quality randomly. If this setting is enabled, the <varname>Bandwidth=</varname> setting is
|
||||
used as an initial estimate. Defaults to unset, and the kernel's default is used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>OverheadBytes=</varname></term>
|
||||
<listitem>
|
||||
|
@ -386,6 +386,7 @@ BFIFO.LimitBytes, config_parse_bfifo_size,
|
||||
CAKE.Parent, config_parse_qdisc_parent, QDISC_KIND_CAKE, 0
|
||||
CAKE.Handle, config_parse_qdisc_handle, QDISC_KIND_CAKE, 0
|
||||
CAKE.Bandwidth, config_parse_cake_bandwidth, QDISC_KIND_CAKE, 0
|
||||
CAKE.AutoRateIngress, config_parse_cake_tristate, QDISC_KIND_CAKE, 0
|
||||
CAKE.OverheadBytes, config_parse_cake_overhead, QDISC_KIND_CAKE, 0
|
||||
ControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_CODEL, 0
|
||||
ControlledDelay.Handle, config_parse_qdisc_handle, QDISC_KIND_CODEL, 0
|
||||
|
@ -11,6 +11,18 @@
|
||||
#include "qdisc.h"
|
||||
#include "string-util.h"
|
||||
|
||||
static int cake_init(QDisc *qdisc) {
|
||||
CommonApplicationsKeptEnhanced *c;
|
||||
|
||||
assert(qdisc);
|
||||
|
||||
c = CAKE(qdisc);
|
||||
|
||||
c->autorate = -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cake_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) {
|
||||
CommonApplicationsKeptEnhanced *c;
|
||||
int r;
|
||||
@ -31,6 +43,12 @@ static int cake_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req)
|
||||
return log_link_error_errno(link, r, "Could not append TCA_CAKE_BASE_RATE64 attribute: %m");
|
||||
}
|
||||
|
||||
if (c->autorate >= 0) {
|
||||
r = sd_netlink_message_append_u32(req, TCA_CAKE_AUTORATE, c->autorate);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append TCA_CAKE_AUTORATE attribute: %m");
|
||||
}
|
||||
|
||||
r = sd_netlink_message_append_s32(req, TCA_CAKE_OVERHEAD, c->overhead);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append TCA_CAKE_OVERHEAD attribute: %m");
|
||||
@ -156,8 +174,66 @@ int config_parse_cake_overhead(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_cake_tristate(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
const char *section,
|
||||
unsigned section_line,
|
||||
const char *lvalue,
|
||||
int ltype,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
|
||||
CommonApplicationsKeptEnhanced *c;
|
||||
Network *network = data;
|
||||
int *dest, r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = qdisc_new_static(QDISC_KIND_CAKE, network, filename, section_line, &qdisc);
|
||||
if (r == -ENOMEM)
|
||||
return log_oom();
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"More than one kind of queueing discipline, ignoring assignment: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
c = CAKE(qdisc);
|
||||
|
||||
if (streq(lvalue, "AutoRateIngress"))
|
||||
dest = &c->autorate;
|
||||
else
|
||||
assert_not_reached();
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
*dest = -1;
|
||||
TAKE_PTR(qdisc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = parse_boolean(rvalue);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to parse '%s=', ignoring assignment: %s",
|
||||
lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*dest = r;
|
||||
TAKE_PTR(qdisc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QDiscVTable cake_vtable = {
|
||||
.object_size = sizeof(CommonApplicationsKeptEnhanced),
|
||||
.tca_kind = "cake",
|
||||
.init = cake_init,
|
||||
.fill_message = cake_fill_message,
|
||||
};
|
||||
|
@ -8,9 +8,13 @@
|
||||
typedef struct CommonApplicationsKeptEnhanced {
|
||||
QDisc meta;
|
||||
|
||||
int overhead;
|
||||
/* Shaper parameters */
|
||||
int autorate;
|
||||
uint64_t bandwidth;
|
||||
|
||||
/* Overhead compensation parameters */
|
||||
int overhead;
|
||||
|
||||
} CommonApplicationsKeptEnhanced;
|
||||
|
||||
DEFINE_QDISC_CAST(CAKE, CommonApplicationsKeptEnhanced);
|
||||
@ -18,3 +22,4 @@ extern const QDiscVTable cake_vtable;
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_cake_bandwidth);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_cake_overhead);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_cake_tristate);
|
||||
|
@ -468,6 +468,7 @@ ECN=
|
||||
Parent=
|
||||
Handle=
|
||||
Bandwidth=
|
||||
AutoRateIngress=
|
||||
OverheadBytes=
|
||||
[TrafficControlQueueingDiscipline]
|
||||
Parent=
|
||||
|
Loading…
x
Reference in New Issue
Block a user