Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp685577pxb; Tue, 5 Apr 2022 18:44:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhHCSb+W0ywaC0tagCYsf71ycENZX2pwhXGniZjKxVMuXQn8Rl4Bmj5C3+MeTkbs7i8cxj X-Received: by 2002:aa7:cfda:0:b0:41c:bd28:a7da with SMTP id r26-20020aa7cfda000000b0041cbd28a7damr6311670edy.129.1649209383534; Tue, 05 Apr 2022 18:43:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649209383; cv=none; d=google.com; s=arc-20160816; b=h0gR++W5CNLcBHbiHnrEIUwJwRGAH0aj7UNybMS9pClKfRLobImi9Gx38odSKTm8Ia 4NzXvkOghKGrB1bQ/tdo7vNDhqdQgb6KQGqrqHj9v+fju1ancK1YmwbTgucZFJSfuh3r Y86mgUBw3sGInKCNwz6PJneURav2R8V41BAR6lYuOJz0PmMQdVnMhZ1wA0xoujUpx/hK NFeC+unkqxMaQ+IAwFkv7ZupFYjAjcaklfsY6ctPado9XIMfWCbb2k3KUKrES+CuM1B4 H7eHUwH3YH03L9E/DK/Q9Q/TZOx+Hzl1keki/KaFLhuIXzRhuPko1dFtotBTB1B+USCQ cqMw== 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=+g9n4SyRll14daEJdKnJTPRS9UY9EfYmKcOD+ALtDCk=; b=Wt5yaOva76KAF99sMHYXbCNIa3dgfPu3doe4kMZlsPEOKiO/ltghT3XBF4qbLLDCFU MheU4m+K3NEWV0rm9sjGZt7SPaqKu8gkBfJpRtHMxSkdxaY5Qqld0hhO/zlfZCKUgSIK lLARjZ59Qv7LtL6crbCGXZJ1/56hCvtYOkd/XQLn3MpQWG+bkUNer18V/fcUHrA3AAXg RU2zGVsuiZuRJoWvnAdMfZL6JLwf60QXM9Tr4iXDgLciXoL8UiIe7d6A06EPYvRHjP1t EQ4PX8KGDfNwU3Sp3P2OMrFohi1H09kbYd2gcWu5RV8UvcMsifdPLfyC+1I0uL0aDeNU oGCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lNNm1ne8; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kj16-20020a170907765000b006e106ad0114si10516681ejc.900.2022.04.05.18.42.34; Tue, 05 Apr 2022 18:43:03 -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=lNNm1ne8; 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 S1385258AbiDEMcI (ORCPT + 99 others); Tue, 5 Apr 2022 08:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236080AbiDEI7P (ORCPT ); Tue, 5 Apr 2022 04:59:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D61FE255A7; Tue, 5 Apr 2022 01:53:21 -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 ams.source.kernel.org (Postfix) with ESMTPS id 6EE63B81BD9; Tue, 5 Apr 2022 08:53:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3150C385A1; Tue, 5 Apr 2022 08:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148799; bh=uZbSp/e8RnRyXsLlnieqg+hbOw+fz3mD3VWlhSBXOG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lNNm1ne8S+MAp43Uxxn05bZp8IlYRK12KbekCQ6zM/eVm/Q9ATSFq9qxlz0DWJhLE EbghY0HXbekkSKkyhube6gE4EXt9IvI2FEI38+H/zLfbbmfS9TqP2Begeiu/V6TMZQ iQO0DSQpYoX6T5+Pe7mjcSoj5X4swZSdtLVSUeO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiao Yang , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.16 0486/1017] RDMA/rxe: Check the last packet by RXE_END_MASK Date: Tue, 5 Apr 2022 09:23:19 +0200 Message-Id: <20220405070408.724845173@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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 From: Xiao Yang [ Upstream commit b1377cc37f6bebd57ce8747b7e16163a475af295 ] It's wrong to check the last packet by RXE_COMP_MASK because the flag is to indicate if responder needs to generate a completion. Fixes: 9fcd67d1772c ("IB/rxe: increment msn only when completing a request") Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20211229034438.1854908-1-yangx.jy@fujitsu.com Signed-off-by: Xiao Yang Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_resp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index e8f435fa6e4d..380934e38923 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -814,6 +814,10 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt) return RESPST_ERR_INVALIDATE_RKEY; } + if (pkt->mask & RXE_END_MASK) + /* We successfully processed this new request. */ + qp->resp.msn++; + /* next expected psn, read handles this separately */ qp->resp.psn = (pkt->psn + 1) & BTH_PSN_MASK; qp->resp.ack_psn = qp->resp.psn; @@ -821,11 +825,9 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt) qp->resp.opcode = pkt->opcode; qp->resp.status = IB_WC_SUCCESS; - if (pkt->mask & RXE_COMP_MASK) { - /* We successfully processed this new request. */ - qp->resp.msn++; + if (pkt->mask & RXE_COMP_MASK) return RESPST_COMPLETE; - } else if (qp_type(qp) == IB_QPT_RC) + else if (qp_type(qp) == IB_QPT_RC) return RESPST_ACKNOWLEDGE; else return RESPST_CLEANUP; -- 2.34.1