summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/ethernet.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-09-12 08:06:38 +0200
committerGitHub <noreply@github.com>2022-09-12 08:06:38 +0200
commit84ee78e524713d98a01212ae0b7c58fcbc36382b (patch)
tree2d5a18bded2ef2f3d13bb15a069827756cc640d9 /python/vyos/ifconfig/ethernet.py
parent1a2a1591cc7382bd0b484ea4e564e704a14f42d4 (diff)
parent53355271a2864d844daca89a064c21e514e10adb (diff)
downloadvyos-1x-84ee78e524713d98a01212ae0b7c58fcbc36382b.tar.gz
vyos-1x-84ee78e524713d98a01212ae0b7c58fcbc36382b.zip
Merge pull request #1533 from jack9603301/T4689
rfs: T4689: Support RFS(Receive Flow Steering)
Diffstat (limited to 'python/vyos/ifconfig/ethernet.py')
-rw-r--r--python/vyos/ifconfig/ethernet.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index b8deb3311..55e7ffc1e 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -16,6 +16,7 @@
import os
import re
+from glob import glob
from vyos.ethtool import Ethtool
from vyos.ifconfig.interface import Interface
from vyos.util import run
@@ -258,6 +259,21 @@ class EthernetIf(Interface):
# send bitmask representation as hex string without leading '0x'
return self.set_interface('rps', rps_cpus)
+ def set_rfs(self, state):
+ rfs_flow = 0
+ global_rfs_flow = 0
+ queues = glob(f'/sys/class/net/{ifname}/queues/rx-*')
+ if state:
+ global_rfs_flow = 32768
+ rfs_flow = global_rfs_flow/queues
+
+ call(f'echo {global_rfs_flow} > /proc/sys/net/core/rps_sock_flow_entries')
+
+ for i in range(0,queues):
+ call(f'echo {rfs_flow} > /sys/class/net/{ifname}/queues/rx-{i}/rps_flow_cnt')
+
+ return True
+
def set_sg(self, state):
"""
Enable Scatter-Gather support. State can be either True or False.
@@ -342,6 +358,9 @@ class EthernetIf(Interface):
# RPS - Receive Packet Steering
self.set_rps(dict_search('offload.rps', config) != None)
+ # RFS - Receive Flow Steering
+ self.set_rfs(dict_search('offload.rfs', config) != None)
+
# scatter-gather option
self.set_sg(dict_search('offload.sg', config) != None)