IB/core: Introduce modify QP operation with udata
PATCH 1/2 IB/core: Introduce modify QP operation with udata
From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>
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.
--- drivers/infiniband/core/verbs.c | 32 ++++++++++++++++++++++++-------- include/rdma/ib_verbs.h | 16 ++++++++++++++++ 2 files changed, 40 insertions(+), 8 deletions(-)
drivers/infiniband/core/verbs.c +24 -8
@@ -1253,20 +1253,36 @@ int ib_resolve_eth_dmac(struct ib_device *device, }EXPORT_SYMBOL (ib_resolve_eth_dmac); -int ib_modify_qp (struct ib_qp *qp, -struct ib_qp_attr *qp_attr, -int qp_attr_mask) +/** +* ib_modify_qp_with_udata - Modifies the attributes for the specified QP. +* @qp: The QP to modify. +* @attr: On input, specifies the QP attributes to modify. On output, +* the current values of selected QP attributes are returned. +* @attr_mask: A bit-mask used to specify which attributes of the QP +* are being modified. +* @udata: pointer to user's input output buffer information +* are being modified. +* It returns 0 on success and returns appropriate error code on error. +*/ +int ib_modify_qp_with_udata (struct ib_qp *qp,struct ib_qp_attr *attr, +int attr_mask,struct ib_udata *udata) { +int ret; -if (qp_attr_mask &IB_QP_AV ) { -int ret; - - ret =ib_resolve_eth_dmac (qp->device, &qp_attr->ah_attr); +if (attr_mask &IB_QP_AV ) { + ret =ib_resolve_eth_dmac (qp->device, &attr->ah_attr);if (ret)return ret; } +return qp->device->modify_qp (qp->real_qp, attr, attr_mask, udata); +} +EXPORT_SYMBOL (ib_modify_qp_with_udata); -return qp->device->modify_qp (qp->real_qp, qp_attr, qp_attr_mask,NULL ); +int ib_modify_qp (struct ib_qp *qp, +struct ib_qp_attr *qp_attr, +int qp_attr_mask) +{ +return ib_modify_qp_with_udata (qp, qp_attr, qp_attr_mask,NULL ); }EXPORT_SYMBOL (ib_modify_qp);
include/rdma/ib_verbs.h +16 -0
@@ -2898,6 +2898,22 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *qp_init_attr);/** +* ib_modify_qp_with_udata - Modifies the attributes for the specified QP. +* @qp: The QP to modify. +* @attr: On input, specifies the QP attributes to modify. On output, +* the current values of selected QP attributes are returned. +* @attr_mask: A bit-mask used to specify which attributes of the QP +* are being modified. +* @udata: pointer to user's input output buffer information +* are being modified. +* It returns 0 on success and returns appropriate error code on error. +*/ +int ib_modify_qp_with_udata (struct ib_qp *qp, +struct ib_qp_attr *attr, +int attr_mask, +struct ib_udata *udata); + +/** * ib_modify_qp - Modifies the attributes for the specified QP and then * transitions the QP to the given state. * @qp: The QP to modify.
Signature · 6 lines
2.12.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170523082609.12603-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
PATCH 2/2 IB/uverbs: Make use of ib_modify_qp variant to avoid resolving DMAC
From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>
This patch makes use of IB core's ib_modify_qp_with_udata function that also resolves the DMAC and handles udata.
--- drivers/infiniband/core/uverbs_cmd.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +4 -17
@@ -1996,23 +1996,10 @@ static int modify_qp(struct ib_uverbs_file *file,rdma_ah_set_port_num (&attr->alt_ah_attr, cmd->base.alt_dest.port_num); -if (qp->real_qp == qp) { -if (cmd->base.attr_mask &IB_QP_AV ) { - ret =ib_resolve_eth_dmac (qp->device, &attr->ah_attr); -if (ret) - goto release_qp; - } - ret = qp->device->modify_qp (qp, attr, -modify_qp_mask (qp->qp_type, - cmd->base.attr_mask), - udata); - }else { - ret =ib_modify_qp (qp, attr, -modify_qp_mask (qp->qp_type, - cmd->base.attr_mask)); - } - -release_qp: + ret =ib_modify_qp_with_udata (qp, attr, +modify_qp_mask (qp->qp_type, + cmd->base.attr_mask), + udata);uobj_put_obj_read (qp); out:
Signature · 6 lines
2.12.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Leon Romanovsky
From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>
This patch adds new function
ib_modify_qp_with_udataso 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.
This series has been accepted into 4.13-rc, thanks.
Signature · 3 lines
Doug Ledford <[email protected]> GPG Key ID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD