summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2022-10-03 12:46:43 +0100
committerGitHub <noreply@github.com>2022-10-03 12:46:43 +0100
commit1b00aefa5a42cc441b33a8c2771e22bd39202997 (patch)
tree6ebdc1e2d4b013a541f8476b3ab40e338950a47d /python
parent435016fdb353b79577c40baa23af8e01fcadd098 (diff)
parent23e92590334ad179befdffd3e181e1b48a6d07f7 (diff)
downloadvyos-1x-1b00aefa5a42cc441b33a8c2771e22bd39202997.tar.gz
vyos-1x-1b00aefa5a42cc441b33a8c2771e22bd39202997.zip
Merge pull request #1556 from c-po/equules-t3171
ethernet: T3171: enable RPS (Receive Packet Steering) for all RX queues
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/ethernet.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index cb1dcd277..c9fa6ea8b 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2021 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2022 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -16,6 +16,8 @@
import os
import re
+from glob import glob
+
from vyos.ethtool import Ethtool
from vyos.ifconfig.interface import Interface
from vyos.util import run
@@ -70,13 +72,6 @@ class EthernetIf(Interface):
},
}}
- _sysfs_set = {**Interface._sysfs_set, **{
- 'rps': {
- 'convert': lambda cpus: cpus if cpus else '0',
- 'location': '/sys/class/net/{ifname}/queues/rx-0/rps_cpus',
- },
- }}
-
def __init__(self, ifname, **kargs):
super().__init__(ifname, **kargs)
self.ethtool = Ethtool(ifname)
@@ -240,6 +235,7 @@ class EthernetIf(Interface):
raise ValueError('Value out of range')
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
# utilize so the system has one spare core when it's under high
@@ -249,8 +245,11 @@ class EthernetIf(Interface):
# Linux will clip that internally!
rps_cpus = 'ffffffff,ffffffff,ffffffff,fffffffe'
+ for i in range(0, queues):
+ self._write_sysfs(f'/sys/class/net/{self.ifname}/queues/rx-{i}/rps_cpus', rps_cpus)
+
# send bitmask representation as hex string without leading '0x'
- return self.set_interface('rps', rps_cpus)
+ return True
def set_sg(self, state):
"""