Commit 9d025383 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

nvme: rename nqn fields in public API to subnqn



The discover and probe 'nqn' fields are subsystem NQNs, so name them
subnqn to be consistent with the spec and the rest of the code and to
distinguish them from host NQNs.

Change-Id: I4a80fbc1f4b037c8a4f91c8f28d2a96e47c66c47
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 89136259
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -406,9 +406,9 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_probe_inf
	cdata = spdk_nvme_ctrlr_get_data(ctrlr);

	printf("=====================================================\n");
	if (probe_info->nqn[0]) {
	if (probe_info->subnqn[0]) {
		printf("NVMe over Fabrics controller at %s:%s: %s\n",
		       probe_info->traddr, probe_info->trsvcid, probe_info->nqn);
		       probe_info->traddr, probe_info->trsvcid, probe_info->subnqn);
	} else {
		printf("NVMe Controller at %04x:%02x:%02x.%x [%04x:%04x]\n",
		       probe_info->pci_addr.domain, probe_info->pci_addr.bus,
@@ -874,7 +874,7 @@ parse_args(int argc, char **argv)
{
	int op, rc;

	info.nqn = SPDK_NVMF_DISCOVERY_NQN;
	info.subnqn = SPDK_NVMF_DISCOVERY_NQN;

	while ((op = getopt(argc, argv, "a:n:s:t:xH")) != -1) {
		switch (op) {
@@ -902,7 +902,7 @@ parse_args(int argc, char **argv)
			info.trsvcid = optarg;
			break;
		case 'n':
			info.nqn = optarg;
			info.subnqn = optarg;
			break;
		case 'H':
		default:
@@ -911,7 +911,7 @@ parse_args(int argc, char **argv)
		}
	}

	if (!info.traddr || !info.trsvcid || !info.nqn) {
	if (!info.traddr || !info.trsvcid || !info.subnqn) {
		return 0;
	}

@@ -920,7 +920,7 @@ parse_args(int argc, char **argv)
		return 0;
	}

	if (strlen(info.nqn) >= SPDK_NVMF_NQN_MAX_LEN) {
	if (strlen(info.subnqn) >= SPDK_NVMF_NQN_MAX_LEN) {
		printf("NQN must be less than %d bytes long\n", SPDK_NVMF_NQN_MAX_LEN);
		return 0;
	}
+2 −2
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ struct spdk_nvme_discover_info {
	/**
	 * Subsystem NQN of the NVMe over Fabrics discovery service.
	 */
	const char *nqn;
	const char *subnqn;

	/**
	 * Transport address of the NVMe over Fabrics discovery service. For transports which use IP
@@ -161,7 +161,7 @@ struct spdk_nvme_probe_info {
	 *
	 * If this is not an NVMe over Fabrics controller, this field will be a zero-length string.
	 */
	char nqn[SPDK_NVMF_NQN_MAX_LEN + 1];
	char subnqn[SPDK_NVMF_NQN_MAX_LEN + 1];

	/**
	 * NVMe over Fabrics transport type.
+1 −1
Original line number Diff line number Diff line
@@ -392,7 +392,7 @@ int spdk_nvme_discover(const struct spdk_nvme_discover_info *info, void *cb_ctx,
		       spdk_nvme_attach_cb attach_cb,
		       spdk_nvme_remove_cb remove_cb)
{
	if (!info || !info->traddr || !info->trsvcid || !info->nqn) {
	if (!info || !info->traddr || !info->trsvcid || !info->subnqn) {
		return -1;
	}

+6 −6
Original line number Diff line number Diff line
@@ -765,7 +765,7 @@ nvme_rdma_qpair_fabric_connect(struct nvme_rdma_qpair *rqpair)
	strncpy((char *)&nvmf_data->hostid, (char *)NVME_HOST_ID_DEFAULT,
		strlen((char *)NVME_HOST_ID_DEFAULT));
	strncpy((char *)nvmf_data->hostnqn, ctrlr->opts.hostnqn, sizeof(nvmf_data->hostnqn));
	strncpy((char *)nvmf_data->subnqn, ctrlr->probe_info.nqn, sizeof(nvmf_data->subnqn));
	strncpy((char *)nvmf_data->subnqn, ctrlr->probe_info.subnqn, sizeof(nvmf_data->subnqn));

	if (nvme_qpair_is_admin_queue(&rqpair->qpair)) {
		rc = spdk_nvme_ctrlr_cmd_admin_raw(ctrlr,
@@ -1060,7 +1060,7 @@ nvme_rdma_ctrlr_scan(enum spdk_nvme_transport transport,
	spdk_nvme_ctrlr_opts_set_defaults(&discovery_opts);

	probe_info.trtype = (uint8_t)transport;
	snprintf(probe_info.nqn, sizeof(probe_info.nqn), "%s", discover_info->nqn);
	snprintf(probe_info.subnqn, sizeof(probe_info.subnqn), "%s", discover_info->subnqn);
	snprintf(probe_info.traddr, sizeof(probe_info.traddr), "%s", discover_info->traddr);
	snprintf(probe_info.trsvcid, sizeof(probe_info.trsvcid), "%s", discover_info->trsvcid);

@@ -1116,8 +1116,8 @@ nvme_rdma_ctrlr_scan(enum spdk_nvme_transport transport,
			continue;
		}
		len = end - entry->subnqn;
		memcpy(probe_info.nqn, entry->subnqn, len);
		probe_info.nqn[len] = '\0';
		memcpy(probe_info.subnqn, entry->subnqn, len);
		probe_info.subnqn[len] = '\0';

		/* Convert traddr to a null terminated string. */
		len = spdk_strlen_pad(entry->traddr, sizeof(entry->traddr), ' ');
@@ -1127,8 +1127,8 @@ nvme_rdma_ctrlr_scan(enum spdk_nvme_transport transport,
		len = spdk_strlen_pad(entry->trsvcid, sizeof(entry->trsvcid), ' ');
		memcpy(probe_info.trsvcid, entry->trsvcid, len);

		SPDK_TRACELOG(SPDK_TRACE_DEBUG, "nqn=%s, trtype=%u, traddr=%s, trsvcid=%s\n", probe_info.nqn,
			      probe_info.trtype, probe_info.traddr, probe_info.trsvcid);
		SPDK_TRACELOG(SPDK_TRACE_DEBUG, "subnqn=%s, trtype=%u, traddr=%s, trsvcid=%s\n",
			      probe_info.subnqn, probe_info.trtype, probe_info.traddr, probe_info.trsvcid);
		/* Todo: need to differentiate the NVMe over fabrics to avoid duplicated connection */
		nvme_probe_one(entry->trtype, probe_cb, cb_ctx, &probe_info, NULL);
	}