Merge pull request #15050 from ssahani/fq-pie
network: tc: add support for FQ-PIE packet scheduler
This commit is contained in:
@@ -870,6 +870,10 @@ static const NLType rtnl_tca_option_data_fq_codel_types[] = {
|
||||
[TCA_FQ_CODEL_MEMORY_LIMIT] = { .type = NETLINK_TYPE_U32 },
|
||||
};
|
||||
|
||||
static const NLType rtnl_tca_option_data_fq_pie_types[] = {
|
||||
[TCA_FQ_PIE_LIMIT] = { .type = NETLINK_TYPE_U32 },
|
||||
};
|
||||
|
||||
static const NLType rtnl_tca_option_data_gred_types[] = {
|
||||
[TCA_GRED_DPS] = { .size = sizeof(struct tc_gred_sopt) },
|
||||
};
|
||||
@@ -917,6 +921,7 @@ static const char* const nl_union_tca_option_data_table[] = {
|
||||
[NL_UNION_TCA_OPTION_DATA_ETS] = "ets",
|
||||
[NL_UNION_TCA_OPTION_DATA_FQ] = "fq",
|
||||
[NL_UNION_TCA_OPTION_DATA_FQ_CODEL] = "fq_codel",
|
||||
[NL_UNION_TCA_OPTION_DATA_FQ_PIE] = "fq_pie",
|
||||
[NL_UNION_TCA_OPTION_DATA_GRED] = "gred",
|
||||
[NL_UNION_TCA_OPTION_DATA_HHF] = "hhf",
|
||||
[NL_UNION_TCA_OPTION_DATA_HTB] = "htb",
|
||||
@@ -941,6 +946,8 @@ static const NLTypeSystem rtnl_tca_option_data_type_systems[] = {
|
||||
.types = rtnl_tca_option_data_fq_types },
|
||||
[NL_UNION_TCA_OPTION_DATA_FQ_CODEL] = { .count = ELEMENTSOF(rtnl_tca_option_data_fq_codel_types),
|
||||
.types = rtnl_tca_option_data_fq_codel_types },
|
||||
[NL_UNION_TCA_OPTION_DATA_FQ_PIE] = { .count = ELEMENTSOF(rtnl_tca_option_data_fq_pie_types),
|
||||
.types = rtnl_tca_option_data_fq_pie_types },
|
||||
[NL_UNION_TCA_OPTION_DATA_GRED] = { .count = ELEMENTSOF(rtnl_tca_option_data_gred_types),
|
||||
.types = rtnl_tca_option_data_gred_types },
|
||||
[NL_UNION_TCA_OPTION_DATA_HHF] = { .count = ELEMENTSOF(rtnl_tca_option_data_hhf_types),
|
||||
|
||||
@@ -103,6 +103,7 @@ typedef enum NLUnionTCAOptionData {
|
||||
NL_UNION_TCA_OPTION_DATA_ETS,
|
||||
NL_UNION_TCA_OPTION_DATA_FQ,
|
||||
NL_UNION_TCA_OPTION_DATA_FQ_CODEL,
|
||||
NL_UNION_TCA_OPTION_DATA_FQ_PIE,
|
||||
NL_UNION_TCA_OPTION_DATA_GRED,
|
||||
NL_UNION_TCA_OPTION_DATA_HHF,
|
||||
NL_UNION_TCA_OPTION_DATA_HTB,
|
||||
|
||||
@@ -129,6 +129,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/* 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;
|
||||
uint32_t val;
|
||||
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, &val);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to parse '%s=', ignoring assignment: %s",
|
||||
lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
if (val == 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
||||
"Invalid '%s=', ignoring assignment: %s",
|
||||
lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fq_pie->packet_limit = val;
|
||||
qdisc = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QDiscVTable fq_pie_vtable = {
|
||||
.object_size = sizeof(FlowQueuePIE),
|
||||
.tca_kind = "fq_pie",
|
||||
.fill_message = fq_pie_fill_message,
|
||||
};
|
||||
@@ -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);
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user