svn commit: r341545 - in head/sys/dev/mlx4: . mlx4_core
Slava Shwartsman
slavash at FreeBSD.org
Wed Dec 5 13:30:50 UTC 2018
Author: slavash
Date: Wed Dec 5 13:30:48 2018
New Revision: 341545
URL: https://svnweb.freebsd.org/changeset/base/341545
Log:
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.
Approved by: hselasky (mentor)
MFC after: 1 week
Sponsored by: Mellanox Technologies
Modified:
head/sys/dev/mlx4/device.h
head/sys/dev/mlx4/mlx4_core/mlx4_main.c
Modified: head/sys/dev/mlx4/device.h
==============================================================================
--- head/sys/dev/mlx4/device.h Wed Dec 5 13:30:16 2018 (r341544)
+++ head/sys/dev/mlx4/device.h Wed Dec 5 13:30:48 2018 (r341545)
@@ -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: head/sys/dev/mlx4/mlx4_core/mlx4_main.c
==============================================================================
--- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:30:16 2018 (r341544)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:30:48 2018 (r341545)
@@ -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