Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3924330pxj; Mon, 21 Jun 2021 09:29:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNbEMbC8Al8hlrXKFFnGNnuJRbSbI1zCmOwY1DMqWlE5TLSWyOwSRkCkB1k1lcCxWARpSN X-Received: by 2002:a92:cacf:: with SMTP id m15mr15283028ilq.14.1624292942527; Mon, 21 Jun 2021 09:29:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624292942; cv=none; d=google.com; s=arc-20160816; b=iZ/+7oDaT7PecVF+4eK1UwJ6CfHbpSiB0wir4hI7Lut8NlptxCnFFFO8z66ybvB52Q dTD7xQ5Ll/YQo0WWBbyIDJQjW0I9D/7WZSgKaHV8bssYRaAlN35157hll16LRKo+/iL7 HnQrzdJE3a9f3qh/dV9OpmFesqJgxCSg6L8vJbRpOGzy3hnQ6Kh+3tMqItmmS9uJJ33m AY2bw5yi7wExoVAmme3nbphz/0M66braaVPzpsw6OvcjjtbvC4lT3EMJkShoTKjnuHVN K4gePy344/6sBdVYdXqzO0u3sTNF0e/5C+/ZNTy33ris3xBUCXcmQtePKYvJBiH86SGO 2HOg== 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=Jf1X3qwu4XV8bVZRhiyd+toArh9qcAMlQlfuMKO+RfU=; b=uo5mHJ3f8iCIOHhWxy+1bURCwTxzPnzKbqHKYuQQBCJXQy/KdcosjA9wOJZdhWj+dq Qg/wLJlh2ESh/5Tfs/3Ahv+QdPG0vrjMqTQajRihfTHcfi+LCoMCHfgkShkNzGMUaDao +cPpY1tVopT5+UUGFQKesamJky+X7NpRlcumozxtDZVqA3JDTALCc3iTPDWCT8Mw7Apt AzQdD6QQhGSACmHKH3aCGcz+Y/+azknpmu06DMnMi54bgIp9auqFgY2oJe8V4oROGtII wGVikQw5pRFfxRwIhsvws6A86cPQEq6hL4urcbhv8NUscLnfcY3upfvpys4QuTVfdvaq OXng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ubg1idS8; 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 i13si15218321ilm.45.2021.06.21.09.28.50; Mon, 21 Jun 2021 09:29:02 -0700 (PDT) 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=ubg1idS8; 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 S231661AbhFUQaS (ORCPT + 99 others); Mon, 21 Jun 2021 12:30:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:49228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232216AbhFUQ20 (ORCPT ); Mon, 21 Jun 2021 12:28:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EC7D96120D; Mon, 21 Jun 2021 16:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292611; bh=1dgFalT/73kRXYnrBzVok6Sidf/EhzCHCX7OKKsWQdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ubg1idS8338mLBAfZa5YeSiKDXdP7I0ilHLyi4ThmYckvNHWcWipDNKvajlMqX+nW LDfJb5OPBjHzthFQzr9U0jku480se4+YQwF9l7STs/jhKkoq2mTR6bTtC0kuxysg1K bOS6R1TFd5mS1+8uDFnct+UHwse0N/aaVjonfBJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Amir Tzin , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.10 064/146] net/mlx5: Reset mkey index on creation Date: Mon, 21 Jun 2021 18:14:54 +0200 Message-Id: <20210621154914.782431557@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@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: Aya Levin [ Upstream commit 0232fc2ddcf4ffe01069fd1aa07922652120f44a ] Reset only the index part of the mkey and keep the variant part. On devlink reload, driver recreates mkeys, so the mkey index may change. Trying to preserve the variant part of the mkey, driver mistakenly merged the mkey index with current value. In case of a devlink reload, current value of index part is dirty, so the index may be corrupted. Fixes: 54c62e13ad76 ("{IB,net}/mlx5: Setup mkey variant before mr create command invocation") Signed-off-by: Aya Levin Signed-off-by: Amir Tzin Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mr.c b/drivers/net/ethernet/mellanox/mlx5/core/mr.c index 9eb51f06d3ae..d1972508338c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/mr.c @@ -54,7 +54,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev, mkey_index = MLX5_GET(create_mkey_out, lout, mkey_index); mkey->iova = MLX5_GET64(mkc, mkc, start_addr); mkey->size = MLX5_GET64(mkc, mkc, len); - mkey->key |= mlx5_idx_to_mkey(mkey_index); + mkey->key = (u32)mlx5_mkey_variant(mkey->key) | mlx5_idx_to_mkey(mkey_index); mkey->pd = MLX5_GET(mkc, mkc, pd); mlx5_core_dbg(dev, "out 0x%x, mkey 0x%x\n", mkey_index, mkey->key); -- 2.30.2