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=-7.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 67CF7C433E2 for ; Wed, 16 Sep 2020 19:55:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15399206DB for ; Wed, 16 Sep 2020 19:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600286157; bh=u3fzYRznUihHRjmh0c6MetS/Kbvnp5ksgQYlzz5G6wo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=NGRQwHukdGaRxvZbmPjDPTORfjxvAFguALh4MMpFNVnxA+SaIGENwUGSfuQWTe/ve eFNNgmQqpWnVNTz/tGv3s5l4L+JMgsrbVP5+BW3DxyJds89NraE9q6RvxgHRS3GpNk vHiGX25zIRW+bLP6vJmCPE/jN22X5S/VWVy+Q0CU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728197AbgIPTyE (ORCPT ); Wed, 16 Sep 2020 15:54:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:48190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727216AbgIPRgT (ORCPT ); Wed, 16 Sep 2020 13:36:19 -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 41EEB22266; Wed, 16 Sep 2020 12:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600260273; bh=u3fzYRznUihHRjmh0c6MetS/Kbvnp5ksgQYlzz5G6wo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LDicXfxI2xkzfD9uqrytbXkxSS7y3JZJdNo44kotNXFfsWqFuC+ueMWUYCfmtbzyk fRSPyUXtYwYxPZaiwzKhJIVIiu5OfRRfTixHMogaIQEuxlURdtHSk+BWOwGHwa6Fzk yn3jdiTV1G2r/q0EVpURZME4hnmM0wsZWsy4i2cQ= Date: Wed, 16 Sep 2020 15:44:29 +0300 From: Leon Romanovsky To: Jason Gunthorpe Cc: Doug Ledford , Avihai Horon , linux-rdma@vger.kernel.org Subject: Re: [PATCH rdma-next 4/4] RDMA/uverbs: Expose the new GID query API to user space Message-ID: <20200916124429.GI486552@unreal> References: <20200910142204.1309061-1-leon@kernel.org> <20200910142204.1309061-5-leon@kernel.org> <20200911195918.GT904879@nvidia.com> <20200913091302.GF35718@unreal> <20200914155550.GF904879@nvidia.com> <20200915114704.GB486552@unreal> <20200915190614.GE1573713@nvidia.com> <20200916103710.GH486552@unreal> <20200916120440.GL1573713@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200916120440.GL1573713@nvidia.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Wed, Sep 16, 2020 at 09:04:40AM -0300, Jason Gunthorpe wrote: > On Wed, Sep 16, 2020 at 01:37:10PM +0300, Leon Romanovsky wrote: > > It depends on how you want to treat errors from rdma_read_gid_attr_ndev_rcu(). > > Current check allows us to ensure that any error returned by this call is > > handled. > > > > Otherwise we will find ourselves with something like this: > > ndev = rdma_read_gid_attr_ndev_rcu(gid_attr); > > if (IS_ERR(ndev)) { > > if (rdma_protocol_roce()) > > goto error; > > if (ERR_PTR(ndev) != -ENODEV) > > goto error; > > } > > Isn't it just > > if (IS_ERR(ndev)) { > if (ERR_PTR(ndev) != -ENODEV) > goto error; > index = -1; > } > > Which seems fine and clear enough It is a problem if roce device returned -ENODEV. I don't want to paper-out this case by setting index = 0. Thanks > > Jason