From e976ee9ed5d18c62fb3cfc6980ac1dc485b9fa20 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 15 Sep 2022 14:06:11 +0200 Subject: ethernet: rfs: T4689: remove redundant code --- python/vyos/ifconfig/ethernet.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'python') diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py index eac72ab8c..32e667038 100644 --- a/python/vyos/ifconfig/ethernet.py +++ b/python/vyos/ifconfig/ethernet.py @@ -266,18 +266,16 @@ class EthernetIf(Interface): def set_rfs(self, state): rfs_flow = 0 global_rfs_flow = 0 - ifname = self.config['ifname'] - queues = glob(f'/sys/class/net/{ifname}/queues/rx-*') + queues = len(glob(f'/sys/class/net/{self.ifname}/queues/rx-*')) if state: global_rfs_flow = 32768 - rfs_flow = global_rfs_flow/len(queues) - - self.set_interface('rfs', str(int(global_rfs_flow))) + rfs_flow = int(global_rfs_flow/queues) - for i in range(0,len(queues)): - self._write_sysfs(f'/sys/class/net/{ifname}/queues/rx-{i}/rps_flow_cnt',str(int(rfs_flow))) + self.set_interface('rfs', global_rfs_flow) + for i in range(0, queues): + self._write_sysfs(f'/sys/class/net/{self.ifname}/queues/rx-{i}/rps_flow_cnt', rfs_flow) - return state + return True def set_sg(self, state): """ -- cgit v1.2.3