|
@@ -1259,6 +1259,10 @@ static int hns_roce_v2_profile(struct hns_roce_dev *hr_dev)
|
|
|
HNS_ROCE_CAP_FLAG_RQ_INLINE |
|
|
|
HNS_ROCE_CAP_FLAG_RECORD_DB |
|
|
|
HNS_ROCE_CAP_FLAG_SQ_RECORD_DB;
|
|
|
+
|
|
|
+ if (hr_dev->pci_dev->revision == 0x21)
|
|
|
+ caps->flags |= HNS_ROCE_CAP_FLAG_MW;
|
|
|
+
|
|
|
caps->pkey_table_len[0] = 1;
|
|
|
caps->gid_table_len[0] = HNS_ROCE_V2_GID_INDEX_NUM;
|
|
|
caps->ceqe_depth = HNS_ROCE_V2_COMP_EQE_NUM;
|
|
@@ -1825,6 +1829,46 @@ static int hns_roce_v2_rereg_write_mtpt(struct hns_roce_dev *hr_dev,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static int hns_roce_v2_mw_write_mtpt(void *mb_buf, struct hns_roce_mw *mw)
|
|
|
+{
|
|
|
+ struct hns_roce_v2_mpt_entry *mpt_entry;
|
|
|
+
|
|
|
+ mpt_entry = mb_buf;
|
|
|
+ memset(mpt_entry, 0, sizeof(*mpt_entry));
|
|
|
+
|
|
|
+ roce_set_field(mpt_entry->byte_4_pd_hop_st, V2_MPT_BYTE_4_MPT_ST_M,
|
|
|
+ V2_MPT_BYTE_4_MPT_ST_S, V2_MPT_ST_FREE);
|
|
|
+ roce_set_field(mpt_entry->byte_4_pd_hop_st, V2_MPT_BYTE_4_PD_M,
|
|
|
+ V2_MPT_BYTE_4_PD_S, mw->pdn);
|
|
|
+ roce_set_field(mpt_entry->byte_4_pd_hop_st,
|
|
|
+ V2_MPT_BYTE_4_PBL_HOP_NUM_M,
|
|
|
+ V2_MPT_BYTE_4_PBL_HOP_NUM_S,
|
|
|
+ mw->pbl_hop_num == HNS_ROCE_HOP_NUM_0 ?
|
|
|
+ 0 : mw->pbl_hop_num);
|
|
|
+ roce_set_field(mpt_entry->byte_4_pd_hop_st,
|
|
|
+ V2_MPT_BYTE_4_PBL_BA_PG_SZ_M,
|
|
|
+ V2_MPT_BYTE_4_PBL_BA_PG_SZ_S,
|
|
|
+ mw->pbl_ba_pg_sz + PG_SHIFT_OFFSET);
|
|
|
+
|
|
|
+ roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_R_INV_EN_S, 1);
|
|
|
+ roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_L_INV_EN_S, 1);
|
|
|
+
|
|
|
+ roce_set_bit(mpt_entry->byte_12_mw_pa, V2_MPT_BYTE_12_PA_S, 0);
|
|
|
+ roce_set_bit(mpt_entry->byte_12_mw_pa, V2_MPT_BYTE_12_MR_MW_S, 1);
|
|
|
+ roce_set_bit(mpt_entry->byte_12_mw_pa, V2_MPT_BYTE_12_BPD_S, 1);
|
|
|
+ roce_set_bit(mpt_entry->byte_12_mw_pa, V2_MPT_BYTE_12_BQP_S,
|
|
|
+ mw->ibmw.type == IB_MW_TYPE_1 ? 0 : 1);
|
|
|
+
|
|
|
+ roce_set_field(mpt_entry->byte_64_buf_pa1,
|
|
|
+ V2_MPT_BYTE_64_PBL_BUF_PG_SZ_M,
|
|
|
+ V2_MPT_BYTE_64_PBL_BUF_PG_SZ_S,
|
|
|
+ mw->pbl_buf_pg_sz + PG_SHIFT_OFFSET);
|
|
|
+
|
|
|
+ mpt_entry->lkey = cpu_to_le32(mw->rkey);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static void *get_cqe_v2(struct hns_roce_cq *hr_cq, int n)
|
|
|
{
|
|
|
return hns_roce_buf_offset(&hr_cq->hr_buf.hr_buf,
|
|
@@ -5175,6 +5219,7 @@ static const struct hns_roce_hw hns_roce_hw_v2 = {
|
|
|
.set_mac = hns_roce_v2_set_mac,
|
|
|
.write_mtpt = hns_roce_v2_write_mtpt,
|
|
|
.rereg_write_mtpt = hns_roce_v2_rereg_write_mtpt,
|
|
|
+ .mw_write_mtpt = hns_roce_v2_mw_write_mtpt,
|
|
|
.write_cqc = hns_roce_v2_write_cqc,
|
|
|
.set_hem = hns_roce_v2_set_hem,
|
|
|
.clear_hem = hns_roce_v2_clear_hem,
|