Skip to content

Commit 8527604

Browse files
hreineckeigaw
authored andcommitted
libnvme/fabrics: drop fabric_args from __create_discovery_ctrl()
All information is stored in nvmf_context, so use that instead. Signed-off-by: Hannes Reinecke <[email protected]>
1 parent 70f7973 commit 8527604

1 file changed

Lines changed: 13 additions & 43 deletions

File tree

libnvme/src/nvme/fabrics.c

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,21 +2072,20 @@ static int nvme_add_ctrl(struct nvmf_context *fctx,
20722072

20732073
static int __create_discovery_ctrl(struct nvme_global_ctx *ctx,
20742074
struct nvmf_context *fctx, nvme_host_t h,
2075-
struct nvme_fabrics_config *cfg, struct fabric_args *trcfg,
2076-
struct nvme_ctrl **ctrl)
2075+
struct nvme_fabrics_config *cfg, struct nvme_ctrl **ctrl)
20772076
{
20782077
nvme_ctrl_t c;
20792078
int tmo, ret;
20802079

2081-
ret = nvme_create_ctrl(ctx, trcfg->subsysnqn, trcfg->transport,
2082-
trcfg->traddr, trcfg->host_traddr,
2083-
trcfg->host_iface, trcfg->trsvcid, &c);
2080+
ret = nvme_create_ctrl(ctx, fctx->subsysnqn, fctx->transport,
2081+
fctx->traddr, fctx->host_traddr,
2082+
fctx->host_iface, fctx->trsvcid, &c);
20842083
if (ret)
20852084
return ret;
20862085

20872086
nvme_ctrl_set_discovery_ctrl(c, true);
20882087
nvme_ctrl_set_unique_discovery_ctrl(c,
2089-
strcmp(trcfg->subsysnqn, NVME_DISC_SUBSYS_NAME));
2088+
strcmp(fctx->subsysnqn, NVME_DISC_SUBSYS_NAME));
20902089
tmo = set_discovery_kato(fctx, cfg);
20912090

