diff --git a/lisa/tools/ntttcp.py b/lisa/tools/ntttcp.py index 92ba9114c6..1ffb39dc26 100644 --- a/lisa/tools/ntttcp.py +++ b/lisa/tools/ntttcp.py @@ -12,7 +12,7 @@ TransportProtocol, create_perf_message, ) -from lisa.operating_system import CBLMariner +from lisa.operating_system import CBLMariner, FreeBSD from lisa.tools import Firewall, Gcc, Git, Make, Sed from lisa.util import constants from lisa.util.process import ExecutableResult, Process @@ -119,12 +119,23 @@ class Ntttcp(Tool): {"vm.max_map_count": "655300"}, {"net.ipv4.ip_local_port_range": "1024 65535"}, ] + freebsd_sys_list_tcp = [ + {"kern.pid_max": "99999"}, + {"vm.max_map_count": "2147483647"}, + {"net.inet.ip.portrange.first": "10000"}, + {"net.inet.ip.portrange.last": "65535"}, + ] sys_list_udp = [ {"net.core.rmem_max": "67108864"}, {"net.core.rmem_default": "67108864"}, {"net.core.wmem_default": "67108864"}, {"net.core.wmem_max": "67108864"}, ] + freebsd_sys_list_udp = [ + {"kern.ipc.maxsockbuf": "67108864"}, + {"net.inet.udp.recvspace": "67108864"}, + {"net.inet.udp.sendspace": "67108864"}, + ] @property def dependencies(self) -> List[Type[Tool]]: @@ -140,9 +151,17 @@ def can_install(self) -> bool: def setup_system(self, udp_mode: bool = False, set_task_max: bool = True) -> None: sysctl = self.node.tools[Sysctl] - sys_list = self.sys_list_tcp + sys_list: List[Dict[str, str]] = [] + if isinstance(self.node.os, FreeBSD): + sys_list = self.freebsd_sys_list_tcp + else: + sys_list = self.sys_list_tcp if udp_mode: - sys_list = self.sys_list_udp + if isinstance(self.node.os, FreeBSD): + sys_list = self.freebsd_sys_list_udp + else: + sys_list = self.sys_list_udp + for sys in sys_list: for variable, value in sys.items(): sysctl.write(variable, value) @@ -421,10 +440,19 @@ def _initialize(self, *args: Any, **kwargs: Any) -> None: self._original_settings_tcp: List[Dict[str, str]] = [] self._original_settings_udp: List[Dict[str, str]] = [] sysctl = self.node.tools[Sysctl] - for tcp_sys in self.sys_list_tcp: + sys_list_tcp: List[Dict[str, str]] = [] + sys_list_udp: List[Dict[str, str]] = [] + if isinstance(self.node.os, FreeBSD): + sys_list_tcp = self.freebsd_sys_list_tcp + sys_list_udp = self.freebsd_sys_list_udp + else: + sys_list_tcp = self.sys_list_tcp + sys_list_udp = self.sys_list_udp + + for tcp_sys in sys_list_tcp: for variable, _ in tcp_sys.items(): self._original_settings_tcp.append({variable: sysctl.get(variable)}) - for udp_sys in self.sys_list_udp: + for udp_sys in sys_list_udp: for variable, _ in udp_sys.items(): self._original_settings_udp.append({variable: sysctl.get(variable)})