Commit ed262287 authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford

IB/srpt: Rename a local variable, a member variable and a constant

Rename rsp_size into max_rsp_size and SRPT_RQ_SIZE into MAX_SRPT_RQ_SIZE.
The new names better reflect the role of this member variable and constant.
Since the prefix "srp_" is superfluous in the context of the function
that creates an RDMA channel, rename srp_sq_size into sq_size.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent f8781a53
...@@ -325,7 +325,7 @@ static void srpt_get_ioc(struct srpt_port *sport, u32 slot, ...@@ -325,7 +325,7 @@ static void srpt_get_ioc(struct srpt_port *sport, u32 slot,
if (sdev->use_srq) if (sdev->use_srq)
send_queue_depth = sdev->srq_size; send_queue_depth = sdev->srq_size;
else else
send_queue_depth = min(SRPT_RQ_SIZE, send_queue_depth = min(MAX_SRPT_RQ_SIZE,
sdev->device->attrs.max_qp_wr); sdev->device->attrs.max_qp_wr);
memset(iocp, 0, sizeof(*iocp)); memset(iocp, 0, sizeof(*iocp));
...@@ -1693,7 +1693,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) ...@@ -1693,7 +1693,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
struct srpt_port *sport = ch->sport; struct srpt_port *sport = ch->sport;
struct srpt_device *sdev = sport->sdev; struct srpt_device *sdev = sport->sdev;
const struct ib_device_attr *attrs = &sdev->device->attrs; const struct ib_device_attr *attrs = &sdev->device->attrs;
u32 srp_sq_size = sport->port_attrib.srp_sq_size; int sq_size = sport->port_attrib.srp_sq_size;
int i, ret; int i, ret;
WARN_ON(ch->rq_size < 1); WARN_ON(ch->rq_size < 1);
...@@ -1704,12 +1704,12 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) ...@@ -1704,12 +1704,12 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
goto out; goto out;
retry: retry:
ch->cq = ib_alloc_cq(sdev->device, ch, ch->rq_size + srp_sq_size, ch->cq = ib_alloc_cq(sdev->device, ch, ch->rq_size + sq_size,
0 /* XXX: spread CQs */, IB_POLL_WORKQUEUE); 0 /* XXX: spread CQs */, IB_POLL_WORKQUEUE);
if (IS_ERR(ch->cq)) { if (IS_ERR(ch->cq)) {
ret = PTR_ERR(ch->cq); ret = PTR_ERR(ch->cq);
pr_err("failed to create CQ cqe= %d ret= %d\n", pr_err("failed to create CQ cqe= %d ret= %d\n",
ch->rq_size + srp_sq_size, ret); ch->rq_size + sq_size, ret);
goto out; goto out;
} }
...@@ -1727,8 +1727,8 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) ...@@ -1727,8 +1727,8 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
* both both, as RDMA contexts will also post completions for the * both both, as RDMA contexts will also post completions for the
* RDMA READ case. * RDMA READ case.
*/ */
qp_init->cap.max_send_wr = min(srp_sq_size / 2, attrs->max_qp_wr + 0U); qp_init->cap.max_send_wr = min(sq_size / 2, attrs->max_qp_wr);
qp_init->cap.max_rdma_ctxs = srp_sq_size / 2; qp_init->cap.max_rdma_ctxs = sq_size / 2;
qp_init->cap.max_send_sge = min(attrs->max_sge, SRPT_MAX_SG_PER_WQE); qp_init->cap.max_send_sge = min(attrs->max_sge, SRPT_MAX_SG_PER_WQE);
qp_init->port_num = ch->sport->port; qp_init->port_num = ch->sport->port;
if (sdev->use_srq) { if (sdev->use_srq) {
...@@ -1742,8 +1742,8 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) ...@@ -1742,8 +1742,8 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
if (IS_ERR(ch->qp)) { if (IS_ERR(ch->qp)) {
ret = PTR_ERR(ch->qp); ret = PTR_ERR(ch->qp);
if (ret == -ENOMEM) { if (ret == -ENOMEM) {
srp_sq_size /= 2; sq_size /= 2;
if (srp_sq_size >= MIN_SRPT_SQ_SIZE) { if (sq_size >= MIN_SRPT_SQ_SIZE) {
ib_destroy_cq(ch->cq); ib_destroy_cq(ch->cq);
goto retry; goto retry;
} }
...@@ -1950,7 +1950,7 @@ static void srpt_release_channel_work(struct work_struct *w) ...@@ -1950,7 +1950,7 @@ static void srpt_release_channel_work(struct work_struct *w)
srpt_free_ioctx_ring((struct srpt_ioctx **)ch->ioctx_ring, srpt_free_ioctx_ring((struct srpt_ioctx **)ch->ioctx_ring,
ch->sport->sdev, ch->rq_size, ch->sport->sdev, ch->rq_size,
ch->rsp_size, DMA_TO_DEVICE); ch->max_rsp_size, DMA_TO_DEVICE);
srpt_free_ioctx_ring((struct srpt_ioctx **)ch->ioctx_recv_ring, srpt_free_ioctx_ring((struct srpt_ioctx **)ch->ioctx_recv_ring,
sdev, ch->rq_size, sdev, ch->rq_size,
...@@ -2098,16 +2098,16 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2098,16 +2098,16 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
* depth to avoid that the initiator driver has to report QUEUE_FULL * depth to avoid that the initiator driver has to report QUEUE_FULL
* to the SCSI mid-layer. * to the SCSI mid-layer.
*/ */
ch->rq_size = min(SRPT_RQ_SIZE, sdev->device->attrs.max_qp_wr); ch->rq_size = min(MAX_SRPT_RQ_SIZE, sdev->device->attrs.max_qp_wr);
spin_lock_init(&ch->spinlock); spin_lock_init(&ch->spinlock);
ch->state = CH_CONNECTING; ch->state = CH_CONNECTING;
INIT_LIST_HEAD(&ch->cmd_wait_list); INIT_LIST_HEAD(&ch->cmd_wait_list);
ch->rsp_size = ch->sport->port_attrib.srp_max_rsp_size; ch->max_rsp_size = ch->sport->port_attrib.srp_max_rsp_size;
ch->ioctx_ring = (struct srpt_send_ioctx **) ch->ioctx_ring = (struct srpt_send_ioctx **)
srpt_alloc_ioctx_ring(ch->sport->sdev, ch->rq_size, srpt_alloc_ioctx_ring(ch->sport->sdev, ch->rq_size,
sizeof(*ch->ioctx_ring[0]), sizeof(*ch->ioctx_ring[0]),
ch->rsp_size, DMA_TO_DEVICE); ch->max_rsp_size, DMA_TO_DEVICE);
if (!ch->ioctx_ring) if (!ch->ioctx_ring)
goto free_ch; goto free_ch;
...@@ -2235,7 +2235,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2235,7 +2235,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
free_ring: free_ring:
srpt_free_ioctx_ring((struct srpt_ioctx **)ch->ioctx_ring, srpt_free_ioctx_ring((struct srpt_ioctx **)ch->ioctx_ring,
ch->sport->sdev, ch->rq_size, ch->sport->sdev, ch->rq_size,
ch->rsp_size, DMA_TO_DEVICE); ch->max_rsp_size, DMA_TO_DEVICE);
free_ch: free_ch:
kfree(ch); kfree(ch);
......
...@@ -114,7 +114,7 @@ enum { ...@@ -114,7 +114,7 @@ enum {
MIN_SRPT_SQ_SIZE = 16, MIN_SRPT_SQ_SIZE = 16,
DEF_SRPT_SQ_SIZE = 4096, DEF_SRPT_SQ_SIZE = 4096,
SRPT_RQ_SIZE = 128, MAX_SRPT_RQ_SIZE = 128,
MIN_SRPT_SRQ_SIZE = 4, MIN_SRPT_SRQ_SIZE = 4,
DEFAULT_SRPT_SRQ_SIZE = 4095, DEFAULT_SRPT_SRQ_SIZE = 4095,
MAX_SRPT_SRQ_SIZE = 65535, MAX_SRPT_SRQ_SIZE = 65535,
...@@ -248,7 +248,7 @@ enum rdma_ch_state { ...@@ -248,7 +248,7 @@ enum rdma_ch_state {
* @zw_cqe: Zero-length write CQE. * @zw_cqe: Zero-length write CQE.
* @kref: kref for this channel. * @kref: kref for this channel.
* @rq_size: IB receive queue size. * @rq_size: IB receive queue size.
* @rsp_size: IB response message size in bytes. * @max_rsp_size: Maximum size of an RSP response message in bytes.
* @sq_wr_avail: number of work requests available in the send queue. * @sq_wr_avail: number of work requests available in the send queue.
* @sport: pointer to the information of the HCA port used by this * @sport: pointer to the information of the HCA port used by this
* channel. * channel.
...@@ -280,7 +280,7 @@ struct srpt_rdma_ch { ...@@ -280,7 +280,7 @@ struct srpt_rdma_ch {
struct ib_cqe zw_cqe; struct ib_cqe zw_cqe;
struct kref kref; struct kref kref;
int rq_size; int rq_size;
u32 rsp_size; u32 max_rsp_size;
atomic_t sq_wr_avail; atomic_t sq_wr_avail;
struct srpt_port *sport; struct srpt_port *sport;
u8 i_port_id[16]; u8 i_port_id[16];
......
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