From 5b5c79c6a0c94586cc392a1a476397b44912e820 Mon Sep 17 00:00:00 2001 From: apfelkuchen06 Date: Tue, 28 Feb 2023 00:06:40 +0100 Subject: [PATCH] nixos/networkd: add GenericRandomEarlyDetection options --- nixos/modules/system/boot/networkd.nix | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 87e70d48a757..886096f067b2 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -1300,6 +1300,21 @@ let (assertInt "StrictBands") (assertRange "StrictBands" 1 16) ]; + + sectionGenericRandomEarlyDetection = checkUnitConfig "GenericRandomEarlyDetection" [ + (assertOnlyFields [ + "Parent" + "Handle" + "VirtualQueues" + "DefaultVirtualQueue" + "GenericRIO" + ]) + (assertInt "VirtualQueues") + (assertRange "VirtualQueues" 1 16) + (assertInt "DefaultVirtualQueue") + (assertRange "DefaultVirtualQueue" 1 16) + (assertValueOneOf "GenericRIO" boolValues) + ]; }; }; @@ -2144,6 +2159,17 @@ let ''; }; + genericRandomEarlyDetectionConfig = mkOption { + default = {}; + example = { Parent = "root"; VirtualQueues = 5; DefaultVirtualQueue = 3; }; + type = types.addCheck (types.attrsOf unitOption) check.network.sectionGenericRandomEarlyDetection; + description = lib.mdDoc '' + Each attribute in this set specifies an option in the + `[GenericRandomEarlyDetection]` section of the unit. See + {manpage}`systemd.network(5)` for details. + ''; + }; + name = mkOption { type = types.nullOr types.str; default = null; @@ -2639,6 +2665,10 @@ let [EnhancedTransmissionSelection] ${attrsToSection def.enhancedTransmissionSelectionConfig} '' + + optionalString (def.genericRandomEarlyDetectionConfig != { }) '' + [GenericRandomEarlyDetection] + ${attrsToSection def.genericRandomEarlyDetectionConfig} + '' + def.extraConfig; };