From patchwork Thu Oct 10 08:50:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13829764 X-Patchwork-Delegate: jgg@ziepe.ca Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F0351BC074 for ; Thu, 10 Oct 2024 08:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728550229; cv=none; b=cm3dcJsZj5aVPhWktQdcrP6C5UtgqwOY80WY18s06hEdibSItqr/H08a7NAe/R5StW9VCoF2PoMjN/eCxRrYmGqy4i2Bd1+8Kap1TrS0c+WuNj+b5u9CtMDTPx2diTurXA4HeoM1ZcK1OegesRpYIutNO6yh7YV3Ofok9Ugmm3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728550229; c=relaxed/simple; bh=GlU0IJ/igaMWyrKdw/I6XGO6NbL8NYl68+YzL1zMGnQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=czSZgxBJr2okk9JmxOD75nDjzlh1fH4p9HtbHhxh5bnnkjkbsSUn1/AZOMJ38IeKLt6Yx6tfrLRqBfj43zqT8hEpAGh8jeb7N+DSvqmX8O0DbdDPDSO7lBsRzJU5McJJihL+8Uytxuoe+zNIzAAbV7iwqiq0CUBkHp+UBelkfyk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a6qBB5ij; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a6qBB5ij" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5598AC4CEC6; Thu, 10 Oct 2024 08:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728550228; bh=GlU0IJ/igaMWyrKdw/I6XGO6NbL8NYl68+YzL1zMGnQ=; h=From:To:Cc:Subject:Date:From; b=a6qBB5ijKN/byEEHRPKV14eo4aI7UwpO2wN7usNDmnpFVfhwevQP6/KN7uDERdJlk cApL+4FBMFU0bLeRVfh6ynaWASTSlK3Bliw+5SpzWBUDkjxtanPJ6JF8YbB8MHRmTx p09+9IHh1rJjIoFgk/jeQDk0+kWIkSo55rGwqun+Qg6sj+6oMTe57X/OrwwWvOOmMV JJ0I+Yp51slWJ3w4spwj9PyIFNbpVt2mZU0HIJPRn6wptZzOti/CS8ya+tCPLMrUVI HpH/lIFtoNtZYVKQr6Q0KScoV1jxQpco0B4FgJkXNMAd47jrF5xa3kZ42ljGMjMgds A58wrNjBVMNSQ== From: Leon Romanovsky To: Jason Gunthorpe Cc: Patrisious Haddad , linux-rdma@vger.kernel.org, Maher Sanalla , Maor Gottlieb , Mark Zhang Subject: [PATCH rdma-rc] RDMA/mlx5: Round max_rd_atomic/max_dest_rd_atomic up instead of down Date: Thu, 10 Oct 2024 11:50:23 +0300 Message-ID: X-Mailer: git-send-email 2.46.2 Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Patrisious Haddad After the cited commit below max_dest_rd_atomic and max_rd_atomic values are being rounded down to the next power of 2. As opposed to the old behavior and mlx4 driver where they used to be rounded up instead. In order to stay consistent with older code and other drivers, revert to using fls round function which rounds up to the next power of 2. Fixes: f18e26af6aba ("RDMA/mlx5: Convert modify QP to use MLX5_SET macros") Signed-off-by: Patrisious Haddad Reviewed-by: Maher Sanalla Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/mlx5/qp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 849a160f99bc..88b6d9797a33 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -4297,14 +4297,14 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, MLX5_SET(qpc, qpc, retry_count, attr->retry_cnt); if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && attr->max_rd_atomic) - MLX5_SET(qpc, qpc, log_sra_max, ilog2(attr->max_rd_atomic)); + MLX5_SET(qpc, qpc, log_sra_max, fls(attr->max_rd_atomic - 1)); if (attr_mask & IB_QP_SQ_PSN) MLX5_SET(qpc, qpc, next_send_psn, attr->sq_psn); if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && attr->max_dest_rd_atomic) MLX5_SET(qpc, qpc, log_rra_max, - ilog2(attr->max_dest_rd_atomic)); + fls(attr->max_dest_rd_atomic - 1)); if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) { err = set_qpc_atomic_flags(qp, attr, attr_mask, qpc);