Skip to content

Commit d16da11

Browse files
oulijunjgunthorpe
authored andcommitted
RDMA/hns: Eanble SRQ capacity for hip08
This patch configures the flags for enabling the SRQ(Share Receive Queue) capacity as well as update the verb of querying device for setting srq specifications. Signed-off-by: Lijun Ou <oulijun@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
1 parent b2d8754 commit d16da11

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

drivers/infiniband/hw/hns/hns_roce_device.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ enum {
196196
HNS_ROCE_CAP_FLAG_RQ_INLINE = BIT(2),
197197
HNS_ROCE_CAP_FLAG_RECORD_DB = BIT(3),
198198
HNS_ROCE_CAP_FLAG_SQ_RECORD_DB = BIT(4),
199+
HNS_ROCE_CAP_FLAG_SRQ = BIT(5),
199200
HNS_ROCE_CAP_FLAG_MW = BIT(7),
200201
HNS_ROCE_CAP_FLAG_FRMR = BIT(8),
201202
HNS_ROCE_CAP_FLAG_ATOMIC = BIT(10),
@@ -680,6 +681,9 @@ struct hns_roce_caps {
680681
int num_qps; /* 256k */
681682
int reserved_qps;
682683
u32 max_wqes; /* 16k */
684+
u32 max_srqs;
685+
u32 max_srq_wrs;
686+
u32 max_srq_sges;
683687
u32 max_sq_desc_sz; /* 64 */
684688
u32 max_rq_desc_sz; /* 64 */
685689
u32 max_srq_desc_sz;

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,13 @@ static int hns_roce_v2_profile(struct hns_roce_dev *hr_dev)
13541354
caps->local_ca_ack_delay = 0;
13551355
caps->max_mtu = IB_MTU_4096;
13561356

1357+
caps->max_srqs = HNS_ROCE_V2_MAX_SRQ;
1358+
caps->max_srq_wrs = HNS_ROCE_V2_MAX_SRQ_WR;
1359+
caps->max_srq_sges = HNS_ROCE_V2_MAX_SRQ_SGE;
1360+
13571361
if (hr_dev->pci_dev->revision == 0x21)
1358-
caps->flags |= HNS_ROCE_CAP_FLAG_ATOMIC;
1362+
caps->flags |= HNS_ROCE_CAP_FLAG_ATOMIC |
1363+
HNS_ROCE_CAP_FLAG_SRQ;
13591364

13601365
ret = hns_roce_v2_set_bt(hr_dev);
13611366
if (ret)

drivers/infiniband/hw/hns/hns_roce_hw_v2.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646

4747
#define HNS_ROCE_V2_MAX_QP_NUM 0x2000
4848
#define HNS_ROCE_V2_MAX_WQE_NUM 0x8000
49+
#define HNS_ROCE_V2_MAX_SRQ 0x100000
50+
#define HNS_ROCE_V2_MAX_SRQ_WR 0x8000
51+
#define HNS_ROCE_V2_MAX_SRQ_SGE 0x100
4952
#define HNS_ROCE_V2_MAX_CQ_NUM 0x8000
5053
#define HNS_ROCE_V2_MAX_CQE_NUM 0x10000
5154
#define HNS_ROCE_V2_MAX_RQ_SGE_NUM 0x100

drivers/infiniband/hw/hns/hns_roce_main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ static int hns_roce_query_device(struct ib_device *ib_dev,
220220
IB_ATOMIC_HCA : IB_ATOMIC_NONE;
221221
props->max_pkeys = 1;
222222
props->local_ca_ack_delay = hr_dev->caps.local_ca_ack_delay;
223+
if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) {
224+
props->max_srq = hr_dev->caps.max_srqs;
225+
props->max_srq_wr = hr_dev->caps.max_srq_wrs;
226+
props->max_srq_sge = hr_dev->caps.max_srq_sges;
227+
}
223228

224229
return 0;
225230
}

0 commit comments

Comments
 (0)