summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-network-gperf.gperf1
-rw-r--r--src/network/tc/cake.c64
-rw-r--r--src/network/tc/cake.h3
3 files changed, 67 insertions, 1 deletions
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 70dead97ab..00255b46a6 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -420,6 +420,7 @@ CAKE.PriorityQueueingPreset, config_parse_cake_priority_queueing
CAKE.FirewallMark, config_parse_cake_fwmark, QDISC_KIND_CAKE, 0
CAKE.Wash, config_parse_cake_tristate, QDISC_KIND_CAKE, 0
CAKE.SplitGSO, config_parse_cake_tristate, QDISC_KIND_CAKE, 0
+CAKE.RTTSec, config_parse_cake_rtt, QDISC_KIND_CAKE, 0
ControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_CODEL, 0
ControlledDelay.Handle, config_parse_qdisc_handle, QDISC_KIND_CODEL, 0
ControlledDelay.PacketLimit, config_parse_controlled_delay_u32, QDISC_KIND_CODEL, 0
diff --git a/src/network/tc/cake.c b/src/network/tc/cake.c
index 8d770b0896..c056ec9e04 100644
--- a/src/network/tc/cake.c
+++ b/src/network/tc/cake.c
@@ -118,6 +118,12 @@ static int cake_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req)
return r;
}
+ if (c->rtt > 0) {
+ r = sd_netlink_message_append_u32(req, TCA_CAKE_RTT, c->rtt);
+ if (r < 0)
+ return r;
+ }
+
r = sd_netlink_message_close_container(req);
if (r < 0)
return r;
@@ -605,6 +611,64 @@ int config_parse_cake_fwmark(
return 0;
}
+int config_parse_cake_rtt(
+ 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 = ASSERT_PTR(data);
+ usec_t t;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ 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->rtt = 0;
+ TAKE_PTR(qdisc);
+ return 0;
+ }
+
+ r = parse_sec(rvalue, &t);
+ if (r < 0) {
+ log_syntax(unit, LOG_WARNING, filename, line, r,
+ "Failed to parse '%s=', ignoring assignment: %s",
+ lvalue, rvalue);
+ return 0;
+ }
+ if (t <= 0 || t > UINT32_MAX) {
+ log_syntax(unit, LOG_WARNING, filename, line, 0,
+ "Invalid '%s=', ignoring assignment: %s",
+ lvalue, rvalue);
+ return 0;
+ }
+
+ c->rtt = t;
+ TAKE_PTR(qdisc);
+ return 0;
+}
+
const QDiscVTable cake_vtable = {
.object_size = sizeof(CommonApplicationsKeptEnhanced),
.tca_kind = "cake",
diff --git a/src/network/tc/cake.h b/src/network/tc/cake.h
index ff68cedabf..418d9744a3 100644
--- a/src/network/tc/cake.h
+++ b/src/network/tc/cake.h
@@ -63,7 +63,7 @@ typedef struct CommonApplicationsKeptEnhanced {
/* Other parameters */
int wash;
int split_gso;
-
+ usec_t rtt;
} CommonApplicationsKeptEnhanced;
DEFINE_QDISC_CAST(CAKE, CommonApplicationsKeptEnhanced);
@@ -77,3 +77,4 @@ CONFIG_PARSER_PROTOTYPE(config_parse_cake_compensation_mode);
CONFIG_PARSER_PROTOTYPE(config_parse_cake_flow_isolation_mode);
CONFIG_PARSER_PROTOTYPE(config_parse_cake_priority_queueing_preset);
CONFIG_PARSER_PROTOTYPE(config_parse_cake_fwmark);
+CONFIG_PARSER_PROTOTYPE(config_parse_cake_rtt);