20922091
if (nvme_ctrl_get_unique_discovery_ctrl(c) && fctx->hostkey) {
@@ -2109,14 +2108,13 @@ static int __create_discovery_ctrl(struct nvme_global_ctx *ctx,
21092108
static int nvmf_create_discovery_ctrl(struct nvme_global_ctx *ctx,
21102109
struct nvmf_context *fctx, nvme_host_t h,
21112110
struct nvme_fabrics_config *cfg,
2112-
struct fabric_args *trcfg,
21132111
struct nvme_ctrl **ctrl)
21142112
{
21152113
_cleanup_free_ struct nvme_id_ctrl *id = NULL;
21162114
struct nvme_ctrl *c;
21172115
int ret;
21182116

2119-
ret = __create_discovery_ctrl(ctx, fctx, h, cfg, trcfg, &c);
2117+
ret = __create_discovery_ctrl(ctx, fctx, h, cfg, &c);
21202118
if (ret)
21212119
return ret;
21222120

@@ -2160,8 +2158,8 @@ static int nvmf_create_discovery_ctrl(struct nvme_global_ctx *ctx,
21602158
nvme_disconnect_ctrl(c);
21612159
nvme_free_ctrl(c);
21622160

2163-
trcfg->subsysnqn = id->subnqn;
2164-
ret = __create_discovery_ctrl(ctx, fctx, h, cfg, trcfg, &c);
2161+
fctx->subsysnqn = id->subnqn;
2162+
ret = __create_discovery_ctrl(ctx, fctx, h, cfg, &c);
21652163
if (ret)
21662164
return ret;
21672165

@@ -2226,15 +2224,6 @@ int _discovery_config_json(struct nvme_global_ctx *ctx,
22262224

22272225
memcpy(&cfg, fctx->cfg, sizeof(cfg));
22282226

2229-
struct fabric_args trcfg = {
2230-
.subsysnqn = nfctx.subsysnqn,
2231-
.transport = nfctx.transport,
2232-
.traddr = nfctx.traddr,
2233-
.trsvcid = nfctx.trsvcid,
2234-
.host_traddr = nfctx.host_traddr,
2235-
.host_iface = nfctx.host_iface,
2236-
};
2237-
22382227
if (!force) {
22392228
cn = lookup_ctrl(h, &nfctx);
22402229
if (cn) {
@@ -2244,7 +2233,7 @@ int _discovery_config_json(struct nvme_global_ctx *ctx,
22442233
}
22452234
}
22462235

2247-
ret = nvmf_create_discovery_ctrl(ctx, &nfctx, h, &cfg, &trcfg, &cn);
2236+
ret = nvmf_create_discovery_ctrl(ctx, &nfctx, h, &cfg, &cn);
22482237
if (ret)
22492238
return 0;
22502239

@@ -2388,14 +2377,6 @@ __public int nvmf_discovery_config_file(struct nvme_global_ctx *ctx,
23882377
break;
23892378

23902379
struct nvmf_context nfctx = *fctx;
2391-
struct fabric_args trcfg = {
2392-
.subsysnqn = fctx->subsysnqn,
2393-
.transport = fctx->transport,
2394-
.traddr = fctx->traddr,
2395-
.trsvcid = fctx->trsvcid,
2396-
.host_traddr = fctx->host_traddr,
2397-
.host_iface = fctx->host_iface,
2398-
};
23992380

24002381
if (!force) {
24012382
c = lookup_ctrl(h, &nfctx);
@@ -2406,7 +2387,7 @@ __public int nvmf_discovery_config_file(struct nvme_global_ctx *ctx,
24062387
}
24072388

24082389
err = nvmf_create_discovery_ctrl(ctx, &nfctx, h, fctx->cfg,
2409-
&trcfg, &c);
2390+
&c);
24102391
if (err)
24112392
continue;
24122393

@@ -2946,15 +2927,14 @@ __public int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
29462927

29472928
if (!c) {
29482929
ret = nvmf_create_discovery_ctrl(ctx, &nfctx,
2949-
h, fctx->cfg, &trcfg, &c);
2930+
h, fctx->cfg, &c);
29502931
if (ret == -ENVME_CONNECT_ADDRNOTAVAIL &&
29512932
!strcmp(nfctx.transport, "tcp") &&
29522933
strlen(hfi->tcp_info.dhcp_server_ipaddr) > 0) {
29532934
trcfg.host_traddr = NULL;
29542935
nfctx.traddr = NULL;
29552936
ret = nvmf_create_discovery_ctrl(ctx,
2956-
&nfctx, h, fctx->cfg,
2957-
&trcfg, &c);
2937+
&nfctx, h, fctx->cfg, &c);
29582938
}
29592939
} else
29602940
ret = 0;
@@ -3055,24 +3035,14 @@ __public int nvmf_discovery(struct nvme_global_ctx *ctx, struct nvmf_context *fc
30553035
}
30563036
}
30573037

3058-
struct fabric_args trcfg = {
3059-
.subsysnqn = fctx->subsysnqn,
3060-
.transport = fctx->transport,
3061-
.traddr = fctx->traddr,
3062-
.trsvcid = fctx->trsvcid,
3063-
.host_traddr = fctx->host_traddr,
3064-
.host_iface = fctx->host_iface,
3065-
};
3066-
30673038
if (!c && !force) {
30683039
c = lookup_ctrl(h, fctx);
30693040
if (c)
30703041
fctx->persistent = true;
30713042
}
30723043
if (!c) {
30733044
/* No device or non-matching device, create a new controller */
3074-
ret = nvmf_create_discovery_ctrl(ctx, fctx, h, fctx->cfg,
3075-
&trcfg, &c);
3045+
ret = nvmf_create_discovery_ctrl(ctx, fctx, h, fctx->cfg, &c);
30763046
if (ret) {
30773047
if (ret != -ENVME_CONNECT_IGNORED)
30783048
nvme_msg(ctx, LOG_ERR,

0 commit comments

Comments
 (0)