]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
RDMA/hns: Bugfix for reserved qp number
authorLijun Ou <oulijun@huawei.com>
Sun, 30 Sep 2018 09:00:28 +0000 (17:00 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 3 Oct 2018 22:21:17 +0000 (16:21 -0600)
It needs to include two special qps for every port. The hip08 have four
ports and the all reserved qp numbers are eight.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hns/hns_roce_device.h
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.h
drivers/infiniband/hw/hns/hns_roce_qp.c

index ffa92550dbfadcb46c708c1a4a1a5c11f4519ee1..34f8e90c8044c33db24001ee2977d3bf7f49fd12 100644 (file)
@@ -671,6 +671,7 @@ struct hns_roce_caps {
        u32             max_sq_inline;  /* 32 */
        u32             max_rq_sg;      /* 2 */
        int             num_qps;        /* 256k */
+       int             reserved_qps;
        u32             max_wqes;       /* 16k */
        u32             max_sq_desc_sz; /* 64 */
        u32             max_rq_desc_sz; /* 64 */
index 8136dd85845eb71d1359950408b87aba1ee82531..e4d98a1f7e82f98511f7f04de70ed6638a364b6f 100644 (file)
@@ -1219,6 +1219,7 @@ static int hns_roce_v2_profile(struct hns_roce_dev *hr_dev)
        caps->reserved_mrws     = 1;
        caps->reserved_uars     = 0;
        caps->reserved_cqs      = 0;
+       caps->reserved_qps      = HNS_ROCE_V2_RSV_QPS;
 
        caps->qpc_ba_pg_sz      = 0;
        caps->qpc_buf_pg_sz     = 0;
index 712542657c64c6b05787a26fb473303fc182ad24..18775813cf13bcf4935ca48c81f4c93782fec2b5 100644 (file)
@@ -78,6 +78,7 @@
 #define HNS_ROCE_INVALID_LKEY                  0x100
 #define HNS_ROCE_CMQ_TX_TIMEOUT                        30000
 #define HNS_ROCE_V2_UC_RC_SGE_NUM_IN_WQE       2
+#define HNS_ROCE_V2_RSV_QPS                    8
 
 #define HNS_ROCE_CONTEXT_HOP_NUM               1
 #define HNS_ROCE_MTT_HOP_NUM                   1
index 0378fc41fcfafac351ddd16c84c04634e0fe048e..0e0c79609b0c9fc438b69efc3d9b82d1e3917d7b 100644 (file)
@@ -1106,14 +1106,20 @@ int hns_roce_init_qp_table(struct hns_roce_dev *hr_dev)
 {
        struct hns_roce_qp_table *qp_table = &hr_dev->qp_table;
        int reserved_from_top = 0;
+       int reserved_from_bot;
        int ret;
 
        spin_lock_init(&qp_table->lock);
        INIT_RADIX_TREE(&hr_dev->qp_table_tree, GFP_ATOMIC);
 
-       /* A port include two SQP, six port total 12 */
+       /* In hw v1, a port include two SQP, six ports total 12 */
+       if (hr_dev->caps.max_sq_sg <= 2)
+               reserved_from_bot = SQP_NUM;
+       else
+               reserved_from_bot = hr_dev->caps.reserved_qps;
+
        ret = hns_roce_bitmap_init(&qp_table->bitmap, hr_dev->caps.num_qps,
-                                  hr_dev->caps.num_qps - 1, SQP_NUM,
+                                  hr_dev->caps.num_qps - 1, reserved_from_bot,
                                   reserved_from_top);
        if (ret) {
                dev_err(hr_dev->dev, "qp bitmap init failed!error=%d\n",