nvme-rdma: assign completion vector correctly
authorMax Gurtovoy <maxg@mellanox.com>
Tue, 23 Jun 2020 14:55:25 +0000 (17:55 +0300)
committerChristoph Hellwig <hch@lst.de>
Wed, 24 Jun 2020 16:41:19 +0000 (18:41 +0200)
The completion vector index that is given during CQ creation can't
exceed the number of support vectors by the underlying RDMA device. This
violation currently can accure, for example, in case one will try to
connect with N regular read/write queues and M poll queues and the sum
of N + M > num_supported_vectors. This will lead to failure in establish
a connection to remote target. Instead, in that case, share a completion
vector between queues.

Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/rdma.c

index f8f856dc0c67bdacea1f7f45701ddaffa3a5b36c..13506a87a44443f72c1bc5d456c56ebc2612f481 100644 (file)
@@ -470,7 +470,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue)
         * Spread I/O queues completion vectors according their queue index.
         * Admin queues can always go on completion vector 0.
         */
-       comp_vector = idx == 0 ? idx : idx - 1;
+       comp_vector = (idx == 0 ? idx : idx - 1) % ibdev->num_comp_vectors;
 
        /* Polling queues need direct cq polling context */
        if (nvme_rdma_poll_queue(queue))