Commit a512c2fb authored by Parav Pandit's avatar Parav Pandit Committed by Doug Ledford

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: default avatarParav Pandit <parav@mellanox.com>
Reviewed-by: default avatarEli Cohen <eli@mellanox.com>
Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent cbd09aeb
...@@ -1276,20 +1276,36 @@ int ib_resolve_eth_dmac(struct ib_device *device, ...@@ -1276,20 +1276,36 @@ int ib_resolve_eth_dmac(struct ib_device *device,
} }
EXPORT_SYMBOL(ib_resolve_eth_dmac); EXPORT_SYMBOL(ib_resolve_eth_dmac);
int ib_modify_qp(struct ib_qp *qp, /**
struct ib_qp_attr *qp_attr, * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
int qp_attr_mask) * @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) { if (attr_mask & IB_QP_AV) {
int ret; ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr);
ret = ib_resolve_eth_dmac(qp->device, &qp_attr->ah_attr);
if (ret) if (ret)
return ret; return ret;
} }
return ib_security_modify_qp(qp, attr, attr_mask, udata);
}
EXPORT_SYMBOL(ib_modify_qp_with_udata);
return ib_security_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); EXPORT_SYMBOL(ib_modify_qp);
......
...@@ -2947,6 +2947,22 @@ static inline int ib_post_srq_recv(struct ib_srq *srq, ...@@ -2947,6 +2947,22 @@ static inline int ib_post_srq_recv(struct ib_srq *srq,
struct ib_qp *ib_create_qp(struct ib_pd *pd, struct ib_qp *ib_create_qp(struct ib_pd *pd,
struct ib_qp_init_attr *qp_init_attr); 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 * ib_modify_qp - Modifies the attributes for the specified QP and then
* transitions the QP to the given state. * transitions the QP to the given state.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment