File 0022-fabrics-add-default-port-number-for-NVMe-TCP-I-O-con.patch of Package nvme-cli.22025
From: Martin George <marting@netapp.com>
Date: Fri, 6 Aug 2021 17:35:20 +0530
Subject: fabrics: add default port number for NVMe/TCP I/O controllers
References: bsc#1189195 bsc#1187858
Git-commit: 362c90f364a8e96a2551e83e9fc5746bf4aed859
As per section 7.4.9.3 "Transport Service Identifier" of the NVMe over
Fabrics 1.1 specification, the default IANA port number for a NVMe/TCP
discovery controller is 8009. But at the same time, it also clearly
states that NVMe/TCP I/O controllers should not use TCP port number
8009, but may instead use 4420 as the default here.
So make sure to fill these values appropriately, and pass it down.
Signed-off-by: Martin George <marting@netapp.com>
---
fabrics.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
--- a/fabrics.c
+++ b/fabrics.c
@@ -905,11 +905,16 @@ static int build_options(char *argstr, i
return 0;
}
-static void discovery_trsvcid(struct config *cfg)
+static void discovery_trsvcid(struct config *cfg, bool discover)
{
if (!strcmp(cfg->transport, "tcp")) {
- /* Default port for NVMe/TCP discovery controllers */
- cfg->trsvcid = __stringify(NVME_DISC_IP_PORT);
+ if (discover) {
+ /* Default port for NVMe/TCP discovery controllers */
+ cfg->trsvcid = __stringify(NVME_DISC_IP_PORT);
+ } else {
+ /* Default port for NVMe/TCP io controllers */
+ cfg->trsvcid = __stringify(NVME_RDMA_IP_PORT);
+ }
} else if (!strcmp(cfg->transport, "rdma")) {
/* Default port for NVMe/RDMA controllers */
cfg->trsvcid = __stringify(NVME_RDMA_IP_PORT);
@@ -1292,7 +1297,7 @@ static int discover_from_conf_file(const
set_discovery_kato(&cfg);
if (!cfg.trsvcid)
- discovery_trsvcid(&cfg);
+ discovery_trsvcid(&cfg, true);
err = build_options(argstr, BUF_SIZE, true);
if (err) {
@@ -1361,7 +1366,7 @@ int discover(const char *desc, int argc,
set_discovery_kato(&cfg);
if (!cfg.trsvcid)
- discovery_trsvcid(&cfg);
+ discovery_trsvcid(&cfg, true);
ret = build_options(argstr, BUF_SIZE, true);
if (ret)
@@ -1407,6 +1412,9 @@ int connect(const char *desc, int argc,
if (ret)
goto out;
+ if (!cfg.trsvcid)
+ discovery_trsvcid(&cfg, false);
+
ret = build_options(argstr, BUF_SIZE, false);
if (ret)
goto out;