summaryrefslogtreecommitdiff
path: root/smoketest/scripts
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-01 18:27:23 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-01 18:35:14 +0100
commit9fb9e5cade4ceccd98aefb854a12a2a42db7c672 (patch)
treef08b577494673b0c553025b344e3a640de7e6242 /smoketest/scripts
parent09bc3cdff7d7c70885e232f4ada8b1db7e0026ed (diff)
downloadvyos-1x-9fb9e5cade4ceccd98aefb854a12a2a42db7c672.tar.gz
vyos-1x-9fb9e5cade4ceccd98aefb854a12a2a42db7c672.zip
ethernet: T3171: add CLI option to enable RPS (Receive Packet Steering)
set interfaces ethernet <interface> offload rps
Diffstat (limited to 'smoketest/scripts')
-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: