Skip to content

Commit a512c2f

Browse files
paravmellanoxdledford
authored andcommitted
IB/core: Introduce modify QP operation with udata
This patch adds new function ib_modify_qp_with_udata so that uverbs layer can avoid handling L2 mac address at verbs layer and depend on the core layer to resolve the mac address consistently for all required QPs. Signed-off-by: Parav Pandit <[email protected]> Reviewed-by: Eli Cohen <[email protected]> Reviewed-by: Daniel Jurgens <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent cbd09ae commit a512c2f

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

drivers/infiniband/core/verbs.c

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,20 +1276,36 @@ int ib_resolve_eth_dmac(struct ib_device *device,
12761276
}
12771277
EXPORT_SYMBOL(ib_resolve_eth_dmac);
12781278

1279-
int ib_modify_qp(struct ib_qp *qp,
1280-
struct ib_qp_attr *qp_attr,
1281-
int qp_attr_mask)
1279+
/**
1280+
* ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
1281+
* @qp: The QP to modify.
1282+
* @attr: On input, specifies the QP attributes to modify. On output,
1283+
* the current values of selected QP attributes are returned.
1284+
* @attr_mask: A bit-mask used to specify which attributes of the QP
1285+
* are being modified.
1286+
* @udata: pointer to user's input output buffer information
1287+
* are being modified.
1288+
* It returns 0 on success and returns appropriate error code on error.
1289+
*/
1290+
int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
1291+
int attr_mask, struct ib_udata *udata)
12821292
{
1293+
int ret;
12831294

1284-
if (qp_attr_mask & IB_QP_AV) {
1285-
int ret;
1286-
1287-
ret = ib_resolve_eth_dmac(qp->device, &qp_attr->ah_attr);
1295+
if (attr_mask & IB_QP_AV) {
1296+
ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr);
12881297
if (ret)
12891298
return ret;
12901299
}
1300+
return ib_security_modify_qp(qp, attr, attr_mask, udata);
1301+
}
1302+
EXPORT_SYMBOL(ib_modify_qp_with_udata);
12911303

1292-
return ib_security_modify_qp(qp->real_qp, qp_attr, qp_attr_mask, NULL);
1304+
int ib_modify_qp(struct ib_qp *qp,
1305+
struct ib_qp_attr *qp_attr,
1306+
int qp_attr_mask)
1307+
{
1308+
return ib_modify_qp_with_udata(qp, qp_attr, qp_attr_mask, NULL);
12931309
}
12941310
EXPORT_SYMBOL(ib_modify_qp);
12951311

include/rdma/ib_verbs.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2947,6 +2947,22 @@ static inline int ib_post_srq_recv(struct ib_srq *srq,
29472947
struct ib_qp *ib_create_qp(struct ib_pd *pd,
29482948
struct ib_qp_init_attr *qp_init_attr);
29492949

2950+
/**
2951+
* ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
2952+
* @qp: The QP to modify.
2953+
* @attr: On input, specifies the QP attributes to modify. On output,
2954+
* the current values of selected QP attributes are returned.
2955+
* @attr_mask: A bit-mask used to specify which attributes of the QP
2956+
* are being modified.
2957+
* @udata: pointer to user's input output buffer information
2958+
* are being modified.
2959+
* It returns 0 on success and returns appropriate error code on error.
2960+
*/
2961+
int ib_modify_qp_with_udata(struct ib_qp *qp,
2962+
struct ib_qp_attr *attr,
2963+
int attr_mask,
2964+
struct ib_udata *udata);
2965+
29502966
/**
29512967
* ib_modify_qp - Modifies the attributes for the specified QP and then
29522968
* transitions the QP to the given state.

0 commit comments

Comments
 (0)