nixos/networkd: add FairQueueing options

This commit is contained in:
apfelkuchen06 2023-02-28 00:06:40 +01:00
parent dbc14e5a44
commit cf470ebd88

View File

@ -1333,6 +1333,26 @@ let
(assertInt "Flows") (assertInt "Flows")
(assertValueOneOf "ECN" boolValues) (assertValueOneOf "ECN" boolValues)
]; ];
sectionFairQueueing = checkUnitConfig "FairQueueing" [
(assertOnlyFields [
"Parent"
"Handle"
"PacketLimit"
"FlowLimit"
"QuantumBytes"
"InitualQuantumBytes"
"MaximumRate"
"Buckets"
"OrphanMask"
"Pacing"
"CEThresholdSec"
])
(assertInt "PacketLimit")
(assertInt "FlowLimit")
(assertInt "OrphanMask")
(assertValueOneOf "Pacing" boolValues)
];
}; };
}; };
@ -2199,6 +2219,17 @@ let
''; '';
}; };
fairQueueingConfig = mkOption {
default = {};
example = { Parent = "root"; FlowLimit = 5; };
type = types.addCheck (types.attrsOf unitOption) check.network.sectionFairQueueing;
description = lib.mdDoc ''
Each attribute in this set specifies an option in the
`[FairQueueing]` section of the unit. See
{manpage}`systemd.network(5)` for details.
'';
};
name = mkOption { name = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
@ -2702,6 +2733,10 @@ let
[FairQueueingControlledDelay] [FairQueueingControlledDelay]
${attrsToSection def.fairQueueingControlledDelayConfig} ${attrsToSection def.fairQueueingControlledDelayConfig}
'' ''
+ optionalString (def.fairQueueingConfig != { }) ''
[FairQueueing]
${attrsToSection def.fairQueueingConfig}
''
+ def.extraConfig; + def.extraConfig;
}; };