Skip to content

Commit 2969159

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Pull rdma fixes from Doug Ledford: "First round of -rc fixes for 4.10 kernel: - a series of qedr fixes - a series of rxe fixes - one i40iw fix - one cma fix - one cxgb4 fix" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: IB/rxe: Don't check for null ptr in send() IB/rxe: Drop future atomic/read packets rather than retrying IB/rxe: Use BTH_PSN_MASK when ACKing duplicate sends qedr: Always notify the verb consumer of flushed CQEs qedr: clear the vendor error field in the work completion qedr: post_send/recv according to QP state qedr: ignore inline flag in read verbs qedr: modify QP state to error when destroying it qedr: return correct value on modify qp qedr: return error if destroy CQ failed qedr: configure the number of CQEs on CQ creation i40iw: Set 128B as the only supported RQ WQE size IB/cma: Fix a race condition in iboe_addr_get_sgid() IB/rxe: Fix a memory leak in rxe_qp_cleanup() iw_cxgb4: set correct FetchBurstMax for QPs
2 parents f290cba + 5cc8fab commit 2969159

File tree

15 files changed

+90
-43
lines changed

15 files changed

+90
-43
lines changed

drivers/infiniband/hw/cxgb4/qp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
321321
FW_RI_RES_WR_DCAEN_V(0) |
322322
FW_RI_RES_WR_DCACPU_V(0) |
323323
FW_RI_RES_WR_FBMIN_V(2) |
324-
FW_RI_RES_WR_FBMAX_V(2) |
324+
(t4_sq_onchip(&wq->sq) ? FW_RI_RES_WR_FBMAX_V(2) :
325+
FW_RI_RES_WR_FBMAX_V(3)) |
325326
FW_RI_RES_WR_CIDXFTHRESHO_V(0) |
326327
FW_RI_RES_WR_CIDXFTHRESH_V(0) |
327328
FW_RI_RES_WR_EQSIZE_V(eqsize));
@@ -345,7 +346,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
345346
FW_RI_RES_WR_DCAEN_V(0) |
346347
FW_RI_RES_WR_DCACPU_V(0) |
347348
FW_RI_RES_WR_FBMIN_V(2) |
348-
FW_RI_RES_WR_FBMAX_V(2) |
349+
FW_RI_RES_WR_FBMAX_V(3) |
349350
FW_RI_RES_WR_CIDXFTHRESHO_V(0) |
350351
FW_RI_RES_WR_CIDXFTHRESH_V(0) |
351352
FW_RI_RES_WR_EQSIZE_V(eqsize));

drivers/infiniband/hw/i40iw/i40iw_ctrl.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,16 @@ void i40iw_qp_add_qos(struct i40iw_sc_qp *qp)
358358
* @dev: sc device struct
359359
* @pd: sc pd ptr
360360
* @pd_id: pd_id for allocated pd
361+
* @abi_ver: ABI version from user context, -1 if not valid
361362
*/
362363
static void i40iw_sc_pd_init(struct i40iw_sc_dev *dev,
363364
struct i40iw_sc_pd *pd,
364-
u16 pd_id)
365+
u16 pd_id,
366+
int abi_ver)
365367
{
366368
pd->size = sizeof(*pd);
367369
pd->pd_id = pd_id;
370+
pd->abi_ver = abi_ver;
368371
pd->dev = dev;
369372
}
370373

@@ -2252,6 +2255,7 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
22522255
offset);
22532256

