network: TC - introduce fq pie

see https://patchwork.ozlabs.org/patch/1233253/
This commit is contained in:
Susant Sahani 2020-03-09 14:03:49 +01:00 committed by Yu Watanabe
parent 3428b32a04
commit 8f6b6d7091
9 changed files with 144 additions and 0 deletions

View File

@ -2823,6 +2823,25 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
</variablelist>
</refsect1>
<refsect1>
<title>[FlowQueuePIE] Section Options</title>
<para>The <literal>[FlowQueuePIE]</literal> section manages the queueing discipline
(qdisc) of Flow Queue Proportional Integral controller-Enhanced (fq_pie).</para>
<variablelist class='network-directives'>
<xi:include href="tc.xml" xpointer="qdisc-parent" />
<xi:include href="tc.xml" xpointer="qdisc-handle" />
<varlistentry>
<term><varname>PacketLimit=</varname></term>
<listitem>
<para>Specifies the hard limit on the queue size in number of packets. When this limit is reached, incoming packets are
dropped. An unsigned integer ranges 1 to 4294967294. Defaults to unset and kernel's default is used.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>[StochasticFairBlue] Section Options</title>
<para>The [StochasticFairBlue] section manages the queueing discipline (qdisc) of stochastic fair blue

View File

@ -127,6 +127,8 @@ sources = files('''
tc/fq.h
tc/fq-codel.c
tc/fq-codel.h
tc/fq-pie.c
tc/fq-pie.h
tc/gred.c
tc/gred.h
tc/hhf.c

View File

@ -364,6 +364,9 @@ FairQueueingControlledDelay.TargetSec, config_parse_fair_queueing_controll
FairQueueingControlledDelay.IntervalSec, config_parse_fair_queueing_controlled_delay_usec, QDISC_KIND_FQ_CODEL, 0
FairQueueingControlledDelay.CEThresholdSec, config_parse_fair_queueing_controlled_delay_usec, QDISC_KIND_FQ_CODEL, 0
FairQueueingControlledDelay.ECN, config_parse_fair_queueing_controlled_delay_bool, QDISC_KIND_FQ_CODEL, 0
FlowQueuePIE.Parent, config_parse_qdisc_parent, QDISC_KIND_FQ_PIE, 0
FlowQueuePIE.Handle, config_parse_qdisc_handle, QDISC_KIND_FQ_PIE, 0
FlowQueuePIE.PacketLimit, config_parse_fq_pie_packet_limit, QDISC_KIND_FQ_PIE, 0
GenericRandomEarlyDetection.Parent, config_parse_qdisc_parent, QDISC_KIND_GRED, 0
GenericRandomEarlyDetection.Handle, config_parse_qdisc_handle, QDISC_KIND_GRED, 0
GenericRandomEarlyDetection.VirtualQueues, config_parse_generic_random_early_detection_u32, QDISC_KIND_GRED, 0

View File

@ -538,6 +538,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
"EnhancedTransmissionSelection\0"
"FairQueueing\0"
"FairQueueingControlledDelay\0"
"FlowQueuePIE\0"
"GenericRandomEarlyDetection\0"
"HeavyHitterFilter\0"
"HierarchyTokenBucket\0"

95
src/network/tc/fq-pie.c Normal file
View File

@ -0,0 +1,95 @@
/* SPDX-License-Identifier: LGPL-2.1+
* Copyright © 2020 VMware, Inc. */
#include <linux/pkt_sched.h>
#include "alloc-util.h"
#include "conf-parser.h"
#include "fq-pie.h"
#include "netlink-util.h"
#include "parse-util.h"
#include "string-util.h"
static int fq_pie_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) {
FlowQueuePIE *fq_pie;
int r;
assert(link);
assert(qdisc);
assert(req);
fq_pie = FQ_PIE(qdisc);
r = sd_netlink_message_open_container_union(req, TCA_OPTIONS, "fq_pie");
if (r < 0)
return log_link_error_errno(link, r, "Could not open container TCA_OPTIONS: %m");
if (fq_pie->packet_limit > 0) {
r = sd_netlink_message_append_u32(req, TCA_FQ_PIE_LIMIT, fq_pie->packet_limit);
if (r < 0)
return log_link_error_errno(link, r, "Could not append TCA_FQ_PIE_PLIMIT attribute: %m");
}
r = sd_netlink_message_close_container(req);
if (r < 0)
return log_link_error_errno(link, r, "Could not close container TCA_OPTIONS: %m");
return 0;
}
int config_parse_fq_pie_packet_limit(
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;
FlowQueuePIE *fq_pie;
Network *network = data;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
r = qdisc_new_static(QDISC_KIND_FQ_PIE, network, filename, section_line, &qdisc);
if (r == -ENOMEM)
return log_oom();
if (r < 0)
return log_syntax(unit, LOG_WARNING, filename, line, r,
"More than one kind of queueing discipline, ignoring assignment: %m");
fq_pie = FQ_PIE(qdisc);
if (isempty(rvalue)) {
fq_pie->packet_limit = 0;
qdisc = NULL;
return 0;
}
r = safe_atou32(rvalue, &fq_pie->packet_limit);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
qdisc = NULL;
return 0;
}
const QDiscVTable fq_pie_vtable = {
.object_size = sizeof(FlowQueuePIE),
.tca_kind = "fq_pie",
.fill_message = fq_pie_fill_message,
};

17
src/network/tc/fq-pie.h Normal file
View File

@ -0,0 +1,17 @@
/* SPDX-License-Identifier: LGPL-2.1+
* Copyright © 2020 VMware, Inc. */
#pragma once
#include "conf-parser.h"
#include "qdisc.h"
typedef struct FlowQueuePIE {
QDisc meta;
uint32_t packet_limit;
} FlowQueuePIE;
DEFINE_QDISC_CAST(FQ_PIE, FlowQueuePIE);
extern const QDiscVTable fq_pie_vtable;
CONFIG_PARSER_PROTOTYPE(config_parse_fq_pie_packet_limit);

View File

@ -23,6 +23,7 @@ const QDiscVTable * const qdisc_vtable[_QDISC_KIND_MAX] = {
[QDISC_KIND_ETS] = &ets_vtable,
[QDISC_KIND_FQ] = &fq_vtable,
[QDISC_KIND_FQ_CODEL] = &fq_codel_vtable,
[QDISC_KIND_FQ_PIE] = &fq_pie_vtable,
[QDISC_KIND_GRED] = &gred_vtable,
[QDISC_KIND_HHF] = &hhf_vtable,
[QDISC_KIND_HTB] = &htb_vtable,

View File

@ -16,6 +16,7 @@ typedef enum QDiscKind {
QDISC_KIND_ETS,
QDISC_KIND_FQ,
QDISC_KIND_FQ_CODEL,
QDISC_KIND_FQ_PIE,
QDISC_KIND_GRED,
QDISC_KIND_HHF,
QDISC_KIND_HTB,
@ -91,6 +92,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_qdisc_handle);
#include "ets.h"
#include "fifo.h"
#include "fq-codel.h"
#include "fq-pie.h"
#include "fq.h"
#include "gred.h"
#include "hhf.h"

View File

@ -471,3 +471,7 @@ PriorityMap=
Parent=
Handle=
PacketLimit=
[FlowQueuePIE]
Parent=
Handle=
PacketLimit=