Skip to content

Commit 096f3b2

Browse files
committed
tree: Remove default port setting for TCP and RDMA ports
When the controller is created, the discovery_ctrl attribute is not set yet. The caller is supposed to set this after the creation of the new discovery controller. Thus we can't really set the default port at this level. This is a bit of a chicken-egg situation. Move this work up to the caller to provide the correct defaults. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 451b365 commit 096f3b2

1 file changed

Lines changed: 0 additions & 21 deletions

File tree

src/nvme/tree.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -948,25 +948,6 @@ void nvme_free_ctrl(nvme_ctrl_t c)
948948
__nvme_free_ctrl(c);
949949
}
950950

951-
#define ____stringify(x...) #x
952-
#define __stringify(x...) ____stringify(x)
953-
954-
static void set_default_trsvcid(nvme_ctrl_t c)
955-
{
956-
if (!strcmp(c->transport, "tcp")) {
957-
if (c->discovery_ctrl) {
958-
/* Default port for NVMe/TCP discovery controllers */
959-
c->trsvcid = strdup(__stringify(NVME_DISC_IP_PORT));
960-
} else {
961-
/* Default port for NVMe/TCP io controllers */
962-
c->trsvcid = strdup(__stringify(NVME_RDMA_IP_PORT));
963-
}
964-
} else if (!strcmp(c->transport, "rdma")) {
965-
/* Default port for NVMe/RDMA controllers */
966-
c->trsvcid = strdup(__stringify(NVME_RDMA_IP_PORT));
967-
}
968-
}
969-
970951
static bool traddr_is_hostname(const char *transport, const char *traddr)
971952
{
972953
char addrstr[NVMF_TRADDR_SIZE];
@@ -1030,8 +1011,6 @@ struct nvme_ctrl *nvme_create_ctrl(nvme_root_t r,
10301011
c->cfg.host_iface = strdup(host_iface);
10311012
if (trsvcid)
10321013
c->trsvcid = strdup(trsvcid);
1033-
else
1034-
set_default_trsvcid(c);
10351014

10361015
return c;
10371016
}

0 commit comments

Comments
 (0)