Lines Matching refs:trid

36 	(spdk_nvme_trtype_is_fabrics(nvme_ctrlr->active_path_id->trid.trtype) ? \
37 nvme_ctrlr->active_path_id->trid.subnqn : nvme_ctrlr->active_path_id->trid.traddr)
145 struct spdk_nvme_transport_id trid;
317 const struct spdk_nvme_transport_id *trid, const char *hostnqn)
324 if (spdk_nvme_transport_id_compare(trid, &nvme_ctrlr->active_path_id->trid) == 0 &&
394 nvme_ctrlr_get(const struct spdk_nvme_transport_id *trid, const char *hostnqn)
401 nvme_ctrlr = nvme_bdev_ctrlr_get_ctrlr(nbdev_ctrlr, trid, hostnqn);
566 nvme_bdev_dump_trid_json(const struct spdk_nvme_transport_id *trid, struct spdk_json_write_ctx *w)
571 trtype_str = spdk_nvme_transport_id_trtype_str(trid->trtype);
576 adrfam_str = spdk_nvme_transport_id_adrfam_str(trid->adrfam);
581 if (trid->traddr[0] != '\0') {
582 spdk_json_write_named_string(w, "traddr", trid->traddr);
585 if (trid->trsvcid[0] != '\0') {
586 spdk_json_write_named_string(w, "trsvcid", trid->trsvcid);
589 if (trid->subnqn[0] != '\0') {
590 spdk_json_write_named_string(w, "subnqn", trid->subnqn);
2021 /* This function marks the current trid as failed by storing the current ticks
2022 * and then sets the next trid to the active trid within a controller if exists.
2025 * the current trid now to try connecting the next trid.
2038 /* Update the last failed time. It means the trid is failed if its last
2044 /* There is no alternate trid within a controller. */
2050 * the next trid will be done by the next bdev_nvme_failover_ctrlr() call.
2055 assert(path_id->trid.trtype != SPDK_NVME_TRANSPORT_PCIE);
2058 path_id->trid.traddr, path_id->trid.trsvcid,
2059 next_path->trid.traddr, next_path->trid.trsvcid);
2063 rc = spdk_nvme_ctrlr_set_trid(nvme_ctrlr->ctrlr, &next_path->trid);
2067 /** Shuffle the old trid to the end of the list and use the new one.
2076 /* bdev_nvme_failover_ctrlr() is just called or the next trid is not failed
2077 * or used yet. Try the next trid now.
2084 /* Enough backoff passed since the next trid failed. Try the next trid now. */
2088 /* The next trid will be tried after reconnect_delay_sec seconds. */
2253 /* Connecting the active trid failed. Set the next alternate trid to the
2254 * active trid if it exists.
2257 /* The next alternate trid exists and is ready to try. Try it now. */
2260 NVME_CTRLR_INFOLOG(nvme_ctrlr, "Try the next alternate trid %s:%s now.\n",
2261 nvme_ctrlr->active_path_id->trid.traddr,
2262 nvme_ctrlr->active_path_id->trid.trsvcid);
2268 /* We came here if there is no alternate trid or if the next trid exists but
2269 * is not ready to try. We will try the active trid after reconnect_delay_sec
2273 /* Connecting the active trid succeeded. Clear the last failed time because it
2274 * means the trid is failed if its last failed time is non-zero.
2477 struct spdk_nvme_transport_id *trid;
2495 trid = &nvme_ctrlr->active_path_id->trid;
2497 if (spdk_nvme_trtype_is_fabrics(trid->trtype)) {
2499 trid->traddr, trid->trsvcid);
3928 struct spdk_nvme_transport_id *trid;
3947 trid = &nvme_ctrlr->active_path_id->trid;
3948 spdk_json_write_named_object_begin(w, "trid");
3949 nvme_bdev_dump_trid_json(trid, w);
3956 trid = &path_id->trid;
3958 nvme_bdev_dump_trid_json(trid, w);
3990 const struct spdk_nvme_transport_id *trid;
4003 trid = spdk_nvme_ctrlr_get_transport_id(ctrlr);
4008 if (trid->trtype == SPDK_NVME_TRANSPORT_PCIE) {
4009 spdk_json_write_named_string(w, "pci_address", trid->traddr);
4012 spdk_json_write_named_object_begin(w, "trid");
4014 nvme_bdev_dump_trid_json(trid, w);
4702 hotplug_probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
4708 if (spdk_nvme_transport_id_compare(trid, &entry->trid) == 0) {
4719 SPDK_DEBUGLOG(bdev_nvme, "Attaching to %s\n", trid->traddr);
4757 if (nvme_ctrlr->active_path_id->trid.trtype == SPDK_NVME_TRANSPORT_PCIE || qpair != NULL) {
5660 struct spdk_nvme_transport_id *trid = &nvme_ctrlr->active_path_id->trid;
5662 if (spdk_nvme_trtype_is_fabrics(trid->trtype)) {
5664 trid->traddr, trid->trsvcid);
5846 const struct spdk_nvme_transport_id *trid,
5921 SPDK_ERRLOG("Failed to allocate trid entry pointer\n");
5926 path_id->trid = *trid;
6022 attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
6033 if (nvme_ctrlr_create(ctrlr, name, trid, NULL) == 0) {
6034 SPDK_DEBUGLOG(bdev_nvme, "Attached to %s (%s)\n", trid->traddr, name);
6036 SPDK_ERRLOG("Failed to attach to %s (%s)\n", trid->traddr, name);
6062 nvme_ctrlr->active_path_id->trid.trtype == SPDK_NVME_TRANSPORT_PCIE) {
6067 entry->trid = nvme_ctrlr->active_path_id->trid;
6417 struct spdk_nvme_transport_id *trid)
6421 if (trid->trtype == SPDK_NVME_TRANSPORT_PCIE) {
6427 if (nvme_ctrlr->active_path_id->trid.trtype != trid->trtype) {
6430 spdk_nvme_transport_id_trtype_str(nvme_ctrlr->active_path_id->trid.trtype),
6431 spdk_nvme_transport_id_trtype_str(trid->trtype));
6437 if (strncmp(trid->subnqn, nvme_ctrlr->active_path_id->trid.subnqn, SPDK_NVMF_NQN_MAX_LEN)) {
6440 nvme_ctrlr->active_path_id->trid.subnqn, trid->subnqn);
6446 if (!spdk_nvme_transport_id_compare(&tmp_trid->trid, trid)) {
6448 trid->traddr, trid->subnqn);
6480 struct spdk_nvme_transport_id *trid)
6488 new_trid->trid = *trid;
6494 /* Skip the active trid not to replace it until it is failed. */
6500 /* It means the trid is faled if its last failed time is non-zero.
6501 * Insert the new alternate trid before any failed trid.
6522 struct spdk_nvme_transport_id *trid)
6530 rc = bdev_nvme_check_secondary_trid(nvme_ctrlr, new_ctrlr, trid);
6540 rc = _bdev_nvme_add_secondary_trid(nvme_ctrlr, trid);
6551 connect_attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
6561 rc = nvme_ctrlr_create(ctrlr, ctx->base_name, &ctx->trid, ctx);
6570 connect_set_failover_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
6584 rc = bdev_nvme_add_secondary_trid(nvme_ctrlr, ctrlr, &ctx->trid);
6665 spdk_bdev_nvme_create(struct spdk_nvme_transport_id *trid,
6683 if (nvme_ctrlr_get(trid, drv_opts->hostnqn) != NULL) {
6684 SPDK_ERRLOG("A controller with the provided trid (traddr: %s, hostnqn: %s) "
6685 "already exists.\n", trid->traddr, drv_opts->hostnqn);
6716 ctx->trid = *trid;
6724 if (trid->trtype == SPDK_NVME_TRANSPORT_PCIE) {
6726 if (spdk_nvme_transport_id_compare(trid, &entry->trid) == 0) {
6742 if (trid->trtype == SPDK_NVME_TRANSPORT_PCIE) {
6799 ctx->probe_ctx = spdk_nvme_connect_async(trid, &ctx->drv_opts, attach_cb);
6801 SPDK_ERRLOG("No controller was found with provided trid (traddr: %s)\n", trid->traddr);
6831 if (path_id->trid.trtype != 0) {
6832 if (path_id->trid.trtype == SPDK_NVME_TRANSPORT_CUSTOM) {
6833 if (strcasecmp(path_id->trid.trstring, p->trid.trstring) != 0) {
6837 if (path_id->trid.trtype != p->trid.trtype) {
6843 if (!spdk_mem_all_zero(path_id->trid.traddr, sizeof(path_id->trid.traddr))) {
6844 if (strcasecmp(path_id->trid.traddr, p->trid.traddr) != 0) {
6849 if (path_id->trid.adrfam != 0) {
6850 if (path_id->trid.adrfam != p->trid.adrfam) {
6855 if (!spdk_mem_all_zero(path_id->trid.trsvcid, sizeof(path_id->trid.trsvcid))) {
6856 if (strcasecmp(path_id->trid.trsvcid, p->trid.trsvcid) != 0) {
6861 if (!spdk_mem_all_zero(path_id->trid.subnqn, sizeof(path_id->trid.subnqn))) {
6862 if (strcmp(path_id->trid.subnqn, p->trid.subnqn) != 0) {
7070 SPDK_INFOLOG(bdev_nvme, "Discovery[%s:%s] " format, ctx->trid.traddr, ctx->trid.trsvcid, ##__VA_ARGS__);
7073 SPDK_ERRLOG("Discovery[%s:%s] " format, ctx->trid.traddr, ctx->trid.trsvcid, ##__VA_ARGS__);
7077 struct spdk_nvme_transport_id trid;
7092 struct spdk_nvme_transport_id trid;
7164 build_trid_from_log_page_entry(struct spdk_nvme_transport_id *trid,
7169 trid->trtype = entry->trtype;
7170 trid->adrfam = entry->adrfam;
7171 memcpy(trid->traddr, entry->traddr, sizeof(entry->traddr));
7172 memcpy(trid->trsvcid, entry->trsvcid, sizeof(entry->trsvcid));
7173 /* Because the source buffer (entry->subnqn) is longer than trid->subnqn, and
7174 * before call to this function trid->subnqn is zeroed out, we need
7175 * to copy sizeof(trid->subnqn) minus one byte to make sure the last character
7178 memcpy(trid->subnqn, entry->subnqn, sizeof(trid->subnqn) - 1);
7185 space = strchr(trid->traddr, ' ');
7189 space = strchr(trid->trsvcid, ' ');
7193 space = strchr(trid->subnqn, ' ');
7216 path.trid = entry_ctx->trid;
7253 struct spdk_nvme_transport_id trid = {};
7260 build_trid_from_log_page_entry(&trid, &entry_ctx->entry);
7261 if (spdk_nvme_transport_id_compare(&trid, &path_id->trid) != 0) {
7268 trid.subnqn, trid.traddr, trid.trsvcid);
7306 path.trid = entry_ctx->trid;
7349 create_discovery_entry_ctx(struct discovery_ctx *ctx, struct spdk_nvme_transport_id *trid)
7360 memcpy(&new_ctx->trid, trid, sizeof(*trid));
7394 struct spdk_nvme_transport_id trid = {};
7396 build_trid_from_log_page_entry(&trid, new_entry);
7397 new_ctx = create_discovery_entry_ctx(ctx, &trid);
7437 build_trid_from_log_page_entry(&new_ctx->trid, new_entry);
7441 new_ctx->trid.subnqn, new_ctx->trid.traddr, new_ctx->trid.trsvcid,
7446 new_ctx->trid.subnqn, new_ctx->trid.traddr, new_ctx->trid.trsvcid,
7451 rc = spdk_bdev_nvme_create(&new_ctx->trid, new_ctx->name, NULL, 0,
7508 discovery_attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
7533 struct spdk_nvme_transport_id *trid;
7572 trid = &ctx->entry_ctx_in_use->trid;
7579 ctx->probe_ctx = spdk_nvme_connect_async(trid, &ctx->drv_opts, discovery_attach_cb);
7649 bdev_nvme_start_discovery(struct spdk_nvme_transport_id *trid,
7660 snprintf(trid->subnqn, sizeof(trid->subnqn), "%s", SPDK_NVMF_DISCOVERY_NQN);
7667 if (!spdk_nvme_transport_id_compare(trid, &ctx->entry_ctx_in_use->trid)) {
7673 if (!spdk_nvme_transport_id_compare(trid, &discovery_entry_ctx->trid)) {
7709 memcpy(&ctx->trid, trid, sizeof(*trid));
7716 discovery_entry_ctx = create_discovery_entry_ctx(ctx, trid);
8908 struct spdk_nvme_transport_id trid;
8918 trid = ctx->trid;
8919 memset(trid.subnqn, 0, sizeof(trid.subnqn));
8920 nvme_bdev_dump_trid_json(&trid, w);
8962 struct spdk_nvme_transport_id *trid;
8973 trid = &path_id->trid;
8981 nvme_bdev_dump_trid_json(trid, w);
9372 const struct spdk_nvme_transport_id *trid;
9380 trid = spdk_nvme_ctrlr_get_transport_id(nvme_ctrlr->ctrlr);
9388 spdk_json_write_named_string(w, "trtype", trid->trstring);
9389 spdk_json_write_named_string(w, "traddr", trid->traddr);
9390 if (trid->trsvcid[0] != '\0') {
9391 spdk_json_write_named_string(w, "trsvcid", trid->trsvcid);
9393 adrfam_str = spdk_nvme_transport_id_adrfam_str(trid->adrfam);
9413 spdk_json_write_named_object_begin(w, "trid");
9414 nvme_bdev_dump_trid_json(&ctx->trid, w);
9420 spdk_json_write_named_object_begin(w, "trid");
9421 nvme_bdev_dump_trid_json(&entry_ctx->trid, w);