linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Parav Pandit <parav@nvidia.com>
Cc: Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	gregkh <gregkh@linuxfoundation.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Jason Wang <jasowang@redhat.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Roi Dayan <roid@nvidia.com>, Saeed Mahameed <saeedm@nvidia.com>,
	"virtualization@lists.linux-foundation.org" 
	<virtualization@lists.linux-foundation.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"tiwai@suse.de" <tiwai@suse.de>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	"ranjani.sridharan@linux.intel.com" 
	<ranjani.sridharan@linux.intel.com>,
	"pierre-louis.bossart@linux.intel.com" 
	<pierre-louis.bossart@linux.intel.com>,
	"fred.oh@linux.intel.com" <fred.oh@linux.intel.com>,
	"shiraz.saleem@intel.com" <shiraz.saleem@intel.com>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"kiran.patil@intel.com" <kiran.patil@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH mlx5-next v1 03/11] net/mlx5_core: Clean driver version and name
Date: Mon, 2 Nov 2020 07:56:26 +0200	[thread overview]
Message-ID: <20201102055626.GD5429@unreal> (raw)
In-Reply-To: <BY5PR12MB4322B244D7AEBDCED43B906EDC100@BY5PR12MB4322.namprd12.prod.outlook.com>

On Mon, Nov 02, 2020 at 05:07:59AM +0000, Parav Pandit wrote:
>
>
> > From: Leon Romanovsky <leon@kernel.org>
> > Sent: Monday, November 2, 2020 1:46 AM
> >
> > From: Leon Romanovsky <leonro@nvidia.com>
> >
> > Remove exposed driver version as it was done in other drivers, so module
> > version will work correctly by displaying the kernel version for which it is
> > compiled.
> >
> > And move mlx5_core module name to general include, so auxiliary drivers
> > will be able to use it as a basis for a name in their device ID tables.
> >
> > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > ---
> >  drivers/net/ethernet/mellanox/mlx5/core/devlink.c     |  2 +-
> >  drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c  |  4 +---
> >  drivers/net/ethernet/mellanox/mlx5/core/en_rep.c      |  1 -
> >  .../net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c   |  2 +-
> >  drivers/net/ethernet/mellanox/mlx5/core/main.c        | 11 +++++++----
> >  drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h   |  3 ---
> >  include/linux/mlx5/driver.h                           |  2 ++
> >  7 files changed, 12 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
> > index a28f95df2901..1a351e2f6ace 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
> > @@ -52,7 +52,7 @@ mlx5_devlink_info_get(struct devlink *devlink, struct
> > devlink_info_req *req,
> >  	u32 running_fw, stored_fw;
> >  	int err;
> >
> > -	err = devlink_info_driver_name_put(req, DRIVER_NAME);
> > +	err = devlink_info_driver_name_put(req, KBUILD_MODNAME);
> >  	if (err)
> >  		return err;
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> > index d25a56ec6876..bcff18a87bcd 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> > @@ -40,9 +40,7 @@ void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv
> > *priv,  {
> >  	struct mlx5_core_dev *mdev = priv->mdev;
> >
> > -	strlcpy(drvinfo->driver, DRIVER_NAME, sizeof(drvinfo->driver));
> > -	strlcpy(drvinfo->version, DRIVER_VERSION,
> > -		sizeof(drvinfo->version));
> > +	strlcpy(drvinfo->driver, KBUILD_MODNAME, sizeof(drvinfo-
> > >driver));
> >  	snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
> >  		 "%d.%d.%04d (%.16s)",
> >  		 fw_rev_maj(mdev), fw_rev_min(mdev),
> > fw_rev_sub(mdev), diff --git
> > a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> > index 67247c33b9fd..ef2f8889ba0f 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> > @@ -64,7 +64,6 @@ static void mlx5e_rep_get_drvinfo(struct net_device
> > *dev,
> >
> >  	strlcpy(drvinfo->driver, mlx5e_rep_driver_name,
> >  		sizeof(drvinfo->driver));
> > -	strlcpy(drvinfo->version, UTS_RELEASE, sizeof(drvinfo->version));
> >  	snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
> >  		 "%d.%d.%04d (%.16s)",
> >  		 fw_rev_maj(mdev), fw_rev_min(mdev),
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
> > index cac8f085b16d..97d96fc38a65 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
> > @@ -39,7 +39,7 @@ static void mlx5i_get_drvinfo(struct net_device *dev,
> >  	struct mlx5e_priv *priv = mlx5i_epriv(dev);
> >
> >  	mlx5e_ethtool_get_drvinfo(priv, drvinfo);
> > -	strlcpy(drvinfo->driver, DRIVER_NAME "[ib_ipoib]",
> > +	strlcpy(drvinfo->driver, KBUILD_MODNAME "[ib_ipoib]",
> >  		sizeof(drvinfo->driver));
> >  }
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > index 71e210f22f69..9827127cb674 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > @@ -77,7 +77,6 @@
> >  MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>");
> > MODULE_DESCRIPTION("Mellanox 5th generation network adapters
> > (ConnectX series) core driver");  MODULE_LICENSE("Dual BSD/GPL"); -
> > MODULE_VERSION(DRIVER_VERSION);
> >
> >  unsigned int mlx5_core_debug_mask;
> >  module_param_named(debug_mask, mlx5_core_debug_mask, uint, 0644);
> > @@ -228,7 +227,7 @@ static void mlx5_set_driver_version(struct
> > mlx5_core_dev *dev)
> >  	strncat(string, ",", remaining_size);
> >
> >  	remaining_size = max_t(int, 0, driver_ver_sz - strlen(string));
> > -	strncat(string, DRIVER_NAME, remaining_size);
> > +	strncat(string, KBUILD_MODNAME, remaining_size);
> >
> >  	remaining_size = max_t(int, 0, driver_ver_sz - strlen(string));
> >  	strncat(string, ",", remaining_size);
> > @@ -313,7 +312,7 @@ static int request_bar(struct pci_dev *pdev)
> >  		return -ENODEV;
> >  	}
> >
> > -	err = pci_request_regions(pdev, DRIVER_NAME);
> > +	err = pci_request_regions(pdev, KBUILD_MODNAME);
> >  	if (err)
> >  		dev_err(&pdev->dev, "Couldn't get PCI resources,
> > aborting\n");
> >
> > @@ -1617,7 +1616,7 @@ void mlx5_recover_device(struct mlx5_core_dev
> > *dev)  }
> >
> >  static struct pci_driver mlx5_core_driver = {
> > -	.name           = DRIVER_NAME,
> > +	.name           = KBUILD_MODNAME,
> >  	.id_table       = mlx5_core_pci_table,
> >  	.probe          = init_one,
> >  	.remove         = remove_one,
> > @@ -1643,6 +1642,10 @@ static int __init init(void)  {
> >  	int err;
> >
> > +	WARN_ONCE(strcmp(MLX5_ADEV_NAME, KBUILD_MODNAME) ||
> > +		  strlen(MLX5_ADEV_NAME) != strlen(KBUILD_MODNAME),
> > +		  "mlx5_core name not in sync with kernel module name");
> > +
> In which case, both the strings are same but their length not?
> You likely don't need the string length check.

Yes, I was overzealous, I'll remove when will apply the series.

>
> >  	get_random_bytes(&sw_owner_id, sizeof(sw_owner_id));
> >
> >  	mlx5_core_verify_params();
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
> > b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
> > index 8cec85ab419d..b285f1515e4e 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
> > @@ -42,9 +42,6 @@
> >  #include <linux/mlx5/fs.h>
> >  #include <linux/mlx5/driver.h>
> >
> > -#define DRIVER_NAME "mlx5_core"
> > -#define DRIVER_VERSION "5.0-0"
> > -
> >  extern uint mlx5_core_debug_mask;
> >
> >  #define mlx5_core_dbg(__dev, format, ...)				\
> > diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index
> > 317257f8e0ad..ed1d030658d2 100644
> > --- a/include/linux/mlx5/driver.h
> > +++ b/include/linux/mlx5/driver.h
> > @@ -56,6 +56,8 @@
> >  #include <linux/ptp_clock_kernel.h>
> >  #include <net/devlink.h>
> >
> > +#define MLX5_ADEV_NAME "mlx5_core"
> > +
> >  enum {
> >  	MLX5_BOARD_ID_LEN = 64,
> >  };
> > --
> > 2.28.0
>
>
> Other than strlen removal check,
> Reviewed-by: Parav Pandit <parav@nvidia.com>
>

Thanks

  reply	other threads:[~2020-11-02  5:56 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-01 20:15 [PATCH mlx5-next v1 00/11] Convert mlx5 to use auxiliary bus Leon Romanovsky
2020-11-01 20:15 ` [PATCH mlx5-next v1 01/11] net/mlx5: Don't skip vport check Leon Romanovsky
2020-11-01 20:15 ` [PATCH mlx5-next v1 02/11] net/mlx5: Properly convey driver version to firmware Leon Romanovsky
2020-11-02 14:47   ` Roi Dayan
2020-11-01 20:15 ` [PATCH mlx5-next v1 03/11] net/mlx5_core: Clean driver version and name Leon Romanovsky
2020-11-02  5:07   ` Parav Pandit
2020-11-02  5:56     ` Leon Romanovsky [this message]
2020-11-01 20:15 ` [PATCH mlx5-next v1 04/11] vdpa/mlx5: Make hardware definitions visible to all mlx5 devices Leon Romanovsky
2020-11-05 20:31   ` Saeed Mahameed
2020-11-05 20:36     ` Jason Gunthorpe
2020-11-06  7:05       ` Leon Romanovsky
2020-11-01 20:15 ` [PATCH mlx5-next v1 05/11] net/mlx5: Register mlx5 devices to auxiliary virtual bus Leon Romanovsky
2020-11-05 20:59   ` Saeed Mahameed
2020-11-05 21:09     ` Jason Gunthorpe
2020-11-06  6:56       ` Leon Romanovsky
2020-11-01 20:15 ` [PATCH mlx5-next v1 06/11] vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus Leon Romanovsky
2020-11-03 15:45   ` Jason Gunthorpe
2020-11-04 23:21     ` Dan Williams
2020-11-05  7:33       ` gregkh
2020-11-05  7:49         ` Dan Williams
2020-11-05 16:47         ` Jason Gunthorpe
2020-11-05 16:57           ` gregkh
2020-11-01 20:15 ` [PATCH mlx5-next v1 07/11] net/mlx5e: Connect ethernet part " Leon Romanovsky
2020-11-01 20:15 ` [PATCH mlx5-next v1 08/11] RDMA/mlx5: Convert mlx5_ib to use " Leon Romanovsky
2020-11-01 20:15 ` [PATCH mlx5-next v1 09/11] net/mlx5: Delete custom device management logic Leon Romanovsky
2020-11-01 20:15 ` [PATCH mlx5-next v1 10/11] net/mlx5: Simplify eswitch mode check Leon Romanovsky
2020-11-02 14:54   ` Roi Dayan
2020-11-01 20:15 ` [PATCH mlx5-next v1 11/11] RDMA/mlx5: Remove IB representors dead code Leon Romanovsky
2020-11-03  7:10   ` Roi Dayan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201102055626.GD5429@unreal \
    --to=leon@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=davem@davemloft.net \
    --cc=dledford@redhat.com \
    --cc=fred.oh@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowang@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=kiran.patil@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=parav@nvidia.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=roid@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=shiraz.saleem@intel.com \
    --cc=tiwai@suse.de \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).