devlink: Add devlink port health command
Add devlink port health show subcommand which displays information about
specified port reporter or all present port reporters as in the example.
Device and port reporters can be distinguished by a handle being used.
Make other devlink-health subcommands be aliased by devlink port health.
Refactor devlink-health commands for usage of port handles in order to
interact with port reporters.
Change devlink health show output to dump information about both device
and port reporters with correct handles.
Example:
$ devlink health show
pci/0000:00:0b.0:
reporter fw
state healthy error 0 recover 0 auto_dump true
reporter fw_fatal
state healthy error 0 recover 0 grace_period
1200000 auto_recover true auto_dump true
pci/0000:00:0b.0/1:
reporter tx
state healthy error 0 recover 0 grace_period 10000 auto_recover true auto_dump true
reporter rx
state healthy error 0 recover 0 grace_period 10000 auto_recover true auto_dump true
$ devlink health show pci/0000:00:0b.0/1 reporter rx
Which is equivalent to:
$ devlink port health show pci/0000:00:0b.0/1 reporter rx
pci/0000:00:0b.0/1:
reporter rx
state healthy error 0 recover 0 grace_period 10000 auto_recover true auto_dump true
$ devlink port health show pci/0000:00:0b.0/1 reporter rx -j --pretty
{
"health": {
"pci/0000:00:0b.0/1": [ {
"reporter": "rx",
"state": "healthy",
"error": 0,
"recover": 0,
"grace_period": 500,
"auto_recover": true,
"auto_dump": true
} ]
}
}
$ devlink health set pci/0000:00:0b.0/1 reporter rx grace_period 5000
Which is equivalent to:
$ devlink port health set pci/0000:00:0b.0/1 reporter rx grace_period 5000
$ devlink port health show pci/0000:00:0b.0/1 reporter rx
pci/0000:00:0b.0/1:
reporter rx
state healthy error 0 recover 0 grace_period 5000 auto_recover true auto_dump true
Signed-off-by: Vladyslav Tarasiuk <vladyslavt@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>