From patchwork Wed Oct 19 08:30:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp316064wrs; Wed, 19 Oct 2022 06:07:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ozBqS7fyWRpnCUw1eSiJBScUzZuLW1osQotuGz0xaxXkjm0Mo2jJ7+wkP0gYQooQr/yBq X-Received: by 2002:a17:90b:811:b0:20b:16ca:2abc with SMTP id bk17-20020a17090b081100b0020b16ca2abcmr9904631pjb.163.1666184831997; Wed, 19 Oct 2022 06:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184831; cv=none; d=google.com; s=arc-20160816; b=KvSbIXBSChPIjK/wRzaF5It+DFzolUV/MlJmiLlB/raKnDZNEOetQNLa+S02fj4iPT JkYNf2tY421PtZUAqawjZY9JzrASKrkS4sKk7TsMvgRbPdueCPJ6mdmBuQ9KYwDY5jag uv4yY05jmrJuGHeTXxZIG7+Ir5KFj7tMJS9IsKDwZR2n1pI3UdutFD7xhNbciSm4eQny K+VcbLFUeFgslVOrpZsbH4AWocTt/Y7ButCVI8xkzPE1wf2V8wQqUah3ojgUqbAl+lYb o/uI4DAdtWR9ueXCn0m5Wl6SbQvwmWrkS7D6WM6wqYmMhenMaSfCPaZvVt2B8EsY9qVp vU6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XQWTFWqPdrLlJyM9kTwxE6M4jvxIaSdeF7dUraf0DXY=; b=q7rXpMYg11gr2wC77c+w2cXXy+mW+of6uAzg2zUehOSLoxfYBKiAbnnxRRqfOVW863 Lsj86KyG+UlLT6SSdezs/SfGzXD+k314pZH3rmhzeoKyhq2Nuhjy/uuWeZzeGPhquutn X2zL8Pn2jjzDpn3cF3sXjhLH+8NSLMDCeYQAmWD4+RXZQX6zBmCnqRcg/uqDNXMjk8bZ GPjYInRlJCNZR/XI9NomH4WSPVqJY+6AqZQXTkGIGWFO42CIDr3bcUvqvLsU4QeMN0MA gXSFBcnvZK3RFVjhoCp9DMHBpx1BMBFwZ9E/nuDDRNV/8LdDwFHx51F7WJI636TrzayZ yKNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rs24cvKH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 184-20020a6304c1000000b0046afcf0fa93si17926756pge.522.2022.10.19.06.06.43; Wed, 19 Oct 2022 06:07:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rs24cvKH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231340AbiJSNDf (ORCPT + 99 others); Wed, 19 Oct 2022 09:03:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231270AbiJSNDN (ORCPT ); Wed, 19 Oct 2022 09:03:13 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3B951D440A; Wed, 19 Oct 2022 05:46:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C51E5CE2101; Wed, 19 Oct 2022 09:02:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C416CC433D6; Wed, 19 Oct 2022 09:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170167; bh=PxotsaKLlKY7b4HcUMIZ3OuGfX1704mNrjuqwc66VrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rs24cvKHcV+f0JnbBfW7wsPYqCGOtYDgsxRYng/XVx7/tnwwSz/LHgYCh4FBDPldG oXhqe/W4yAzgnKsYs6XwZfPr2RQZW8gwL9ioqqYpCxIDsTyU3CyoWHZBaF+ebjNO8z 3P31i3crlpm7aQa3+G9+eeUR1pO1edDAeVUXbcbY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Zhang , Mark Bloch , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.0 551/862] RDMA/cm: Use SLID in the work completion as the DLID in responder side Date: Wed, 19 Oct 2022 10:30:38 +0200 Message-Id: <20221019083314.320395236@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747121426185524188?= X-GMAIL-MSGID: =?utf-8?q?1747121426185524188?= From: Mark Zhang [ Upstream commit b7d95040c13f61a4a6a859c5355faf583eff9658 ] 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 Reviewed-by: Mark Bloch Link: https://lore.kernel.org/r/cd17c240231e059d2fc07c17dfe555d548b917eb.1662631201.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/core/cm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index b985e0d9bc05..5c910f5c01b3 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -1632,14 +1632,13 @@ static void cm_path_set_rec_type(struct ib_device *ib_device, u32 port_num, static void cm_format_path_lid_from_req(struct cm_req_msg *req_msg, struct sa_path_rec *primary_path, - struct sa_path_rec *alt_path) + struct sa_path_rec *alt_path, + struct ib_wc *wc) { u32 lid; if (primary_path->rec_type != SA_PATH_REC_TYPE_OPA) { - sa_path_set_dlid(primary_path, - IBA_GET(CM_REQ_PRIMARY_LOCAL_PORT_LID, - req_msg)); + sa_path_set_dlid(primary_path, wc->slid); sa_path_set_slid(primary_path, IBA_GET(CM_REQ_PRIMARY_REMOTE_PORT_LID, req_msg)); @@ -1676,7 +1675,8 @@ static void cm_format_path_lid_from_req(struct cm_req_msg *req_msg, static void cm_format_paths_from_req(struct cm_req_msg *req_msg, struct sa_path_rec *primary_path, - struct sa_path_rec *alt_path) + struct sa_path_rec *alt_path, + struct ib_wc *wc) { primary_path->dgid = *IBA_GET_MEM_PTR(CM_REQ_PRIMARY_LOCAL_PORT_GID, req_msg); @@ -1734,7 +1734,7 @@ static void cm_format_paths_from_req(struct cm_req_msg *req_msg, if (sa_path_is_roce(alt_path)) alt_path->roce.route_resolved = false; } - cm_format_path_lid_from_req(req_msg, primary_path, alt_path); + cm_format_path_lid_from_req(req_msg, primary_path, alt_path, wc); } static u16 cm_get_bth_pkey(struct cm_work *work) @@ -2148,7 +2148,7 @@ static int cm_req_handler(struct cm_work *work) if (cm_req_has_alt_path(req_msg)) work->path[1].rec_type = work->path[0].rec_type; cm_format_paths_from_req(req_msg, &work->path[0], - &work->path[1]); + &work->path[1], work->mad_recv_wc->wc); if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE) sa_path_set_dmac(&work->path[0], cm_id_priv->av.ah_attr.roce.dmac);