@@ -1092,6 +1092,26 @@ __public int nvmf_connect_ctrl(nvme_ctrl_t c)
10921092 return 0 ;
10931093}
10941094
1095+ static void nvmf_update_tls_concat (struct nvmf_disc_log_entry * e ,
1096+ nvme_ctrl_t c , nvme_host_t h )
1097+ {
1098+ if (!e || !c || !h )
1099+ return ;
1100+
1101+ if (e -> trtype == NVMF_TRTYPE_TCP &&
1102+ e -> tsas .tcp .sectype != NVMF_TCP_SECTYPE_NONE ) {
1103+ if (e -> treq & NVMF_TREQ_REQUIRED ) {
1104+ nvme_msg (h -> ctx , LOG_DEBUG , "setting --tls due to treq %s and sectype %s\n" ,
1105+ nvmf_treq_str (e -> treq ), nvmf_sectype_str (e -> tsas .tcp .sectype ));
1106+ c -> cfg .tls = true;
1107+ } else if (e -> treq & NVMF_TREQ_NOT_REQUIRED ) {
1108+ nvme_msg (h -> ctx , LOG_DEBUG , "setting --concat due to treq %s and sectype %s\n" ,
1109+ nvmf_treq_str (e -> treq ), nvmf_sectype_str (e -> tsas .tcp .sectype ));
1110+ c -> cfg .concat = true;
1111+ }
1112+ }
1113+ }
1114+
10951115static int nvmf_connect_disc_entry (nvme_host_t h ,
10961116 struct nvmf_disc_log_entry * e ,
10971117 const char * host_traddr , const char * host_iface ,
@@ -1187,18 +1207,8 @@ static int nvmf_connect_disc_entry(nvme_host_t h,
11871207 nvmf_check_option (h -> ctx , disable_sqflow ))
11881208 c -> cfg .disable_sqflow = true;
11891209
1190- if (e -> trtype == NVMF_TRTYPE_TCP &&
1191- e -> tsas .tcp .sectype != NVMF_TCP_SECTYPE_NONE ) {
1192- if (e -> treq & NVMF_TREQ_REQUIRED ) {
1193- nvme_msg (h -> ctx , LOG_DEBUG , "setting --tls due to treq %s and sectype %s\n" ,
1194- nvmf_treq_str (e -> treq ), nvmf_sectype_str (e -> tsas .tcp .sectype ));
1195- c -> cfg .tls = true;
1196- } else if (e -> treq & NVMF_TREQ_NOT_REQUIRED ) {
1197- nvme_msg (h -> ctx , LOG_DEBUG , "setting --concat due to treq %s and sectype %s\n" ,
1198- nvmf_treq_str (e -> treq ), nvmf_sectype_str (e -> tsas .tcp .sectype ));
1199- c -> cfg .concat = true;
1200- }
1201- }
1210+ /* update tls or concat */
1211+ nvmf_update_tls_concat (e , c , h );
12021212
12031213 ret = nvmf_add_ctrl (h , c , cfg );
12041214 if (!ret ) {
@@ -2564,11 +2574,8 @@ static int nbft_connect(struct nvme_global_ctx *ctx,
25642574 if (ss && ss -> unavailable && saved_log_level < 1 )
25652575 nvme_set_logging_level (ctx , -1 , false, false);
25662576
2567- if (e ) {
2568- if (e -> trtype == NVMF_TRTYPE_TCP &&
2569- e -> tsas .tcp .sectype != NVMF_TCP_SECTYPE_NONE )
2570- cfg -> tls = true;
2571- }
2577+ /* Update tls or concat */
2578+ nvmf_update_tls_concat (e , c , h );
25722579
25732580 ret = nvmf_add_ctrl (h , c , cfg );
25742581
0 commit comments