@@ -2071,21 +2071,20 @@ static int nvme_add_ctrl(struct nvmf_context *fctx,
20712071
20722072static int __create_discovery_ctrl (struct nvme_global_ctx * ctx ,
20732073 struct nvmf_context * fctx , nvme_host_t h ,
2074- struct nvme_fabrics_config * cfg , struct fabric_args * trcfg ,
2075- struct nvme_ctrl * * ctrl )
2074+ struct nvme_fabrics_config * cfg , struct nvme_ctrl * * ctrl )
20762075{
20772076 nvme_ctrl_t c ;
20782077 int tmo , ret ;
20792078
2080- ret = nvme_create_ctrl (ctx , trcfg -> subsysnqn , trcfg -> transport ,
2081- trcfg -> traddr , trcfg -> host_traddr ,
2082- trcfg -> host_iface , trcfg -> trsvcid , & c );
2079+ ret = nvme_create_ctrl (ctx , fctx -> subsysnqn , fctx -> transport ,
2080+ fctx -> traddr , fctx -> host_traddr ,
2081+ fctx -> host_iface , fctx -> trsvcid , & c );
20832082 if (ret )
20842083 return ret ;
20852084
20862085 nvme_ctrl_set_discovery_ctrl (c , true);
20872086 nvme_ctrl_set_unique_discovery_ctrl (c ,
2088- strcmp (trcfg -> subsysnqn , NVME_DISC_SUBSYS_NAME ));
2087+ strcmp (fctx -> subsysnqn , NVME_DISC_SUBSYS_NAME ));
20892088 tmo = set_discovery_kato (fctx , cfg );
20902089
20912090 if (nvme_ctrl_get_unique_discovery_ctrl (c ) && fctx -> hostkey ) {
@@ -2108,14 +2107,13 @@ static int __create_discovery_ctrl(struct nvme_global_ctx *ctx,
21082107static int nvmf_create_discovery_ctrl (struct nvme_global_ctx * ctx ,
21092108 struct nvmf_context * fctx , nvme_host_t h ,
21102109 struct nvme_fabrics_config * cfg ,
2111- struct fabric_args * trcfg ,
21122110 struct nvme_ctrl * * ctrl )
21132111{
21142112 _cleanup_free_ struct nvme_id_ctrl * id = NULL ;
21152113 struct nvme_ctrl * c ;
21162114 int ret ;
21172115
2118- ret = __create_discovery_ctrl (ctx , fctx , h , cfg , trcfg , & c );
2116+ ret = __create_discovery_ctrl (ctx , fctx , h , cfg , & c );
21192117 if (ret )
21202118 return ret ;
21212119
@@ -2159,8 +2157,8 @@ static int nvmf_create_discovery_ctrl(struct nvme_global_ctx *ctx,
21592157 nvme_disconnect_ctrl (c );
21602158 nvme_free_ctrl (c );
21612159
2162- trcfg -> subsysnqn = id -> subnqn ;
2163- ret = __create_discovery_ctrl (ctx , fctx , h , cfg , trcfg , & c );
2160+ fctx -> subsysnqn = id -> subnqn ;
2161+ ret = __create_discovery_ctrl (ctx , fctx , h , cfg , & c );
21642162 if (ret )
21652163 return ret ;
21662164
@@ -2225,15 +2223,6 @@ int _discovery_config_json(struct nvme_global_ctx *ctx,
22252223
22262224 memcpy (& cfg , fctx -> cfg , sizeof (cfg ));
22272225
2228- struct fabric_args trcfg = {
2229- .subsysnqn = nfctx .subsysnqn ,
2230- .transport = nfctx .transport ,
2231- .traddr = nfctx .traddr ,
2232- .trsvcid = nfctx .trsvcid ,
2233- .host_traddr = nfctx .host_traddr ,
2234- .host_iface = nfctx .host_iface ,
2235- };
2236-
22372226 if (!force ) {
22382227 cn = lookup_ctrl (h , & nfctx );
22392228 if (cn ) {
@@ -2243,7 +2232,7 @@ int _discovery_config_json(struct nvme_global_ctx *ctx,
22432232 }
22442233 }
22452234
2246- ret = nvmf_create_discovery_ctrl (ctx , & nfctx , h , & cfg , & trcfg , & cn );
2235+ ret = nvmf_create_discovery_ctrl (ctx , & nfctx , h , & cfg , & cn );
22472236 if (ret )
22482237 return 0 ;
22492238
@@ -2387,14 +2376,6 @@ int nvmf_discovery_config_file(struct nvme_global_ctx *ctx,
23872376 break ;
23882377
23892378 struct nvmf_context nfctx = * fctx ;
2390- struct fabric_args trcfg = {
2391- .subsysnqn = fctx -> subsysnqn ,
2392- .transport = fctx -> transport ,
2393- .traddr = fctx -> traddr ,
2394- .trsvcid = fctx -> trsvcid ,
2395- .host_traddr = fctx -> host_traddr ,
2396- .host_iface = fctx -> host_iface ,
2397- };
23982379
23992380 if (!force ) {
24002381 c = lookup_ctrl (h , & nfctx );
@@ -2405,7 +2386,7 @@ int nvmf_discovery_config_file(struct nvme_global_ctx *ctx,
24052386 }
24062387
24072388 err = nvmf_create_discovery_ctrl (ctx , & nfctx , h , fctx -> cfg ,
2408- & trcfg , & c );
2389+ & c );
24092390 if (err )
24102391 continue ;
24112392
@@ -2945,15 +2926,14 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
29452926
29462927 if (!c ) {
29472928 ret = nvmf_create_discovery_ctrl (ctx , & nfctx ,
2948- h , fctx -> cfg , & trcfg , & c );
2929+ h , fctx -> cfg , & c );
29492930 if (ret == - ENVME_CONNECT_ADDRNOTAVAIL &&
29502931 !strcmp (nfctx .transport , "tcp" ) &&
29512932 strlen (hfi -> tcp_info .dhcp_server_ipaddr ) > 0 ) {
29522933 trcfg .host_traddr = NULL ;
29532934 nfctx .traddr = NULL ;
29542935 ret = nvmf_create_discovery_ctrl (ctx ,
2955- & nfctx , h , fctx -> cfg ,
2956- & trcfg , & c );
2936+ & nfctx , h , fctx -> cfg , & c );
29572937 }
29582938 } else
29592939 ret = 0 ;
@@ -3054,24 +3034,14 @@ int nvmf_discovery(struct nvme_global_ctx *ctx, struct nvmf_context *fctx,
30543034 }
30553035 }
30563036
3057- struct fabric_args trcfg = {
3058- .subsysnqn = fctx -> subsysnqn ,
3059- .transport = fctx -> transport ,
3060- .traddr = fctx -> traddr ,
3061- .trsvcid = fctx -> trsvcid ,
3062- .host_traddr = fctx -> host_traddr ,
3063- .host_iface = fctx -> host_iface ,
3064- };
3065-
30663037 if (!c && !force ) {
30673038 c = lookup_ctrl (h , fctx );
30683039 if (c )
30693040 fctx -> persistent = true;
30703041 }
30713042 if (!c ) {
30723043 /* No device or non-matching device, create a new controller */
3073- ret = nvmf_create_discovery_ctrl (ctx , fctx , h , fctx -> cfg ,
3074- & trcfg , & c );
3044+ ret = nvmf_create_discovery_ctrl (ctx , fctx , h , fctx -> cfg , & c );
30753045 if (ret ) {
30763046 if (ret != - ENVME_CONNECT_IGNORED )
30773047 nvme_msg (ctx , LOG_ERR ,
0 commit comments