Skip to content

Commit 2ce3843

Browse files
Chengchang Tangrleon
authored andcommitted
RDMA/hns: Add max_ah and cq moderation capacities in query_device()
Add max_ah and cq moderation capacities to hns_roce_query_device(). Fixes: 9a44353 ("IB/hns: Add driver files for hns RoCE driver") Signed-off-by: Chengchang Tang <tangchengchang@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://lore.kernel.org/r/20240412091616.370789-4-huangjunxian6@hisilicon.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent f4caa86 commit 2ce3843

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

drivers/infiniband/hw/hns/hns_roce_device.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@
100100
#define CQ_BANKID_SHIFT 2
101101
#define CQ_BANKID_MASK GENMASK(1, 0)
102102

103+
#define HNS_ROCE_MAX_CQ_COUNT 0xFFFF
104+
#define HNS_ROCE_MAX_CQ_PERIOD 0xFFFF
105+
103106
enum {
104107
SERV_TYPE_RC,
105108
SERV_TYPE_UC,

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5848,7 +5848,7 @@ static int hns_roce_v2_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period)
58485848
dev_info(hr_dev->dev,
58495849
"cq_period(%u) reached the upper limit, adjusted to 65.\n",
58505850
cq_period);
5851-
cq_period = HNS_ROCE_MAX_CQ_PERIOD;
5851+
cq_period = HNS_ROCE_MAX_CQ_PERIOD_HIP08;
58525852
}
58535853
cq_period *= HNS_ROCE_CLOCK_ADJUST;
58545854
}

drivers/infiniband/hw/hns/hns_roce_hw_v2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ struct fmea_ram_ecc {
13471347

13481348
/* only for RNR timeout issue of HIP08 */
13491349
#define HNS_ROCE_CLOCK_ADJUST 1000
1350-
#define HNS_ROCE_MAX_CQ_PERIOD 65
1350+
#define HNS_ROCE_MAX_CQ_PERIOD_HIP08 65
13511351
#define HNS_ROCE_MAX_EQ_PERIOD 65
13521352
#define HNS_ROCE_RNR_TIMER_10NS 1
13531353
#define HNS_ROCE_1US_CFG 999

drivers/infiniband/hw/hns/hns_roce_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "hns_roce_common.h"
4141
#include "hns_roce_device.h"
4242
#include "hns_roce_hem.h"
43+
#include "hns_roce_hw_v2.h"
4344

4445
static int hns_roce_set_mac(struct hns_roce_dev *hr_dev, u32 port,
4546
const u8 *addr)
@@ -192,6 +193,12 @@ static int hns_roce_query_device(struct ib_device *ib_dev,
192193
IB_ATOMIC_HCA : IB_ATOMIC_NONE;
193194
props->max_pkeys = 1;
194195
props->local_ca_ack_delay = hr_dev->caps.local_ca_ack_delay;
196+
props->max_ah = INT_MAX;
197+
props->cq_caps.max_cq_moderation_period = HNS_ROCE_MAX_CQ_PERIOD;
198+
props->cq_caps.max_cq_moderation_count = HNS_ROCE_MAX_CQ_COUNT;
199+
if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08)
200+
props->cq_caps.max_cq_moderation_period = HNS_ROCE_MAX_CQ_PERIOD_HIP08;
201+
195202
if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) {
196203
props->max_srq = hr_dev->caps.num_srqs;
197204
props->max_srq_wr = hr_dev->caps.max_srq_wrs;

0 commit comments

Comments
 (0)