Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fabrics: align identify command payload #2289

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ static nvme_ctrl_t create_discover_ctrl(nvme_root_t r, nvme_host_t h,
struct nvme_fabrics_config *cfg,
struct tr_config *trcfg)
{
_cleanup_free_ struct nvme_id_ctrl *id = NULL;
nvme_ctrl_t c;

c = __create_discover_ctrl(r, h, cfg, trcfg);
Expand All @@ -208,18 +209,20 @@ static nvme_ctrl_t create_discover_ctrl(nvme_root_t r, nvme_host_t h,
if (nvme_ctrl_is_unique_discovery_ctrl(c))
return c;

/* Find out the name of discovery controller */
struct nvme_id_ctrl id = { 0 };
id = nvme_alloc(sizeof(*id));
if (!id)
return NULL;

if (nvme_ctrl_identify(c, &id)) {
/* Find out the name of discovery controller */
if (nvme_ctrl_identify(c, id)) {
fprintf(stderr, "failed to identify controller, error %s\n",
nvme_strerror(errno));
nvme_disconnect_ctrl(c);
nvme_free_ctrl(c);
return NULL;
}

if (!strcmp(id.subnqn, NVME_DISC_SUBSYS_NAME))
if (!strcmp(id->subnqn, NVME_DISC_SUBSYS_NAME))
return c;

/*
Expand All @@ -229,7 +232,7 @@ static nvme_ctrl_t create_discover_ctrl(nvme_root_t r, nvme_host_t h,
nvme_disconnect_ctrl(c);
nvme_free_ctrl(c);

trcfg->subsysnqn = id.subnqn;
trcfg->subsysnqn = id->subnqn;
return __create_discover_ctrl(r, h, cfg, trcfg);
}

Expand Down