summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_interfaces_ethernet.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-01 18:40:21 +0100
committerGitHub <noreply@github.com>2021-01-01 18:40:21 +0100
commitb13235d2b2a186be059690af88b243b33b37d60f (patch)
treef08b577494673b0c553025b344e3a640de7e6242 /smoketest/scripts/cli/test_interfaces_ethernet.py
parent215ddbe0bc51417b7ba66298764810754b204082 (diff)
parent9fb9e5cade4ceccd98aefb854a12a2a42db7c672 (diff)
downloadvyos-1x-b13235d2b2a186be059690af88b243b33b37d60f.tar.gz
vyos-1x-b13235d2b2a186be059690af88b243b33b37d60f.zip
Merge pull request #666 from c-po/t3171-rps
T3171: Ethernet RPS support
Diffstat (limited to 'smoketest/scripts/cli/test_interfaces_ethernet.py')
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_ethernet.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_ethernet.py b/smoketest/scripts/cli/test_interfaces_ethernet.py
index d5dcdc536..2d0a4827d 100755
--- a/smoketest/scripts/cli/test_interfaces_ethernet.py
+++ b/smoketest/scripts/cli/test_interfaces_ethernet.py
@@ -99,6 +99,31 @@ class EthernetInterfaceTest(BasicInterfaceTest.BaseTest):
flags = f.read()
self.assertEqual(int(flags, 16) & 1, 0)
+ def test_offloading_rps(self):
+ # enable RPS on all available CPUs, RPS works woth a CPU bitmask,
+ # where each bit represents a CPU (core/thread). The formula below
+ # expands to rps_cpus = 255 for a 8 core system
+ 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 interface in self._interfaces:
+ self.session.set(self._base_path + [interface, 'offload', 'rps'])
+
+ self.session.commit()
+
+ for interface in self._interfaces:
+ cpus = read_file('/sys/class/net/eth1/queues/rx-0/rps_cpus')
+ # remove the nasty ',' separation on larger strings
+ cpus = cpus.replace(',','')
+ cpus = int(cpus, 16)
+
+ self.assertEqual(f'{cpus:x}', f'{rps_cpus:x}')
+
def test_eapol_support(self):
for interface in self._interfaces: