From: Ira Weiny <ira.we...@intel.com> Change the default node description string to IB_DEFAULT_ND_FORMAT Use ib_build_node_desc to dynamically map this string to set Node Description in FW
Reviewed-by: John Fleck <john.fl...@intel.com> Reviewed-by: Michael Heinz <michael.william.he...@intel.com> Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com> Signed-off-by: Ira Weiny <ira.we...@intel.com> --- drivers/infiniband/hw/mlx5/main.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index a244317..a8bf1de 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -424,11 +424,12 @@ static int mlx5_ib_modify_device(struct ib_device *ibdev, int mask, if (!(mask & IB_DEVICE_MODIFY_NODE_DESC)) return 0; + ib_build_node_desc(in.desc, props->node_desc, 64, ibdev); + /* * If possible, pass node desc to FW, so it can generate * a 144 trap. If cmd fails, just ignore. */ - memcpy(&in, props->node_desc, 64); err = mlx5_core_access_reg(dev->mdev, &in, sizeof(in), &out, sizeof(out), MLX5_REG_NODE_DESC, 0, 1); if (err) @@ -806,20 +807,18 @@ static int init_node_data(struct mlx5_ib_dev *dev) struct ib_smp *in_mad = NULL; struct ib_smp *out_mad = NULL; int err = -ENOMEM; + struct ib_device_modify props; in_mad = kzalloc(sizeof(*in_mad), GFP_KERNEL); out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); if (!in_mad || !out_mad) goto out; - init_query_mad(in_mad); - in_mad->attr_id = IB_SMP_ATTR_NODE_DESC; + snprintf(props.node_desc, sizeof(props.node_desc)-1, "%s", + IB_DEFAULT_ND_FORMAT); + mlx5_ib_modify_device(&dev->ib_dev, IB_DEVICE_MODIFY_NODE_DESC, &props); - err = mlx5_MAD_IFC(dev, 1, 1, 1, NULL, NULL, in_mad, out_mad); - if (err) - goto out; - - memcpy(dev->ib_dev.node_desc, out_mad->data, 64); + init_query_mad(in_mad); in_mad->attr_id = IB_SMP_ATTR_NODE_INFO; -- 1.8.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html