svn commit: r341905 - in stable/12/sys/dev/mlx4: . mlx4_core
Hans Petter Selasky
hselasky at FreeBSD.org
Wed Dec 12 11:43:53 UTC 2018
Author: hselasky
Date: Wed Dec 12 11:43:52 2018
New Revision: 341905
URL: https://svnweb.freebsd.org/changeset/base/341905
Log:
MFC r341545:
mlx4: Add board identifier and firmware version to sysctl
In last mlx4 update (r325841) we lost the sysctl to show the
firmware version for mlx4 devices.
Add both board identifier and firmware version under:
sys.device.mlx4_core0.hw sysctl node.
Sponsored by: Mellanox Technologies
Modified:
stable/12/sys/dev/mlx4/device.h
stable/12/sys/dev/mlx4/mlx4_core/mlx4_main.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/dev/mlx4/device.h
==============================================================================
--- stable/12/sys/dev/mlx4/device.h Wed Dec 12 11:43:49 2018 (r341904)
+++ stable/12/sys/dev/mlx4/device.h Wed Dec 12 11:43:52 2018 (r341905)
@@ -877,6 +877,8 @@ struct mlx4_dev {
u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
struct mlx4_vf_dev *dev_vfs;
u8 uar_page_shift;
+ struct sysctl_ctx_list hw_ctx;
+ char fw_str[64];
};
struct mlx4_clock_params {
Modified: stable/12/sys/dev/mlx4/mlx4_core/mlx4_main.c
==============================================================================
--- stable/12/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 12 11:43:49 2018 (r341904)
+++ stable/12/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 12 11:43:52 2018 (r341905)
@@ -1893,6 +1893,7 @@ static void unmap_internal_clock(struct mlx4_dev *dev)
static void mlx4_close_hca(struct mlx4_dev *dev)
{
+ sysctl_ctx_free(&dev->hw_ctx);
unmap_internal_clock(dev);
unmap_bf_area(dev);
if (mlx4_is_slave(dev))
@@ -3745,10 +3746,14 @@ err_disable_pdev:
static int mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{
- struct mlx4_priv *priv;
- struct mlx4_dev *dev;
- int ret;
+ struct sysctl_ctx_list *ctx;
+ struct sysctl_oid *node;
+ struct sysctl_oid_list *node_list;
+ struct mlx4_priv *priv;
+ struct mlx4_dev *dev;
+ int ret;
+
printk_once(KERN_INFO "%s", mlx4_version);
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -3773,8 +3778,28 @@ static int mlx4_init_one(struct pci_dev *pdev, const s
if (ret) {
kfree(dev->persist);
kfree(priv);
+ return ret;
} else {
pci_save_state(pdev->dev.bsddev);
+ }
+
+ snprintf(dev->fw_str, sizeof(dev->fw_str), "%d.%d.%d",
+ (int) (dev->caps.fw_ver >> 32),
+ (int) (dev->caps.fw_ver >> 16) & 0xffff,
+ (int) (dev->caps.fw_ver & 0xffff));
+
+ ctx = &dev->hw_ctx;
+ sysctl_ctx_init(ctx);
+ node = SYSCTL_ADD_NODE(ctx,SYSCTL_CHILDREN(pdev->dev.kobj.oidp),
+ OID_AUTO, "hw" , CTLFLAG_RD, 0, "mlx4 dev hw information");
+ if (node != NULL) {
+ node_list = SYSCTL_CHILDREN(node);
+ SYSCTL_ADD_STRING(ctx, node_list, OID_AUTO,
+ "fw_version", CTLFLAG_RD, dev->fw_str, 0,
+ "Device firmware version");
+ SYSCTL_ADD_STRING(ctx, node_list, OID_AUTO,
+ "board_id", CTLFLAG_RD, dev->board_id, 0,
+ "Device board identifier");
}
return ret;
More information about the svn-src-all
mailing list