Skip to content

Commit 085b90b

Browse files
martin-gpyigaw
authored andcommitted
fabrics: add helper to update tls and concat
Only --tls was properly updated in nbft_connect(), and not --concat. But this is properly done in nvmf_connect_disc_entry() already. So add a helper function to update both --tls and --concat and invoke the same from nvmf_connect_disc_entry() and nbft_connect() respectively. Signed-off-by: Martin George <[email protected]> [wagi: reformated the function to improve readability] (cherry picked from 99dd46fdff25) Signed-off-by: Daniel Wagner <[email protected]>
1 parent 64a0208 commit 085b90b

1 file changed

Lines changed: 30 additions & 12 deletions

File tree

src/nvme/fabrics.c

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,34 @@ int nvmf_connect_ctrl(nvme_ctrl_t c)
10111011
return 0;
10121012
}
10131013

1014+
static void nvmf_update_tls_concat(struct nvmf_disc_log_entry *e,
1015+
nvme_ctrl_t c, nvme_host_t h)
1016+
{
1017+
if (e->trtype != NVMF_TRTYPE_TCP ||
1018+
e->tsas.tcp.sectype == NVMF_TCP_SECTYPE_NONE)
1019+
return;
1020+
1021+
if (e->treq & NVMF_TREQ_REQUIRED) {
1022+
nvme_msg(h->r, LOG_DEBUG,
1023+
"setting --tls due to treq %s and sectype %s\n",
1024+
nvmf_treq_str(e->treq),
1025+
nvmf_sectype_str(e->tsas.tcp.sectype));
1026+
1027+
c->cfg.tls = true;
1028+
return;
1029+
}
1030+
1031+
if (e->treq & NVMF_TREQ_NOT_REQUIRED) {
1032+
nvme_msg(h->r, LOG_DEBUG,
1033+
"setting --concat due to treq %s and sectype %s\n",
1034+
nvmf_treq_str(e->treq),
1035+
nvmf_sectype_str(e->tsas.tcp.sectype));
1036+
1037+
c->cfg.concat = true;
1038+
return;
1039+
}
1040+
}
1041+
10141042
nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
10151043
struct nvmf_disc_log_entry *e,
10161044
const struct nvme_fabrics_config *cfg,
@@ -1109,18 +1137,8 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
11091137
nvmf_check_option(h->r, disable_sqflow))
11101138
c->cfg.disable_sqflow = true;
11111139

1112-
if (e->trtype == NVMF_TRTYPE_TCP &&
1113-
e->tsas.tcp.sectype != NVMF_TCP_SECTYPE_NONE) {
1114-
if (e->treq & NVMF_TREQ_REQUIRED) {
1115-
nvme_msg(h->r, LOG_DEBUG, "setting --tls due to treq %s and sectype %s\n",
1116-
nvmf_treq_str(e->treq), nvmf_sectype_str(e->tsas.tcp.sectype));
1117-
c->cfg.tls = true;
1118-
} else if (e->treq & NVMF_TREQ_NOT_REQUIRED) {
1119-
nvme_msg(h->r, LOG_DEBUG, "setting --concat due to treq %s and sectype %s\n",
1120-
nvmf_treq_str(e->treq), nvmf_sectype_str(e->tsas.tcp.sectype));
1121-
c->cfg.concat = true;
1122-
}
1123-
}
1140+
/* update tls or concat */
1141+
nvmf_update_tls_concat(e, c, h);
11241142

11251143
ret = nvmf_add_ctrl(h, c, cfg);
11261144
if (!ret)

0 commit comments

Comments
 (0)