Skip to content

Commit eb31dfc

Browse files
shirazsaleemrleon
authored andcommitted
RDMA/irdma: Restrict Memory Window and CQE Timestamping to GEN3
With the deprecation of Memory Window and Timestamping support in GEN2, move these features to be exclusive to GEN3. This iteration supports only Type2 Memory Windows. Additionally, it includes the reporting of the timestamp mask and Host Channel Adapter (HCA) core clock frequency via the query device verb. Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com> Link: https://patch.msgid.link/20250827152545.2056-14-tatyana.e.nikolova@intel.com Tested-by: Jacob Moroni <jmoroni@google.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 563e1fe commit eb31dfc

1 file changed

Lines changed: 26 additions & 16 deletions

File tree

drivers/infiniband/hw/irdma/verbs.c

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ static int irdma_query_device(struct ib_device *ibdev,
4141
props->max_cq = rf->max_cq - rf->used_cqs;
4242
props->max_cqe = rf->max_cqe - 1;
4343
props->max_mr = rf->max_mr - rf->used_mrs;
44-
props->max_mw = props->max_mr;
44+
if (hw_attrs->uk_attrs.hw_rev >= IRDMA_GEN_3)
45+
props->max_mw = props->max_mr;
4546
props->max_pd = rf->max_pd - rf->used_pds;
4647
props->max_sge_rd = hw_attrs->uk_attrs.max_hw_read_sges;
4748
props->max_qp_rd_atom = hw_attrs->max_hw_ird;
@@ -56,12 +57,16 @@ static int irdma_query_device(struct ib_device *ibdev,
5657
props->max_mcast_qp_attach = IRDMA_MAX_MGS_PER_CTX;
5758
props->max_total_mcast_qp_attach = rf->max_qp * IRDMA_MAX_MGS_PER_CTX;
5859
props->max_fast_reg_page_list_len = IRDMA_MAX_PAGES_PER_FMR;
59-
#define HCA_CLOCK_TIMESTAMP_MASK 0x1ffff
60-
if (hw_attrs->uk_attrs.hw_rev >= IRDMA_GEN_2)
61-
props->timestamp_mask = HCA_CLOCK_TIMESTAMP_MASK;
6260
props->max_srq = rf->max_srq - rf->used_srqs;
6361
props->max_srq_wr = IRDMA_MAX_SRQ_WRS;
6462
props->max_srq_sge = hw_attrs->uk_attrs.max_hw_wq_frags;
63+
if (hw_attrs->uk_attrs.hw_rev >= IRDMA_GEN_3) {
64+
#define HCA_CORE_CLOCK_KHZ 1000000UL
65+
props->timestamp_mask = GENMASK(31, 0);
66+
props->hca_core_clock = HCA_CORE_CLOCK_KHZ;
67+
}
68+
if (hw_attrs->uk_attrs.hw_rev >= IRDMA_GEN_3)
69+
props->device_cap_flags |= IB_DEVICE_MEM_WINDOW_TYPE_2B;
6570

6671
return 0;
6772
}
@@ -798,7 +803,8 @@ static void irdma_roce_fill_and_set_qpctx_info(struct irdma_qp *iwqp,
798803
roce_info->is_qp1 = true;
799804
roce_info->rd_en = true;
800805
roce_info->wr_rdresp_en = true;
801-
roce_info->bind_en = true;
806+
if (dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_3)
807+
roce_info->bind_en = true;
802808
roce_info->dcqcn_en = false;
803809
roce_info->rtomin = 5;
804810

@@ -829,7 +835,6 @@ static void irdma_iw_fill_and_set_qpctx_info(struct irdma_qp *iwqp,
829835
ether_addr_copy(iwarp_info->mac_addr, iwdev->netdev->dev_addr);
830836
iwarp_info->rd_en = true;
831837
iwarp_info->wr_rdresp_en = true;
832-
iwarp_info->bind_en = true;
833838
iwarp_info->ecn_en = true;
834839
iwarp_info->rtomin = 5;
835840

@@ -1147,8 +1152,6 @@ static int irdma_get_ib_acc_flags(struct irdma_qp *iwqp)
11471152
}
11481153
if (iwqp->iwarp_info.rd_en)
11491154
acc_flags |= IB_ACCESS_REMOTE_READ;
1150-
if (iwqp->iwarp_info.bind_en)
1151-
acc_flags |= IB_ACCESS_MW_BIND;
11521155
}
11531156
return acc_flags;
11541157
}
@@ -2433,8 +2436,8 @@ static int irdma_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr)
24332436

