network: tc: rename several settings which take size in bytes

This commit is contained in:
Yu Watanabe 2020-07-01 16:05:32 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent 25b67032a8
commit c03ef420fa
15 changed files with 148 additions and 77 deletions

View file

@ -2724,20 +2724,20 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>LimitSize=</varname></term> <term><varname>LimitBytes=</varname></term>
<listitem> <listitem>
<para>Takes the number of bytes that can be queued waiting for tokens to become available. <para>Takes the number of bytes that can be queued waiting for tokens to become available.
When the size is suffixed with K, M, or G, it is parsed as Kilobytes, Megabytes, or Gigabytes, When the size is suffixed with K, M, or G, it is parsed as Kilobytes, Megabytes, or Gigabytes,
respectively, to the base of 1000. Defaults to unset.</para> respectively, to the base of 1024. Defaults to unset.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>Burst=</varname></term> <term><varname>BurstBytes=</varname></term>
<listitem> <listitem>
<para>Specifies the size of the bucket. This is the maximum amount of bytes that tokens <para>Specifies the size of the bucket. This is the maximum amount of bytes that tokens
can be available for instantaneous transfer. When the size is suffixed with K, M, or G, it is can be available for instantaneous transfer. When the size is suffixed with K, M, or G, it is
parsed as Kilobytes, Megabytes, or Gigabytes, respectively, to the base of 1000. Defaults to parsed as Kilobytes, Megabytes, or Gigabytes, respectively, to the base of 1024. Defaults to
unset.</para> unset.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -2756,7 +2756,7 @@
<listitem> <listitem>
<para>The Minimum Packet Unit (MPU) determines the minimal token usage (specified in bytes) <para>The Minimum Packet Unit (MPU) determines the minimal token usage (specified in bytes)
for a packet. When suffixed with K, M, or G, the specified size is parsed as Kilobytes, for a packet. When suffixed with K, M, or G, the specified size is parsed as Kilobytes,
Megabytes, or Gigabytes, respectively, to the base of 1000. Defaults to zero.</para> Megabytes, or Gigabytes, respectively, to the base of 1024. Defaults to zero.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -2773,7 +2773,7 @@
<term><varname>MTUBytes=</varname></term> <term><varname>MTUBytes=</varname></term>
<listitem> <listitem>
<para>Specifies the size of the peakrate bucket. When suffixed with K, M, or G, the specified <para>Specifies the size of the peakrate bucket. When suffixed with K, M, or G, the specified
size is parsed as Kilobytes, Megabytes, or Gigabytes, respectively, to the base of 1000. size is parsed as Kilobytes, Megabytes, or Gigabytes, respectively, to the base of 1024.
Defaults to unset.</para> Defaults to unset.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -2846,7 +2846,7 @@
<xi:include href="tc.xml" xpointer="qdisc-handle" /> <xi:include href="tc.xml" xpointer="qdisc-handle" />
<varlistentry> <varlistentry>
<term><varname>LimitSize=</varname></term> <term><varname>LimitBytes=</varname></term>
<listitem> <listitem>
<para>Specifies the hard limit on the FIFO size in bytes. The size limit (a buffer size) to prevent it <para>Specifies the hard limit on the FIFO size in bytes. The size limit (a buffer size) to prevent it
from overflowing in case it is unable to dequeue packets as quickly as it receives them. When this limit from overflowing in case it is unable to dequeue packets as quickly as it receives them. When this limit
@ -2915,7 +2915,7 @@
<xi:include href="tc.xml" xpointer="qdisc-handle" /> <xi:include href="tc.xml" xpointer="qdisc-handle" />
<varlistentry> <varlistentry>
<term><varname>Overhead=</varname></term> <term><varname>OverheadBytes=</varname></term>
<listitem> <listitem>
<para>Specifies that bytes to be addeded to the size of each packet. Bytes may be negative. <para>Specifies that bytes to be addeded to the size of each packet. Bytes may be negative.
Takes an integer ranges -64 to 256. Defaults to unset and kernel's default is used.</para> Takes an integer ranges -64 to 256. Defaults to unset and kernel's default is used.</para>
@ -3005,11 +3005,12 @@
<xi:include href="tc.xml" xpointer="tclass-classid" /> <xi:include href="tc.xml" xpointer="tclass-classid" />
<varlistentry> <varlistentry>
<term><varname>Quantum=</varname></term> <term><varname>QuantumBytes=</varname></term>
<listitem> <listitem>
<para>Specifies the amount of bytes a flow is allowed to dequeue before the <para>Specifies the amount of bytes a flow is allowed to dequeue before the scheduler moves
scheduler moves to the next class. An unsigned integer ranges 1 to 4294967294. to the next class. When suffixed with K, M, or G, the specified size is parsed as Kilobytes,
Defaults to the MTU of the interface.</para> Megabytes, or Gigabytes, respectively, to the base of 1024. Defaults to the MTU of the
interface.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -3120,7 +3121,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>MemoryLimit=</varname></term> <term><varname>MemoryLimitBytes=</varname></term>
<listitem> <listitem>
<para>Specifies the limit on the total number of bytes that can be queued in this FQ-CoDel instance. <para>Specifies the limit on the total number of bytes that can be queued in this FQ-CoDel instance.
When suffixed with K, M, or G, the specified size is parsed as Kilobytes, Megabytes, or Gigabytes, When suffixed with K, M, or G, the specified size is parsed as Kilobytes, Megabytes, or Gigabytes,
@ -3153,7 +3154,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>Quantum=</varname></term> <term><varname>QuantumBytes=</varname></term>
<listitem> <listitem>
<para>Specifies the number of bytes used as 'deficit' in the fair queuing algorithmtimespan. <para>Specifies the number of bytes used as 'deficit' in the fair queuing algorithmtimespan.
When suffixed with K, M, or G, the specified size is parsed as Kilobytes, Megabytes, or Gigabytes, When suffixed with K, M, or G, the specified size is parsed as Kilobytes, Megabytes, or Gigabytes,
@ -3205,7 +3206,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>Quantum=</varname></term> <term><varname>QuantumBytes=</varname></term>
<listitem> <listitem>
<para>Specifies the credit per dequeue RR round, i.e. the amount of bytes a flow is allowed <para>Specifies the credit per dequeue RR round, i.e. the amount of bytes a flow is allowed
to dequeue at once. When suffixed with K, M, or G, the specified size is parsed as Kilobytes, to dequeue at once. When suffixed with K, M, or G, the specified size is parsed as Kilobytes,
@ -3215,7 +3216,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>InitialQuantum=</varname></term> <term><varname>InitialQuantumBytes=</varname></term>
<listitem> <listitem>
<para>Specifies the initial sending rate credit, i.e. the amount of bytes a new flow is <para>Specifies the initial sending rate credit, i.e. the amount of bytes a new flow is
allowed to dequeue initially. When suffixed with K, M, or G, the specified size is parsed as allowed to dequeue initially. When suffixed with K, M, or G, the specified size is parsed as
@ -3446,10 +3447,10 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>MaxPacketSize=</varname></term> <term><varname>MaxPacketBytes=</varname></term>
<listitem> <listitem>
<para>Specifies the maximum packet size in bytes for the class. When suffixed with K, M, or G, the specified <para>Specifies the maximum packet size in bytes for the class. When suffixed with K, M, or G, the specified
size is parsed as Kilobytes, Megabytes, or Gigabytes, respectively, to the base of 1000. When unset, size is parsed as Kilobytes, Megabytes, or Gigabytes, respectively, to the base of 1024. When unset,
the kernel default is used.</para> the kernel default is used.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View file

