From f5f58669cccbb99ae2b8bc9737e9d6bb782a53a4 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Tue, 31 Aug 2021 23:31:29 +0200
Subject: vyos.ethtool: T3163: ring-buffer values should be stored as string

Commit 29082959 ("ethernet: T3163: only change ring-buffer settings if
required") added a delta-check code for the ring buffer values, unfortunately
this was never properly evaluated as str() and int() got compared resulting
always in an unequal result.

(cherry picked from commit 6c280b1ca52c8f2a80bbaea52aa3e09060af04b3)
---
 python/vyos/ethtool.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'python')

diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index 87b9d7dd0..609d83b5e 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -113,7 +113,7 @@ class Ethtool:
                 # output format from 0 -> n/a. As we are only interested in the
                 # tx/rx keys we do not care about RX Mini/Jumbo.
                 if value.isdigit():
-                    self._ring_buffers_max[key] = int(value)
+                    self._ring_buffers_max[key] = value
         # Now we wan't to get the current RX/TX ringbuffer values - used for
         for line in out.splitlines()[7:11]:
             if ':' in line:
@@ -123,7 +123,7 @@ class Ethtool:
                 # output format from 0 -> n/a. As we are only interested in the
                 # tx/rx keys we do not care about RX Mini/Jumbo.
                 if value.isdigit():
-                    self._ring_buffers[key] = int(value)
+                    self._ring_buffers[key] = value
 
         # Get current flow control settings, but this is not supported by
         # all NICs (e.g. vmxnet3 does not support is)
@@ -177,7 +177,7 @@ class Ethtool:
         # thus when it's impossible return None
         if rx_tx not in ['rx', 'tx']:
             ValueError('Ring-buffer type must be either "rx" or "tx"')
-        return self._ring_buffers.get(rx_tx, None)
+        return str(self._ring_buffers.get(rx_tx, None))
 
     def check_speed_duplex(self, speed, duplex):
         """ Check if the passed speed and duplex combination is supported by
-- 
cgit v1.2.3