Commit 5ba325fe authored by Jiri Pirko's avatar Jiri Pirko Committed by Jakub Kicinski

mlxsw: core_linecards: Expose HW revision and INI version

Implement info_get() to expose HW revision of a linecard and loaded INI
version.

Example:

$ devlink dev info auxiliary/mlxsw_core.lc.0
auxiliary/mlxsw_core.lc.0:
  versions:
      fixed:
        hw.revision 0
      running:
        ini.version 4
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent bd02fd76
...@@ -58,6 +58,24 @@ The ``mlxsw`` driver reports the following versions ...@@ -58,6 +58,24 @@ The ``mlxsw`` driver reports the following versions
- running - running
- Three digit firmware version - Three digit firmware version
Line card auxiliary device info versions
========================================
The ``mlxsw`` driver reports the following versions for line card auxiliary device
.. list-table:: devlink info versions implemented
:widths: 5 5 90
* - Name
- Type
- Description
* - ``hw.revision``
- fixed
- The hardware revision for this line card
* - ``ini.version``
- running
- Version of line card INI loaded
Driver-specific Traps Driver-specific Traps
===================== =====================
......
...@@ -601,6 +601,10 @@ mlxsw_linecard_get(struct mlxsw_linecards *linecards, u8 slot_index) ...@@ -601,6 +601,10 @@ mlxsw_linecard_get(struct mlxsw_linecards *linecards, u8 slot_index)
return &linecards->linecards[slot_index - 1]; return &linecards->linecards[slot_index - 1];
} }
int mlxsw_linecard_devlink_info_get(struct mlxsw_linecard *linecard,
struct devlink_info_req *req,
struct netlink_ext_ack *extack);
int mlxsw_linecards_init(struct mlxsw_core *mlxsw_core, int mlxsw_linecards_init(struct mlxsw_core *mlxsw_core,
const struct mlxsw_bus_info *bus_info); const struct mlxsw_bus_info *bus_info);
void mlxsw_linecards_fini(struct mlxsw_core *mlxsw_core); void mlxsw_linecards_fini(struct mlxsw_core *mlxsw_core);
......
...@@ -98,7 +98,18 @@ void mlxsw_linecard_bdev_del(struct mlxsw_linecard *linecard) ...@@ -98,7 +98,18 @@ void mlxsw_linecard_bdev_del(struct mlxsw_linecard *linecard)
linecard->bdev = NULL; linecard->bdev = NULL;
} }
static int mlxsw_linecard_dev_devlink_info_get(struct devlink *devlink,
struct devlink_info_req *req,
struct netlink_ext_ack *extack)
{
struct mlxsw_linecard_dev *linecard_dev = devlink_priv(devlink);
struct mlxsw_linecard *linecard = linecard_dev->linecard;
return mlxsw_linecard_devlink_info_get(linecard, req, extack);
}
static const struct devlink_ops mlxsw_linecard_dev_devlink_ops = { static const struct devlink_ops mlxsw_linecard_dev_devlink_ops = {
.info_get = mlxsw_linecard_dev_devlink_info_get,
}; };
static int mlxsw_linecard_bdev_probe(struct auxiliary_device *adev, static int mlxsw_linecard_bdev_probe(struct auxiliary_device *adev,
......
...@@ -226,6 +226,34 @@ void mlxsw_linecards_event_ops_unregister(struct mlxsw_core *mlxsw_core, ...@@ -226,6 +226,34 @@ void mlxsw_linecards_event_ops_unregister(struct mlxsw_core *mlxsw_core,
} }
EXPORT_SYMBOL(mlxsw_linecards_event_ops_unregister); EXPORT_SYMBOL(mlxsw_linecards_event_ops_unregister);
int mlxsw_linecard_devlink_info_get(struct mlxsw_linecard *linecard,
struct devlink_info_req *req,
struct netlink_ext_ack *extack)
{
char buf[32];
int err;
mutex_lock(&linecard->lock);
if (WARN_ON(!linecard->provisioned)) {
err = -EOPNOTSUPP;
goto unlock;
}
sprintf(buf, "%d", linecard->hw_revision);
err = devlink_info_version_fixed_put(req, "hw.revision", buf);
if (err)
goto unlock;
sprintf(buf, "%d", linecard->ini_version);
err = devlink_info_version_running_put(req, "ini.version", buf);
if (err)
goto unlock;
unlock:
mutex_unlock(&linecard->lock);
return err;
}
static int static int
mlxsw_linecard_provision_set(struct mlxsw_linecard *linecard, u8 card_type, mlxsw_linecard_provision_set(struct mlxsw_linecard *linecard, u8 card_type,
u16 hw_revision, u16 ini_version) u16 hw_revision, u16 ini_version)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment