@@ -2542,11 +2542,10 @@ static bool validate_uri(struct nvme_global_ctx *ctx,
25422542static int nbft_connect (struct nvme_global_ctx * ctx ,
25432543 struct nvmf_context * fctx , struct nvme_host * h ,
25442544 struct nvmf_disc_log_entry * e ,
2545- struct nbft_info_subsystem_ns * ss , struct fabric_args * trcfg ,
2545+ struct nbft_info_subsystem_ns * ss ,
25462546 struct nvme_fabrics_config * cfg )
25472547{
25482548 nvme_ctrl_t c ;
2549- struct nvmf_context nfctx = * fctx ;
25502549 int saved_log_level ;
25512550 bool saved_log_tstamp ;
25522551 bool saved_log_pid ;
@@ -2555,21 +2554,13 @@ static int nbft_connect(struct nvme_global_ctx *ctx,
25552554 saved_log_level = nvme_get_logging_level (ctx , & saved_log_tstamp ,
25562555 & saved_log_pid );
25572556
2558- /* Already connected ? */
2559- nfctx .subsysnqn = trcfg -> subsysnqn ;
2560- nfctx .transport = trcfg -> transport ;
2561- nfctx .traddr = trcfg -> traddr ;
2562- nfctx .trsvcid = trcfg -> trsvcid ;
2563- nfctx .host_traddr = trcfg -> host_traddr ;
2564- nfctx .host_iface = trcfg -> host_iface ;
2565-
2566- c = lookup_ctrl (h , & nfctx );
2557+ c = lookup_ctrl (h , fctx );
25672558 if (c && nvme_ctrl_get_name (c ))
25682559 return 0 ;
25692560
2570- ret = nvme_create_ctrl (ctx , nfctx . subsysnqn , nfctx . transport ,
2571- nfctx . traddr , nfctx . host_traddr ,
2572- nfctx . host_iface , nfctx . trsvcid , & c );
2561+ ret = nvme_create_ctrl (ctx , fctx -> subsysnqn , fctx -> transport ,
2562+ fctx -> traddr , fctx -> host_traddr ,
2563+ fctx -> host_iface , fctx -> trsvcid , & c );
25732564 if (ret )
25742565 return ret ;
25752566
@@ -2607,16 +2598,16 @@ static int nbft_connect(struct nvme_global_ctx *ctx,
26072598 return ret ;
26082599 }
26092600
2610- if (nfctx . connected )
2611- nfctx . connected (& nfctx , c , nfctx . user_data );
2601+ if (fctx -> connected )
2602+ fctx -> connected (fctx , c , fctx -> user_data );
26122603
26132604 return 0 ;
26142605}
26152606
26162607static int nbft_discovery (struct nvme_global_ctx * ctx ,
26172608 struct nvmf_context * fctx , struct nbft_info_discovery * dd ,
26182609 struct nvme_host * h , struct nvme_ctrl * c ,
2619- struct nvme_fabrics_config * defcfg , struct fabric_args * deftrcfg )
2610+ struct nvme_fabrics_config * defcfg )
26202611{
26212612 struct nvmf_discovery_log * log = NULL ;
26222613 int ret ;
@@ -2650,15 +2641,6 @@ static int nbft_discovery(struct nvme_global_ctx *ctx,
26502641 nfctx .traddr = e -> traddr ;
26512642 nfctx .trsvcid = e -> trsvcid ;
26522643
2653- struct fabric_args trcfg = {
2654- .subsysnqn = e -> subnqn ,
2655- .transport = nvmf_trtype_str (e -> trtype ),
2656- .traddr = e -> traddr ,
2657- .host_traddr = fctx -> host_traddr ,
2658- .host_iface = fctx -> host_iface ,
2659- .trsvcid = e -> trsvcid ,
2660- };
2661-
26622644 if (e -> subtype == NVME_NQN_CURR )
26632645 continue ;
26642646
@@ -2680,27 +2662,26 @@ static int nbft_discovery(struct nvme_global_ctx *ctx,
26802662 defcfg , NULL , & child );
26812663 if (ret )
26822664 continue ;
2683- nbft_discovery (ctx , & nfctx , dd , h , child ,
2684- defcfg , & trcfg );
2665+ nbft_discovery (ctx , & nfctx , dd , h , child , defcfg );
26852666 nvme_disconnect_ctrl (child );
26862667 nvme_free_ctrl (child );
26872668 } else {
26882669 ret = nbft_connect (ctx , & nfctx , h , e , NULL ,
2689- & trcfg , defcfg );
2670+ defcfg );
26902671
26912672 /*
26922673 * With TCP/DHCP, it can happen that the OS
26932674 * obtains a different local IP address than the
26942675 * firmware had. Retry without host_traddr.
26952676 */
26962677 if (ret == - ENVME_CONNECT_ADDRNOTAVAIL &&
2697- !strcmp (trcfg .transport , "tcp" ) &&
2678+ !strcmp (nfctx .transport , "tcp" ) &&
26982679 strlen (dd -> hfi -> tcp_info .dhcp_server_ipaddr ) > 0 ) {
2699- const char * htradr = trcfg .host_traddr ;
2680+ const char * htradr = nfctx .host_traddr ;
27002681
2701- trcfg .host_traddr = NULL ;
2682+ nfctx .host_traddr = NULL ;
27022683 ret = nbft_connect (ctx , & nfctx , h , e , NULL ,
2703- & trcfg , defcfg );
2684+ defcfg );
27042685
27052686 if (ret == 0 )
27062687 nvme_msg (ctx , LOG_INFO ,
@@ -2810,17 +2791,8 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
28102791 nfctx .trsvcid = (* ss )-> trsvcid ;
28112792 nfctx .host_iface = NULL ;
28122793
2813- struct fabric_args trcfg = {
2814- .subsysnqn = (* ss )-> subsys_nqn ,
2815- .transport = (* ss )-> transport ,
2816- .traddr = (* ss )-> traddr ,
2817- .trsvcid = (* ss )-> trsvcid ,
2818- .host_traddr = host_traddr ,
2819- .host_iface = NULL ,
2820- };
2821-
28222794 rr = nbft_connect (ctx , & nfctx , h , NULL ,
2823- * ss , & trcfg , fctx -> cfg );
2795+ * ss , fctx -> cfg );
28242796
28252797 /*
28262798 * With TCP/DHCP, it can happen that the OS
@@ -2830,11 +2802,10 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
28302802 if (rr == - ENVME_CONNECT_ADDRNOTAVAIL &&
28312803 !strcmp (nfctx .transport , "tcp" ) &&
28322804 strlen (hfi -> tcp_info .dhcp_server_ipaddr ) > 0 ) {
2833- trcfg .host_traddr = NULL ;
28342805 nfctx .host_traddr = NULL ;
28352806
28362807 rr = nbft_connect (ctx , & nfctx , h , NULL ,
2837- * ss , & trcfg , fctx -> cfg );
2808+ * ss , fctx -> cfg );
28382809
28392810 if (rr == 0 )
28402811 nvme_msg (ctx , LOG_INFO ,
@@ -2902,15 +2873,6 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
29022873 strdup (nvmf_get_default_trsvcid (
29032874 uri -> protocol , true));
29042875
2905- struct fabric_args trcfg = {
2906- .subsysnqn = NVME_DISC_SUBSYS_NAME ,
2907- .transport = uri -> protocol ,
2908- .traddr = uri -> host ,
2909- .trsvcid = trsvcid ,
2910- .host_traddr = host_traddr ,
2911- .host_iface = NULL ,
2912- };
2913-
29142876 nfctx .subsysnqn = NVME_DISC_SUBSYS_NAME ;
29152877 nfctx .transport = uri -> protocol ;
29162878 nfctx .traddr = uri -> host ;
@@ -2929,7 +2891,6 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
29292891 if (ret == - ENVME_CONNECT_ADDRNOTAVAIL &&
29302892 !strcmp (nfctx .transport , "tcp" ) &&
29312893 strlen (hfi -> tcp_info .dhcp_server_ipaddr ) > 0 ) {
2932- trcfg .host_traddr = NULL ;
29332894 nfctx .traddr = NULL ;
29342895 ret = nvmf_create_discovery_ctrl (ctx ,
29352896 & nfctx , h , fctx -> cfg , & c );
@@ -2944,8 +2905,7 @@ int nvmf_discovery_nbft(struct nvme_global_ctx *ctx,
29442905 goto out_free ;
29452906 }
29462907
2947- rr = nbft_discovery (ctx , & nfctx , * dd , h , c , fctx -> cfg ,
2948- & trcfg );
2908+ rr = nbft_discovery (ctx , & nfctx , * dd , h , c , fctx -> cfg );
29492909 if (!persistent )
29502910 nvme_disconnect_ctrl (c );
29512911 nvme_free_ctrl (c );
0 commit comments