[ethtool] ethtool: don't report UFO on kernels v4.14 and above

Message ID 20181129153653.766-1-cera@cera.cz
State New
Delegated to: John Linville
Headers show
Series
  • [ethtool] ethtool: don't report UFO on kernels v4.14 and above
Related show

Commit Message

Ivan Vecera Nov. 29, 2018, 3:36 p.m.
Support for UDP fragmentation offloading was removed in kernel v4.14.
The ethtool reports incorrectly its state on this and newer kernels:

$ ethtool -k enp0s31f6 | grep udp-frag
udp-fragmentation-offload: off

It's look like that the feature is supported and disabled only. Instead
of this behavior the status of UFO should not be reported on such kernels.

As the UFO is only one feature that was removed from the ethtool I have
decided after discussion with John to implement only simple check for
this instead of implementing more generic solution like 'max_kernel_ver
field in struct off_flag_def'.

Cc: John W. Linville <linville@redhat.com>
Signed-off-by: Ivan Vecera <cera@cera.cz>
---
 ethtool.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/ethtool.c b/ethtool.c
index 2f7e96b..6121979 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1465,8 +1465,10 @@  static void dump_features(const struct feature_defs *defs,
 		 * kernel version
 		 */
 		if (defs->off_flag_matched[i] == 0 &&
-		    off_flag_def[i].get_cmd == 0 &&
-		    kernel_ver < off_flag_def[i].min_kernel_ver)
+		    ((off_flag_def[i].get_cmd == 0 &&
+		      kernel_ver < off_flag_def[i].min_kernel_ver) ||
+		     (off_flag_def[i].get_cmd == ETHTOOL_GUFO &&
+		      kernel_ver >= KERNEL_VERSION(4, 14, 0))))
 			continue;
 
 		value = off_flag_def[i].value;