Skip to content

Commit 90a6cd5

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Pull more rdma fixes from Doug Ledford: "Well, I thought we were going to be done for this -rc cycle. I should have known better than to say so though. We have four additional items that trickled in. One was a simple mistake on my part. I took a patch into my for-next thinking that the issue was less severe than it was. I was then notified that it needed to be in my -rc area instead. The other three were just found late in testing. Summary: - One core fix accidentally applied first to for-next and then cherry picked back because it needed to be in the -rc cycles instead - Another core fix - Two mlx5 fixes" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: IB/mlx5: Always return success for RoCE modify port IB/mlx5: Fix Raw Packet QP event handler assignment IB/core: Avoid accessing non-allocated memory when inferring port type RDMA/uverbs: Initialize cq_context appropriately
2 parents 4898b99 + ec25587 commit 90a6cd5

5 files changed

Lines changed: 22 additions & 6 deletions

File tree

‎drivers/infiniband/core/uverbs_cmd.c‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ static struct ib_ucq_object *create_cq(struct ib_uverbs_file *file,
10151015
cq->uobject = &obj->uobject;
10161016
cq->comp_handler = ib_uverbs_comp_handler;
10171017
cq->event_handler = ib_uverbs_cq_event_handler;
1018-
cq->cq_context = &ev_file->ev_queue;
1018+
cq->cq_context = ev_file ? &ev_file->ev_queue : NULL;
10191019
atomic_set(&cq->usecnt, 0);
10201020

10211021
obj->uobject.object = cq;
@@ -1522,6 +1522,7 @@ static int create_qp(struct ib_uverbs_file *file,
15221522
qp->qp_type = attr.qp_type;
15231523
atomic_set(&qp->usecnt, 0);
15241524
atomic_inc(&pd->usecnt);
1525+
qp->port = 0;
15251526
if (attr.send_cq)
15261527
atomic_inc(&attr.send_cq->usecnt);
15271528
if (attr.recv_cq)
@@ -1962,8 +1963,9 @@ static int modify_qp(struct ib_uverbs_file *file,
19621963
attr->alt_timeout = cmd->base.alt_timeout;
19631964
attr->rate_limit = cmd->rate_limit;
19641965

1965-
attr->ah_attr.type = rdma_ah_find_type(qp->device,
1966-
cmd->base.dest.port_num);
1966+
if (cmd->base.attr_mask & IB_QP_AV)
1967+
attr->ah_attr.type = rdma_ah_find_type(qp->device,
1968+
cmd->base.dest.port_num);
19671969
if (cmd->base.dest.is_global) {
19681970
rdma_ah_set_grh(&attr->ah_attr, NULL,
19691971
cmd->base.dest.flow_label,
@@ -1981,8 +1983,9 @@ static int modify_qp(struct ib_uverbs_file *file,
19811983
rdma_ah_set_port_num(&attr->ah_attr,
19821984
cmd->base.dest.port_num);
19831985

1984-
attr->alt_ah_attr.type = rdma_ah_find_type(qp->device,
1985-
cmd->base.dest.port_num);
1986+
if (cmd->base.attr_mask & IB_QP_ALT_PATH)
1987+
attr->alt_ah_attr.type =
1988+
rdma_ah_find_type(qp->device, cmd->base.dest.port_num);
19861989
if (cmd->base.alt_dest.is_global) {
19871990
rdma_ah_set_grh(&attr->alt_ah_attr, NULL,
19881991
cmd->base.alt_dest.flow_label,

‎drivers/infiniband/core/verbs.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd,
838838
spin_lock_init(&qp->mr_lock);
839839
INIT_LIST_HEAD(&qp->rdma_mrs);
840840
INIT_LIST_HEAD(&qp->sig_mrs);
841+
qp->port = 0;
841842

842843
if (qp_init_attr->qp_type == IB_QPT_XRC_TGT)
843844
return ib_create_xrc_qp(qp, qp_init_attr);
@@ -1297,7 +1298,11 @@ int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
12971298
if (ret)
12981299
return ret;
12991300
}
1300-
return ib_security_modify_qp(qp, attr, attr_mask, udata);
1301+
ret = ib_security_modify_qp(qp, attr, attr_mask, udata);
1302+
if (!ret && (attr_mask & IB_QP_PORT))
1303+
qp->port = attr->port_num;
1304+
1305+
return ret;
13011306
}
13021307
EXPORT_SYMBOL(ib_modify_qp_with_udata);
13031308

‎drivers/infiniband/hw/mlx5/main.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,12 @@ static int mlx5_ib_modify_port(struct ib_device *ibdev, u8 port, int mask,
10851085
bool is_ib = (mlx5_ib_port_link_layer(ibdev, port) ==
10861086
IB_LINK_LAYER_INFINIBAND);
10871087

1088+
/* CM layer calls ib_modify_port() regardless of the link layer. For
1089+
* Ethernet ports, qkey violation and Port capabilities are meaningless.
1090+
*/
1091+
if (!is_ib)
1092+
return 0;
1093+
10881094
if (MLX5_CAP_GEN(dev->mdev, ib_virt) && is_ib) {
10891095
change_mask = props->clr_port_cap_mask | props->set_port_cap_mask;
10901096
value = ~props->clr_port_cap_mask | props->set_port_cap_mask;

‎drivers/infiniband/hw/mlx5/qp.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
12381238
goto err_destroy_tis;
12391239

12401240
sq->base.container_mibqp = qp;
1241+
sq->base.mqp.event = mlx5_ib_qp_event;
12411242
}
12421243

12431244
if (qp->rq.wqe_cnt) {

‎include/rdma/ib_verbs.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,7 @@ struct ib_qp {
16831683
enum ib_qp_type qp_type;
16841684
struct ib_rwq_ind_table *rwq_ind_tbl;
16851685
struct ib_qp_security *qp_sec;
1686+
u8 port;
16861687
};
16871688

16881689
struct ib_mr {

0 commit comments

Comments
 (0)