22542257
info->qp_uk_init_info.wqe_alloc_reg = wqe_alloc_reg;
2258+
info->qp_uk_init_info.abi_ver = qp->pd->abi_ver;
22552259
ret_code = i40iw_qp_uk_init(&qp->qp_uk, &info->qp_uk_init_info);
22562260
if (ret_code)
22572261
return ret_code;
@@ -2270,10 +2274,21 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
22702274
false);
22712275
i40iw_debug(qp->dev, I40IW_DEBUG_WQE, "%s: hw_sq_size[%04d] sq_ring.size[%04d]\n",
22722276
__func__, qp->hw_sq_size, qp->qp_uk.sq_ring.size);
2273-
ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
2274-
&wqe_size);
2275-
if (ret_code)
2276-
return ret_code;
2277+
2278+
switch (qp->pd->abi_ver) {
2279+
case 4:
2280+
ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
2281+
&wqe_size);
2282+
if (ret_code)
2283+
return ret_code;
2284+
break;
2285+
case 5: /* fallthrough until next ABI version */
2286+
default:
2287+
if (qp->qp_uk.max_rq_frag_cnt > I40IW_MAX_WQ_FRAGMENT_COUNT)
2288+
return I40IW_ERR_INVALID_FRAG_COUNT;
2289+
wqe_size = I40IW_MAX_WQE_SIZE_RQ;
2290+
break;
2291+
}
22772292
qp->hw_rq_size = i40iw_get_encoded_wqe_size(qp->qp_uk.rq_size *
22782293
(wqe_size / I40IW_QP_WQE_MIN_SIZE), false);
22792294
i40iw_debug(qp->dev, I40IW_DEBUG_WQE,

drivers/infiniband/hw/i40iw/i40iw_puda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ enum i40iw_status_code i40iw_puda_create_rsrc(struct i40iw_sc_vsi *vsi,
930930
INIT_LIST_HEAD(&rsrc->txpend);
931931

932932
rsrc->tx_wqe_avail_cnt = info->sq_size - 1;
933-
dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id);
933+
dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id, -1);
934934
rsrc->qp_id = info->qp_id;
935935
rsrc->cq_id = info->cq_id;
936936
rsrc->sq_size = info->sq_size;

drivers/infiniband/hw/i40iw/i40iw_type.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ struct i40iw_sc_pd {
280280
u32 size;
281281
struct i40iw_sc_dev *dev;
282282
u16 pd_id;
283+
int abi_ver;
283284
};
284285

285286
struct i40iw_cqp_quanta {
@@ -852,6 +853,7 @@ struct i40iw_qp_init_info {
852853
u64 host_ctx_pa;
853854
u64 q2_pa;
854855
u64 shadow_area_pa;
856+
int abi_ver;
855857
u8 sq_tph_val;
856858
u8 rq_tph_val;
857859
u8 type;
@@ -1051,7 +1053,7 @@ struct i40iw_aeq_ops {
10511053
};
10521054

10531055
struct i40iw_pd_ops {
1054-
void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16);
1056+
void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16, int);
10551057
};
10561058

