-
Notifications
You must be signed in to change notification settings - Fork 61
nvme: Default to well-known tr_svcid values when not specified #1128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,7 +156,7 @@ static void parse_extra_args (const BDExtraArg **extra, struct nvme_fabrics_conf | |
| * @subsysnqn: The name for the NVMe subsystem to connect to. | ||
| * @transport: The network fabric used for a NVMe-over-Fabrics network. | ||
| * @transport_addr: (nullable): The network address of the Controller. For transports using IP addressing (e.g. `rdma`) this should be an IP-based address. | ||
| * @transport_svcid: (nullable): The transport service id. For transports using IP addressing (e.g. `rdma`) this field is the port number. By default, the IP port number for the `RDMA` transport is `4420`. | ||
| * @transport_svcid: (nullable): The transport service ID. For transports using IP addressing (e.g. `tcp`, `rdma`) this field is the port number. The default port number for the `tcp` and `rdma` transports is `4420` and `8009` respectively when the well-known Discovery NQN is specified. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The updated documentation for * @transport_svcid: (nullable): The transport service ID. For transports using IP addressing (e.g. `tcp`, `rdma`) this field is the port number. For `tcp` and `rdma` transports, this defaults to port `4420` for I/O controllers and `8009` for discovery controllers.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope. |
||
| * @host_traddr: (nullable): The network address used on the host to connect to the Controller. For TCP, this sets the source address on the socket. | ||
| * @host_iface: (nullable): The network interface used on the host to connect to the Controller (e.g. IP `eth1`, `enp2s0`). This forces the connection to be made on a specific interface instead of letting the system decide. | ||
| * @host_nqn: (nullable): Overrides the default Host NQN that identifies the NVMe Host. If this option is %NULL, the default is read from `/etc/nvme/hostnqn` first. | ||
|
|
@@ -300,6 +300,18 @@ gboolean bd_nvme_connect (const gchar *subsysnqn, const gchar *transport, const | |
| if (hostsymname) | ||
| nvme_host_set_hostsymname (host, hostsymname); | ||
|
|
||
| /* tr_svcid defaults */ | ||
| if (!transport_svcid) { | ||
| if (g_strcmp0 (transport, "tcp") == 0) { | ||
| if (g_strcmp0 (subsysnqn, NVME_DISC_SUBSYS_NAME) == 0) | ||
| transport_svcid = G_STRINGIFY (NVME_DISC_IP_PORT); | ||
| else | ||
| transport_svcid = G_STRINGIFY (NVME_RDMA_IP_PORT); | ||
| } else | ||
| if (g_strcmp0(transport, "rdma") == 0) | ||
| transport_svcid = G_STRINGIFY (NVME_RDMA_IP_PORT); | ||
|
Comment on lines
+305
to
+312
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current implementation for setting the default Additionally, the code structure can be simplified to avoid repetition and improve clarity. The I suggest refactoring this block to correctly handle both if (g_strcmp0(transport, "tcp") == 0 || g_strcmp0(transport, "rdma") == 0) {
if (g_strcmp0(subsysnqn, NVME_DISC_SUBSYS_NAME) == 0)
transport_svcid = G_STRINGIFY(NVME_DISC_IP_PORT);
else
transport_svcid = G_STRINGIFY(NVME_RDMA_IP_PORT);
}
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope. |
||
| } | ||
|
|
||
| ctrl = nvme_create_ctrl (root, subsysnqn, transport, transport_addr, host_traddr, host_iface, transport_svcid); | ||
| if (ctrl == NULL) { | ||
| _nvme_fabrics_errno_to_gerror (-1, errno, error); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated documentation for
@transport_svcidis a bit ambiguous. The use of 'respectively' could be misinterpreted to mean port4420fortcpand8009forrdma. A clearer phrasing would explicitly state which port is for I/O controllers and which is for discovery controllers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, that's what I do.