mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-10 01:17:44 +03:00
network: tc/cake: introduce MPUBytes= setting
This commit is contained in:
parent
4bff808648
commit
863542e1ce
@ -3491,6 +3491,14 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>MPUBytes=</varname></term>
|
||||
<listitem>
|
||||
<para>Rounds each packet (including overhead) up to the specified bytes. Takes an integer in
|
||||
the range 1…256. Defaults to unset and kernel's default is used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>CompensationMode=</varname></term>
|
||||
<listitem>
|
||||
|
@ -388,6 +388,7 @@ CAKE.Handle, config_parse_qdisc_handle,
|
||||
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
|
||||
CAKE.MPUBytes, config_parse_cake_mpu, QDISC_KIND_CAKE, 0
|
||||
CAKE.CompensationMode, config_parse_cake_compensation_mode, QDISC_KIND_CAKE, 0
|
||||
CAKE.FlowIsolationMode, config_parse_cake_flow_isolation_mode, QDISC_KIND_CAKE, 0
|
||||
CAKE.NAT, config_parse_cake_tristate, QDISC_KIND_CAKE, 0
|
||||
|
@ -59,6 +59,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_OVERHEAD attribute: %m");
|
||||
}
|
||||
|
||||
if (c->mpu > 0) {
|
||||
r = sd_netlink_message_append_u32(req, TCA_CAKE_MPU, c->mpu);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append TCA_CAKE_MPU attribute: %m");
|
||||
}
|
||||
|
||||
if (c->compensation_mode >= 0) {
|
||||
r = sd_netlink_message_append_u32(req, TCA_CAKE_ATM, c->compensation_mode);
|
||||
if (r < 0)
|
||||
@ -199,6 +205,65 @@ int config_parse_cake_overhead(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_cake_mpu(
|
||||
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;
|
||||
uint32_t v;
|
||||
int 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 (isempty(rvalue)) {
|
||||
c->mpu = 0;
|
||||
TAKE_PTR(qdisc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = safe_atou32(rvalue, &v);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to parse '%s=', ignoring assignment: %s",
|
||||
lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
if (v <= 0 || v > 256) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
||||
"Invalid '%s=', ignoring assignment: %s",
|
||||
lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
c->mpu = v;
|
||||
TAKE_PTR(qdisc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_cake_tristate(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
|
@ -38,6 +38,7 @@ typedef struct CommonApplicationsKeptEnhanced {
|
||||
/* Overhead compensation parameters */
|
||||
bool overhead_set;
|
||||
int overhead;
|
||||
uint32_t mpu;
|
||||
CakeCompensationMode compensation_mode;
|
||||
|
||||
/* Flow isolation parameters */
|
||||
@ -51,6 +52,7 @@ 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_mpu);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_cake_tristate);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_cake_compensation_mode);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_cake_flow_isolation_mode);
|
||||
|
@ -470,6 +470,7 @@ Handle=
|
||||
Bandwidth=
|
||||
AutoRateIngress=
|
||||
OverheadBytes=
|
||||
MPUBytes=
|
||||
CompensationMode=
|
||||
FlowIsolationMode=
|
||||
NAT=
|
||||
|
Loading…
Reference in New Issue
Block a user