10571059
struct i40iw_priv_qp_ops {

drivers/infiniband/hw/i40iw/i40iw_ucontext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939

4040
#include <linux/types.h>
4141

42-
#define I40IW_ABI_USERSPACE_VER 4
43-
#define I40IW_ABI_KERNEL_VER 4
42+
#define I40IW_ABI_VER 5
43+
4444
struct i40iw_alloc_ucontext_req {
4545
__u32 reserved32;
4646
__u8 userspace_ver;

drivers/infiniband/hw/i40iw/i40iw_uk.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -966,10 +966,6 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
966966
if (ret_code)
967967
return ret_code;
968968

969-
ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
970-
if (ret_code)
971-
return ret_code;
972-
973969
qp->sq_base = info->sq;
974970
qp->rq_base = info->rq;
975971
qp->shadow_area = info->shadow_area;
@@ -998,8 +994,19 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
998994
if (!qp->use_srq) {
999995
qp->rq_size = info->rq_size;
1000996
qp->max_rq_frag_cnt = info->max_rq_frag_cnt;
1001-
qp->rq_wqe_size = rqshift;
1002997
I40IW_RING_INIT(qp->rq_ring, qp->rq_size);
998+
switch (info->abi_ver) {
999+
case 4:
1000+
ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
1001+
if (ret_code)
1002+
return ret_code;
1003+
break;
1004+
case 5: /* fallthrough until next ABI version */
1005+
default:
1006+
rqshift = I40IW_MAX_RQ_WQE_SHIFT;
1007+
break;
1008+
}
1009+
qp->rq_wqe_size = rqshift;
10031010
qp->rq_wqe_size_multiplier = 4 << rqshift;
10041011
}
10051012
qp->ops = iw_qp_uk_ops;

drivers/infiniband/hw/i40iw/i40iw_user.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ enum i40iw_device_capabilities_const {
7676
I40IW_MAX_ORD_SIZE = 127,
7777
I40IW_MAX_WQ_ENTRIES = 2048,
7878
I40IW_Q2_BUFFER_SIZE = (248 + 100),
79+
I40IW_MAX_WQE_SIZE_RQ = 128,
7980
I40IW_QP_CTX_SIZE = 248,
8081
I40IW_MAX_PDS = 32768
8182
};
@@ -97,6 +98,7 @@ enum i40iw_device_capabilities_const {
9798
#define i40iw_address_list u64 *
9899

99100
#define I40IW_MAX_MR_SIZE 0x10000000000L
101+
#define I40IW_MAX_RQ_WQE_SHIFT 2
100102

101103
struct i40iw_qp_uk;
102104
struct i40iw_cq_uk;
@@ -405,7 +407,7 @@ struct i40iw_qp_uk_init_info {
405407
u32 max_sq_frag_cnt;
406408
u32 max_rq_frag_cnt;
407409
u32 max_inline_data;
408-
410+
int abi_ver;
409411
};
410412

411413
struct i40iw_cq_uk_init_info {

drivers/infiniband/hw/i40iw/i40iw_verbs.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,23 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
145145
if (ib_copy_from_udata(&req, udata, sizeof(req)))
146146
return ERR_PTR(-EINVAL);
147147

148-
if (req.userspace_ver != I40IW_ABI_USERSPACE_VER) {
149-
i40iw_pr_err("Invalid userspace driver version detected. Detected version %d, should be %d\n",
150-
req.userspace_ver, I40IW_ABI_USERSPACE_VER);
148+
if (req.userspace_ver < 4 || req.userspace_ver > I40IW_ABI_VER) {
149+
i40iw_pr_err("Unsupported provider library version %u.\n", req.userspace_ver);
151150
return ERR_PTR(-EINVAL);
152151
}
153152

154153
memset(&uresp, 0, sizeof(uresp));
155154
uresp.max_qps = iwdev->max_qp;
156155
uresp.max_pds = iwdev->max_pd;
157156
uresp.wq_size = iwdev->max_qp_wr * 2;
158-
uresp.kernel_ver = I40IW_ABI_KERNEL_VER;
157+
uresp.kernel_ver = req.userspace_ver;
159158

160159
ucontext = kzalloc(sizeof(*ucontext), GFP_KERNEL);
161160
if (!ucontext)
162161
return ERR_PTR(-ENOMEM);
163162

164163
ucontext->iwdev = iwdev;
164+
ucontext->abi_ver = req.userspace_ver;
165165

166166
if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
167167
kfree(ucontext);
@@ -333,6 +333,7 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
333333
struct i40iw_sc_dev *dev = &iwdev->sc_dev;
334334
struct i40iw_alloc_pd_resp uresp;
335335
struct i40iw_sc_pd *sc_pd;
336+
struct i40iw_ucontext *ucontext;
336337
u32 pd_id = 0;
337338
int err;
338339

@@ -353,15 +354,18 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
353354
}
354355

355356
sc_pd = &iwpd->sc_pd;
356-
dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id);
357357

358358
if (context) {
359+
ucontext = to_ucontext(context);
360+
dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, ucontext->abi_ver);
359361
memset(&uresp, 0, sizeof(uresp));
360362
uresp.pd_id = pd_id;
361363
if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
362364
err = -EFAULT;
363365
goto error;
364366
}
367+
} else {
368+
dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, -1);
365369
}
366370

367371
i40iw_add_pdusecount(iwpd);
@@ -518,7 +522,7 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
518522
struct i40iw_dma_mem *mem = &iwqp->kqp.dma_mem;
519523
u32 sqdepth, rqdepth;
520524
u32 sq_size, rq_size;
521-
u8 sqshift, rqshift;
525+
u8 sqshift;
522526
u32 size;
523527
enum i40iw_status_code status;
524528
struct i40iw_qp_uk_init_info *ukinfo = &info->qp_uk_init_info;
@@ -527,14 +531,11 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
527531
rq_size = i40iw_qp_roundup(ukinfo->rq_size + 1);
528532

529533
status = i40iw_get_wqe_shift(sq_size, ukinfo->max_sq_frag_cnt, ukinfo->max_inline_data, &sqshift);
530-
if (!status)
531-
status = i40iw_get_wqe_shift(rq_size, ukinfo->max_rq_frag_cnt, 0, &rqshift);
532-
533534
if (status)
534535
return -ENOMEM;
535536

