Skip to contentSkip to conversation

gve: mixes DPDK and Linux versions in compatibility check

PATCH Stephen Hemminger 2 participants 2 messages Jan 11, 2024 – Jan 20, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

This seems wrong:

	*driver_info = (struct gve_driver_info) {
		.os_type = 5, /* DPDK */
		.driver_major = GVE_VERSION_MAJOR,
		.driver_minor = GVE_VERSION_MINOR,
		.driver_sub = GVE_VERSION_SUB,
		.os_version_major = cpu_to_be32(DPDK_VERSION_MAJOR),
		.os_version_minor = cpu_to_be32(DPDK_VERSION_MINOR),
		.os_version_sub = cpu_to_be32(DPDK_VERSION_SUB),
		.driver_capability_flags = {
			cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS1),
			cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS2),
			cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS3),
			cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS4),
		},
	};

	populate_driver_version_strings((char *)driver_info->os_version_str1,
			(char *)driver_info->os_version_str2);

The numeric values os_version_major, os_version_minor use DPDK version which is good. But the populate_driver_version_strings gets the Linux kernel version number which is problematic. Looks like a bug to me.

Also technically, the Linux kernel version is not the same as the OS release.

Shouldn't it be more like:

drivers/net/gve/base/gve_osdep.h +0 -13
index a3702f4b8c8d..914746c8d226 100644
@@ -171,17 +171,4 @@ gve_free_dma_mem(struct gve_dma_mem *mem)
 	mem->pa = 0;
 }
 
-static inline void
-populate_driver_version_strings(char *str1, char *str2)
-{
-	struct utsname uts;
-	if (uname(&uts) >= 0) {
-		/* release */
-		rte_strscpy(str1, uts.release,
-			OS_VERSION_STRLEN);
-		/* version */
-		rte_strscpy(str2, uts.version,
-			OS_VERSION_STRLEN);
-	}
-}
 #endif /* _GVE_OSDEP_H_ */
drivers/net/gve/gve_ethdev.c +2 -2
index ecd37ff37f55..b8c48fc657b9 100644
@@ -273,8 +273,8 @@ gve_verify_driver_compatibility(struct gve_priv *priv)
 		},
 	};
 
-	populate_driver_version_strings((char *)driver_info->os_version_str1,
-			(char *)driver_info->os_version_str2);
+	rte_strscpy(driver_info.os_version_str1, OS_VERSION_STRLEN,
+		    rte_version());
 
 	err = gve_adminq_verify_driver_compatibility(priv,
 		sizeof(struct gve_driver_info),
#1 lore raw

Hi Stephen
We wish to capture both rte version and linux kernel version.

The current implementation is needed to answer questions like how many customers are on Dpdk 23.11 for Ubuntu 22 vs Debian 11. Therefore, we need the uts library and the adminq is working as intended.

Quoted 71 lines · Stephen Hemminger

This seems wrong:

        *driver_info = (struct gve_driver_info) {
                .os_type = 5, /* DPDK */
                .driver_major = GVE_VERSION_MAJOR,
                .driver_minor = GVE_VERSION_MINOR,
                .driver_sub = GVE_VERSION_SUB,
                .os_version_major = cpu_to_be32(DPDK_VERSION_MAJOR),
                .os_version_minor = cpu_to_be32(DPDK_VERSION_MINOR),
                .os_version_sub = cpu_to_be32(DPDK_VERSION_SUB),
                .driver_capability_flags = {
                        cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS1),
                        cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS2),
                        cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS3),
                        cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS4),
                },
        };

        populate_driver_version_strings((char
*)driver_info->os_version_str1,
                        (char *)driver_info->os_version_str2);

The numeric values os_version_major, os_version_minor use DPDK version which
is good. But the populate_driver_version_strings gets the Linux kernel version number which is problematic. Looks like a bug to me.

Also technically, the Linux kernel version is not the same as the OS release.

Shouldn't it be more like:

drivers/net/gve/base/gve_osdep.h +0 -13
index a3702f4b8c8d..914746c8d226 100644
@@ -171,17 +171,4 @@ gve_free_dma_mem(struct gve_dma_mem *mem)
        mem->pa = 0;
 }
 
-static inline void
-populate_driver_version_strings(char *str1, char *str2)
-{
-       struct utsname uts;
-       if (uname(&uts) >= 0) {
-               /* release */
-               rte_strscpy(str1, uts.release,
-                       OS_VERSION_STRLEN);
-               /* version */
-               rte_strscpy(str2, uts.version,
-                       OS_VERSION_STRLEN);
-       }
-}
 #endif /* _GVE_OSDEP_H_ */
drivers/net/gve/gve_ethdev.c +2 -2
index ecd37ff37f55..b8c48fc657b9 100644
@@ -273,8 +273,8 @@ gve_verify_driver_compatibility(struct gve_priv *priv)
                },
        };
 
-       populate_driver_version_strings((char
 *)driver_info->os_version_str1,
-                       (char *)driver_info->os_version_str2);
+       rte_strscpy(driver_info.os_version_str1, OS_VERSION_STRLEN,
+                   rte_version());
 
        err = gve_adminq_verify_driver_compatibility(priv,

sizeof(struct gve_driver_info),