From cf470ebd88c4b9e8d4b7ae875ffaebbef6b2b02e Mon Sep 17 00:00:00 2001 From: apfelkuchen06 Date: Tue, 28 Feb 2023 00:06:40 +0100 Subject: [PATCH] nixos/networkd: add FairQueueing options --- nixos/modules/system/boot/networkd.nix | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index ec2d7b10824a..ce23c59895cb 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -1333,6 +1333,26 @@ let (assertInt "Flows") (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 { type = types.nullOr types.str; default = null; @@ -2702,6 +2733,10 @@ let [FairQueueingControlledDelay] ${attrsToSection def.fairQueueingControlledDelayConfig} '' + + optionalString (def.fairQueueingConfig != { }) '' + [FairQueueing] + ${attrsToSection def.fairQueueingConfig} + '' + def.extraConfig; };