536537
sqdepth = sq_size << sqshift;
537-
rqdepth = rq_size << rqshift;
538+
rqdepth = rq_size << I40IW_MAX_RQ_WQE_SHIFT;
538539

539540
size = sqdepth * sizeof(struct i40iw_sq_uk_wr_trk_info) + (rqdepth << 3);
540541
iwqp->kqp.wrid_mem = kzalloc(size, GFP_KERNEL);

drivers/infiniband/hw/i40iw/i40iw_verbs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct i40iw_ucontext {
4242
spinlock_t cq_reg_mem_list_lock; /* memory list for cq's */
4343
struct list_head qp_reg_mem_list;
4444
spinlock_t qp_reg_mem_list_lock; /* memory list for qp's */
45+
int abi_ver;
4546
};
4647

4748
struct i40iw_pd {

drivers/infiniband/hw/qedr/verbs.c

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,8 @@ struct ib_cq *qedr_create_cq(struct ib_device *ibdev,
890890

891891
pbl_ptr = cq->q.pbl_tbl->pa;
892892
page_cnt = cq->q.pbl_info.num_pbes;
893+
894+
cq->ibcq.cqe = chain_entries;
893895
} else {
894896
cq->cq_type = QEDR_CQ_TYPE_KERNEL;
895897

@@ -905,6 +907,7 @@ struct ib_cq *qedr_create_cq(struct ib_device *ibdev,
905907

906908
page_cnt = qed_chain_get_page_cnt(&cq->pbl);
907909
pbl_ptr = qed_chain_get_pbl_phys(&cq->pbl);
910+
cq->ibcq.cqe = cq->pbl.capacity;
908911
}
909912

910913
qedr_init_cq_params(cq, ctx, dev, vector, chain_entries, page_cnt,
@@ -982,8 +985,13 @@ int qedr_destroy_cq(struct ib_cq *ibcq)
982985

983986
/* GSIs CQs are handled by driver, so they don't exist in the FW */
984987
if (cq->cq_type != QEDR_CQ_TYPE_GSI) {
988+
int rc;
989+
985990
iparams.icid = cq->icid;
986-
dev->ops->rdma_destroy_cq(dev->rdma_ctx, &iparams, &oparams);
991+
rc = dev->ops->rdma_destroy_cq(dev->rdma_ctx, &iparams,
992+
&oparams);
993+
if (rc)
994+
return rc;
987995
dev->ops->common->chain_free(dev->cdev, &cq->pbl);
988996
}
989997

@@ -1966,7 +1974,7 @@ int qedr_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
19661974

19671975
if (attr_mask & IB_QP_STATE) {
19681976
if ((qp->qp_type != IB_QPT_GSI) && (!udata))
1969-
qedr_update_qp_state(dev, qp, qp_params.new_state);
1977+
rc = qedr_update_qp_state(dev, qp, qp_params.new_state);
19701978
qp->state = qp_params.new_state;
19711979
}
19721980

@@ -2070,8 +2078,10 @@ int qedr_destroy_qp(struct ib_qp *ibqp)
20702078
DP_DEBUG(dev, QEDR_MSG_QP, "destroy qp: destroying %p, qp type=%d\n",
20712079
qp, qp->qp_type);
20722080

2073-
if (qp->state != (QED_ROCE_QP_STATE_RESET | QED_ROCE_QP_STATE_ERR |
2074-
QED_ROCE_QP_STATE_INIT)) {
2081+
if ((qp->state != QED_ROCE_QP_STATE_RESET) &&
2082+
(qp->state != QED_ROCE_QP_STATE_ERR) &&
2083+
(qp->state != QED_ROCE_QP_STATE_INIT)) {
2084+
20752085
attr.qp_state = IB_QPS_ERR;
20762086
attr_mask |= IB_QP_STATE;
20772087

@@ -2626,7 +2636,9 @@ static u32 qedr_prepare_sq_rdma_data(struct qedr_dev *dev,
26262636
rwqe2->r_key = cpu_to_le32(rdma_wr(wr)->rkey);
26272637
DMA_REGPAIR_LE(rwqe2->remote_va, rdma_wr(wr)->remote_addr);
26282638

2629-
if (wr->send_flags & IB_SEND_INLINE) {
2639+
if (wr->send_flags & IB_SEND_INLINE &&
2640+
(wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM ||
2641+
wr->opcode == IB_WR_RDMA_WRITE)) {
26302642
u8 flags = 0;
26312643

26322644
SET_FIELD2(flags, RDMA_SQ_RDMA_WQE_1ST_INLINE_FLG, 1);
@@ -2977,8 +2989,9 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
29772989

29782990
spin_lock_irqsave(&qp->q_lock, flags);
29792991

2980-
if ((qp->state == QED_ROCE_QP_STATE_RESET) ||
2981-
(qp->state == QED_ROCE_QP_STATE_ERR)) {
2992+
if ((qp->state != QED_ROCE_QP_STATE_RTS) &&
2993+
(qp->state != QED_ROCE_QP_STATE_ERR) &&
2994+
(qp->state != QED_ROCE_QP_STATE_SQD)) {
29822995
spin_unlock_irqrestore(&qp->q_lock, flags);
29832996
*bad_wr = wr;
29842997
DP_DEBUG(dev, QEDR_MSG_CQ,
@@ -3031,8 +3044,7 @@ int qedr_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
30313044

30323045
spin_lock_irqsave(&qp->q_lock, flags);
30333046

3034-
if ((qp->state == QED_ROCE_QP_STATE_RESET) ||
3035-
(qp->state == QED_ROCE_QP_STATE_ERR)) {
3047+
if (qp->state == QED_ROCE_QP_STATE_RESET) {
30363048
spin_unlock_irqrestore(&qp->q_lock, flags);
30373049
*bad_wr = wr;
30383050
return -EINVAL;
@@ -3174,6 +3186,7 @@ static int process_req(struct qedr_dev *dev, struct qedr_qp *qp,
31743186

31753187
/* fill WC */
31763188
wc->status = status;
3189+
wc->vendor_err = 0;
31773190
wc->wc_flags = 0;
31783191
wc->src_qp = qp->id;
31793192
wc->qp = &qp->ibqp;
@@ -3225,7 +3238,7 @@ static int qedr_poll_cq_req(struct qedr_dev *dev,
32253238
"Error: POLL CQ with RDMA_CQE_REQ_STS_WORK_REQUEST_FLUSHED_ERR. CQ icid=0x%x, QP icid=0x%x\n",
32263239
cq->icid, qp->icid);
32273240
cnt = process_req(dev, qp, cq, num_entries, wc, req->sq_cons,
3228-
IB_WC_WR_FLUSH_ERR, 0);
3241+
IB_WC_WR_FLUSH_ERR, 1);
32293242
break;
32303243
default:
32313244
/* process all WQE before the cosumer */
@@ -3363,6 +3376,7 @@ static void __process_resp_one(struct qedr_dev *dev, struct qedr_qp *qp,
33633376

33643377
/* fill WC */
33653378
wc->status = wc_status;
3379+
wc->vendor_err = 0;
33663380
wc->src_qp = qp->id;
33673381
wc->qp = &qp->ibqp;
33683382
wc->wr_id = wr_id;
@@ -3391,6 +3405,7 @@ static int process_resp_flush(struct qedr_qp *qp, struct qedr_cq *cq,
33913405
while (num_entries && qp->rq.wqe_cons != hw_cons) {
33923406
/* fill WC */
33933407
wc->status = IB_WC_WR_FLUSH_ERR;
3408+
wc->vendor_err = 0;
33943409
wc->wc_flags = 0;
33953410
wc->src_qp = qp->id;
33963411
wc->byte_len = 0;

drivers/infiniband/sw/rxe/rxe_comp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static inline enum comp_state check_psn(struct rxe_qp *qp,
224224
else
225225
return COMPST_DONE;
226226
} else if ((diff > 0) && (wqe->mask & WR_ATOMIC_OR_READ_MASK)) {
227-
return COMPST_ERROR_RETRY;
227+
return COMPST_DONE;
228228
} else {
229229
return COMPST_CHECK_ACK;
230230
}

0 commit comments

Comments
 (0)