Commit 6fa350f7 authored by Max Gurtovoy's avatar Max Gurtovoy Committed by Christoph Hellwig

nvmet: introduce flags member in nvmet_fabrics_ops

Replace has_keyed_sgls and metadata_support booleans with a flags member
that will be used for adding more features in the future.
Signed-off-by: default avatarMax Gurtovoy <maxg@mellanox.com>
Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: default avatarIsrael Rukshin <israelr@mellanox.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 4e102559
...@@ -427,7 +427,7 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) ...@@ -427,7 +427,7 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
id->awupf = 0; id->awupf = 0;
id->sgls = cpu_to_le32(1 << 0); /* we always support SGLs */ id->sgls = cpu_to_le32(1 << 0); /* we always support SGLs */
if (ctrl->ops->has_keyed_sgls) if (ctrl->ops->flags & NVMF_KEYED_SGLS)
id->sgls |= cpu_to_le32(1 << 2); id->sgls |= cpu_to_le32(1 << 2);
if (req->port->inline_data_size) if (req->port->inline_data_size)
id->sgls |= cpu_to_le32(1 << 20); id->sgls |= cpu_to_le32(1 << 20);
......
...@@ -336,7 +336,7 @@ int nvmet_enable_port(struct nvmet_port *port) ...@@ -336,7 +336,7 @@ int nvmet_enable_port(struct nvmet_port *port)
* If the user requested PI support and the transport isn't pi capable, * If the user requested PI support and the transport isn't pi capable,
* don't enable the port. * don't enable the port.
*/ */
if (port->pi_enable && !ops->metadata_support) { if (port->pi_enable && !(ops->flags & NVMF_METADATA_SUPPORTED)) {
pr_err("T10-PI is not supported by transport type %d\n", pr_err("T10-PI is not supported by transport type %d\n",
port->disc_addr.trtype); port->disc_addr.trtype);
ret = -EINVAL; ret = -EINVAL;
......
...@@ -277,7 +277,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req) ...@@ -277,7 +277,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
id->maxcmd = cpu_to_le16(NVMET_MAX_CMD); id->maxcmd = cpu_to_le16(NVMET_MAX_CMD);
id->sgls = cpu_to_le32(1 << 0); /* we always support SGLs */ id->sgls = cpu_to_le32(1 << 0); /* we always support SGLs */
if (ctrl->ops->has_keyed_sgls) if (ctrl->ops->flags & NVMF_KEYED_SGLS)
id->sgls |= cpu_to_le32(1 << 2); id->sgls |= cpu_to_le32(1 << 2);
if (req->port->inline_data_size) if (req->port->inline_data_size)
id->sgls |= cpu_to_le32(1 << 20); id->sgls |= cpu_to_le32(1 << 20);
......
...@@ -286,8 +286,9 @@ struct nvmet_fabrics_ops { ...@@ -286,8 +286,9 @@ struct nvmet_fabrics_ops {
struct module *owner; struct module *owner;
unsigned int type; unsigned int type;
unsigned int msdbd; unsigned int msdbd;
bool has_keyed_sgls : 1; unsigned int flags;
bool metadata_support : 1; #define NVMF_KEYED_SGLS (1 << 0)
#define NVMF_METADATA_SUPPORTED (1 << 1)
void (*queue_response)(struct nvmet_req *req); void (*queue_response)(struct nvmet_req *req);
int (*add_port)(struct nvmet_port *port); int (*add_port)(struct nvmet_port *port);
void (*remove_port)(struct nvmet_port *port); void (*remove_port)(struct nvmet_port *port);
......
...@@ -1970,8 +1970,7 @@ static const struct nvmet_fabrics_ops nvmet_rdma_ops = { ...@@ -1970,8 +1970,7 @@ static const struct nvmet_fabrics_ops nvmet_rdma_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.type = NVMF_TRTYPE_RDMA, .type = NVMF_TRTYPE_RDMA,
.msdbd = 1, .msdbd = 1,
.has_keyed_sgls = 1, .flags = NVMF_KEYED_SGLS | NVMF_METADATA_SUPPORTED,
.metadata_support = 1,
.add_port = nvmet_rdma_add_port, .add_port = nvmet_rdma_add_port,
.remove_port = nvmet_rdma_remove_port, .remove_port = nvmet_rdma_remove_port,
.queue_response = nvmet_rdma_queue_response, .queue_response = nvmet_rdma_queue_response,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment