Skip to content

Commit

Permalink
ethernet: rps: T4928: adjust to Kernel ABI changes
Browse files Browse the repository at this point in the history
In the past we could simply set all bits for all CPUs even if they did not
exist. With 6.1.y Kernel series this is no longer possible and the input data
is validated against the available number of CPUs.
  • Loading branch information
c-po committed Jan 12, 2023
1 parent 3045b32 commit c0ffb8b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/vyos/ifconfig/ethernet.py
Expand Up @@ -248,10 +248,12 @@ def set_rps(self, state):
# 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 = 'ffffffff,ffffffff,ffffffff,fffffffe'
rps_cpus = os.cpu_count()
if rps_cpus > 1:
rps_cpus -= 1

for i in range(0, queues):
self._write_sysfs(f'/sys/class/net/{self.ifname}/queues/rx-{i}/rps_cpus', rps_cpus)
self._write_sysfs(f'/sys/class/net/{self.ifname}/queues/rx-{i}/rps_cpus', f'{rps_cpus:x}')

# send bitmask representation as hex string without leading '0x'
return True
Expand Down

0 comments on commit c0ffb8b

Please sign in to comment.