Skip to content

Commit e85ec33

Browse files
weiny2dledford
authored andcommitted
IB/rdmavt: add modify queue pair driver helpers
Low level drivers need to be able to check incoming attributes as well as be able to adjust their private data on queue pair modification. Add 2 driver callbacks, check_modify_qp and modify_qp, to facilitate this. Signed-off-by: Ira Weiny <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 2b047ea commit e85ec33

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

drivers/infiniband/sw/rdmavt/qp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,10 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
970970
attr_mask, link))
971971
goto inval;
972972

973+
if (rdi->driver_f.check_modify_qp &&
974+
rdi->driver_f.check_modify_qp(qp, attr, attr_mask, udata))
975+
goto inval;
976+
973977
if (attr_mask & IB_QP_AV) {
974978
if (attr->ah_attr.dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE))
975979
goto inval;
@@ -1166,6 +1170,9 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
11661170
if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC)
11671171
qp->s_max_rd_atomic = attr->max_rd_atomic;
11681172

1173+
if (rdi->driver_f.modify_qp)
1174+
rdi->driver_f.modify_qp(qp, attr, attr_mask, udata);
1175+
11691176
spin_unlock(&qp->s_lock);
11701177
spin_unlock_irq(&qp->r_lock);
11711178

include/rdma/rdma_vt.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ struct rvt_driver_provided {
256256
struct rvt_ah *);
257257
int (*alloc_qpn)(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt,
258258
enum ib_qp_type type, u8 port, gfp_t gfp);
259+
/**
260+
* Return 0 if modification is valid, -errno otherwise
261+
*/
262+
int (*check_modify_qp)(struct rvt_qp *qp, struct ib_qp_attr *attr,
263+
int attr_mask, struct ib_udata *udata);
264+
void (*modify_qp)(struct rvt_qp *qp, struct ib_qp_attr *attr,
265+
int attr_mask, struct ib_udata *udata);
259266
};
260267

261268
struct rvt_dev_info {

0 commit comments

Comments
 (0)