Skip to content

Commit db1cf34

Browse files
Martin Belangerdwsuse
authored andcommitted
tree: Add cntrltype and dctype to the controller object
The Discovery Controller Type (dctype) is a new attribute defined in TP8010. This new attribute, as well as the existing Controller Type (cntrltype) attributes will now be exposed through the sysfs starting with kernel 5.18. For older kernels, the cntrltype and dctype must be retrieved by performing a Identify command. Signed-off-by: Martin Belanger <[email protected]> [dwagner: Removed nvme_fetch_cntrltype_dctype_from_id] Signed-off-by: Daniel Wagner <[email protected]>
1 parent 854a76c commit db1cf34

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/nvme/private.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ struct nvme_ctrl {
8080
char *traddr;
8181
char *trsvcid;
8282
char *dhchap_key;
83+
char *cntrltype;
84+
char *dctype;
8385
bool discovery_ctrl;
8486
bool discovered;
8587
bool persistent;

src/nvme/tree.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,8 @@ void nvme_deconfigure_ctrl(nvme_ctrl_t c)
860860
FREE_CTRL_ATTR(c->serial);
861861
FREE_CTRL_ATTR(c->sqsize);
862862
FREE_CTRL_ATTR(c->address);
863+
FREE_CTRL_ATTR(c->dctype);
864+
FREE_CTRL_ATTR(c->cntrltype);
863865
}
864866

865867
int nvme_disconnect_ctrl(nvme_ctrl_t c)
@@ -1129,6 +1131,9 @@ static int nvme_configure_ctrl(nvme_root_t r, nvme_ctrl_t c, const char *path,
11291131
free(c->dhchap_key);
11301132
c->dhchap_key = NULL;
11311133
}
1134+
c->cntrltype = nvme_get_ctrl_attr(c, "cntrltype");
1135+
c->dctype = nvme_get_ctrl_attr(c, "dctype");
1136+
11321137
return 0;
11331138
}
11341139

0 commit comments

Comments
 (0)