diff options
author | Parav Pandit <parav@mellanox.com> | 2018-01-09 15:24:51 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-01-15 15:33:21 -0700 |
commit | b96ac05a87da602d501b05883385a049862c0476 (patch) | |
tree | 74a660a4d09192ee5d81aacb968f556f8c158602 | |
parent | b2bedfb39541a7e14798d066b6f8685d84c8fcf5 (diff) |
IB/core: Limit DMAC resolution to userspace QPs
Currently ah_attr is initialized by the ib_cm layer for rdma_cm
based applications. For RoCE transport ah_attr.roce.dmac is already
initialized by ib_cm, rdma_cm either from wc, path record, route
resolve, explicit path record setting depending on active or passive
side QP. Therefore avoid resolving DMAC for QP of kernel consumers.
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r-- | drivers/infiniband/core/verbs.c | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index be18ed7c2326..af3f8780f93f 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -1323,29 +1323,14 @@ static int ib_resolve_eth_dmac(struct ib_device *device, } /** - * ib_modify_qp_with_udata - Modifies the attributes for the specified QP. - * @ib_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. + * IB core internal function to perform QP attributes modification. */ -int ib_modify_qp_with_udata(struct ib_qp *ib_qp, struct ib_qp_attr *attr, - int attr_mask, struct ib_udata *udata) +static int _ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr, + int attr_mask, struct ib_udata *udata) { - struct ib_qp *qp = ib_qp->real_qp; u8 port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; int ret; - if (attr_mask & IB_QP_AV) { - ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr); - if (ret) - return ret; - } - if (rdma_ib_or_roce(qp->device, port)) { if (attr_mask & IB_QP_RQ_PSN && attr->rq_psn & ~0xffffff) { pr_warn("%s: %s rq_psn overflow, masking to 24 bits\n", @@ -1366,6 +1351,31 @@ int ib_modify_qp_with_udata(struct ib_qp *ib_qp, struct ib_qp_attr *attr, return ret; } + +/** + * ib_modify_qp_with_udata - Modifies the attributes for the specified QP. + * @ib_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 *ib_qp, struct ib_qp_attr *attr, + int attr_mask, struct ib_udata *udata) +{ + struct ib_qp *qp = ib_qp->real_qp; + int ret; + + if (attr_mask & IB_QP_AV) { + ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr); + if (ret) + return ret; + } + return _ib_modify_qp(qp, attr, attr_mask, udata); +} EXPORT_SYMBOL(ib_modify_qp_with_udata); int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width) @@ -1427,7 +1437,7 @@ 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); + return _ib_modify_qp(qp->real_qp, qp_attr, qp_attr_mask, NULL); } EXPORT_SYMBOL(ib_modify_qp); |