Skip to contentSkip to conversation

gve: enhance driver name usage

PATCH In review Junfeng Guo 2 participants 3 messages Jul 7, 2023 – Jul 8, 2023

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

PATCH 1/1 gve: enhance driver name usage

Current codebase contained the usage of two different names for this driver (i.e., gvnic and gve), which is quite unfriendly for users to use, especially when trying to bind or unbind the driver manually. The corresponding kernel module is registered with the name of gve. It's more reasonable to align the name of the driver with the module.

---
 drivers/net/ethernet/google/gve/gve.h         |  1 +
 drivers/net/ethernet/google/gve/gve_adminq.c  | 10 +++++-----
 drivers/net/ethernet/google/gve/gve_ethtool.c |  2 +-
 drivers/net/ethernet/google/gve/gve_main.c    | 11 ++++++-----
 4 files changed, 13 insertions(+), 11 deletions(-)
drivers/net/ethernet/google/gve/gve.h +1 -0
index 98eb78d98e9f..4b425bf71ede 100644
@@ -964,5 +964,6 @@ void gve_handle_report_stats(struct gve_priv *priv);
 /* exported by ethtool.c */
 extern const struct ethtool_ops gve_ethtool_ops;
 /* needed by ethtool */
+extern char gve_driver_name[];
 extern const char gve_version_str[];
 #endif /* _GVE_H_ */
drivers/net/ethernet/google/gve/gve_adminq.c +5 -5
index 252974202a3f..ae8f8c935bbe 100644
@@ -899,7 +899,7 @@ int gve_adminq_verify_driver_compatibility(struct gve_priv *priv,
 
 int gve_adminq_report_link_speed(struct gve_priv *priv)
 {
-	union gve_adminq_command gvnic_cmd;
+	union gve_adminq_command gve_cmd;
 	dma_addr_t link_speed_region_bus;
 	__be64 *link_speed_region;
 	int err;
@@ -911,12 +911,12 @@ int gve_adminq_report_link_speed(struct gve_priv *priv)
 	if (!link_speed_region)
 		return -ENOMEM;
 
-	memset(&gvnic_cmd, 0, sizeof(gvnic_cmd));
-	gvnic_cmd.opcode = cpu_to_be32(GVE_ADMINQ_REPORT_LINK_SPEED);
-	gvnic_cmd.report_link_speed.link_speed_address =
+	memset(&gve_cmd, 0, sizeof(gve_cmd));
+	gve_cmd.opcode = cpu_to_be32(GVE_ADMINQ_REPORT_LINK_SPEED);
+	gve_cmd.report_link_speed.link_speed_address =
 		cpu_to_be64(link_speed_region_bus);
 
-	err = gve_adminq_execute_cmd(priv, &gvnic_cmd);
+	err = gve_adminq_execute_cmd(priv, &gve_cmd);
 
 	priv->link_speed = be64_to_cpu(*link_speed_region);
 	dma_free_coherent(&priv->pdev->dev, sizeof(*link_speed_region), link_speed_region,
drivers/net/ethernet/google/gve/gve_ethtool.c +1 -1
index 50162ec9424d..233e5946905e 100644
@@ -15,7 +15,7 @@ static void gve_get_drvinfo(struct net_device *netdev,
 {
 	struct gve_priv *priv = netdev_priv(netdev);
 
-	strscpy(info->driver, "gve", sizeof(info->driver));
+	strscpy(info->driver, gve_driver_name, sizeof(info->driver));
 	strscpy(info->version, gve_version_str, sizeof(info->version));
 	strscpy(info->bus_info, pci_name(priv->pdev), sizeof(info->bus_info));
 }
drivers/net/ethernet/google/gve/gve_main.c +6 -5
index 8fb70db63b8b..e6f1711d9be0 100644
@@ -33,6 +33,7 @@
 #define MIN_TX_TIMEOUT_GAP (1000 * 10)
 #define DQO_TX_MAX	0x3FFFF
 
+char gve_driver_name[] = "gve";
 const char gve_version_str[] = GVE_VERSION;
 static const char gve_version_prefix[] = GVE_VERSION_PREFIX;
 
@@ -2200,7 +2201,7 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (err)
 		return err;
 
-	err = pci_request_regions(pdev, "gvnic-cfg");
+	err = pci_request_regions(pdev, gve_driver_name);
 	if (err)
 		goto abort_with_enabled;
 
@@ -2393,8 +2394,8 @@ static const struct pci_device_id gve_id_table[] = {
 	{ }
 };
 
-static struct pci_driver gvnic_driver = {
-	.name		= "gvnic",
+static struct pci_driver gve_driver = {
+	.name		= gve_driver_name,
 	.id_table	= gve_id_table,
 	.probe		= gve_probe,
 	.remove		= gve_remove,
@@ -2405,10 +2406,10 @@ static struct pci_driver gvnic_driver = {
 #endif
 };
 
-module_pci_driver(gvnic_driver);
+module_pci_driver(gve_driver);
 
 MODULE_DEVICE_TABLE(pci, gve_id_table);
 MODULE_AUTHOR("Google, Inc.");
-MODULE_DESCRIPTION("gVNIC Driver");
+MODULE_DESCRIPTION("Google Virtual NIC Driver");
 MODULE_LICENSE("Dual MIT/GPL");
 MODULE_VERSION(GVE_VERSION);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 5 lines · On Fri, 7 Jul 2023 10:44:05 +0800 Junfeng Guo wrote:

Current codebase contained the usage of two different names for this driver (i.e., gvnic and gve), which is quite unfriendly for users to use, especially when trying to bind or unbind the driver manually. The corresponding kernel module is registered with the name of gve. It's more reasonable to align the name of the driver with the module.

Please read the guidelines before posting patches:

https://www.kernel.org/doc/html/next/process/maintainer-netdev.html

#2 lore raw
Quoted 20 lines

-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Saturday, July 8, 2023 07:20
To: Guo, Junfeng <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Wang, Haiyue <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net-next] gve: enhance driver name usage

Quoted 5 lines · On Fri, 7 Jul 2023 10:44:05 +0800 Junfeng Guo wrote:

Current codebase contained the usage of two different names for this driver (i.e., gvnic and gve), which is quite unfriendly for users to use, especially when trying to bind or unbind the driver manually. The corresponding kernel module is registered with the name of gve. It's more reasonable to align the name of the driver with the module.

Quoted 3 lines

Please read the guidelines before posting patches:

https://www.kernel.org/doc/html/next/process/maintainer-netdev.html

Thanks for the advice! It's very helpful!

Regards