Skip to content

Commit 72d422c

Browse files
Sindhu-Devalerleon
authored andcommitted
RDMA/irdma: Use HW specific minimum WQ size
HW GEN1 and GEN2 have different min WQ sizes but they are currently set to the same value. Use a gen specific attribute min_hw_wq_size and extend ABI to pass it to user-space. Signed-off-by: Sindhu Devale <sindhu.devale@intel.com> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> Link: https://lore.kernel.org/r/20230725155525.1081-3-shiraz.saleem@intel.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 3a84987 commit 72d422c

File tree

9 files changed

+19
-5
lines changed

9 files changed

+19
-5
lines changed

drivers/infiniband/hw/irdma/i40iw_hw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,5 +254,6 @@ void i40iw_init_hw(struct irdma_sc_dev *dev)
254254
dev->hw_attrs.max_stat_idx = IRDMA_HW_STAT_INDEX_MAX_GEN_1;
255255
dev->hw_attrs.max_hw_outbound_msg_size = I40IW_MAX_OUTBOUND_MSG_SIZE;
256256
dev->hw_attrs.max_hw_inbound_msg_size = I40IW_MAX_INBOUND_MSG_SIZE;
257+
dev->hw_attrs.uk_attrs.min_hw_wq_size = I40IW_MIN_WQ_SIZE;
257258
dev->hw_attrs.max_qp_wr = I40IW_MAX_QP_WRS;
258259
}

drivers/infiniband/hw/irdma/i40iw_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ enum i40iw_device_caps_const {
140140
I40IW_MAX_CQ_SIZE = 1048575,
141141
I40IW_MAX_OUTBOUND_MSG_SIZE = 2147483647,
142142
I40IW_MAX_INBOUND_MSG_SIZE = 2147483647,
143+
I40IW_MIN_WQ_SIZE = 4 /* WQEs */,
143144
};
144145

145146
#define I40IW_QP_WQE_MIN_SIZE 32
146147
#define I40IW_QP_WQE_MAX_SIZE 128
147-
#define I40IW_QP_SW_MIN_WQSIZE 4
148148
#define I40IW_MAX_RQ_WQE_SHIFT 2
149149
#define I40IW_MAX_QUANTA_PER_WR 2
150150

drivers/infiniband/hw/irdma/icrdma_hw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ void icrdma_init_hw(struct irdma_sc_dev *dev)
195195
dev->hw_attrs.max_stat_inst = ICRDMA_MAX_STATS_COUNT;
196196
dev->hw_attrs.max_stat_idx = IRDMA_HW_STAT_INDEX_MAX_GEN_2;
197197

198+
dev->hw_attrs.uk_attrs.min_hw_wq_size = ICRDMA_MIN_WQ_SIZE;
198199
dev->hw_attrs.uk_attrs.max_hw_sq_chunk = IRDMA_MAX_QUANTA_PER_WR;
199200
dev->hw_attrs.uk_attrs.feature_flags |= IRDMA_FEATURE_RTS_AE |
200201
IRDMA_FEATURE_CQ_RESIZE;

drivers/infiniband/hw/irdma/icrdma_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ enum icrdma_device_caps_const {
6464

6565
ICRDMA_MAX_IRD_SIZE = 127,
6666
ICRDMA_MAX_ORD_SIZE = 255,
67+
ICRDMA_MIN_WQ_SIZE = 8 /* WQEs */,
6768

6869
};
6970

drivers/infiniband/hw/irdma/irdma.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ struct irdma_uk_attrs {
119119
u32 min_hw_cq_size;
120120
u32 max_hw_cq_size;
121121
u16 max_hw_sq_chunk;
122+
u16 min_hw_wq_size;
122123
u8 hw_rev;
123124
};
124125

