Skip to content

Commit 015ad2b

Browse files
pizhenweiChristoph Hellwig
authored andcommitted
nvme-rdma: minor cleanup in nvme_rdma_create_cq()
Before cleanup: enum ib_poll_context poll_ctx; if (nvme_rdma_poll_queue(queue)) { poll_ctx = IB_POLL_DIRECT; queue->ib_cq = ib_alloc_cq(ibdev, queue, queue->cq_size, comp_vector, poll_ctx); } else { poll_ctx = IB_POLL_SOFTIRQ; queue->ib_cq = ib_cq_pool_get(ibdev, queue->cq_size, comp_vector, poll_ctx); } After cleanup: if (nvme_rdma_poll_queue(queue)) queue->ib_cq = ib_alloc_cq(ibdev, queue, queue->cq_size, comp_vector, IB_POLL_DIRECT); else queue->ib_cq = ib_cq_pool_get(ibdev, queue->cq_size, comp_vector, IB_POLL_SOFTIRQ); IB_POLL_SOFTIRQ/IB_POLL_SOFTIRQ gets used directly in function, this seems more accessible. Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent d4f1d5f commit 015ad2b

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

drivers/nvme/host/rdma.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ static int nvme_rdma_create_cq(struct ib_device *ibdev,
464464
struct nvme_rdma_queue *queue)
465465
{
466466
int ret, comp_vector, idx = nvme_rdma_queue_idx(queue);
467-
enum ib_poll_context poll_ctx;
468467

469468
/*
470469
* Spread I/O queues completion vectors according their queue index.
@@ -473,15 +472,12 @@ static int nvme_rdma_create_cq(struct ib_device *ibdev,
473472
comp_vector = (idx == 0 ? idx : idx - 1) % ibdev->num_comp_vectors;
474473

475474
/* Polling queues need direct cq polling context */
476-
if (nvme_rdma_poll_queue(queue)) {
477-
poll_ctx = IB_POLL_DIRECT;
475+
if (nvme_rdma_poll_queue(queue))
478476
queue->ib_cq = ib_alloc_cq(ibdev, queue, queue->cq_size,
479-
comp_vector, poll_ctx);
480-
} else {
481-
poll_ctx = IB_POLL_SOFTIRQ;
477+
comp_vector, IB_POLL_DIRECT);
478+
else
482479
queue->ib_cq = ib_cq_pool_get(ibdev, queue->cq_size,
483-
comp_vector, poll_ctx);
484-
}
480+
comp_vector, IB_POLL_SOFTIRQ);
485481

486482
if (IS_ERR(queue->ib_cq)) {
487483
ret = PTR_ERR(queue->ib_cq);

0 commit comments

Comments
 (0)