Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9221930pxu; Mon, 28 Dec 2020 09:40:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTT3jkXuUjiYZEir2zzegtUsHX+c+vjxGYfOYZj72wqQ+YbNpHH0rCBYY2BiC2zsDO4hdx X-Received: by 2002:a17:906:bc9b:: with SMTP id lv27mr41478264ejb.505.1609177257973; Mon, 28 Dec 2020 09:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609177257; cv=none; d=google.com; s=arc-20160816; b=cxk3AxpCCkhob585GUCggDvJLZRf9W2gmrLkFTfN/JrH68KdDrU2n8FHiWKhiTJnzx 9jfQWBs2blYMjDHehBgZT2xk8YuGQfHTQiJmWlp+fctb6olnvJCn4Fe/503s+YAHPfXq kkmRc1TcinqfW2d2vox9iujrw5Q5Lk2s04NgwAf1m6Hz9UL83Nn6x8l2t7x3LvcN63v5 cPUv7hSk0NxGckgIcLSUImPDQ6+Zua5APwMze5GXDXjDeFv80xZFE7AvUXlEPFvcE+zZ M7KF5ft/x3Nt/4zcBl8lkn5FW5ruj1t7eRmFH1BXSxiXEJvfcG4ZbJqZD1XsmKZtv3C8 6Gyg== 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=5Bxd1U8xgyEXMOvsLfh5nDVrthIAc4y5dM515vLSBSA=; b=nApAs0n1x2/ao5Erbdx2C4hST2x2yfIUHZIFbWX+8V4gAJwlR6EDXvZP+PsGKL6hmB sZsKvC9CxnqBzbau+Bnpas4kVUwsQFYkxY/hUXFCa2wu5EZiXY/4Zn/33O4ov0JCZvR7 8xSeZJbmOVRR+RSToeW1AZVz4r2ltxzWPmZtr7K0Yfi4IbzznQoR2601O4DjeYytW6tK aQEsuuE64FdNZy8FKuVzyYbtJXhcMF/HuRQgKU0IJaeh17BxX/It2jd+ifsxln2zl5Zz CueHrNfv+U5u4Wx/RR86khDpG/iipYTSMQevkmlBqgHLLo6adRn+WYC4HWG0/cQBz+E9 1qvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D2UPcqcV; 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 gn38si18427471ejc.438.2020.12.28.09.40.35; Mon, 28 Dec 2020 09:40:57 -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=D2UPcqcV; 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 S1731416AbgL1NKc (ORCPT + 99 others); Mon, 28 Dec 2020 08:10:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:37962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729679AbgL1NKa (ORCPT ); Mon, 28 Dec 2020 08:10:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E441A20728; Mon, 28 Dec 2020 13:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161014; bh=fRTe/BIEwO1lR6nwfXwwrFYIGxDT2pdPzAUgcL/kN0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D2UPcqcVHhlQEb/ojl327mHCBX+MXCq0ivV6z1cl2loksL3kVcNp9rPyBItMpzfNB 12sy9A5+idS5ahACVV33oqHEHvofGL6OqpfY15NQ8cGiplspMm7XMQEab451+bewjB zgqR5kg4cly/8wEukQjSWyTH+NRhFUQC5ufsUgE4= 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 4.14 070/242] RDMA/rxe: Compute PSN windows correctly Date: Mon, 28 Dec 2020 13:47:55 +0100 Message-Id: <20201228124908.132070682@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 e6785b1ea85fc..693884160f001 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -664,7 +664,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