Commit 65d4801a authored by Håkon Bugge's avatar Håkon Bugge Committed by Jason Gunthorpe

RDMA/core: Unify RoCE check and re-factor code

In cm_req_handler(), unify the check for RoCE and re-factor to avoid
one test.

Link: https://lore.kernel.org/r/1617705423-15570-1-git-send-email-haakon.bugge@oracle.comSuggested-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Fixes: 8f974860 ("IB/cm: Reduce dependency on gid attribute ndev check")
Fixes: 194f64a3 ("RDMA/core: Fix corrupted SL on passive side")
Signed-off-by: default avatarHåkon Bugge <haakon.bugge@oracle.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 3ccbd933
......@@ -2138,21 +2138,17 @@ static int cm_req_handler(struct cm_work *work)
goto destroy;
}
if (cm_id_priv->av.ah_attr.type != RDMA_AH_ATTR_TYPE_ROCE)
cm_process_routed_req(req_msg, work->mad_recv_wc->wc);
memset(&work->path[0], 0, sizeof(work->path[0]));
if (cm_req_has_alt_path(req_msg))
memset(&work->path[1], 0, sizeof(work->path[1]));
grh = rdma_ah_read_grh(&cm_id_priv->av.ah_attr);
gid_attr = grh->sgid_attr;
if (gid_attr &&
rdma_protocol_roce(work->port->cm_dev->ib_device,
work->port->port_num)) {
if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE) {
work->path[0].rec_type =
sa_conv_gid_to_pathrec_type(gid_attr->gid_type);
} else {
cm_process_routed_req(req_msg, work->mad_recv_wc->wc);
cm_path_set_rec_type(
work->port->cm_dev->ib_device, work->port->port_num,
&work->path[0],
......
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