@ -304,11 +304,11 @@ QDisc.Parent, config_parse_qdisc_parent,
QDisc.Handle, config_parse_qdisc_handle, _QDISC_KIND_INVALID, 0 QDisc.Handle, config_parse_qdisc_handle, _QDISC_KIND_INVALID, 0
BFIFO.Parent, config_parse_qdisc_parent, QDISC_KIND_BFIFO, 0 BFIFO.Parent, config_parse_qdisc_parent, QDISC_KIND_BFIFO, 0
BFIFO.Handle, config_parse_qdisc_handle, QDISC_KIND_BFIFO, 0 BFIFO.Handle, config_parse_qdisc_handle, QDISC_KIND_BFIFO, 0
BFIFO.LimitSize, config_parse_bfifo_size, QDISC_KIND_BFIFO, 0 BFIFO.LimitBytes, config_parse_bfifo_size, QDISC_KIND_BFIFO, 0
CAKE.Parent, config_parse_qdisc_parent, QDISC_KIND_CAKE, 0 CAKE.Parent, config_parse_qdisc_parent, QDISC_KIND_CAKE, 0
CAKE.Handle, config_parse_qdisc_handle, QDISC_KIND_CAKE, 0 CAKE.Handle, config_parse_qdisc_handle, QDISC_KIND_CAKE, 0
CAKE.Bandwidth, config_parse_cake_bandwidth, QDISC_KIND_CAKE, 0 CAKE.Bandwidth, config_parse_cake_bandwidth, QDISC_KIND_CAKE, 0
CAKE.Overhead, config_parse_cake_overhead, QDISC_KIND_CAKE, 0 CAKE.OverheadBytes, config_parse_cake_overhead, QDISC_KIND_CAKE, 0
ControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_CODEL, 0 ControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_CODEL, 0
ControlledDelay.Handle, config_parse_qdisc_handle, 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 ControlledDelay.PacketLimit, config_parse_controlled_delay_u32, QDISC_KIND_CODEL, 0
@ -320,7 +320,7 @@ DeficitRoundRobinScheduler.Parent, config_parse_qdisc_parent,
DeficitRoundRobinScheduler.Handle, config_parse_qdisc_handle, QDISC_KIND_DRR, 0 DeficitRoundRobinScheduler.Handle, config_parse_qdisc_handle, QDISC_KIND_DRR, 0
DeficitRoundRobinSchedulerClass.Parent, config_parse_tclass_parent, TCLASS_KIND_DRR, 0 DeficitRoundRobinSchedulerClass.Parent, config_parse_tclass_parent, TCLASS_KIND_DRR, 0
DeficitRoundRobinSchedulerClass.ClassId, config_parse_tclass_classid, TCLASS_KIND_DRR, 0 DeficitRoundRobinSchedulerClass.ClassId, config_parse_tclass_classid, TCLASS_KIND_DRR, 0
DeficitRoundRobinSchedulerClass.Quantum, config_parse_drr_size, TCLASS_KIND_DRR, 0 DeficitRoundRobinSchedulerClass.QuantumBytes, config_parse_drr_size, TCLASS_KIND_DRR, 0
EnhancedTransmissionSelection.Parent, config_parse_qdisc_parent, QDISC_KIND_ETS, 0 EnhancedTransmissionSelection.Parent, config_parse_qdisc_parent, QDISC_KIND_ETS, 0
EnhancedTransmissionSelection.Handle, config_parse_qdisc_handle, QDISC_KIND_ETS, 0 EnhancedTransmissionSelection.Handle, config_parse_qdisc_handle, QDISC_KIND_ETS, 0
EnhancedTransmissionSelection.Bands, config_parse_ets_u8, QDISC_KIND_ETS, 0 EnhancedTransmissionSelection.Bands, config_parse_ets_u8, QDISC_KIND_ETS, 0
@ -340,13 +340,13 @@ QuickFairQueueing.Handle, config_parse_qdisc_handle,
QuickFairQueueingClass.Parent, config_parse_tclass_parent, TCLASS_KIND_QFQ, 0 QuickFairQueueingClass.Parent, config_parse_tclass_parent, TCLASS_KIND_QFQ, 0
QuickFairQueueingClass.ClassId, config_parse_tclass_classid, TCLASS_KIND_QFQ, 0 QuickFairQueueingClass.ClassId, config_parse_tclass_classid, TCLASS_KIND_QFQ, 0
QuickFairQueueingClass.Weight, config_parse_quick_fair_queueing_weight, TCLASS_KIND_QFQ, 0 QuickFairQueueingClass.Weight, config_parse_quick_fair_queueing_weight, TCLASS_KIND_QFQ, 0
QuickFairQueueingClass.MaxPacketSize, config_parse_quick_fair_queueing_max_packet, TCLASS_KIND_QFQ, 0 QuickFairQueueingClass.MaxPacketBytes, config_parse_quick_fair_queueing_max_packet, TCLASS_KIND_QFQ, 0
FairQueueing.Parent, config_parse_qdisc_parent, QDISC_KIND_FQ, 0 FairQueueing.Parent, config_parse_qdisc_parent, QDISC_KIND_FQ, 0
FairQueueing.Handle, config_parse_qdisc_handle, QDISC_KIND_FQ, 0 FairQueueing.Handle, config_parse_qdisc_handle, QDISC_KIND_FQ, 0
FairQueueing.PacketLimit, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0 FairQueueing.PacketLimit, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0
FairQueueing.FlowLimit, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0 FairQueueing.FlowLimit, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0
FairQueueing.Quantum, config_parse_fair_queueing_size, QDISC_KIND_FQ, 0 FairQueueing.QuantumBytes, config_parse_fair_queueing_size, QDISC_KIND_FQ, 0
FairQueueing.InitialQuantum, config_parse_fair_queueing_size, QDISC_KIND_FQ, 0 FairQueueing.InitialQuantumBytes, config_parse_fair_queueing_size, QDISC_KIND_FQ, 0
FairQueueing.MaximumRate, config_parse_fair_queueing_max_rate, QDISC_KIND_FQ, 0 FairQueueing.MaximumRate, config_parse_fair_queueing_max_rate, QDISC_KIND_FQ, 0
FairQueueing.Buckets, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0 FairQueueing.Buckets, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0
FairQueueing.OrphanMask, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0 FairQueueing.OrphanMask, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0
@ -355,9 +355,9 @@ FairQueueing.CEThresholdSec, config_parse_fair_queueing_usec,
FairQueueingControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_FQ_CODEL, 0 FairQueueingControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_FQ_CODEL, 0
FairQueueingControlledDelay.Handle, config_parse_qdisc_handle, QDISC_KIND_FQ_CODEL, 0 FairQueueingControlledDelay.Handle, config_parse_qdisc_handle, QDISC_KIND_FQ_CODEL, 0
FairQueueingControlledDelay.PacketLimit, config_parse_fair_queueing_controlled_delay_u32, QDISC_KIND_FQ_CODEL, 0 FairQueueingControlledDelay.PacketLimit, config_parse_fair_queueing_controlled_delay_u32, QDISC_KIND_FQ_CODEL, 0
FairQueueingControlledDelay.MemoryLimit, config_parse_fair_queueing_controlled_delay_size, QDISC_KIND_FQ_CODEL, 0 FairQueueingControlledDelay.MemoryLimitBytes, config_parse_fair_queueing_controlled_delay_size, QDISC_KIND_FQ_CODEL, 0
FairQueueingControlledDelay.Flows, config_parse_fair_queueing_controlled_delay_u32, QDISC_KIND_FQ_CODEL, 0 FairQueueingControlledDelay.Flows, config_parse_fair_queueing_controlled_delay_u32, QDISC_KIND_FQ_CODEL, 0
FairQueueingControlledDelay.Quantum, config_parse_fair_queueing_controlled_delay_size, QDISC_KIND_FQ_CODEL, 0 FairQueueingControlledDelay.QuantumBytes, config_parse_fair_queueing_controlled_delay_size, QDISC_KIND_FQ_CODEL, 0
FairQueueingControlledDelay.TargetSec, config_parse_fair_queueing_controlled_delay_usec, QDISC_KIND_FQ_CODEL, 0 FairQueueingControlledDelay.TargetSec, config_parse_fair_queueing_controlled_delay_usec, QDISC_KIND_FQ_CODEL, 0
FairQueueingControlledDelay.IntervalSec, config_parse_fair_queueing_controlled_delay_usec, QDISC_KIND_FQ_CODEL, 0 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.CEThresholdSec, config_parse_fair_queueing_controlled_delay_usec, QDISC_KIND_FQ_CODEL, 0
@ -402,12 +402,12 @@ StochasticFairnessQueueing.Handle, config_parse_qdisc_handle,
StochasticFairnessQueueing.PerturbPeriodSec, config_parse_stochastic_fairness_queueing_perturb_period, QDISC_KIND_SFQ, 0 StochasticFairnessQueueing.PerturbPeriodSec, config_parse_stochastic_fairness_queueing_perturb_period, QDISC_KIND_SFQ, 0
TokenBucketFilter.Parent, config_parse_qdisc_parent, QDISC_KIND_TBF, 0 TokenBucketFilter.Parent, config_parse_qdisc_parent, QDISC_KIND_TBF, 0
TokenBucketFilter.Handle, config_parse_qdisc_handle, QDISC_KIND_TBF, 0 TokenBucketFilter.Handle, config_parse_qdisc_handle, QDISC_KIND_TBF, 0
TokenBucketFilter.Rate, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0 TokenBucketFilter.Rate, config_parse_token_bucket_filter_rate, QDISC_KIND_TBF, 0
TokenBucketFilter.Burst, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0 TokenBucketFilter.BurstBytes, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0
TokenBucketFilter.LimitSize, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0 TokenBucketFilter.LimitBytes, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0
TokenBucketFilter.MTUBytes, 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.MPUBytes, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0
TokenBucketFilter.PeakRate, config_parse_token_bucket_filter_size, QDISC_KIND_TBF, 0 TokenBucketFilter.PeakRate, config_parse_token_bucket_filter_rate, QDISC_KIND_TBF, 0
TokenBucketFilter.LatencySec, config_parse_token_bucket_filter_latency, QDISC_KIND_TBF, 0 TokenBucketFilter.LatencySec, config_parse_token_bucket_filter_latency, QDISC_KIND_TBF, 0
TrivialLinkEqualizer.Parent, config_parse_qdisc_parent, QDISC_KIND_TEQL, 0 TrivialLinkEqualizer.Parent, config_parse_qdisc_parent, QDISC_KIND_TEQL, 0
TrivialLinkEqualizer.Handle, config_parse_qdisc_handle, QDISC_KIND_TEQL, 0 TrivialLinkEqualizer.Handle, config_parse_qdisc_handle, QDISC_KIND_TEQL, 0
@ -446,3 +446,9 @@ TrafficControlQueueingDiscipline.NetworkEmulatorDelayJitterSec, config_parse_net
TrafficControlQueueingDiscipline.NetworkEmulatorLossRate, config_parse_network_emulator_rate, 0, 0 TrafficControlQueueingDiscipline.NetworkEmulatorLossRate, config_parse_network_emulator_rate, 0, 0
TrafficControlQueueingDiscipline.NetworkEmulatorDuplicateRate, config_parse_network_emulator_rate, 0, 0 TrafficControlQueueingDiscipline.NetworkEmulatorDuplicateRate, config_parse_network_emulator_rate, 0, 0
TrafficControlQueueingDiscipline.NetworkEmulatorPacketLimit, config_parse_network_emulator_packet_limit, 0, 0 TrafficControlQueueingDiscipline.NetworkEmulatorPacketLimit, config_parse_network_emulator_packet_limit, 0, 0
FairQueueing.Quantum, config_parse_fair_queueing_size, QDISC_KIND_FQ, 0
FairQueueing.InitialQuantum, config_parse_fair_queueing_size, QDISC_KIND_FQ, 0
FairQueueingControlledDelay.MemoryLimit, config_parse_fair_queueing_controlled_delay_size, QDISC_KIND_FQ_CODEL, 0
FairQueueingControlledDelay.Quantum, config_parse_fair_queueing_controlled_delay_size, QDISC_KIND_FQ_CODEL, 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

