Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/cm: Use SLID in the work completion as the DLID in responder side

The responder should always use WC's SLID as the dlid, to follow the
IB SPEC section "13.5.4.2 COMMON RESPONSE ACTIONS":
A responder always takes the following actions in constructing a
response packet:
- The SLID of the received packet is used as the DLID in the response
packet.

Fixes: ac3a949fb2ff ("IB/CM: Set appropriate slid and dlid when handling CM request")
Signed-off-by: Mark Zhang <markzhang@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Link: https://lore.kernel.org/r/cd17c240231e059d2fc07c17dfe555d548b917eb.1662631201.git.leonro@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Mark Zhang and committed by
Leon Romanovsky
b7d95040 5a374949

+7 -7
+7 -7
drivers/infiniband/core/cm.c
··· 1614 1614 1615 1615 static void cm_format_path_lid_from_req(struct cm_req_msg *req_msg, 1616 1616 struct sa_path_rec *primary_path, 1617 - struct sa_path_rec *alt_path) 1617 + struct sa_path_rec *alt_path, 1618 + struct ib_wc *wc) 1618 1619 { 1619 1620 u32 lid; 1620 1621 1621 1622 if (primary_path->rec_type != SA_PATH_REC_TYPE_OPA) { 1622 - sa_path_set_dlid(primary_path, 1623 - IBA_GET(CM_REQ_PRIMARY_LOCAL_PORT_LID, 1624 - req_msg)); 1623 + sa_path_set_dlid(primary_path, wc->slid); 1625 1624 sa_path_set_slid(primary_path, 1626 1625 IBA_GET(CM_REQ_PRIMARY_REMOTE_PORT_LID, 1627 1626 req_msg)); ··· 1657 1658 1658 1659 static void cm_format_paths_from_req(struct cm_req_msg *req_msg, 1659 1660 struct sa_path_rec *primary_path, 1660 - struct sa_path_rec *alt_path) 1661 + struct sa_path_rec *alt_path, 1662 + struct ib_wc *wc) 1661 1663 { 1662 1664 primary_path->dgid = 1663 1665 *IBA_GET_MEM_PTR(CM_REQ_PRIMARY_LOCAL_PORT_GID, req_msg); ··· 1716 1716 if (sa_path_is_roce(alt_path)) 1717 1717 alt_path->roce.route_resolved = false; 1718 1718 } 1719 - cm_format_path_lid_from_req(req_msg, primary_path, alt_path); 1719 + cm_format_path_lid_from_req(req_msg, primary_path, alt_path, wc); 1720 1720 } 1721 1721 1722 1722 static u16 cm_get_bth_pkey(struct cm_work *work) ··· 2129 2129 if (cm_req_has_alt_path(req_msg)) 2130 2130 work->path[1].rec_type = work->path[0].rec_type; 2131 2131 cm_format_paths_from_req(req_msg, &work->path[0], 2132 - &work->path[1]); 2132 + &work->path[1], work->mad_recv_wc->wc); 2133 2133 if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE) 2134 2134 sa_path_set_dmac(&work->path[0], 2135 2135 cm_id_priv->av.ah_attr.roce.dmac);