svn commit: r341948 - in stable/11/sys: compat/linuxkpi/common/src dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib
Hans Petter Selasky
hselasky at FreeBSD.org
Wed Dec 12 12:30:53 UTC 2018
Author: hselasky
Date: Wed Dec 12 12:30:51 2018
New Revision: 341948
URL: https://svnweb.freebsd.org/changeset/base/341948
Log:
MFC r341567:
mlx5: Fix driver version location
Driver description should be set by core and not by the Ethernet driver.
Sponsored by: Mellanox Technologies
Modified:
stable/11/sys/compat/linuxkpi/common/src/linux_pci.c
stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c
stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/compat/linuxkpi/common/src/linux_pci.c
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Wed Dec 12 12:30:47 2018 (r341947)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Wed Dec 12 12:30:51 2018 (r341948)
@@ -199,6 +199,7 @@ linux_pci_detach(device_t dev)
spin_lock(&pci_lock);
list_del(&pdev->links);
spin_unlock(&pci_lock);
+ device_set_desc(dev, NULL);
put_device(&pdev->dev);
return (0);
Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 12 12:30:47 2018 (r341947)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 12 12:30:51 2018 (r341948)
@@ -44,6 +44,8 @@
#include "mlx5_core.h"
#include "fs_core.h"
+static const char mlx5_version[] = "Mellanox Core driver "
+ DRIVER_VERSION " (" DRIVER_RELDATE ")";
MODULE_AUTHOR("Eli Cohen <eli at mellanox.com>");
MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver");
MODULE_LICENSE("Dual BSD/GPL");
@@ -1201,6 +1203,9 @@ static int init_one(struct pci_dev *pdev,
dev->profile = &profiles[prof_sel];
dev->pdev = pdev;
dev->event = mlx5_core_event;
+
+ /* Set desc */
+ device_set_desc(bsddev, mlx5_version);
sysctl_ctx_init(&dev->sysctl_ctx);
SYSCTL_ADD_INT(&dev->sysctl_ctx,
Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:30:47 2018 (r341947)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Wed Dec 12 12:30:51 2018 (r341948)
@@ -34,8 +34,8 @@
#define ETH_DRIVER_VERSION "3.4.2"
#endif
-char mlx5e_version[] = "Mellanox Ethernet driver"
- " (" ETH_DRIVER_VERSION ")";
+static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver "
+ ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n";
static int mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs);
@@ -3557,9 +3557,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
/* set default MTU */
mlx5e_set_dev_port_mtu(ifp, ifp->if_mtu);
- /* Set desc */
- device_set_desc(mdev->pdev->dev.bsddev, mlx5e_version);
-
/* Set default media status */
priv->media_status_last = IFM_AVALID;
priv->media_active_last = IFM_ETHER | IFM_AUTO |
@@ -3664,13 +3661,6 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp
/* don't allow more IOCTLs */
priv->gone = 1;
- /*
- * Clear the device description to avoid use after free,
- * because the bsddev is not destroyed when this module is
- * unloaded:
- */
- device_set_desc(mdev->pdev->dev.bsddev, NULL);
-
/* XXX wait a bit to allow IOCTL handlers to complete */
pause("W", hz);
@@ -3738,6 +3728,14 @@ mlx5e_cleanup(void)
{
mlx5_unregister_interface(&mlx5e_interface);
}
+
+static void
+mlx5e_show_version(void __unused *arg)
+{
+
+ printf("%s", mlx5e_version);
+}
+SYSINIT(mlx5e_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5e_show_version, NULL);
module_init_order(mlx5e_init, SI_ORDER_THIRD);
module_exit_order(mlx5e_cleanup, SI_ORDER_THIRD);
Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:30:47 2018 (r341947)
+++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Dec 12 12:30:51 2018 (r341948)
@@ -50,7 +50,7 @@
#include <dev/mlx5/fs.h>
#include "mlx5_ib.h"
-#define DRIVER_NAME "mlx5_ib"
+#define DRIVER_NAME "mlx5ib"
#ifndef DRIVER_VERSION
#define DRIVER_VERSION "3.4.2"
#endif
@@ -2963,8 +2963,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
if ((ll == IB_LINK_LAYER_ETHERNET) && !MLX5_CAP_GEN(mdev, roce))
return NULL;
- printk_once(KERN_INFO "%s", mlx5_version);
-
dev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*dev));
if (!dev)
return NULL;
@@ -3259,6 +3257,14 @@ static void __exit mlx5_ib_cleanup(void)
mlx5_unregister_interface(&mlx5_ib_interface);
mlx5_ib_odp_cleanup();
}
+
+static void
+mlx5_ib_show_version(void __unused *arg)
+{
+
+ printf("%s", mlx5_version);
+}
+SYSINIT(mlx5_ib_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5_ib_show_version, NULL);
module_init_order(mlx5_ib_init, SI_ORDER_THIRD);
module_exit_order(mlx5_ib_cleanup, SI_ORDER_THIRD);
More information about the svn-src-stable-11
mailing list