lszcrypt: add support for checkstop state

Newer kernel show a sysfs attribute chkstop which displays
the checkstop state of a crypto card. This patch enables
support for lszcrypt to display the checkstop state.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Harald Freudenberger
2021-11-17 15:02:01 +01:00
committed by Jan Höppner
parent 4382901daa
commit 27dce3317a
2 changed files with 15 additions and 4 deletions

View File

@@ -154,6 +154,9 @@ cryptographic operations. 'offline' is displayed when a card or queue
is switched to (software) offline. If a card is 'deconfigured' via
HMC, SE or chzcrypt the field shows 'deconfig'.
.br
A crypto card may also reach a 'checkstopped' state. lszcrypt shows
this as 'chkstop'.
.br
If a queue is not bound to a device driver there is no detailed
information available and thus the status shows only '-'.
.br

View File

@@ -381,7 +381,7 @@ static int read_driver(const char *dir, const char *subdir, char *buf, size_t bu
static void read_subdev_rec_default(struct util_rec *rec, const char *grp_dev,
const char *sub_dev)
{
long config = -1, online = -1;
long config = -1, online = -1, chkstop = -1;
char buf[256];
unsigned long facility;
@@ -392,6 +392,8 @@ static void read_subdev_rec_default(struct util_rec *rec, const char *grp_dev,
if (util_path_is_readable("%s/%s/config", grp_dev, sub_dev))
util_file_read_l(&config, 10, "%s/%s/config", grp_dev, sub_dev);
if (util_path_is_readable("%s/%s/chkstop", grp_dev, sub_dev))
util_file_read_l(&chkstop, 10, "%s/%s/chkstop", grp_dev, sub_dev);
if (util_path_is_readable("%s/%s/online", grp_dev, sub_dev))
util_file_read_l(&online, 10, "%s/%s/online", grp_dev, sub_dev);
@@ -399,7 +401,9 @@ static void read_subdev_rec_default(struct util_rec *rec, const char *grp_dev,
if (config == 0) {
util_rec_set(rec, "status", "deconfig");
} else {
if (online > 0)
if (chkstop > 0)
util_rec_set(rec, "status", "chkstop");
else if (online > 0)
util_rec_set(rec, "status", "online");
else if (online == 0)
util_rec_set(rec, "status", "offline");
@@ -522,7 +526,7 @@ static void show_subdevices(struct util_rec *rec, const char *grp_dev)
*/
static void read_rec_default(struct util_rec *rec, const char *grp_dev)
{
long config = -1, online = -1;
long config = -1, online = -1, chkstop = -1;
char buf[256];
unsigned long facility;
@@ -543,12 +547,16 @@ static void read_rec_default(struct util_rec *rec, const char *grp_dev)
if (util_path_is_readable("%s/config", grp_dev))
util_file_read_l(&config, 10, "%s/config", grp_dev);
if (util_path_is_readable("%s/chkstop", grp_dev))
util_file_read_l(&chkstop, 10, "%s/chkstop", grp_dev);
if (util_path_is_readable("%s/online", grp_dev))
util_file_read_l(&online, 10, "%s/online", grp_dev);
if (config == 0) {
util_rec_set(rec, "status", "deconfig");
} else {
if (online > 0)
if (chkstop > 0)
util_rec_set(rec, "status", "chkstop");
else if (online > 0)
util_rec_set(rec, "status", "online");
else if (online == 0)
util_rec_set(rec, "status", "offline");