diff options
author | Bart Van Assche <bvanassche@acm.org> | 2018-10-08 17:28:45 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-10-17 02:58:29 -0400 |
commit | d3d0bc78be300098104d9fde9ca1330694a70f45 (patch) | |
tree | 0630a0644b03b6d46db303a1a450cce98f488e2d /drivers/nvme | |
parent | 76c910c7cf6d2d325c24439855a606cf1d414d29 (diff) |
nvme-fc: introduce struct nvme_fcp_op_w_sgl
This patch does not change any functionality but makes the intent of the
code more clear.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/host/fc.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index d838987fffe1..fdadc9464f6f 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <uapi/scsi/fc/fc_fs.h> | 20 | #include <uapi/scsi/fc/fc_fs.h> |
21 | #include <uapi/scsi/fc/fc_els.h> | 21 | #include <uapi/scsi/fc/fc_els.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/overflow.h> | ||
23 | 24 | ||
24 | #include "nvme.h" | 25 | #include "nvme.h" |
25 | #include "fabrics.h" | 26 | #include "fabrics.h" |
@@ -104,6 +105,12 @@ struct nvme_fc_fcp_op { | |||
104 | struct nvme_fc_ersp_iu rsp_iu; | 105 | struct nvme_fc_ersp_iu rsp_iu; |
105 | }; | 106 | }; |
106 | 107 | ||
108 | struct nvme_fcp_op_w_sgl { | ||
109 | struct nvme_fc_fcp_op op; | ||
110 | struct scatterlist sgl[SG_CHUNK_SIZE]; | ||
111 | uint8_t priv[0]; | ||
112 | }; | ||
113 | |||
107 | struct nvme_fc_lport { | 114 | struct nvme_fc_lport { |
108 | struct nvme_fc_local_port localport; | 115 | struct nvme_fc_local_port localport; |
109 | 116 | ||
@@ -1686,6 +1693,8 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl, | |||
1686 | struct nvme_fc_queue *queue, struct nvme_fc_fcp_op *op, | 1693 | struct nvme_fc_queue *queue, struct nvme_fc_fcp_op *op, |
1687 | struct request *rq, u32 rqno) | 1694 | struct request *rq, u32 rqno) |
1688 | { | 1695 | { |
1696 | struct nvme_fcp_op_w_sgl *op_w_sgl = | ||
1697 | container_of(op, typeof(*op_w_sgl), op); | ||
1689 | struct nvme_fc_cmd_iu *cmdiu = &op->cmd_iu; | 1698 | struct nvme_fc_cmd_iu *cmdiu = &op->cmd_iu; |
1690 | int ret = 0; | 1699 | int ret = 0; |
1691 | 1700 | ||
@@ -1695,7 +1704,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl, | |||
1695 | op->fcp_req.rspaddr = &op->rsp_iu; | 1704 | op->fcp_req.rspaddr = &op->rsp_iu; |
1696 | op->fcp_req.rsplen = sizeof(op->rsp_iu); | 1705 | op->fcp_req.rsplen = sizeof(op->rsp_iu); |
1697 | op->fcp_req.done = nvme_fc_fcpio_done; | 1706 | op->fcp_req.done = nvme_fc_fcpio_done; |
1698 | op->fcp_req.first_sgl = (struct scatterlist *)&op[1]; | 1707 | op->fcp_req.first_sgl = &op_w_sgl->sgl[0]; |
1699 | op->fcp_req.private = &op->fcp_req.first_sgl[SG_CHUNK_SIZE]; | 1708 | op->fcp_req.private = &op->fcp_req.first_sgl[SG_CHUNK_SIZE]; |
1700 | op->ctrl = ctrl; | 1709 | op->ctrl = ctrl; |
1701 | op->queue = queue; | 1710 | op->queue = queue; |
@@ -1734,12 +1743,12 @@ nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq, | |||
1734 | unsigned int hctx_idx, unsigned int numa_node) | 1743 | unsigned int hctx_idx, unsigned int numa_node) |
1735 | { | 1744 | { |
1736 | struct nvme_fc_ctrl *ctrl = set->driver_data; | 1745 | struct nvme_fc_ctrl *ctrl = set->driver_data; |
1737 | struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(rq); | 1746 | struct nvme_fcp_op_w_sgl *op = blk_mq_rq_to_pdu(rq); |
1738 | int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; | 1747 | int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; |
1739 | struct nvme_fc_queue *queue = &ctrl->queues[queue_idx]; | 1748 | struct nvme_fc_queue *queue = &ctrl->queues[queue_idx]; |
1740 | 1749 | ||
1741 | nvme_req(rq)->ctrl = &ctrl->ctrl; | 1750 | nvme_req(rq)->ctrl = &ctrl->ctrl; |
1742 | return __nvme_fc_init_request(ctrl, queue, op, rq, queue->rqcnt++); | 1751 | return __nvme_fc_init_request(ctrl, queue, &op->op, rq, queue->rqcnt++); |
1743 | } | 1752 | } |
1744 | 1753 | ||
1745 | static int | 1754 | static int |
@@ -2423,10 +2432,9 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) | |||
2423 | ctrl->tag_set.reserved_tags = 1; /* fabric connect */ | 2432 | ctrl->tag_set.reserved_tags = 1; /* fabric connect */ |
2424 | ctrl->tag_set.numa_node = NUMA_NO_NODE; | 2433 | ctrl->tag_set.numa_node = NUMA_NO_NODE; |
2425 | ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; | 2434 | ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; |
2426 | ctrl->tag_set.cmd_size = sizeof(struct nvme_fc_fcp_op) + | 2435 | ctrl->tag_set.cmd_size = |
2427 | (SG_CHUNK_SIZE * | 2436 | struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv, |
2428 | sizeof(struct scatterlist)) + | 2437 | ctrl->lport->ops->fcprqst_priv_sz); |
2429 | ctrl->lport->ops->fcprqst_priv_sz; | ||
2430 | ctrl->tag_set.driver_data = ctrl; | 2438 | ctrl->tag_set.driver_data = ctrl; |
2431 | ctrl->tag_set.nr_hw_queues = ctrl->ctrl.queue_count - 1; | 2439 | ctrl->tag_set.nr_hw_queues = ctrl->ctrl.queue_count - 1; |
2432 | ctrl->tag_set.timeout = NVME_IO_TIMEOUT; | 2440 | ctrl->tag_set.timeout = NVME_IO_TIMEOUT; |
@@ -3028,10 +3036,9 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, | |||
3028 | ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH; | 3036 | ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH; |
3029 | ctrl->admin_tag_set.reserved_tags = 2; /* fabric connect + Keep-Alive */ | 3037 | ctrl->admin_tag_set.reserved_tags = 2; /* fabric connect + Keep-Alive */ |
3030 | ctrl->admin_tag_set.numa_node = NUMA_NO_NODE; | 3038 | ctrl->admin_tag_set.numa_node = NUMA_NO_NODE; |
3031 | ctrl->admin_tag_set.cmd_size = sizeof(struct nvme_fc_fcp_op) + | 3039 | ctrl->admin_tag_set.cmd_size = |
3032 | (SG_CHUNK_SIZE * | 3040 | struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv, |
3033 | sizeof(struct scatterlist)) + | 3041 | ctrl->lport->ops->fcprqst_priv_sz); |
3034 | ctrl->lport->ops->fcprqst_priv_sz; | ||
3035 | ctrl->admin_tag_set.driver_data = ctrl; | 3042 | ctrl->admin_tag_set.driver_data = ctrl; |
3036 | ctrl->admin_tag_set.nr_hw_queues = 1; | 3043 | ctrl->admin_tag_set.nr_hw_queues = 1; |
3037 | ctrl->admin_tag_set.timeout = ADMIN_TIMEOUT; | 3044 | ctrl->admin_tag_set.timeout = ADMIN_TIMEOUT; |