nvme-fabrics: patch target code in prep for FC transport support
- Add FC transport type decoding - Add FC address family decoding Signed-off-by: James Smart <james.smart@broadcom.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Reviewed-by: Jay Freyensee <james_p_freyensee@linux.intel.com> Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
721b3917c4
commit
885aa4015f
@ -37,6 +37,8 @@ static ssize_t nvmet_addr_adrfam_show(struct config_item *item,
|
|||||||
return sprintf(page, "ipv6\n");
|
return sprintf(page, "ipv6\n");
|
||||||
case NVMF_ADDR_FAMILY_IB:
|
case NVMF_ADDR_FAMILY_IB:
|
||||||
return sprintf(page, "ib\n");
|
return sprintf(page, "ib\n");
|
||||||
|
case NVMF_ADDR_FAMILY_FC:
|
||||||
|
return sprintf(page, "fc\n");
|
||||||
default:
|
default:
|
||||||
return sprintf(page, "\n");
|
return sprintf(page, "\n");
|
||||||
}
|
}
|
||||||
@ -59,6 +61,8 @@ static ssize_t nvmet_addr_adrfam_store(struct config_item *item,
|
|||||||
port->disc_addr.adrfam = NVMF_ADDR_FAMILY_IP6;
|
port->disc_addr.adrfam = NVMF_ADDR_FAMILY_IP6;
|
||||||
} else if (sysfs_streq(page, "ib")) {
|
} else if (sysfs_streq(page, "ib")) {
|
||||||
port->disc_addr.adrfam = NVMF_ADDR_FAMILY_IB;
|
port->disc_addr.adrfam = NVMF_ADDR_FAMILY_IB;
|
||||||
|
} else if (sysfs_streq(page, "fc")) {
|
||||||
|
port->disc_addr.adrfam = NVMF_ADDR_FAMILY_FC;
|
||||||
} else {
|
} else {
|
||||||
pr_err("Invalid value '%s' for adrfam\n", page);
|
pr_err("Invalid value '%s' for adrfam\n", page);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -209,6 +213,8 @@ static ssize_t nvmet_addr_trtype_show(struct config_item *item,
|
|||||||
return sprintf(page, "rdma\n");
|
return sprintf(page, "rdma\n");
|
||||||
case NVMF_TRTYPE_LOOP:
|
case NVMF_TRTYPE_LOOP:
|
||||||
return sprintf(page, "loop\n");
|
return sprintf(page, "loop\n");
|
||||||
|
case NVMF_TRTYPE_FC:
|
||||||
|
return sprintf(page, "fc\n");
|
||||||
default:
|
default:
|
||||||
return sprintf(page, "\n");
|
return sprintf(page, "\n");
|
||||||
}
|
}
|
||||||
@ -229,6 +235,12 @@ static void nvmet_port_init_tsas_loop(struct nvmet_port *port)
|
|||||||
memset(&port->disc_addr.tsas, 0, NVMF_TSAS_SIZE);
|
memset(&port->disc_addr.tsas, 0, NVMF_TSAS_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nvmet_port_init_tsas_fc(struct nvmet_port *port)
|
||||||
|
{
|
||||||
|
port->disc_addr.trtype = NVMF_TRTYPE_FC;
|
||||||
|
memset(&port->disc_addr.tsas, 0, NVMF_TSAS_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
static ssize_t nvmet_addr_trtype_store(struct config_item *item,
|
static ssize_t nvmet_addr_trtype_store(struct config_item *item,
|
||||||
const char *page, size_t count)
|
const char *page, size_t count)
|
||||||
{
|
{
|
||||||
@ -244,6 +256,8 @@ static ssize_t nvmet_addr_trtype_store(struct config_item *item,
|
|||||||
nvmet_port_init_tsas_rdma(port);
|
nvmet_port_init_tsas_rdma(port);
|
||||||
} else if (sysfs_streq(page, "loop")) {
|
} else if (sysfs_streq(page, "loop")) {
|
||||||
nvmet_port_init_tsas_loop(port);
|
nvmet_port_init_tsas_loop(port);
|
||||||
|
} else if (sysfs_streq(page, "fc")) {
|
||||||
|
nvmet_port_init_tsas_fc(port);
|
||||||
} else {
|
} else {
|
||||||
pr_err("Invalid value '%s' for trtype\n", page);
|
pr_err("Invalid value '%s' for trtype\n", page);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
Loading…
Reference in New Issue
Block a user