Compare commits
2 Commits
98cd752a28
...
c695dcf929
Author | SHA1 | Date |
---|---|---|
Susant Sahani | c695dcf929 | |
Susant Sahani | a9a5d632da |
|
@ -1618,6 +1618,13 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>RouteMTUBytes=</varname></term>
|
||||
<listitem>
|
||||
<para>Specifies the MTU for the DHCP routes. Please see the [Route] section for further details.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>ListenPort=</varname></term>
|
||||
<listitem>
|
||||
|
@ -2450,6 +2457,14 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>ControlledDelayPacketLimit=</varname></term>
|
||||
<listitem>
|
||||
<para>Specifies the hard lmit on the queue size in number of packets. When this limit is reached, incoming packets are
|
||||
dropped. An unsigned integer ranges 0 to 4294967294. Defaults to unset and kernel's default is used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>FairQueuingControlledDelayPacketLimit=</varname></term>
|
||||
<listitem>
|
||||
|
|
|
@ -745,6 +745,10 @@ static const NLTypeSystem rtnl_nexthop_type_system = {
|
|||
.types = rtnl_nexthop_types,
|
||||
};
|
||||
|
||||
static const NLType rtnl_tca_option_data_codel_types[] = {
|
||||
[TCA_CODEL_LIMIT] = { .type = NETLINK_TYPE_U32 },
|
||||
};
|
||||
|
||||
static const NLType rtnl_tca_option_data_fq_types[] = {
|
||||
[TCA_FQ_PLIMIT] = { .type = NETLINK_TYPE_U32 },
|
||||
[TCA_FQ_FLOW_PLIMIT] = { .type = NETLINK_TYPE_U32 },
|
||||
|
@ -783,6 +787,7 @@ static const NLType rtnl_tca_option_data_tbf_types[] = {
|
|||
};
|
||||
|
||||
static const char* const nl_union_tca_option_data_table[] = {
|
||||
[NL_UNION_TCA_OPTION_DATA_CODEL] = "codel",
|
||||
[NL_UNION_TCA_OPTION_DATA_FQ] = "fq",
|
||||
[NL_UNION_TCA_OPTION_DATA_FQ_CODEL] = "fq_codel",
|
||||
[NL_UNION_TCA_OPTION_DATA_TBF] = "tbf",
|
||||
|
@ -791,6 +796,8 @@ static const char* const nl_union_tca_option_data_table[] = {
|
|||
DEFINE_STRING_TABLE_LOOKUP(nl_union_tca_option_data, NLUnionTCAOptionData);
|
||||
|
||||
static const NLTypeSystem rtnl_tca_option_data_type_systems[] = {
|
||||
[NL_UNION_TCA_OPTION_DATA_CODEL] = { .count = ELEMENTSOF(rtnl_tca_option_data_codel_types),
|
||||
.types = rtnl_tca_option_data_codel_types },
|
||||
[NL_UNION_TCA_OPTION_DATA_FQ] = { .count = ELEMENTSOF(rtnl_tca_option_data_fq_types),
|
||||
.types = rtnl_tca_option_data_fq_types },
|
||||
[NL_UNION_TCA_OPTION_DATA_FQ_CODEL] = { .count = ELEMENTSOF(rtnl_tca_option_data_fq_codel_types),
|
||||
|
|
|
@ -92,6 +92,7 @@ const char *nl_union_link_info_data_to_string(NLUnionLinkInfoData p) _const_;
|
|||
NLUnionLinkInfoData nl_union_link_info_data_from_string(const char *p) _pure_;
|
||||
|
||||
typedef enum NLUnionTCAOptionData {
|
||||
NL_UNION_TCA_OPTION_DATA_CODEL,
|
||||
NL_UNION_TCA_OPTION_DATA_FQ,
|
||||
NL_UNION_TCA_OPTION_DATA_FQ_CODEL,
|
||||
NL_UNION_TCA_OPTION_DATA_TBF,
|
||||
|
|
|
@ -107,6 +107,8 @@ sources = files('''
|
|||
networkd-util.h
|
||||
networkd-wifi.c
|
||||
networkd-wifi.h
|
||||
tc/codel.c
|
||||
tc/codel.h
|
||||
tc/fq.c
|
||||
tc/fq.h
|
||||
tc/fq-codel.c
|
||||
|
|
|
@ -310,6 +310,7 @@ static int link_set_dhcp_routes(Link *link) {
|
|||
assert_se(sd_dhcp_route_get_destination_prefix_length(static_routes[i], &route->dst_prefixlen) >= 0);
|
||||
route->priority = link->network->dhcp_route_metric;
|
||||
route->table = table;
|
||||
route->mtu = link->network->dhcp_route_mtu;
|
||||
route->scope = route_scope_from_address(route, &address);
|
||||
if (IN_SET(route->scope, RT_SCOPE_LINK, RT_SCOPE_UNIVERSE))
|
||||
route->prefsrc.in = address;
|
||||
|
@ -353,6 +354,7 @@ static int link_set_dhcp_routes(Link *link) {
|
|||
route_gw->protocol = RTPROT_DHCP;
|
||||
route_gw->priority = link->network->dhcp_route_metric;
|
||||
route_gw->table = table;
|
||||
route_gw->mtu = link->network->dhcp_route_mtu;
|
||||
|
||||
r = dhcp_route_configure(&route_gw, link);
|
||||
if (r < 0)
|
||||
|
@ -368,6 +370,7 @@ static int link_set_dhcp_routes(Link *link) {
|
|||
route->protocol = RTPROT_DHCP;
|
||||
route->priority = link->network->dhcp_route_metric;
|
||||
route->table = table;
|
||||
route->mtu = link->network->dhcp_route_mtu;
|
||||
|
||||
r = dhcp_route_configure(&route, link);
|
||||
if (r < 0)
|
||||
|
|
|
@ -178,6 +178,7 @@ DHCPv4.SendDecline, config_parse_bool,
|
|||
DHCPv4.BlackList, config_parse_dhcp_black_listed_ip_address, 0, 0
|
||||
DHCPv4.IPServiceType, config_parse_ip_service_type, 0, offsetof(Network, ip_service_type)
|
||||
DHCPv4.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_client_send_options)
|
||||
DHCPv4.RouteMTUBytes, config_parse_mtu, AF_INET, offsetof(Network, dhcp_route_mtu)
|
||||
DHCPv6.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp6_use_dns)
|
||||
DHCPv6.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp6_use_ntp)
|
||||
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
|
||||
|
@ -277,6 +278,7 @@ TrafficControlQueueingDiscipline.FairQueueTrafficPolicingBuckets, con
|
|||
TrafficControlQueueingDiscipline.FairQueueTrafficPolicingOrphanMask, config_parse_tc_fair_queue_traffic_policing_u32, 0, 0
|
||||
TrafficControlQueueingDiscipline.FairQueueTrafficPolicingPacing, config_parse_tc_fair_queue_traffic_policing_bool, 0, 0
|
||||
TrafficControlQueueingDiscipline.FairQueueTrafficPolicingCEThresholdSec, config_parse_tc_fair_queue_traffic_policing_usec, 0, 0
|
||||
TrafficControlQueueingDiscipline.ControlledDelayPacketLimit, config_parse_tc_controlled_delay_u32, 0, 0
|
||||
/* backwards compatibility: do not add new entries to this section */
|
||||
Network.IPv4LL, config_parse_ipv4ll, 0, offsetof(Network, link_local)
|
||||
DHCP.ClientIdentifier, config_parse_dhcp_client_identifier, 0, offsetof(Network, dhcp_client_identifier)
|
||||
|
|
|
@ -95,6 +95,7 @@ struct Network {
|
|||
uint64_t dhcp_max_attempts;
|
||||
unsigned dhcp_route_metric;
|
||||
uint32_t dhcp_route_table;
|
||||
uint32_t dhcp_route_mtu;
|
||||
uint16_t dhcp_client_port;
|
||||
int dhcp_critical;
|
||||
int ip_service_type;
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1+
|
||||
* Copyright © 2019 VMware, Inc. */
|
||||
|
||||
#include <linux/pkt_sched.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "conf-parser.h"
|
||||
#include "netlink-util.h"
|
||||
#include "parse-util.h"
|
||||
#include "qdisc.h"
|
||||
#include "string-util.h"
|
||||
|
||||
static int controlled_delay_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) {
|
||||
ControlledDelay *cd;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
assert(qdisc);
|
||||
assert(req);
|
||||
|
||||
cd = CODEL(qdisc);
|
||||
|
||||
r = sd_netlink_message_open_container_union(req, TCA_OPTIONS, "codel");
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not open container TCA_OPTIONS: %m");
|
||||
|
||||
if (cd->packet_limit > 0) {
|
||||
r = sd_netlink_message_append_u32(req, TCA_CODEL_LIMIT, cd->packet_limit);
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Could not append TCA_CODEL_LIMIT 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_tc_controlled_delay_u32(
|
||||
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;
|
||||
ControlledDelay *cd;
|
||||
Network *network = data;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = qdisc_new_static(QDISC_KIND_CODEL, network, filename, section_line, &qdisc);
|
||||
if (r == -ENOMEM)
|
||||
return log_oom();
|
||||
if (r < 0)
|
||||
return log_syntax(unit, LOG_ERR, filename, line, r,
|
||||
"More than one kind of queueing discipline, ignoring assignment: %m");
|
||||
|
||||
cd = CODEL(qdisc);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
cd->packet_limit = 0;
|
||||
|
||||
qdisc = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = safe_atou32(rvalue, &cd->packet_limit);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
||||
"Failed to parse '%s=', ignoring assignment: %s",
|
||||
lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
qdisc = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QDiscVTable codel_vtable = {
|
||||
.object_size = sizeof(ControlledDelay),
|
||||
.tca_kind = "codel",
|
||||
.fill_message = controlled_delay_fill_message,
|
||||
};
|
|
@ -0,0 +1,19 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1+
|
||||
* Copyright © 2019 VMware, Inc. */
|
||||
#pragma once
|
||||
|
||||
#include "conf-parser.h"
|
||||
#include "qdisc.h"
|
||||
#include "time-util.h"
|
||||
|
||||
typedef struct ControlledDelay {
|
||||
QDisc meta;
|
||||
|
||||
uint32_t packet_limit;
|
||||
|
||||
} ControlledDelay;
|
||||
|
||||
DEFINE_QDISC_CAST(CODEL, ControlledDelay);
|
||||
extern const QDiscVTable codel_vtable;
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_tc_controlled_delay_u32);
|
|
@ -14,6 +14,7 @@
|
|||
#include "string-util.h"
|
||||
|
||||
const QDiscVTable * const qdisc_vtable[_QDISC_KIND_MAX] = {
|
||||
[QDISC_KIND_CODEL] = &codel_vtable,
|
||||
[QDISC_KIND_FQ] = &fq_vtable,
|
||||
[QDISC_KIND_FQ_CODEL] = &fq_codel_vtable,
|
||||
[QDISC_KIND_NETEM] = &netem_vtable,
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "networkd-util.h"
|
||||
|
||||
typedef enum QDiscKind {
|
||||
QDISC_KIND_CODEL,
|
||||
QDISC_KIND_FQ,
|
||||
QDISC_KIND_FQ_CODEL,
|
||||
QDISC_KIND_NETEM,
|
||||
|
@ -64,6 +65,7 @@ DEFINE_NETWORK_SECTION_FUNCTIONS(QDisc, qdisc_free);
|
|||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_tc_qdiscs_parent);
|
||||
|
||||
#include "codel.h"
|
||||
#include "fq-codel.h"
|
||||
#include "fq.h"
|
||||
#include "netem.h"
|
||||
|
|
|
@ -99,6 +99,7 @@ MaxAttempts=
|
|||
IPServiceType=
|
||||
SendOption=
|
||||
SendDecline=
|
||||
RouteMTUBytes=
|
||||
[DHCPv6]
|
||||
UseNTP=
|
||||
UseDNS=
|
||||
|
@ -297,3 +298,4 @@ FairQueueTrafficPolicingBuckets=
|
|||
FairQueueTrafficPolicingOrphanMask=
|
||||
FairQueueTrafficPolicingPacing=
|
||||
FairQueueTrafficPolicingCEThresholdSec=
|
||||
ControlledDelayPacketLimit=
|
||||
|
|
Loading…
Reference in New Issue