From: Zbigniew Jędrzejewski-Szmek Date: Tue, 4 Feb 2020 16:22:41 +0000 (+0100) Subject: network: TokenBufferFilter→TokenBucketFilter X-Git-Tag: v245-rc1~12^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60ed2dcfc7ea7bd9e561e0040d3953868abba293;p=thirdparty%2Fsystemd.git network: TokenBufferFilter→TokenBucketFilter This never made into a release, so we can change the name with impunity. Noticed by Davide Pesavento. --- diff --git a/NEWS b/NEWS index 74dc7e368e5..169c97f4301 100644 --- a/NEWS +++ b/NEWS @@ -125,7 +125,7 @@ CHANGES WITH 245 in spe: marking a process so that it is killed implicitly whenever the event source watching it is freed). - * systemd-networkd gained support for configuring Token Buffer Filter + * systemd-networkd gained support for configuring Token Bucket Filter (TBF) parameters in its qdisc configuration support. Similar, support for Stochastic Fairness Queuing (SFQ), Controlled-Delay Active Queue Management (CoDel), Fair Queue (FQ) has been added. diff --git a/man/systemd.network.xml b/man/systemd.network.xml index e3bd1bbda2a..ad03be6db71 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -2321,9 +2321,9 @@ - [TokenBufferFilter] Section Options - The [TokenBufferFilter] section manages the queueing discipline (qdisc) of - token buffer filter (tbf). + [TokenBucketFilter] Section Options + The [TokenBucketFilter] section manages the queueing discipline (qdisc) of + token bucket filter (tbf). @@ -2338,7 +2338,7 @@ LatencySec= Specifies the latency parameter, which specifies the maximum amount of time a - packet can sit in the Token Buffer Filter (TBF). Defaults to unset. + packet can sit in the Token Bucket Filter (TBF). Defaults to unset. diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 490e1b12edd..d29814820d1 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -284,14 +284,14 @@ NetworkEmulator.DuplicateRate, config_parse_network_emulator_rate, NetworkEmulator.PacketLimit, config_parse_network_emulator_packet_limit, QDISC_KIND_NETEM, 0 StochasticFairnessQueueing.Parent, config_parse_qdisc_parent, QDISC_KIND_SFQ, 0 StochasticFairnessQueueing.PerturbPeriodSec, config_parse_stochastic_fairness_queueing_perturb_period, QDISC_KIND_SFQ, 0 -TokenBufferFilter.Parent, config_parse_qdisc_parent, QDISC_KIND_TBF, 0 -TokenBufferFilter.Rate, config_parse_token_buffer_filter_size, QDISC_KIND_TBF, 0 -TokenBufferFilter.Burst, config_parse_token_buffer_filter_size, QDISC_KIND_TBF, 0 -TokenBufferFilter.LimitSize, config_parse_token_buffer_filter_size, QDISC_KIND_TBF, 0 -TokenBufferFilter.MTUBytes, config_parse_token_buffer_filter_size, QDISC_KIND_TBF, 0 -TokenBufferFilter.MPUBytes, config_parse_token_buffer_filter_size, QDISC_KIND_TBF, 0 -TokenBufferFilter.PeakRate, config_parse_token_buffer_filter_size, QDISC_KIND_TBF, 0 -TokenBufferFilter.LatencySec, config_parse_token_buffer_filter_latency, QDISC_KIND_TBF, 0 +TokenBucketFilter.Parent, config_parse_qdisc_parent, QDISC_KIND_TBF, 0 +TokenBucketFilter.Rate, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0 +TokenBucketFilter.Burst, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0 +TokenBucketFilter.LimitSize, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0 +TokenBucketFilter.MTUBytes, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0 +TokenBucketFilter.MPUBytes, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0 +TokenBucketFilter.PeakRate, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0 +TokenBucketFilter.LatencySec, config_parse_token_bucket_filter_latency, QDISC_KIND_TBF, 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) diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 8a8f4208971..6f49e2a9f48 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -487,7 +487,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi "FairQueueingControlledDelay\0" "NetworkEmulator\0" "StochasticFairnessQueueing\0" - "TokenBufferFilter\0", + "TokenBucketFilter\0", config_item_perf_lookup, network_network_gperf_lookup, CONFIG_PARSE_WARN, network); if (r < 0) diff --git a/src/network/tc/tbf.c b/src/network/tc/tbf.c index 3b068b4ab45..0682ab4cc65 100644 --- a/src/network/tc/tbf.c +++ b/src/network/tc/tbf.c @@ -15,10 +15,10 @@ #include "tc-util.h" #include "util.h" -static int token_buffer_filter_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) { +static int token_bucket_filter_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) { uint32_t rtab[256], ptab[256]; struct tc_tbf_qopt opt = {}; - TokenBufferFilter *tbf; + TokenBucketFilter *tbf; int r; assert(link); @@ -110,7 +110,7 @@ static int token_buffer_filter_fill_message(Link *link, QDisc *qdisc, sd_netlink return 0; } -int config_parse_token_buffer_filter_size( +int config_parse_token_bucket_filter_size( const char *unit, const char *filename, unsigned line, @@ -124,7 +124,7 @@ int config_parse_token_buffer_filter_size( _cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL; Network *network = data; - TokenBufferFilter *tbf; + TokenBucketFilter *tbf; uint64_t k; int r; @@ -186,7 +186,7 @@ int config_parse_token_buffer_filter_size( return 0; } -int config_parse_token_buffer_filter_latency( +int config_parse_token_bucket_filter_latency( const char *unit, const char *filename, unsigned line, @@ -200,7 +200,7 @@ int config_parse_token_buffer_filter_latency( _cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL; Network *network = data; - TokenBufferFilter *tbf; + TokenBucketFilter *tbf; usec_t u; int r; @@ -240,45 +240,45 @@ int config_parse_token_buffer_filter_latency( return 0; } -static int token_buffer_filter_verify(QDisc *qdisc) { - TokenBufferFilter *tbf = TBF(qdisc); +static int token_bucket_filter_verify(QDisc *qdisc) { + TokenBucketFilter *tbf = TBF(qdisc); if (tbf->limit > 0 && tbf->latency > 0) return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "%s: Specifying both LimitSize= and LatencySec= is not allowed. " - "Ignoring [TokenBufferFilter] section from line %u.", + "Ignoring [TokenBucketFilter] section from line %u.", qdisc->section->filename, qdisc->section->line); if (tbf->limit == 0 && tbf->latency == 0) return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "%s: Either LimitSize= or LatencySec= is required. " - "Ignoring [TokenBufferFilter] section from line %u.", + "Ignoring [TokenBucketFilter] section from line %u.", qdisc->section->filename, qdisc->section->line); if (tbf->rate == 0) return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "%s: Rate= is mandatory. " - "Ignoring [TokenBufferFilter] section from line %u.", + "Ignoring [TokenBucketFilter] section from line %u.", qdisc->section->filename, qdisc->section->line); if (tbf->burst == 0) return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "%s: Burst= is mandatory. " - "Ignoring [TokenBufferFilter] section from line %u.", + "Ignoring [TokenBucketFilter] section from line %u.", qdisc->section->filename, qdisc->section->line); if (tbf->peak_rate > 0 && tbf->mtu == 0) return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), "%s: MTUBytes= is mandatory when PeakRate= is specified. " - "Ignoring [TokenBufferFilter] section from line %u.", + "Ignoring [TokenBucketFilter] section from line %u.", qdisc->section->filename, qdisc->section->line); return 0; } const QDiscVTable tbf_vtable = { - .object_size = sizeof(TokenBufferFilter), + .object_size = sizeof(TokenBucketFilter), .tca_kind = "tbf", - .fill_message = token_buffer_filter_fill_message, - .verify = token_buffer_filter_verify + .fill_message = token_bucket_filter_fill_message, + .verify = token_bucket_filter_verify }; diff --git a/src/network/tc/tbf.h b/src/network/tc/tbf.h index 5695dbc07b8..b66aef206c4 100644 --- a/src/network/tc/tbf.h +++ b/src/network/tc/tbf.h @@ -6,7 +6,7 @@ #include "qdisc.h" #include "time-util.h" -typedef struct TokenBufferFilter { +typedef struct TokenBucketFilter { QDisc meta; uint64_t rate; @@ -16,10 +16,10 @@ typedef struct TokenBufferFilter { usec_t latency; size_t limit; size_t mpu; -} TokenBufferFilter; +} TokenBucketFilter; -DEFINE_QDISC_CAST(TBF, TokenBufferFilter); +DEFINE_QDISC_CAST(TBF, TokenBucketFilter); extern const QDiscVTable tbf_vtable; -CONFIG_PARSER_PROTOTYPE(config_parse_token_buffer_filter_latency); -CONFIG_PARSER_PROTOTYPE(config_parse_token_buffer_filter_size); +CONFIG_PARSER_PROTOTYPE(config_parse_token_bucket_filter_latency); +CONFIG_PARSER_PROTOTYPE(config_parse_token_bucket_filter_size); diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network index 70d5245749f..52bf005f1b5 100644 --- a/test/fuzz/fuzz-network-parser/directives.network +++ b/test/fuzz/fuzz-network-parser/directives.network @@ -277,7 +277,7 @@ DelayJitterSec= LossRate= DuplicateRate= PacketLimit= -[TokenBufferFilter] +[TokenBucketFilter] Parent= Rate= Burst= diff --git a/test/test-network/conf/25-qdisc-tbf-and-sfq.network b/test/test-network/conf/25-qdisc-tbf-and-sfq.network index 680dd6b46de..e10317de911 100644 --- a/test/test-network/conf/25-qdisc-tbf-and-sfq.network +++ b/test/test-network/conf/25-qdisc-tbf-and-sfq.network @@ -5,7 +5,7 @@ Name=test1 IPv6AcceptRA=no Address=10.1.2.4/16 -[TokenBufferFilter] +[TokenBucketFilter] Parent=root Rate=1G Burst=5K