diff mbox series

[net-next,2/4] net: mana: Report OS info to the PF driver

Message ID 20211030005408.13932-3-decui@microsoft.com (mailing list archive)
State Accepted
Commit 3c37f3573508937475d62396149df93ec24e71eb
Delegated to: Netdev Maintainers
Headers show
Series net: mana: some misc patches | expand

Checks

Context Check Description
netdev/cover_letter success Series has a cover letter
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 1 maintainers not CCed: sthemmin@microsoft.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Dexuan Cui Oct. 30, 2021, 12:54 a.m. UTC
The PF driver might use the OS info for statistical purposes.

Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
 drivers/net/ethernet/microsoft/mana/gdma_main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Haiyang Zhang Oct. 30, 2021, 3:35 p.m. UTC | #1
> -----Original Message-----
> From: Dexuan Cui <decui@microsoft.com>
> Sent: Friday, October 29, 2021 8:54 PM
> To: davem@davemloft.net; kuba@kernel.org; gustavoars@kernel.org; Haiyang
> Zhang <haiyangz@microsoft.com>; netdev@vger.kernel.org
> Cc: KY Srinivasan <kys@microsoft.com>; stephen@networkplumber.org;
> wei.liu@kernel.org; linux-kernel@vger.kernel.org; linux-
> hyperv@vger.kernel.org; Shachar Raindel <shacharr@microsoft.com>; Paul
> Rosswurm <paulros@microsoft.com>; olaf@aepfle.de; vkuznets
> <vkuznets@redhat.com>; Dexuan Cui <decui@microsoft.com>
> Subject: [PATCH net-next 2/4] net: mana: Report OS info to the PF driver
> 
> The PF driver might use the OS info for statistical purposes.
> 
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> ---
>  drivers/net/ethernet/microsoft/mana/gdma_main.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> index cee75b561f59..8a9ee2885f8c 100644
> --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> @@ -3,6 +3,8 @@
> 
>  #include <linux/module.h>
>  #include <linux/pci.h>
> +#include <linux/utsname.h>
> +#include <linux/version.h>
> 
>  #include "mana.h"
> 
> @@ -848,6 +850,15 @@ int mana_gd_verify_vf_version(struct pci_dev *pdev)
>  	req.gd_drv_cap_flags3 = GDMA_DRV_CAP_FLAGS3;
>  	req.gd_drv_cap_flags4 = GDMA_DRV_CAP_FLAGS4;
> 
> +	req.drv_ver = 0;	/* Unused*/
> +	req.os_type = 0x10;	/* Linux */

Instead of a magic number, could you define it as a macro?

Other parts look fine.

Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>

> +	req.os_ver_major = LINUX_VERSION_MAJOR;
> +	req.os_ver_minor = LINUX_VERSION_PATCHLEVEL;
> +	req.os_ver_build = LINUX_VERSION_SUBLEVEL;
> +	strscpy(req.os_ver_str1, utsname()->sysname,
> sizeof(req.os_ver_str1));
> +	strscpy(req.os_ver_str2, utsname()->release,
> sizeof(req.os_ver_str2));
> +	strscpy(req.os_ver_str3, utsname()->version,
> sizeof(req.os_ver_str3));
> +
>  	err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp),
> &resp);
>  	if (err || resp.hdr.status) {
>  		dev_err(gc->dev, "VfVerifyVersionOutput: %d, status=0x%x\n",
> --
> 2.17.1
Dexuan Cui Nov. 1, 2021, 6:07 a.m. UTC | #2
> From: Haiyang Zhang <haiyangz@microsoft.com>
> Sent: Saturday, October 30, 2021 8:36 AM
> > @@ -848,6 +850,15 @@ int mana_gd_verify_vf_version(struct pci_dev
> *pdev)
> >  	req.gd_drv_cap_flags3 = GDMA_DRV_CAP_FLAGS3;
> >  	req.gd_drv_cap_flags4 = GDMA_DRV_CAP_FLAGS4;
> >
> > +	req.drv_ver = 0;	/* Unused*/
> > +	req.os_type = 0x10;	/* Linux */
> 
> Instead of a magic number, could you define it as a macro?
> 
> Other parts look fine.
> 
> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>

Ok, I'll apply the below change in v2.

@@ -497,6 +497,7 @@ enum {

 #define GDMA_DRV_CAP_FLAGS4 0

+#define GDMA_OS_TYPE_LINUX      0x10
 struct gdma_verify_ver_req {
        struct gdma_req_hdr hdr;

diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
index c96ac81212f7..bea218c5c043 100644
--- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
+++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
@@ -851,7 +851,7 @@ int mana_gd_verify_vf_version(struct pci_dev *pdev)
        req.gd_drv_cap_flags4 = GDMA_DRV_CAP_FLAGS4;

        req.drv_ver = 0;        /* Unused*/
-       req.os_type = 0x10;     /* Linux */
+       req.os_type = GDMA_OS_TYPE_LINUX;
        req.os_ver_major = LINUX_VERSION_MAJOR;
        req.os_ver_minor = LINUX_VERSION_PATCHLEVEL;
        req.os_ver_build = LINUX_VERSION_SUBLEVEL;
diff mbox series

Patch

diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
index cee75b561f59..8a9ee2885f8c 100644
--- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
+++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
@@ -3,6 +3,8 @@ 
 
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/utsname.h>
+#include <linux/version.h>
 
 #include "mana.h"
 
@@ -848,6 +850,15 @@  int mana_gd_verify_vf_version(struct pci_dev *pdev)
 	req.gd_drv_cap_flags3 = GDMA_DRV_CAP_FLAGS3;
 	req.gd_drv_cap_flags4 = GDMA_DRV_CAP_FLAGS4;
 
+	req.drv_ver = 0;	/* Unused*/
+	req.os_type = 0x10;	/* Linux */
+	req.os_ver_major = LINUX_VERSION_MAJOR;
+	req.os_ver_minor = LINUX_VERSION_PATCHLEVEL;
+	req.os_ver_build = LINUX_VERSION_SUBLEVEL;
+	strscpy(req.os_ver_str1, utsname()->sysname, sizeof(req.os_ver_str1));
+	strscpy(req.os_ver_str2, utsname()->release, sizeof(req.os_ver_str2));
+	strscpy(req.os_ver_str3, utsname()->version, sizeof(req.os_ver_str3));
+
 	err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp);
 	if (err || resp.hdr.status) {
 		dev_err(gc->dev, "VfVerifyVersionOutput: %d, status=0x%x\n",