diff mbox series

[net-next,8/8] ionic: drop ethtool driver version

Message ID 20200303041545.1611-9-snelson@pensando.io
State Changes Requested
Delegated to: David Miller
Headers show
Series ionic updates | expand

Commit Message

Shannon Nelson March 3, 2020, 4:15 a.m. UTC
Use the default kernel version in ethtool drv_info output
and drop the module version.

Cc: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 drivers/net/ethernet/pensando/ionic/ionic.h         | 1 -
 drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 1 -
 drivers/net/ethernet/pensando/ionic/ionic_main.c    | 7 +++----
 3 files changed, 3 insertions(+), 6 deletions(-)

Comments

Leon Romanovsky March 3, 2020, 6:35 a.m. UTC | #1
On Mon, Mar 02, 2020 at 08:15:45PM -0800, Shannon Nelson wrote:
> Use the default kernel version in ethtool drv_info output
> and drop the module version.
>
> Cc: Leon Romanovsky <leonro@mellanox.com>
> Signed-off-by: Shannon Nelson <snelson@pensando.io>
> ---
>  drivers/net/ethernet/pensando/ionic/ionic.h         | 1 -
>  drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 1 -
>  drivers/net/ethernet/pensando/ionic/ionic_main.c    | 7 +++----
>  3 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h
> index c8ff33da243a..1c720759fd80 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic.h
> +++ b/drivers/net/ethernet/pensando/ionic/ionic.h
> @@ -12,7 +12,6 @@ struct ionic_lif;
>
>  #define IONIC_DRV_NAME		"ionic"
>  #define IONIC_DRV_DESCRIPTION	"Pensando Ethernet NIC Driver"
> -#define IONIC_DRV_VERSION	"0.20.0-k"
>
>  #define PCI_VENDOR_ID_PENSANDO			0x1dd8
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> index acd53e27d1ec..bea9b78e0189 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> @@ -86,7 +86,6 @@ static void ionic_get_drvinfo(struct net_device *netdev,
>  	struct ionic *ionic = lif->ionic;
>
>  	strlcpy(drvinfo->driver, IONIC_DRV_NAME, sizeof(drvinfo->driver));
> -	strlcpy(drvinfo->version, IONIC_DRV_VERSION, sizeof(drvinfo->version));
>  	strlcpy(drvinfo->fw_version, ionic->idev.dev_info.fw_version,
>  		sizeof(drvinfo->fw_version));
>  	strlcpy(drvinfo->bus_info, ionic_bus_info(ionic),
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c
> index a8e3fb73b465..5428af885fa7 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c
> @@ -6,6 +6,7 @@
>  #include <linux/module.h>
>  #include <linux/netdevice.h>
>  #include <linux/utsname.h>
> +#include <linux/vermagic.h>
>
>  #include "ionic.h"
>  #include "ionic_bus.h"
> @@ -15,7 +16,6 @@
>  MODULE_DESCRIPTION(IONIC_DRV_DESCRIPTION);
>  MODULE_AUTHOR("Pensando Systems, Inc");
>  MODULE_LICENSE("GPL");
> -MODULE_VERSION(IONIC_DRV_VERSION);
>
>  static const char *ionic_error_to_str(enum ionic_status_code code)
>  {
> @@ -414,7 +414,7 @@ int ionic_identify(struct ionic *ionic)
>  	memset(ident, 0, sizeof(*ident));
>
>  	ident->drv.os_type = cpu_to_le32(IONIC_OS_TYPE_LINUX);
> -	strncpy(ident->drv.driver_ver_str, IONIC_DRV_VERSION,
> +	strncpy(ident->drv.driver_ver_str, UTS_RELEASE,
>  		sizeof(ident->drv.driver_ver_str) - 1);

Strange, I see that you are issuing command IONIC_CMD_IDENTIFY with this
data, doesn't the other side expect specific format? Can I send any
string here? and what will be result?

>
>  	mutex_lock(&ionic->dev_cmd_lock);
> @@ -558,8 +558,7 @@ int ionic_port_reset(struct ionic *ionic)
>
>  static int __init ionic_init_module(void)
>  {
> -	pr_info("%s %s, ver %s\n",
> -		IONIC_DRV_NAME, IONIC_DRV_DESCRIPTION, IONIC_DRV_VERSION);
> +	pr_info("%s %s\n", IONIC_DRV_NAME, IONIC_DRV_DESCRIPTION);

While cleaning from driver versions, we are removing such code too.
It is done for three reasons:
1. In case of success, there is no need in dmesg to know about the fact
that driver is going to be up.
2. In case of failure, there will/should be error prints.
3. There are so many options to know about execution of every function
and module init/exit that extra print is definitely useless.

Thanks

>  	ionic_debugfs_create();
>  	return ionic_bus_register_driver();
>  }
> --
> 2.17.1
>
Shannon Nelson March 3, 2020, 7:26 p.m. UTC | #2
On 3/2/20 10:35 PM, Leon Romanovsky wrote:
> On Mon, Mar 02, 2020 at 08:15:45PM -0800, Shannon Nelson wrote:
>> Use the default kernel version in ethtool drv_info output
>> and drop the module version.
>>
>> Cc: Leon Romanovsky <leonro@mellanox.com>
>> Signed-off-by: Shannon Nelson <snelson@pensando.io>
>> ---
>>   drivers/net/ethernet/pensando/ionic/ionic.h         | 1 -
>>   drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 1 -
>>   drivers/net/ethernet/pensando/ionic/ionic_main.c    | 7 +++----
>>   3 files changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h
>> index c8ff33da243a..1c720759fd80 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic.h
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic.h
>> @@ -12,7 +12,6 @@ struct ionic_lif;
>>
>>   #define IONIC_DRV_NAME		"ionic"
>>   #define IONIC_DRV_DESCRIPTION	"Pensando Ethernet NIC Driver"
>> -#define IONIC_DRV_VERSION	"0.20.0-k"
>>
>>   #define PCI_VENDOR_ID_PENSANDO			0x1dd8
>>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
>> index acd53e27d1ec..bea9b78e0189 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
>> @@ -86,7 +86,6 @@ static void ionic_get_drvinfo(struct net_device *netdev,
>>   	struct ionic *ionic = lif->ionic;
>>
>>   	strlcpy(drvinfo->driver, IONIC_DRV_NAME, sizeof(drvinfo->driver));
>> -	strlcpy(drvinfo->version, IONIC_DRV_VERSION, sizeof(drvinfo->version));
>>   	strlcpy(drvinfo->fw_version, ionic->idev.dev_info.fw_version,
>>   		sizeof(drvinfo->fw_version));
>>   	strlcpy(drvinfo->bus_info, ionic_bus_info(ionic),
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c
>> index a8e3fb73b465..5428af885fa7 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c
>> @@ -6,6 +6,7 @@
>>   #include <linux/module.h>
>>   #include <linux/netdevice.h>
>>   #include <linux/utsname.h>
>> +#include <linux/vermagic.h>
>>
>>   #include "ionic.h"
>>   #include "ionic_bus.h"
>> @@ -15,7 +16,6 @@
>>   MODULE_DESCRIPTION(IONIC_DRV_DESCRIPTION);
>>   MODULE_AUTHOR("Pensando Systems, Inc");
>>   MODULE_LICENSE("GPL");
>> -MODULE_VERSION(IONIC_DRV_VERSION);
>>
>>   static const char *ionic_error_to_str(enum ionic_status_code code)
>>   {
>> @@ -414,7 +414,7 @@ int ionic_identify(struct ionic *ionic)
>>   	memset(ident, 0, sizeof(*ident));
>>
>>   	ident->drv.os_type = cpu_to_le32(IONIC_OS_TYPE_LINUX);
>> -	strncpy(ident->drv.driver_ver_str, IONIC_DRV_VERSION,
>> +	strncpy(ident->drv.driver_ver_str, UTS_RELEASE,
>>   		sizeof(ident->drv.driver_ver_str) - 1);
> Strange, I see that you are issuing command IONIC_CMD_IDENTIFY with this
> data, doesn't the other side expect specific format? Can I send any
> string here? and what will be result?

There is no expected format - this is a simple string.

Nothing happens with the string other than to end up in a logfile on the 
device as context for a potential support debugging session.

>
>>   	mutex_lock(&ionic->dev_cmd_lock);
>> @@ -558,8 +558,7 @@ int ionic_port_reset(struct ionic *ionic)
>>
>>   static int __init ionic_init_module(void)
>>   {
>> -	pr_info("%s %s, ver %s\n",
>> -		IONIC_DRV_NAME, IONIC_DRV_DESCRIPTION, IONIC_DRV_VERSION);
>> +	pr_info("%s %s\n", IONIC_DRV_NAME, IONIC_DRV_DESCRIPTION);
> While cleaning from driver versions, we are removing such code too.
> It is done for three reasons:
> 1. In case of success, there is no need in dmesg to know about the fact
> that driver is going to be up.
> 2. In case of failure, there will/should be error prints.
> 3. There are so many options to know about execution of every function
> and module init/exit that extra print is definitely useless.

Sure, I'll remove this in the next patchset, or in v2 of this if there 
are other changes needed.

sln

>
> Thanks
>
>>   	ionic_debugfs_create();
>>   	return ionic_bus_register_driver();
>>   }
>> --
>> 2.17.1
>>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h
index c8ff33da243a..1c720759fd80 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic.h
+++ b/drivers/net/ethernet/pensando/ionic/ionic.h
@@ -12,7 +12,6 @@  struct ionic_lif;
 
 #define IONIC_DRV_NAME		"ionic"
 #define IONIC_DRV_DESCRIPTION	"Pensando Ethernet NIC Driver"
-#define IONIC_DRV_VERSION	"0.20.0-k"
 
 #define PCI_VENDOR_ID_PENSANDO			0x1dd8
 
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
index acd53e27d1ec..bea9b78e0189 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
@@ -86,7 +86,6 @@  static void ionic_get_drvinfo(struct net_device *netdev,
 	struct ionic *ionic = lif->ionic;
 
 	strlcpy(drvinfo->driver, IONIC_DRV_NAME, sizeof(drvinfo->driver));
-	strlcpy(drvinfo->version, IONIC_DRV_VERSION, sizeof(drvinfo->version));
 	strlcpy(drvinfo->fw_version, ionic->idev.dev_info.fw_version,
 		sizeof(drvinfo->fw_version));
 	strlcpy(drvinfo->bus_info, ionic_bus_info(ionic),
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c
index a8e3fb73b465..5428af885fa7 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_main.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c
@@ -6,6 +6,7 @@ 
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/utsname.h>
+#include <linux/vermagic.h>
 
 #include "ionic.h"
 #include "ionic_bus.h"
@@ -15,7 +16,6 @@ 
 MODULE_DESCRIPTION(IONIC_DRV_DESCRIPTION);
 MODULE_AUTHOR("Pensando Systems, Inc");
 MODULE_LICENSE("GPL");
-MODULE_VERSION(IONIC_DRV_VERSION);
 
 static const char *ionic_error_to_str(enum ionic_status_code code)
 {
@@ -414,7 +414,7 @@  int ionic_identify(struct ionic *ionic)
 	memset(ident, 0, sizeof(*ident));
 
 	ident->drv.os_type = cpu_to_le32(IONIC_OS_TYPE_LINUX);
-	strncpy(ident->drv.driver_ver_str, IONIC_DRV_VERSION,
+	strncpy(ident->drv.driver_ver_str, UTS_RELEASE,
 		sizeof(ident->drv.driver_ver_str) - 1);
 
 	mutex_lock(&ionic->dev_cmd_lock);
@@ -558,8 +558,7 @@  int ionic_port_reset(struct ionic *ionic)
 
 static int __init ionic_init_module(void)
 {
-	pr_info("%s %s, ver %s\n",
-		IONIC_DRV_NAME, IONIC_DRV_DESCRIPTION, IONIC_DRV_VERSION);
+	pr_info("%s %s\n", IONIC_DRV_NAME, IONIC_DRV_DESCRIPTION);
 	ionic_debugfs_create();
 	return ionic_bus_register_driver();
 }