From e7ac306c31f51c1b6d6ec2dd1aef86744f3fc794 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Fri, 13 Jan 2023 06:47:10 +0100 Subject: ethernet: rps: T4928: adjust to Kernel ABI changes #2 Fix ValueError: Unknown format code 'x' for object of type 'str' added in commit c0ffb8ba4e663 ("ethernet: rps: T4928: adjust to Kernel ABI changes"). --- python/vyos/ifconfig/ethernet.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'python') diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py index b45d8ea28..5080144ff 100644 --- a/python/vyos/ifconfig/ethernet.py +++ b/python/vyos/ifconfig/ethernet.py @@ -239,7 +239,7 @@ class EthernetIf(Interface): if not isinstance(state, bool): raise ValueError('Value out of range') - rps_cpus = '0' + rps_cpus = 0 queues = len(glob(f'/sys/class/net/{self.ifname}/queues/rx-*')) if state: # Enable RPS on all available CPUs except CPU0 which we will not @@ -248,9 +248,13 @@ class EthernetIf(Interface): # representation of the CPUs which should participate on RPS, we # can enable more CPUs that are physically present on the system, # Linux will clip that internally! - rps_cpus = os.cpu_count() - if rps_cpus > 1: - rps_cpus -= 1 + rps_cpus = (1 << os.cpu_count()) -1 + + # XXX: we should probably reserve one core when the system is under + # high preasure so we can still have a core left for housekeeping. + # This is done by masking out the lowst bit so CPU0 is spared from + # receive packet steering. + rps_cpus &= ~1 for i in range(0, queues): self._write_sysfs(f'/sys/class/net/{self.ifname}/queues/rx-{i}/rps_cpus', f'{rps_cpus:x}') -- cgit v1.2.3