Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9078684pxu; Mon, 28 Dec 2020 06:08:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJylLgzQVfnCCd3so89mUQ9nQ2HEJ/d9QHRfz0idBtg9Wir3Z/7S955BRVWuPkZdLF/WAVEd X-Received: by 2002:a17:906:234d:: with SMTP id m13mr2106938eja.270.1609164498343; Mon, 28 Dec 2020 06:08:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164498; cv=none; d=google.com; s=arc-20160816; b=l/sXD+CtmHkOwtIavNAGeEn/vXEf8occbC9iI9tfcHAuL3UniS+zZlATxLvEvx/8Yc 7ZXl3fEKz+9VTcuJFXPEl1sCoEQW9ZfplJA2TrQlnGzQ994xzJBD+GceXY0oAhY2Fzwq N+XA6T1NsY6H3ACc0wghtkC5EUaqHKuTv/SPcoW4tJefP1thCTGZxLF03YL3qmYjTQcc DyCC+6EwttSxutJg1TexCgrEgns9WNf0GromhSoPZZqL0YZyRfdX8q8WMPPhG4W0b8f1 n7jZgHqWFt4SS/PYubafrZndueaMVf8a5axAsgEFRa4Tr9kNqpPeuCu+oUnUQnK8KRCg SdfA== 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=F42BGS25NOsWNN4QUc/iBM2Ev7NhT394WAxNTs1tkMU=; b=Jm0weuigtPE842SPFXVbLmifjMxyVImU4yjQ0XmyPRXbLVQ3RNz2ynCwtz1863RosZ Qj4Sq4Y7FpylaM4unp1TYPoY5dchvpwaW5KGPdicOgoyp2wcD96eoXtLQJyLuQ9tvBxT 1WofVIdIFGxGuS7OSWp0fitDXsT8+VZursM+JzJcCG9PHpNO5EJeJsamTSe7VHZUX21X PHQcerJ9DtMeM+ZxrWFzHSCaOAIQ9MeqWo/AeSPuT3crBpY546oaQsu3g1mMI9H7QbYa KAJsabJqr5OhPIf/ea5CXciqQ0H7xA45DQJRrZCL7Zh9UK6G4Y6GtBZZqWg3vaD37JSU LTjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ysMIByW2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb6si20578650edb.497.2020.12.28.06.07.55; Mon, 28 Dec 2020 06:08:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ysMIByW2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2436536AbgL1OAg (ORCPT + 99 others); Mon, 28 Dec 2020 09:00:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:34300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436517AbgL1OAd (ORCPT ); Mon, 28 Dec 2020 09:00:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D73AD207A9; Mon, 28 Dec 2020 13:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609163992; bh=T1cwB131nMEUdgfIE5pWH1enmq/+5bJNUEAWm38jwsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ysMIByW2XnBV2KyitDngKHZ41kllRPHN7PHdCeWf9U2w+jNRqR+54G4GVpDJOcTCJ R9FceQWTLmgOIbKVz2+F2B1D5Y+tJkZUrQ3sYZ32M6oymZa8PzTERRXxfdl5uHy2h0 AqKWY0nKSs+zCKbuqiDWp4Qql9suDOZWsZcGay/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.10 023/717] RDMA/rxe: Compute PSN windows correctly Date: Mon, 28 Dec 2020 13:40:21 +0100 Message-Id: <20201228125022.092965027@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bob Pearson [ Upstream commit bb3ab2979fd69db23328691cb10067861df89037 ] The code which limited the number of unacknowledged PSNs was incorrect. The PSNs are limited to 24 bits and wrap back to zero from 0x00ffffff. The test was computing a 32 bit value which wraps at 32 bits so that qp->req.psn can appear smaller than the limit when it is actually larger. Replace '>' test with psn_compare which is used for other PSN comparisons and correctly handles the 24 bit size. Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20201013170741.3590-1-rpearson@hpe.com Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_req.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index af3923bf0a36b..d4917646641aa 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -634,7 +634,8 @@ next_wqe: } if (unlikely(qp_type(qp) == IB_QPT_RC && - qp->req.psn > (qp->comp.psn + RXE_MAX_UNACKED_PSNS))) { + psn_compare(qp->req.psn, (qp->comp.psn + + RXE_MAX_UNACKED_PSNS)) > 0)) { qp->req.wait_psn = 1; goto exit; } -- 2.27.0