Skip to content

Commit feb7c1e

Browse files
Christoph Hellwigdledford
authored andcommitted
IB: remove in-kernel support for memory windows
Remove the unused ib_allow_mw and ib_bind_mw functions, remove the unused IB_WR_BIND_MW and IB_WC_BIND_MW opcodes and move ib_dealloc_mw into the uverbs module. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> [core] Reviewed-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent b7d3e0a commit feb7c1e

27 files changed

Lines changed: 16 additions & 381 deletions

File tree

‎Documentation/infiniband/core_locking.txt‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Sleeping and interrupt context
1515
modify_ah
1616
query_ah
1717
destroy_ah
18-
bind_mw
1918
post_send
2019
post_recv
2120
poll_cq
@@ -31,7 +30,6 @@ Sleeping and interrupt context
3130
ib_modify_ah
3231
ib_query_ah
3332
ib_destroy_ah
34-
ib_bind_mw
3533
ib_post_send
3634
ib_post_recv
3735
ib_req_notify_cq

‎drivers/infiniband/core/uverbs.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ void ib_uverbs_event_handler(struct ib_event_handler *handler,
204204
struct ib_event *event);
205205
void ib_uverbs_dealloc_xrcd(struct ib_uverbs_device *dev, struct ib_xrcd *xrcd);
206206