24342437
static inline int cq_validate_flags(u32 flags, u8 hw_rev)
24352438
{
2436-
/* GEN1 does not support CQ create flags */
2437-
if (hw_rev == IRDMA_GEN_1)
2439+
/* GEN1/2 does not support CQ create flags */
2440+
if (hw_rev <= IRDMA_GEN_2)
24382441
return flags ? -EOPNOTSUPP : 0;
24392442

24402443
return flags & ~IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION ? -EOPNOTSUPP : 0;
@@ -2660,8 +2663,9 @@ static int irdma_create_cq(struct ib_cq *ibcq,
26602663
/**
26612664
* irdma_get_mr_access - get hw MR access permissions from IB access flags
26622665
* @access: IB access flags
2666+
* @hw_rev: Hardware version
26632667
*/
2664-
static inline u16 irdma_get_mr_access(int access)
2668+
static inline u16 irdma_get_mr_access(int access, u8 hw_rev)
26652669
{
26662670
u16 hw_access = 0;
26672671

@@ -2671,8 +2675,10 @@ static inline u16 irdma_get_mr_access(int access)
26712675
IRDMA_ACCESS_FLAGS_REMOTEWRITE : 0;
26722676
hw_access |= (access & IB_ACCESS_REMOTE_READ) ?
26732677
IRDMA_ACCESS_FLAGS_REMOTEREAD : 0;
2674-
hw_access |= (access & IB_ACCESS_MW_BIND) ?
2675-
IRDMA_ACCESS_FLAGS_BIND_WINDOW : 0;
2678+
if (hw_rev >= IRDMA_GEN_3) {
2679+
hw_access |= (access & IB_ACCESS_MW_BIND) ?
2680+
IRDMA_ACCESS_FLAGS_BIND_WINDOW : 0;
2681+
}
26762682
hw_access |= (access & IB_ZERO_BASED) ?
26772683
IRDMA_ACCESS_FLAGS_ZERO_BASED : 0;
26782684
hw_access |= IRDMA_ACCESS_FLAGS_LOCALREAD;
@@ -3242,7 +3248,8 @@ static int irdma_hwreg_mr(struct irdma_device *iwdev, struct irdma_mr *iwmr,
32423248
stag_info->stag_idx = iwmr->stag >> IRDMA_CQPSQ_STAG_IDX_S;
32433249
stag_info->stag_key = (u8)iwmr->stag;
32443250
stag_info->total_len = iwmr->len;
3245-
stag_info->access_rights = irdma_get_mr_access(access);
3251+
stag_info->access_rights = irdma_get_mr_access(access,
3252+
iwdev->rf->sc_dev.hw_attrs.uk_attrs.hw_rev);
32463253
stag_info->pd_id = iwpd->sc_pd.pd_id;
32473254
stag_info->all_memory = pd->flags & IB_PD_UNSAFE_GLOBAL_RKEY;
32483255
if (stag_info->access_rights & IRDMA_ACCESS_FLAGS_ZERO_BASED)
@@ -4036,7 +4043,9 @@ static int irdma_post_send(struct ib_qp *ibqp,
40364043

40374044
stag_info.signaled = info.signaled;
40384045
stag_info.read_fence = info.read_fence;
4039-
stag_info.access_rights = irdma_get_mr_access(reg_wr(ib_wr)->access);
4046+
stag_info.access_rights =
4047+
irdma_get_mr_access(reg_wr(ib_wr)->access,
4048+
dev->hw_attrs.uk_attrs.hw_rev);
40404049
stag_info.stag_key = reg_wr(ib_wr)->key & 0xff;
40414050
stag_info.stag_idx = reg_wr(ib_wr)->key >> 8;
40424051
stag_info.page_size = reg_wr(ib_wr)->mr->page_size;
@@ -5239,7 +5248,9 @@ static const struct ib_device_ops irdma_gen1_dev_ops = {
52395248
};
52405249

52415250
static const struct ib_device_ops irdma_gen3_dev_ops = {
5251+
.alloc_mw = irdma_alloc_mw,
52425252
.create_srq = irdma_create_srq,
5253+
.dealloc_mw = irdma_dealloc_mw,
52435254
.destroy_srq = irdma_destroy_srq,
52445255
.modify_srq = irdma_modify_srq,
52455256
.post_srq_recv = irdma_post_srq_recv,
@@ -5280,7 +5291,6 @@ static const struct ib_device_ops irdma_dev_ops = {
52805291

52815292
.alloc_hw_port_stats = irdma_alloc_hw_port_stats,
52825293
.alloc_mr = irdma_alloc_mr,
5283-
.alloc_mw = irdma_alloc_mw,
52845294
.alloc_pd = irdma_alloc_pd,
52855295
.alloc_ucontext = irdma_alloc_ucontext,
52865296
.create_cq = irdma_create_cq,

0 commit comments

Comments
 (0)