View file

@ -136,14 +136,14 @@ int config_parse_cake_overhead(
r = safe_atoi32(rvalue, &v); r = safe_atoi32(rvalue, &v);
if (r < 0) { if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse 'Overhead=', ignoring assignment: %s", "Failed to parse '%s=', ignoring assignment: %s",
rvalue); lvalue, rvalue);
return 0; return 0;
} }
if (v < -64 || v > 256) { if (v < -64 || v > 256) {
log_syntax(unit, LOG_ERR, filename, line, 0, log_syntax(unit, LOG_ERR, filename, line, 0,
"Invalid 'Overhead=', ignoring assignment: %s", "Invalid '%s=', ignoring assignment: %s",
rvalue); lvalue, rvalue);
return 0; return 0;
} }

View file

@ -79,7 +79,7 @@ int config_parse_drr_size(
return 0; return 0;
} }
r = parse_size(rvalue, 1000, &u); r = parse_size(rvalue, 1024, &u);
if (r < 0) { if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s", "Failed to parse '%s=', ignoring assignment: %s",

View file

@ -140,7 +140,7 @@ int config_parse_bfifo_size(
return 0; return 0;
} }
r = parse_size(rvalue, 1000, &u); r = parse_size(rvalue, 1024, &u);
if (r < 0) { if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s", "Failed to parse '%s=', ignoring assignment: %s",

View file

@ -9,6 +9,7 @@
#include "parse-util.h" #include "parse-util.h"
#include "qdisc.h" #include "qdisc.h"
#include "string-util.h" #include "string-util.h"
#include "strv.h"
static int fair_queueing_controlled_delay_init(QDisc *qdisc) { static int fair_queueing_controlled_delay_init(QDisc *qdisc) {
FairQueueingControlledDelay *fqcd; FairQueueingControlledDelay *fqcd;
@ -301,15 +302,15 @@ int config_parse_fair_queueing_controlled_delay_size(
fqcd = FQ_CODEL(qdisc); fqcd = FQ_CODEL(qdisc);
if (streq(lvalue, "MemoryLimit")) if (STR_IN_SET(lvalue, "MemoryLimitBytes", "MemoryLimit"))
p = &fqcd->memory_limit; p = &fqcd->memory_limit;
else if (streq(lvalue, "Quantum")) else if (STR_IN_SET(lvalue, "QuantumBytes", "Quantum"))
p = &fqcd->quantum; p = &fqcd->quantum;
else else
assert_not_reached("Invalid lvalue."); assert_not_reached("Invalid lvalue.");
if (isempty(rvalue)) { if (isempty(rvalue)) {
if (streq(lvalue, "MemoryLimit")) if (STR_IN_SET(lvalue, "MemoryLimitBytes", "MemoryLimit"))
*p = UINT32_MAX; *p = UINT32_MAX;
else else
*p = 0; *p = 0;

View file

@ -9,7 +9,7 @@
#include "netlink-util.h" #include "netlink-util.h"
#include "parse-util.h" #include "parse-util.h"
#include "string-util.h" #include "string-util.h"
#include "util.h" #include "strv.h"
static int fair_queueing_init(QDisc *qdisc) { static int fair_queueing_init(QDisc *qdisc) {
FairQueueing *fq; FairQueueing *fq;
@ -198,9 +198,9 @@ int config_parse_fair_queueing_size(
fq = FQ(qdisc); fq = FQ(qdisc);
if (streq(lvalue, "Quantum")) if (STR_IN_SET(lvalue, "QuantumBytes", "Quantum"))
p = &fq->quantum; p = &fq->quantum;
else if (streq(lvalue, "InitialQuantum")) else if (STR_IN_SET(lvalue, "InitialQuantumBytes", "InitialQuantum"))
p = &fq->initial_quantum; p = &fq->initial_quantum;
else else
assert_not_reached("Invalid lvalue"); assert_not_reached("Invalid lvalue");

View file

@ -142,7 +142,7 @@ int config_parse_quick_fair_queueing_max_packet(
return 0; return 0;
} }
r = parse_size(rvalue, 1000, &v); r = parse_size(rvalue, 1024, &v);
if (r < 0) { if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s", "Failed to parse '%s=', ignoring assignment: %s",

View file

@ -12,8 +12,8 @@
#include "parse-util.h" #include "parse-util.h"
#include "qdisc.h" #include "qdisc.h"
#include "string-util.h" #include "string-util.h"
#include "strv.h"
#include "tc-util.h" #include "tc-util.h"
#include "util.h"
static int token_bucket_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]; uint32_t rtab[256], ptab[256];
@ -143,18 +143,85 @@ int config_parse_token_bucket_filter_size(
tbf = TBF(qdisc); tbf = TBF(qdisc);
if (isempty(rvalue)) { if (isempty(rvalue)) {
if (streq(lvalue, "Rate")) if (STR_IN_SET(lvalue, "BurstBytes", "Burst"))
tbf->rate = 0;
else if (streq(lvalue, "Burst"))
tbf->burst = 0; tbf->burst = 0;
else if (streq(lvalue, "LimitSize")) else if (STR_IN_SET(lvalue, "LimitBytes", "LimitSize"))
tbf->limit = 0; tbf->limit = 0;
else if (streq(lvalue, "MTUBytes")) else if (streq(lvalue, "MTUBytes"))
tbf->mtu = 0; tbf->mtu = 0;
else if (streq(lvalue, "MPUBytes")) else if (streq(lvalue, "MPUBytes"))
tbf->mpu = 0; tbf->mpu = 0;
else if (streq(lvalue, "PeakRate")) else
tbf->peak_rate = 0; assert_not_reached("unknown lvalue");
qdisc = NULL;
return 0;
}
r = parse_size(rvalue, 1024, &k);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse '%s=', ignoring assignment: %s",
lvalue, rvalue);
return 0;
}
if (STR_IN_SET(lvalue, "BurstBytes", "Burst"))
tbf->burst = k;
else if (STR_IN_SET(lvalue, "LimitBytes", "LimitSize"))
tbf->limit = k;
else if (streq(lvalue, "MPUBytes"))
tbf->mpu = k;
else if (streq(lvalue, "MTUBytes"))
tbf->mtu = k;
else
assert_not_reached("unknown lvalue");
qdisc = NULL;
return 0;
}
int config_parse_token_bucket_filter_rate(
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;
Network *network = data;
TokenBucketFilter *tbf;
uint64_t k, *p;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
r = qdisc_new_static(QDISC_KIND_TBF, 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");
tbf = TBF(qdisc);
if (streq(lvalue, "Rate"))
p = &tbf->rate;
else if (streq(lvalue, "PeakRate"))
p = &tbf->peak_rate;
else
assert_not_reached("unknown lvalue");
if (isempty(rvalue)) {
*p = 0;
qdisc = NULL; qdisc = NULL;
return 0; return 0;
@ -168,18 +235,7 @@ int config_parse_token_bucket_filter_size(
return 0; return 0;
} }
if (streq(lvalue, "Rate")) *p = k / 8;
tbf->rate = k / 8;
else if (streq(lvalue, "Burst"))
tbf->burst = k;
else if (streq(lvalue, "LimitSize"))
tbf->limit = k;
else if (streq(lvalue, "MPUBytes"))
tbf->mpu = k;
else if (streq(lvalue, "MTUBytes"))
tbf->mtu = k;
else if (streq(lvalue, "PeakRate"))
tbf->peak_rate = k / 8;
qdisc = NULL; qdisc = NULL;

View file

@ -23,3 +23,4 @@ extern const QDiscVTable tbf_vtable;
CONFIG_PARSER_PROTOTYPE(config_parse_token_bucket_filter_latency); CONFIG_PARSER_PROTOTYPE(config_parse_token_bucket_filter_latency);
CONFIG_PARSER_PROTOTYPE(config_parse_token_bucket_filter_size); CONFIG_PARSER_PROTOTYPE(config_parse_token_bucket_filter_size);
CONFIG_PARSER_PROTOTYPE(config_parse_token_bucket_filter_rate);

View file

@ -332,7 +332,9 @@ PacketLimit=
Parent= Parent=
Handle= Handle=
Rate= Rate=
BurstBytes=
Burst= Burst=
LimitBytes=
LimitSize= LimitSize=
MTUBytes= MTUBytes=
MPUBytes= MPUBytes=
@ -346,8 +348,10 @@ PerturbPeriodSec=
Parent= Parent=
Handle= Handle=
PacketLimit= PacketLimit=
MemoryLimitBytes=
MemoryLimit= MemoryLimit=
Flows= Flows=
QuantumBytes=
Quantum= Quantum=
TargetSec= TargetSec=
IntervalSec= IntervalSec=
@ -358,7 +362,9 @@ Parent=
Handle= Handle=
PacketLimit= PacketLimit=
FlowLimit= FlowLimit=
QuantumBytes=
Quantum= Quantum=
InitialQuantumBytes=
InitialQuantum= InitialQuantum=
MaximumRate= MaximumRate=
Buckets= Buckets=
@ -377,7 +383,7 @@ ECN=
Parent= Parent=
Handle= Handle=
Bandwidth= Bandwidth=
Overhead= OverheadBytes=
[TrafficControlQueueingDiscipline] [TrafficControlQueueingDiscipline]
Parent= Parent=
NetworkEmulatorDelaySec= NetworkEmulatorDelaySec=
@ -408,7 +414,7 @@ CeilBufferBytes=
[BFIFO] [BFIFO]
Parent= Parent=
Handle= Handle=
LimitSize= LimitBytes=
[PFIFO] [PFIFO]
Parent= Parent=
Handle= Handle=
@ -441,14 +447,14 @@ Handle=
Parent= Parent=
ClassId= ClassId=
Weight= Weight=
MaxPacketSize= MaxPacketBytes=
[DeficitRoundRobinScheduler] [DeficitRoundRobinScheduler]
Parent= Parent=
Handle= Handle=
[DeficitRoundRobinSchedulerClass] [DeficitRoundRobinSchedulerClass]
Parent= Parent=
ClassId= ClassId=
Quantum= QuantumBytes=
[EnhancedTransmissionSelection] [EnhancedTransmissionSelection]
Parent= Parent=
Handle= Handle=

View file

@ -8,5 +8,5 @@ Address=10.1.2.3/16
[CAKE] [CAKE]
Parent=root Parent=root
Handle=3a Handle=3a
Overhead=128 OverheadBytes=128
Bandwidth=500M Bandwidth=500M

View file

@ -58,8 +58,8 @@ Parent=2:32
Handle=0032 Handle=0032
PacketLimit=1000 PacketLimit=1000
FlowLimit=200 FlowLimit=200
Quantum=1500 QuantumBytes=1500
InitialQuantum=13000 InitialQuantumBytes=13000
MaximumRate=1M MaximumRate=1M
Buckets=512 Buckets=512
OrphanMask=511 OrphanMask=511
@ -93,11 +93,11 @@ CeilRate=0.5M
Parent=2:34 Parent=2:34
Handle=0034 Handle=0034
PacketLimit=20480 PacketLimit=20480
MemoryLimit=64M MemoryLimitBytes=64M
Flows=2048 Flows=2048
TargetSec=10ms TargetSec=10ms
IntervalSec=200ms IntervalSec=200ms
Quantum=1400 QuantumBytes=1400
ECN=yes ECN=yes
CEThresholdSec=100ms CEThresholdSec=100ms
@ -112,10 +112,10 @@ CeilRate=0.5M
Parent=2:35 Parent=2:35
Handle=0035 Handle=0035
Rate=1G Rate=1G
Burst=5K BurstBytes=5000
LatencySec=70msec LatencySec=70msec
PeakRate=100G PeakRate=100G
MTUBytes=1M MTUBytes=1000000
[HierarchyTokenBucketClass] [HierarchyTokenBucketClass]
Parent=root Parent=root
@ -177,7 +177,7 @@ CeilRate=0.5M
[BFIFO] [BFIFO]
Parent=2:3a Parent=2:3a
Handle=003a Handle=003a
LimitSize=1M LimitBytes=1000000
[HierarchyTokenBucketClass] [HierarchyTokenBucketClass]
Parent=root Parent=root

View file

@ -12,4 +12,4 @@ Handle=0002
[DeficitRoundRobinSchedulerClass] [DeficitRoundRobinSchedulerClass]
Parent=root Parent=root
ClassId=0002:0030 ClassId=0002:0030
Quantum=2000 QuantumBytes=2000

View file

@ -13,10 +13,10 @@ Handle=0002
Parent=root Parent=root
ClassId=0002:0030 ClassId=0002:0030
Weight=2 Weight=2
MaxPacketSize=16000 MaxPacketBytes=16000
[QuickFairQueueingClass] [QuickFairQueueingClass]
Parent=root Parent=root
ClassId=0002:0031 ClassId=0002:0031
Weight=10 Weight=10
MaxPacketSize=8000 MaxPacketBytes=8000