Skip to content

Commit

Permalink
anolis: RDMA/erdma: Support oob connection attr modification
Browse files Browse the repository at this point in the history
ANBZ: torvalds#293

Support oob connection attributes modification in modify qp
method.

Signed-off-by: Kai <KaiShen@linux.alibaba.com>
Reviewed-by: Cheng You <chengyou@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/1029
  • Loading branch information
Kai authored and zychao66 committed Dec 30, 2022
1 parent 30b45cf commit 63821c2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions drivers/infiniband/hw/erdma/erdma_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,31 @@ static void free_kernel_qp(struct erdma_qp *qp)
qp->kern_qp.rq_db_info_dma_addr);
}

static int update_kernel_qp_oob_attr(struct erdma_qp *qp)
{
struct iw_ext_conn_param *param =
(struct iw_ext_conn_param *)(qp->ibqp.qp_context);

if (!qp->attrs.connect_without_cm)
return -EINVAL;

if (param == NULL)
return -EINVAL;

if (param->sk_addr.family != PF_INET) {
ibdev_err_ratelimited(
&qp->dev->ibdev,
"IPv4 address is required for connection without CM.\n");
return -EINVAL;
}
qp->attrs.sip = ntohl(param->sk_addr.saddr_v4);
qp->attrs.dip = ntohl(param->sk_addr.daddr_v4);
qp->attrs.dport = ntohs(param->sk_addr.dport);
qp->attrs.sport = param->sk_addr.sport;

return 0;
}

static int init_kernel_qp(struct erdma_dev *dev, struct erdma_qp *qp,
struct ib_qp_init_attr *attrs)
{
Expand Down Expand Up @@ -1535,6 +1560,7 @@ static int ib_qp_state_to_erdma_qp_state[IB_QPS_ERR + 1] = {
[IB_QPS_ERR] = ERDMA_QP_STATE_ERROR
};

#define IB_QP_OOB_CONN_ATTR IB_QP_RESERVED1
int erdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
struct ib_udata *udata)
{
Expand All @@ -1545,6 +1571,11 @@ int erdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
struct rdma_ah_attr *ah_attr;
const struct ib_gid_attr *sgid_attr;

if (attr_mask & IB_QP_OOB_CONN_ATTR) {
ret = update_kernel_qp_oob_attr(qp);
if (ret)
return ret;
}

if (compat_mode) {
dprint(DBG_QP, "attr mask: %x, av: %d, state:%d\n", attr_mask,
Expand Down

0 comments on commit 63821c2

Please sign in to comment.