drivers/infiniband/hw/irdma/uk.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,10 +1349,12 @@ void irdma_get_wqe_shift(struct irdma_uk_attrs *uk_attrs, u32 sge,
13491349
int irdma_get_sqdepth(struct irdma_uk_attrs *uk_attrs, u32 sq_size, u8 shift,
13501350
u32 *sqdepth)
13511351
{
1352+
u32 min_size = (u32)uk_attrs->min_hw_wq_size << shift;
1353+
13521354
*sqdepth = irdma_qp_round_up((sq_size << shift) + IRDMA_SQ_RSVD);
13531355

1354-
if (*sqdepth < (IRDMA_QP_SW_MIN_WQSIZE << shift))
1355-
*sqdepth = IRDMA_QP_SW_MIN_WQSIZE << shift;
1356+
if (*sqdepth < min_size)
1357+
*sqdepth = min_size;
13561358
else if (*sqdepth > uk_attrs->max_hw_wq_quanta)
13571359
return -EINVAL;
13581360

@@ -1369,10 +1371,12 @@ int irdma_get_sqdepth(struct irdma_uk_attrs *uk_attrs, u32 sq_size, u8 shift,
13691371
int irdma_get_rqdepth(struct irdma_uk_attrs *uk_attrs, u32 rq_size, u8 shift,
13701372
u32 *rqdepth)
13711373
{
1374+
u32 min_size = (u32)uk_attrs->min_hw_wq_size << shift;
1375+
13721376
*rqdepth = irdma_qp_round_up((rq_size << shift) + IRDMA_RQ_RSVD);
13731377

1374-
if (*rqdepth < (IRDMA_QP_SW_MIN_WQSIZE << shift))
1375-
*rqdepth = IRDMA_QP_SW_MIN_WQSIZE << shift;
1378+
if (*rqdepth < min_size)
1379+
*rqdepth = min_size;
13761380
else if (*rqdepth > uk_attrs->max_hw_rq_quanta)
13771381
return -EINVAL;
13781382

drivers/infiniband/hw/irdma/user.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ enum irdma_device_caps_const {
8585
IRDMA_Q2_BUF_SIZE = 256,
8686
IRDMA_QP_CTX_SIZE = 256,
8787
IRDMA_MAX_PDS = 262144,
88+
IRDMA_MIN_WQ_SIZE_GEN2 = 8,
8889
};
8990

9091
enum irdma_addressing_type {

drivers/infiniband/hw/irdma/verbs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,8 @@ static int irdma_alloc_ucontext(struct ib_ucontext *uctx,
330330
uresp.min_hw_cq_size = uk_attrs->min_hw_cq_size;
331331
uresp.hw_rev = uk_attrs->hw_rev;
332332
uresp.comp_mask |= IRDMA_ALLOC_UCTX_USE_RAW_ATTR;
333+
uresp.min_hw_wq_size = uk_attrs->min_hw_wq_size;
334+
uresp.comp_mask |= IRDMA_ALLOC_UCTX_MIN_HW_WQ_SIZE;
333335
if (ib_copy_to_udata(udata, &uresp,
334336
min(sizeof(uresp), udata->outlen))) {
335337
rdma_user_mmap_entry_remove(ucontext->db_mmap_entry);

include/uapi/rdma/irdma-abi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ enum irdma_memreg_type {
2424

2525
enum {
2626
IRDMA_ALLOC_UCTX_USE_RAW_ATTR = 1 << 0,
27+
IRDMA_ALLOC_UCTX_MIN_HW_WQ_SIZE = 1 << 1,
2728
};
2829

2930
struct irdma_alloc_ucontext_req {
@@ -52,6 +53,8 @@ struct irdma_alloc_ucontext_resp {
5253
__u8 hw_rev;
5354
__u8 rsvd2;
5455
__aligned_u64 comp_mask;
56+
__u16 min_hw_wq_size;
57+
__u8 rsvd3[6];
5558
};
5659

5760
struct irdma_alloc_pd_resp {

0 commit comments

Comments
 (0)