Commit 02cb00e2 authored by Max Gurtovoy's avatar Max Gurtovoy Committed by Keith Busch

nvmet: Add get_mdts op for controllers

Some transports, such as RDMA, would like to set the Maximum Data
Transfer Size (MDTS) according to device/port/ctrl characteristics.
This will enable the transport to set the optimal MDTS according to
controller needs and device capabilities. Add a new nvmet transport
op that is called during ctrl identification. This will not effect
transports that don't implement this option. The return value of the new
op is according to the NVMe spec definition for MDTS.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarMax Gurtovoy <maxg@mellanox.com>
Signed-off-by: default avatarIsrael Rukshin <israelr@mellanox.com>
parent 2db24e4a
...@@ -369,8 +369,12 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) ...@@ -369,8 +369,12 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
/* we support multiple ports, multiples hosts and ANA: */ /* we support multiple ports, multiples hosts and ANA: */
id->cmic = (1 << 0) | (1 << 1) | (1 << 3); id->cmic = (1 << 0) | (1 << 1) | (1 << 3);
/* no limit on data transfer sizes for now */ /* Limit MDTS according to transport capability */
id->mdts = 0; if (ctrl->ops->get_mdts)
id->mdts = ctrl->ops->get_mdts(ctrl);
else
id->mdts = 0;
id->cntlid = cpu_to_le16(ctrl->cntlid); id->cntlid = cpu_to_le16(ctrl->cntlid);
id->ver = cpu_to_le32(ctrl->subsys->ver); id->ver = cpu_to_le32(ctrl->subsys->ver);
......
...@@ -289,6 +289,7 @@ struct nvmet_fabrics_ops { ...@@ -289,6 +289,7 @@ struct nvmet_fabrics_ops {
struct nvmet_port *port, char *traddr); struct nvmet_port *port, char *traddr);
u16 (*install_queue)(struct nvmet_sq *nvme_sq); u16 (*install_queue)(struct nvmet_sq *nvme_sq);
void (*discovery_chg)(struct nvmet_port *port); void (*discovery_chg)(struct nvmet_port *port);
u8 (*get_mdts)(const struct nvmet_ctrl *ctrl);
}; };
#define NVMET_MAX_INLINE_BIOVEC 8 #define NVMET_MAX_INLINE_BIOVEC 8
......
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