Commit 3b37130f authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

mlxsw: core_linecards: Expose HW revision and INI version

Implement info_get() to expose HW revision of a linecard and loaded INI
version.
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5e222989
......@@ -58,6 +58,24 @@ The ``mlxsw`` driver reports the following versions
- running
- Three digit firmware version
Line card info versions
=======================
The ``mlxsw`` driver reports the following versions for line cards
.. list-table:: devlink line card 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
=====================
......
......@@ -834,12 +834,43 @@ static void mlxsw_linecard_types_get(struct devlink_linecard *devlink_linecard,
*type_priv = ini_file;
}
static int
mlxsw_linecard_info_get(struct devlink_linecard *devlink_linecard, void *priv,
struct devlink_info_req *req,
struct netlink_ext_ack *extack)
{
struct mlxsw_linecard *linecard = priv;
char buf[32];
int err;
mutex_lock(&linecard->lock);
if (!linecard->provisioned) {
err = 0;
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 const struct devlink_linecard_ops mlxsw_linecard_ops = {
.provision = mlxsw_linecard_provision,
.unprovision = mlxsw_linecard_unprovision,
.same_provision = mlxsw_linecard_same_provision,
.types_count = mlxsw_linecard_types_count,
.types_get = mlxsw_linecard_types_get,
.info_get = mlxsw_linecard_info_get,
};
struct mlxsw_linecard_status_event {
......
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