From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91196C433E0 for ; Wed, 20 May 2020 08:29:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61969207ED for ; Wed, 20 May 2020 08:29:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589963385; bh=SUeRYqDS0uHEtmTvzKcxquvB91AIjpQqCU52x6zwiG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QHT0ZRzWcS7Nrwx9sPHUYgb40QNh81x9UUjWgAj11LmecEcIEPHJ4Yjwtf8BjzhfG oyijL3r95924Bpuxh1Nx9E6H7rx2IJLynpdKIxtNTCskyiX0iMEU/ZGNOGLlygJutr S1K5SIghwzmTsDBMwIa9hfDbSV33m/GoUHCrS4I4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726560AbgETI3o (ORCPT ); Wed, 20 May 2020 04:29:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:49554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgETI3o (ORCPT ); Wed, 20 May 2020 04:29:44 -0400 Received: from localhost (unknown [213.57.247.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D973206C3; Wed, 20 May 2020 08:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589963384; bh=SUeRYqDS0uHEtmTvzKcxquvB91AIjpQqCU52x6zwiG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jXAJ1JUgY7oFbJYhhr6eBLFe65KaolYjVxcxJsJnhctIq4Mra66q6BCR3IqObyhGZ g+cu4gwmjLipPxe3YDjRlw6m7LijEoORTcvo/B4YmY4qhfj/3P7PBRsTsSh2dU3PiF ivqKC+UUcAAD29Ui771k+ICrpWj5K8XI4eNx3K9c= From: Leon Romanovsky To: Doug Ledford , Jason Gunthorpe Cc: Leon Romanovsky , linux-rdma@vger.kernel.org Subject: [PATCH rdma-next 4/8] RDMA/mlx5: Use direct modify QP implementation Date: Wed, 20 May 2020 11:29:15 +0300 Message-Id: <20200520082919.440939-5-leon@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200520082919.440939-1-leon@kernel.org> References: <20200520082919.440939-1-leon@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Leon Romanovsky As a preparation to removal hand crafted mlx5_qp_context, convert counter code to use mlx5_cmd_exec_in() directly. Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/mlx5/qp.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 25f3dd1871cd..9f9241030800 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -3692,10 +3692,11 @@ static int __mlx5_ib_qp_set_counter(struct ib_qp *qp, struct rdma_counter *counter) { struct mlx5_ib_dev *dev = to_mdev(qp->device); + u32 in[MLX5_ST_SZ_DW(rts2rts_qp_in)] = {}; struct mlx5_ib_qp *mqp = to_mqp(qp); - struct mlx5_qp_context context = {}; struct mlx5_ib_qp_base *base; u32 set_id; + u32 *qpc; if (counter) set_id = counter->id; @@ -3703,11 +3704,15 @@ static int __mlx5_ib_qp_set_counter(struct ib_qp *qp, set_id = mlx5_ib_get_counters_id(dev, mqp->port - 1); base = &mqp->trans_qp.base; - context.qp_counter_set_usr_page &= cpu_to_be32(0xffffff); - context.qp_counter_set_usr_page |= cpu_to_be32(set_id << 24); - return mlx5_core_qp_modify(dev, MLX5_CMD_OP_RTS2RTS_QP, - MLX5_QP_OPTPAR_COUNTER_SET_ID, &context, - &base->mqp); + MLX5_SET(rts2rts_qp_in, in, opcode, MLX5_CMD_OP_RTS2RTS_QP); + MLX5_SET(rts2rts_qp_in, in, qpn, base->mqp.qpn); + MLX5_SET(rts2rts_qp_in, in, uid, base->mqp.uid); + MLX5_SET(rts2rts_qp_in, in, opt_param_mask, + MLX5_QP_OPTPAR_COUNTER_SET_ID); + + qpc = MLX5_ADDR_OF(rts2rts_qp_in, in, qpc); + MLX5_SET(qpc, qpc, counter_set_id, set_id); + return mlx5_cmd_exec_in(dev->mdev, rts2rts_qp, in); } static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, -- 2.26.2