nixos/networkd: add EnhancedTransmissionSelection options

This commit is contained in:
apfelkuchen06 2023-02-28 00:06:40 +01:00
parent 3cde7aaa36
commit ca496f8754

View File

@ -1285,6 +1285,21 @@ let
"QuantumBytes"
])
];
sectionEnhancedTransmissionSelection = checkUnitConfig "EnhancedTransmissionSelection" [
(assertOnlyFields [
"Parent"
"Handle"
"Bands"
"StrictBands"
"QuantumBytes"
"PriorityMap"
])
(assertInt "Bands")
(assertRange "Bands" 1 16)
(assertInt "StrictBands")
(assertRange "StrictBands" 1 16)
];
};
};
@ -2118,6 +2133,17 @@ let
'';
};
enhancedTransmissionSelectionConfig = mkOption {
default = {};
example = { Parent = "root"; QuantumBytes = "300k"; Bands = 3; PriorityMap = "100 200 300"; };
type = types.addCheck (types.attrsOf unitOption) check.network.sectionEnhancedTransmissionSelection;
description = lib.mdDoc ''
Each attribute in this set specifies an option in the
`[EnhancedTransmissionSelection]` section of the unit. See
{manpage}`systemd.network(5)` for details.
'';
};
name = mkOption {
type = types.nullOr types.str;
default = null;
@ -2609,6 +2635,10 @@ let
[DeficitRoundRobinSchedulerClass]
${attrsToSection def.deficitRoundRobinSchedulerClassConfig}
''
+ optionalString (def.enhancedTransmissionSelectionConfig != { }) ''
[EnhancedTransmissionSelection]
${attrsToSection def.enhancedTransmissionSelectionConfig}
''
+ def.extraConfig;
};