Skip to contentSkip to conversation

net/core: Replace driver version to be kernel version

PATCH Applied Leon Romanovsky 4 participants 4 messages Jan 27, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 net/core: Replace driver version to be kernel version

From: Leon Romanovsky <[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's set default version string.

As Linus said in [1]: "Things are supposed to be backwards and forwards compatible, because we don't accept breakage in user space anyway. So versioning is pointless, and only causes problems."

They cause problems when users start to see version changes and expect specific set of features which will be different for stable@, vanilla and distribution kernels.

Distribution kernels are based on some kernel version with extra patches on top, for example, in RedHat world this "extra" is a lot and for them your driver version say nothing. Users who run vanilla kernels won't use driver version information too, because running such kernels requires knowledge and understanding.

Another set of problems are related to difference in versioning scheme and such doesn't allow to write meaningful automation which will work sanely on all ethtool capable devices.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change and once ->version assignment will be deleted from virtio_net:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

---
Changelog:
v4: Set default driver version prior to calling ->get_drvinfo(). This will allow
us to remove all in-the-tree version assignments, while keeping ability
to overwrite it for out-of-tree drivers.
v3: https://lore.kernel.org/linux-rdma/[email protected]
Used wrong target branch, changed from rdma-next to net-next.
v2: https://lore.kernel.org/linux-rdma/[email protected]
Updated commit message.
v1: https://lore.kernel.org/linux-rdma/[email protected]
Resend per-Dave's request
https://lore.kernel.org/linux-rdma/[email protected]
No changes at all and applied cleanly on top of "3333e50b64fe Merge branch 'mlxsw-Offload-TBF'"
v0: https://lore.kernel.org/linux-rdma/[email protected]

---
 net/ethtool/ioctl.c | 2 ++
 1 file changed, 2 insertions(+)
net/ethtool/ioctl.c +2 -0
index 182bffbffa78..0501b615e920 100644
@@ -17,6 +17,7 @@
 #include <linux/phy.h>
 #include <linux/bitops.h>
 #include <linux/uaccess.h>
+#include <linux/vermagic.h>
 #include <linux/vmalloc.h>
 #include <linux/sfp.h>
 #include <linux/slab.h>
@@ -655,6 +656,7 @@ static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev,
 
 	memset(&info, 0, sizeof(info));
 	info.cmd = ETHTOOL_GDRVINFO;
+	strlcpy(info.version, UTS_RELEASE, sizeof(info.version));
 	if (ops->get_drvinfo) {
 		ops->get_drvinfo(dev, &info);
 	} else if (dev->dev.parent && dev->dev.parent->driver) {

--
2.24.1

Acked-by on v4 1/1
#1 lore raw
Quoted 77 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's set default version string.

As Linus said in [1]: "Things are supposed to be backwards and forwards compatible, because we don't accept breakage in user space anyway. So versioning is pointless, and only causes problems."

They cause problems when users start to see version changes and expect specific set of features which will be different for stable@, vanilla and distribution kernels.

Distribution kernels are based on some kernel version with extra patches on top, for example, in RedHat world this "extra" is a lot and for them your driver version say nothing. Users who run vanilla kernels won't use driver version information too, because running such kernels requires knowledge and understanding.

Another set of problems are related to difference in versioning scheme and such doesn't allow to write meaningful automation which will work sanely on all ethtool capable devices.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change and once ->version assignment will be deleted from virtio_net:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

---
Changelog:
v4: Set default driver version prior to calling ->get_drvinfo(). This will allow
us to remove all in-the-tree version assignments, while keeping ability
to overwrite it for out-of-tree drivers.
v3: https://lore.kernel.org/linux-rdma/[email protected]
Used wrong target branch, changed from rdma-next to net-next.
v2: https://lore.kernel.org/linux-rdma/[email protected]
Updated commit message.
v1: https://lore.kernel.org/linux-rdma/[email protected]
Resend per-Dave's request
https://lore.kernel.org/linux-rdma/[email protected]
No changes at all and applied cleanly on top of "3333e50b64fe Merge branch 'mlxsw-Offload-TBF'"
v0: https://lore.kernel.org/linux-rdma/[email protected]

---
  net/ethtool/ioctl.c | 2 ++
  1 file changed, 2 insertions(+)
net/ethtool/ioctl.c +2 -1
index 182bffbffa78..0501b615e920 100644
@@ -17,6 +17,7 @@
  #include <linux/phy.h>
  #include <linux/bitops.h>
  #include <linux/uaccess.h>
+#include <linux/vermagic.h>
  #include <linux/vmalloc.h>
  #include <linux/sfp.h>
  #include <linux/slab.h>
@@ -655,6 +656,7 @@ static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev,
 
  	memset(&info, 0, sizeof(info));
  	info.cmd = ETHTOOL_GDRVINFO;
+	strlcpy(info.version, UTS_RELEASE, sizeof(info.version));
  	if (ops->get_drvinfo) {
  		ops->get_drvinfo(dev, &info);
  	} else if (dev->dev.parent && dev->dev.parent->driver) {
--
Quoted 2 lines

2.24.1

I can work with this - thanks.

maintainer Applied
#2 lore raw
In reply to Leon Romanovsky

From: Leon Romanovsky <[email protected]>
Date: Mon, 27 Jan 2020 09:20:28 +0200

Quoted 34 lines

From: Leon Romanovsky <[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's set default version string.

As Linus said in [1]: "Things are supposed to be backwards and forwards compatible, because we don't accept breakage in user space anyway. So versioning is pointless, and only causes problems."

They cause problems when users start to see version changes and expect specific set of features which will be different for stable@, vanilla and distribution kernels.

Distribution kernels are based on some kernel version with extra patches on top, for example, in RedHat world this "extra" is a lot and for them your driver version say nothing. Users who run vanilla kernels won't use driver version information too, because running such kernels requires knowledge and understanding.

Another set of problems are related to difference in versioning scheme and such doesn't allow to write meaningful automation which will work sanely on all ethtool capable devices.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change and once ->version assignment will be deleted from virtio_net:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

Quoted 4 lines

Applied to net-next, thanks.

#3 lore raw
In reply to Leon Romanovsky
Quoted 16 lines · Leon Romanovsky
 net/ethtool/ioctl.c | 2 ++
 1 file changed, 2 insertions(+)
net/ethtool/ioctl.c +1 -0
index 182bffbffa78..0501b615e920 100644
@@ -17,6 +17,7 @@
 #include <linux/phy.h>
 #include <linux/bitops.h>
 #include <linux/uaccess.h>
+#include <linux/vermagic.h>
 #include <linux/vmalloc.h>
 #include <linux/sfp.h>
 #include <linux/slab.h>

net/ethtool/ioctl.c static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev, · line 659

Quoted 4 lines
net/ethtool/ioctl.c +1 -0
@@ -655,6 +656,7 @@ static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev,
 
 	memset(&info, 0, sizeof(info));
 	info.cmd = ETHTOOL_GDRVINFO;
+	strlcpy(info.version, UTS_RELEASE, sizeof(info.version));

This is much more reasonable, thanks for addressing everyone's concerns Leon.

Signature · 1 line
Florian