diff --git a/lnst/RecipeCommon/Perf/Measurements/XDPBenchMeasurement.py b/lnst/RecipeCommon/Perf/Measurements/XDPBenchMeasurement.py index e2f51e5d7..73a3ba901 100644 --- a/lnst/RecipeCommon/Perf/Measurements/XDPBenchMeasurement.py +++ b/lnst/RecipeCommon/Perf/Measurements/XDPBenchMeasurement.py @@ -27,13 +27,26 @@ class XDPBenchMeasurement(BaseFlowMeasurement): - def __init__(self, flows: list[Flow], xdp_command: str, recipe_conf=None): + def __init__( + self, + flows: list[Flow], + xdp_command: str, + xdp_mode: str, + xdp_load_mode: str = None, + xdp_packet_operation: str = None, + xdp_remote_action: str = None, + recipe_conf=None, + ): super().__init__(recipe_conf) self._flows = flows self._running_measurements = [] self._finished_measurements = [] self.command = xdp_command + self.mode = xdp_mode + self.load_mode = xdp_load_mode + self.packet_operation = xdp_packet_operation + self.remote_action = xdp_remote_action def version(self): return 1.0 @@ -65,6 +78,10 @@ def simulate_start(self): def _prepare_server(self, flow: Flow): params = { "command": self.command, + "xdp_mode": self.mode, + "load_mode": self.load_mode, + "packet_operation": self.packet_operation, + "remote_action": self.remote_action, "interface": flow.receiver_nic, "duration": flow.duration + flow.warmup_duration * 2, } diff --git a/lnst/Recipes/ENRT/MeasurementGenerators/XDPFlowMeasurementGenerator.py b/lnst/Recipes/ENRT/MeasurementGenerators/XDPFlowMeasurementGenerator.py index c6a818cc9..57257b527 100644 --- a/lnst/Recipes/ENRT/MeasurementGenerators/XDPFlowMeasurementGenerator.py +++ b/lnst/Recipes/ENRT/MeasurementGenerators/XDPFlowMeasurementGenerator.py @@ -4,11 +4,25 @@ BaseFlowMeasurementGenerator, ) -from lnst.Tests.XDPBench import XDP_BENCH_COMMANDS +from lnst.Tests.XDPBench import ( + XDP_BENCH_COMMANDS, + XDP_MODES, + XDP_LOAD_MODES, + XDP_PACKET_OPERATIONS, + XDP_REMOTE_ACTIONS, +) class XDPFlowMeasurementGenerator(BaseFlowMeasurementGenerator): xdp_command = ChoiceParam(type=StrParam, choices=XDP_BENCH_COMMANDS) + xdp_mode = ChoiceParam(type=StrParam, choices=XDP_MODES, default="native") + xdp_load_mode = ChoiceParam(type=StrParam, choices=XDP_LOAD_MODES, default="") + xdp_packet_operation = ChoiceParam( + type=StrParam, choices=XDP_PACKET_OPERATIONS, default="" + ) + xdp_remote_action = ChoiceParam( + type=StrParam, choices=XDP_REMOTE_ACTIONS, default="" + ) @property def net_perf_tool_class(self): @@ -25,7 +39,15 @@ def net_perf_tool_class(self): [1] https://github.com/LNST-project/lnst/pull/310#discussion_r1305763175 """ def XDPBenchMeasurement_partial(*args, **kwargs): - return XDPBenchMeasurement(*args, self.params.xdp_command, **kwargs) + return XDPBenchMeasurement( + *args, + self.params.xdp_command, + self.params.xdp_mode, + self.params.xdp_load_mode, + self.params.xdp_packet_operation, + self.params.xdp_remote_action, + **kwargs + ) return XDPBenchMeasurement_partial diff --git a/lnst/Tests/XDPBench.py b/lnst/Tests/XDPBench.py index 9e6030d94..a5cace4da 100644 --- a/lnst/Tests/XDPBench.py +++ b/lnst/Tests/XDPBench.py @@ -85,6 +85,11 @@ def _parse_line(self, line: str) -> tuple: "redirect-multi", ) +XDP_MODES = ("native", "skb") +XDP_LOAD_MODES = ("dpa", "load-bytes", "") +XDP_PACKET_OPERATIONS = ("no-touch", "read-data", "parse-ip", "swap-macs", "") +XDP_REMOTE_ACTIONS = ("disabled", "drop", "pass", "redirect", "") + class XDPBench(BaseTestModule): """ @@ -108,15 +113,13 @@ class XDPBench(BaseTestModule): interval = IntParam(default=1) redirect_device = DeviceParam() - xdp_mode = ChoiceParam(type=StrParam, choices=("native", "skb"), default="native") - load_mode = ChoiceParam(type=StrParam, choices=("dpa", "load-bytes")) + xdp_mode = ChoiceParam(type=StrParam, choices=XDP_MODES, default="native") + load_mode = ChoiceParam(type=StrParam, choices=XDP_LOAD_MODES) packet_operation = ChoiceParam( - type=StrParam, choices=("no-touch", "read-data", "parse-ip", "swap-macs") - ) + type=StrParam, choices=XDP_PACKET_OPERATIONS) qsize = IntParam() remote_action = ChoiceParam( - type=StrParam, choices=("disabled", "drop", "pass", "redirect") - ) + type=StrParam, choices=XDP_REMOTE_ACTIONS) # NOTE: order and names of params above matters. xdp-bench accepts params in that way duration = IntParam(default=60, mandatory=True) @@ -146,6 +149,9 @@ def _prepare_command(self): def _prepare_arguments(self): args = [] for param, value in self.params: + if value == "": + continue # skip empty (default) values + if param == "duration": continue # not a xdp-bench argument