207+
int uverbs_dealloc_mw(struct ib_mw *mw);
208+
207209
struct ib_uverbs_flow_spec {
208210
union {
209211
union {

‎drivers/infiniband/core/uverbs_cmd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file,
12431243
idr_remove_uobj(&ib_uverbs_mw_idr, uobj);
12441244

12451245
err_unalloc:
1246-
ib_dealloc_mw(mw);
1246+
uverbs_dealloc_mw(mw);
12471247

12481248
err_put:
12491249
put_pd_read(pd);
@@ -1272,7 +1272,7 @@ ssize_t ib_uverbs_dealloc_mw(struct ib_uverbs_file *file,
12721272

12731273
mw = uobj->object;
12741274

1275-
ret = ib_dealloc_mw(mw);
1275+
ret = uverbs_dealloc_mw(mw);
12761276
if (!ret)
12771277
uobj->live = 0;
12781278

‎drivers/infiniband/core/uverbs_main.c‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ static int (*uverbs_ex_cmd_table[])(struct ib_uverbs_file *file,
133133
static void ib_uverbs_add_one(struct ib_device *device);
134134
static void ib_uverbs_remove_one(struct ib_device *device, void *client_data);
135135

136+
int uverbs_dealloc_mw(struct ib_mw *mw)
137+
{
138+
struct ib_pd *pd = mw->pd;
139+
int ret;
140+
141+
ret = mw->device->dealloc_mw(mw);
142+
if (!ret)
143+
atomic_dec(&pd->usecnt);
144+
return ret;
145+
}
146+
136147
static void ib_uverbs_release_dev(struct kobject *kobj)
137148
{
138149
struct ib_uverbs_device *dev =
@@ -224,7 +235,7 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
224235
struct ib_mw *mw = uobj->object;
225236

226237
idr_remove_uobj(&ib_uverbs_mw_idr, uobj);
227-
ib_dealloc_mw(mw);
238+
uverbs_dealloc_mw(mw);
228239
kfree(uobj);
229240
}
230241

‎drivers/infiniband/core/verbs.c‎

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,42 +1403,6 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
14031403
}
14041404
EXPORT_SYMBOL(ib_alloc_mr);
14051405

1406-
/* Memory windows */
1407-
1408-
struct ib_mw *ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type)
1409-
{
1410-
struct ib_mw *mw;
1411-
1412-
if (!pd->device->alloc_mw)
1413-
return ERR_PTR(-ENOSYS);
1414-
1415-
mw = pd->device->alloc_mw(pd, type);
1416-
if (!IS_ERR(mw)) {
1417-
mw->device = pd->device;
1418-
mw->pd = pd;
1419-
mw->uobject = NULL;
1420-
mw->type = type;
1421-
atomic_inc(&pd->usecnt);
1422-
}
1423-
1424-
return mw;
1425-
}
1426-
EXPORT_SYMBOL(ib_alloc_mw);
1427-
1428-
int ib_dealloc_mw(struct ib_mw *mw)
1429-
{
1430-
struct ib_pd *pd;
1431-
int ret;
1432-
1433-
pd = mw->pd;
1434-
ret = mw->device->dealloc_mw(mw);
1435-
if (!ret)
1436-
atomic_dec(&pd->usecnt);
1437-
1438-
return ret;
1439-
}
1440-
EXPORT_SYMBOL(ib_dealloc_mw);
1441-
14421406
/* "Fast" memory regions */
14431407

14441408
struct ib_fmr *ib_alloc_fmr(struct ib_pd *pd,

‎drivers/infiniband/hw/cxgb3/iwch_cq.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ static int iwch_poll_cq_one(struct iwch_dev *rhp, struct iwch_cq *chp,
115115
case T3_SEND_WITH_SE_INV:
116116
wc->opcode = IB_WC_SEND;
117117
break;
118-
case T3_BIND_MW:
119-
wc->opcode = IB_WC_BIND_MW;
120-
break;
121-
122118
case T3_LOCAL_INV:
123119
wc->opcode = IB_WC_LOCAL_INV;
124120
break;

‎drivers/infiniband/hw/cxgb3/iwch_provider.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,6 @@ int iwch_register_device(struct iwch_dev *dev)
13881388
dev->ibdev.reg_user_mr = iwch_reg_user_mr;
13891389
dev->ibdev.dereg_mr = iwch_dereg_mr;
13901390
dev->ibdev.alloc_mw = iwch_alloc_mw;
1391-
dev->ibdev.bind_mw = iwch_bind_mw;
13921391
dev->ibdev.dealloc_mw = iwch_dealloc_mw;
13931392
dev->ibdev.alloc_mr = iwch_alloc_mr;
13941393
dev->ibdev.map_mr_sg = iwch_map_mr_sg;

‎drivers/infiniband/hw/cxgb3/iwch_provider.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,6 @@ int iwch_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
330330
struct ib_send_wr **bad_wr);
331331
int iwch_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
332332
struct ib_recv_wr **bad_wr);
333-
int iwch_bind_mw(struct ib_qp *qp,
334-
struct ib_mw *mw,
335-
struct ib_mw_bind *mw_bind);
336333
int iwch_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc);
337334
int iwch_post_terminate(struct iwch_qp *qhp, struct respQ_msg_t *rsp_msg);
338335
int iwch_post_zb_read(struct iwch_ep *ep);

‎drivers/infiniband/hw/cxgb3/iwch_qp.c‎

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -526,88 +526,6 @@ int iwch_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
526526
return err;
527527
}
528528

529-
int iwch_bind_mw(struct ib_qp *qp,
530-
struct ib_mw *mw,
531-
struct ib_mw_bind *mw_bind)
532-
{
533-
struct iwch_dev *rhp;
534-
struct iwch_mw *mhp;
535-
struct iwch_qp *qhp;
536-
union t3_wr *wqe;
537-
u32 pbl_addr;
538-
u8 page_size;
539-
u32 num_wrs;
540-
unsigned long flag;
541-
struct ib_sge sgl;
542-
int err=0;
543-
enum t3_wr_flags t3_wr_flags;
544-
u32 idx;
545-
struct t3_swsq *sqp;
546-
547-
qhp = to_iwch_qp(qp);
548-
mhp = to_iwch_mw(mw);
549-
rhp = qhp->rhp;
550-
551-
spin_lock_irqsave(&qhp->lock, flag);
552-
if (qhp->attr.state > IWCH_QP_STATE_RTS) {
553-
spin_unlock_irqrestore(&qhp->lock, flag);
554-
return -EINVAL;
555-
}
556-
num_wrs = Q_FREECNT(qhp->wq.sq_rptr, qhp->wq.sq_wptr,
557-
qhp->wq.sq_size_log2);
558-
if (num_wrs == 0) {
559-
spin_unlock_irqrestore(&qhp->lock, flag);
560-
return -ENOMEM;
561-
}
562-
idx = Q_PTR2IDX(qhp->wq.wptr, qhp->wq.size_log2);
563-
PDBG("%s: idx 0x%0x, mw 0x%p, mw_bind 0x%p\n", __func__, idx,
564-
mw, mw_bind);
565-
wqe = (union t3_wr *) (qhp->wq.queue + idx);
566-
567-
t3_wr_flags = 0;
568-
if (mw_bind->send_flags & IB_SEND_SIGNALED)
569-
t3_wr_flags = T3_COMPLETION_FLAG;
570-
571-
sgl.addr = mw_bind->bind_info.addr;
572-
sgl.lkey = mw_bind->bind_info.mr->lkey;
573-
sgl.length = mw_bind->bind_info.length;
574-
wqe->bind.reserved = 0;
575-
wqe->bind.type = TPT_VATO;
576-
577-
/* TBD: check perms */
578-
wqe->bind.perms = iwch_ib_to_tpt_bind_access(
579-
mw_bind->bind_info.mw_access_flags);
580-
wqe->bind.mr_stag = cpu_to_be32(mw_bind->bind_info.mr->lkey);
581-
wqe->bind.mw_stag = cpu_to_be32(mw->rkey);
582-
wqe->bind.mw_len = cpu_to_be32(mw_bind->bind_info.length);
583-
wqe->bind.mw_va = cpu_to_be64(mw_bind->bind_info.addr);
584-
err = iwch_sgl2pbl_map(rhp, &sgl, 1, &pbl_addr, &page_size);
585-
if (err) {
586-
spin_unlock_irqrestore(&qhp->lock, flag);
587-
return err;
588-
}
589-
wqe->send.wrid.id0.hi = qhp->wq.sq_wptr;
590-
sqp = qhp->wq.sq + Q_PTR2IDX(qhp->wq.sq_wptr, qhp->wq.sq_size_log2);
591-
sqp->wr_id = mw_bind->wr_id;
592-
sqp->opcode = T3_BIND_MW;
593-
sqp->sq_wptr = qhp->wq.sq_wptr;
594-
sqp->complete = 0;
595-
sqp->signaled = (mw_bind->send_flags & IB_SEND_SIGNALED);
596-
wqe->bind.mr_pbl_addr = cpu_to_be32(pbl_addr);
597-
wqe->bind.mr_pagesz = page_size;
598-
build_fw_riwrh((void *)wqe, T3_WR_BIND, t3_wr_flags,
599-
Q_GENBIT(qhp->wq.wptr, qhp->wq.size_log2), 0,
600-
sizeof(struct t3_bind_mw_wr) >> 3, T3_SOPEOP);
601-
++(qhp->wq.wptr);
602-
++(qhp->wq.sq_wptr);
603-
spin_unlock_irqrestore(&qhp->lock, flag);
604-
605-
if (cxio_wq_db_enabled(&qhp->wq))
606-
ring_doorbell(qhp->wq.doorbell, qhp->wq.qpid);
607-
608-
return err;
609-
}
610-
611529
static inline void build_term_codes(struct respQ_msg_t *rsp_msg,
612530
u8 *layer_type, u8 *ecode)
613531
{

‎drivers/infiniband/hw/cxgb4/cq.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,9 +744,6 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc)
744744
case FW_RI_SEND_WITH_SE:
745745
wc->opcode = IB_WC_SEND;
746746
break;
747-
case FW_RI_BIND_MW:
748-
wc->opcode = IB_WC_BIND_MW;
749-
break;
750747

751748
case FW_RI_LOCAL_INV:
752749
wc->opcode = IB_WC_LOCAL_INV;

0 commit comments

Comments
 (0)