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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 68FC8C433E1 for ; Sun, 12 Jul 2020 10:44:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2EC1E20725 for ; Sun, 12 Jul 2020 10:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594550667; bh=ihv/l9aP+j/Lm8U8zXoL+LCZMt0De/q4f9a80tGX3Oc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=dcFGbbzTAFPXrFE6WaOtphUVFRG6sMSBWB9noq4AXvWkRL6Wikh6jBOQoa2tJN3Gf G9Ji9jAi/M4AhLUvBUuoUfsFvTCmC6e6FcaTNxN34i6govGOAu3LEytaeoMZTahwsY 7Kcb2zl16oXd0pLXK9Muoyg8rqxjn5OgbKRwTEPg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728339AbgGLKoZ (ORCPT ); Sun, 12 Jul 2020 06:44:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:46484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbgGLKoY (ORCPT ); Sun, 12 Jul 2020 06:44:24 -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 814AD206F0; Sun, 12 Jul 2020 10:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594550663; bh=ihv/l9aP+j/Lm8U8zXoL+LCZMt0De/q4f9a80tGX3Oc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jZVAP2uxpjqDkYmydCZgtbbVEH3cKEGW2+UoUW2OevRy8E9Te4ti6EYH0vmyjDeIJ LWlSBM1UExYYEnPhAxSXbkVUeLXVttaVSQJUy2x/y4ry2gY6GXToVoesrmjvTQrPKN vH+wXr8gEG0vBkj/ow0gyIaCQQqP6omQ7ya4joVQ= Date: Sun, 12 Jul 2020 13:44:19 +0300 From: Leon Romanovsky To: Gal Pressman Cc: liweihang , "linux-rdma@vger.kernel.org" , Linuxarm Subject: Re: Question about IB_QP_CUR_STATE Message-ID: <20200712104419.GA7287@unreal> References: <876ca1eb8667461a9d2e0effb8ee3934@huawei.com> <881488e6-03d8-1e01-076c-5c901d84a44a@amazon.com> <20200708154434.GA1276673@unreal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Thu, Jul 09, 2020 at 09:13:45AM +0300, Gal Pressman wrote: > On 08/07/2020 18:44, Leon Romanovsky wrote: > > On Wed, Jul 08, 2020 at 03:42:34PM +0300, Gal Pressman wrote: > >> On 08/07/2020 12:41, liweihang wrote: > >>> Hi all, > >>> > >>> I'm a little confused about the role of IB_QP_CUR_STATE in the enumeration > >>> ib_qp_attr_mask. > >>> > >>> In manual page of ibv_modify_qp(), comments of cur_qp_state is "Assume this > >>> is the current QP state". Why we need to get current qp state from users > >>> instead of drivers? > >>> > >>> For example, why the users are allowed to modify qp from RTR to RTS again > >>> even if the qp's state in driver and hardware has already been RTS. > >>> > >>> I would be appretiate it if someone can help with this. > >>> > >>> Weihang > >>> > >> > >> Talking about IB_QP_CUR_STATE, I see many drivers filling it in their query QP > >> callback although it should only be used in modify operations.. Is there a > >> reason not to remove it? > > > > IBTA section "11.2.5.3 QUERY QUEUE PAIR" has line about IB_QP_CUR_STATE. > > It is one of output modifiers. > > > > Thanks > > > > It says the current QP state should be returned, that's what qp_state field is used for. > According to the man pages: > > libibverbs/man/ibv_query_qp.3: > enum ibv_qp_state qp_state; /* Current QP state */ > enum ibv_qp_state cur_qp_state; /* Current QP state - irrelevant for ibv_query_qp */ I don't think that users read it, because ibv_cmd_query_qp() filled qp_state to be equal to cur_qp_state from day one. Thanks