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=-5.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 2110BC4724C for ; Wed, 6 May 2020 16:05:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F40F2208DB for ; Wed, 6 May 2020 16:05:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="Tr83kb/F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729994AbgEFQF5 (ORCPT ); Wed, 6 May 2020 12:05:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729418AbgEFQF4 (ORCPT ); Wed, 6 May 2020 12:05:56 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB4FBC061A41 for ; Wed, 6 May 2020 09:05:54 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id q7so2509346qkf.3 for ; Wed, 06 May 2020 09:05:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nrpp2T2sh7pMsL3PvoDrM5y2fqkhAxlK1sJUOu9QA9o=; b=Tr83kb/F9G2VBLcHu7x37pNyprDcqbHUZZYB0zOv2RBd+1BHPvHEVKPvXuZIqMslJt WRxGZOJikpMi5eBYxtKo6yrCLuOJLq7J+DscjOjKTQnnrd1h3WeKKt2DEqB7XbQZtVAL HjYOHAHRL+9QCK2KRb/fFvNSoqI3wQyv9hUkPCYhePvKjEIK1pVf4JsL1DBCueLXJJOL n3UuzknRW57RSsLv47vAxS4EZIkUvB4yn9aPp6niVhcBLpY/PAfsvJL15u7Cnwdkb1Dd 2SzCfTuoD4Kp2AXjh5L2+oXey2AyrWZ8VC4q2ZxpUBuGIddwsFS8rNWnuZ5sOm5uYuVr 5Zbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nrpp2T2sh7pMsL3PvoDrM5y2fqkhAxlK1sJUOu9QA9o=; b=PCZizuOMH/jtHUAac5yLvuIkXAxyoapdCQG0CM151WMGPKbH4SumgaoZT7A7s8X5Cp iIaD74qrxoWK9Cr7OTGdOO/vJp9xfxM2S6tN0IPEBbqYpY4x5dQm88s7fE0/Yu9PdA85 SMxsz9og7fsUI9cm/f+mXzVl+YBM38j4FdjHtn6A3L+q6j/5bGKTXeqPzhOVh2cmQ0Yx A1aV6bwn0F2+OdQAOT6f8aaVPA7ioo46GtlUH/dkLaFBragU41U7lWL/Zm+O8qtjRrtL oVNXagH5+SJvcHeNH5oTG6LfykkssTi5pqJzyNMuRBAFjYGXBMcqnREkUJy94Du24yym e/Zw== X-Gm-Message-State: AGi0PublVHdEinEDml5SWK2lK3mVw40h1SgPbdiZewsg4x4+BVxtOzLB K6ttk4zjInHSgEPwwdvB15k65A== X-Google-Smtp-Source: APiQypLzPtnV2MpsE+MV+xNWnkm78v9QYjriPWAQthkfamFRT+pYJFignvWriiKBLQ0XkQ6F6UKvgw== X-Received: by 2002:a05:620a:219a:: with SMTP id g26mr9661209qka.228.1588781153930; Wed, 06 May 2020 09:05:53 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id q9sm1879221qkm.130.2020.05.06.09.05.53 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 May 2020 09:05:53 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1jWMYS-0002c7-Qa; Wed, 06 May 2020 13:05:52 -0300 Date: Wed, 6 May 2020 13:05:52 -0300 From: Jason Gunthorpe To: Leon Romanovsky Cc: Doug Ledford , Bart Van Assche , "David S. Miller" , Dennis Dalessandro , Jakub Kicinski , Karsten Graul , linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, Niranjana Vishwanathapura , rds-devel@oss.oracle.com, Santosh Shilimkar , target-devel@vger.kernel.org, Ursula Braun Subject: Re: [PATCH rdma-next] RDMA: Allow ib_client's to fail when add() is called Message-ID: <20200506160552.GA9993@ziepe.ca> References: <20200421172440.387069-1-leon@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200421172440.387069-1-leon@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Tue, Apr 21, 2020 at 08:24:40PM +0300, Leon Romanovsky wrote: > From: Jason Gunthorpe > > When a client is added it isn't allowed to fail, but all the client's have > various failure paths within their add routines. > > This creates the very fringe condition where the client was added, failed > during add and didn't set the client_data. The core code will then still > call other client_data centric ops like remove(), rename(), get_nl_info(), > and get_net_dev_by_params() with NULL client_data - which is confusing and > unexpected. > > If the add() callback fails, then do not call any more client ops for the > device, even remove. > > Remove all the now redundant checks for NULL client_data in ops callbacks. > > Update all the add() callbacks to return error codes > appropriately. EOPNOTSUPP is used for cases where the ULP does not support > the ib_device - eg because it only works with IB. > > Signed-off-by: Jason Gunthorpe > Signed-off-by: Leon Romanovsky > Acked-by: Ursula Braun > --- > drivers/infiniband/core/cm.c | 24 ++++++++++-------- > drivers/infiniband/core/cma.c | 23 +++++++++-------- > drivers/infiniband/core/device.c | 16 ++++++++++-- > drivers/infiniband/core/mad.c | 17 ++++++++++--- > drivers/infiniband/core/multicast.c | 12 ++++----- > drivers/infiniband/core/sa_query.c | 22 ++++++++-------- > drivers/infiniband/core/user_mad.c | 22 ++++++++-------- > drivers/infiniband/core/uverbs_main.c | 24 +++++++++--------- > drivers/infiniband/ulp/ipoib/ipoib_main.c | 15 ++++------- > .../infiniband/ulp/opa_vnic/opa_vnic_vema.c | 12 ++++----- > drivers/infiniband/ulp/srp/ib_srp.c | 21 ++++++++-------- > drivers/infiniband/ulp/srpt/ib_srpt.c | 25 ++++++++----------- > include/rdma/ib_verbs.h | 2 +- > net/rds/ib.c | 21 ++++++++++------ > net/smc/smc_ib.c | 10 +++----- > 15 files changed, 142 insertions(+), 124 deletions(-) Applied to for-next Jason From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Gunthorpe Date: Wed, 06 May 2020 16:05:52 +0000 Subject: Re: [PATCH rdma-next] RDMA: Allow ib_client's to fail when add() is called Message-Id: <20200506160552.GA9993@ziepe.ca> List-Id: References: <20200421172440.387069-1-leon@kernel.org> In-Reply-To: <20200421172440.387069-1-leon@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Leon Romanovsky Cc: Doug Ledford , Bart Van Assche , "David S. Miller" , Dennis Dalessandro , Jakub Kicinski , Karsten Graul , linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, Niranjana Vishwanathapura , rds-devel@oss.oracle.com, Santosh Shilimkar , target-devel@vger.kernel.org, Ursula Braun On Tue, Apr 21, 2020 at 08:24:40PM +0300, Leon Romanovsky wrote: > From: Jason Gunthorpe > > When a client is added it isn't allowed to fail, but all the client's have > various failure paths within their add routines. > > This creates the very fringe condition where the client was added, failed > during add and didn't set the client_data. The core code will then still > call other client_data centric ops like remove(), rename(), get_nl_info(), > and get_net_dev_by_params() with NULL client_data - which is confusing and > unexpected. > > If the add() callback fails, then do not call any more client ops for the > device, even remove. > > Remove all the now redundant checks for NULL client_data in ops callbacks. > > Update all the add() callbacks to return error codes > appropriately. EOPNOTSUPP is used for cases where the ULP does not support > the ib_device - eg because it only works with IB. > > Signed-off-by: Jason Gunthorpe > Signed-off-by: Leon Romanovsky > Acked-by: Ursula Braun > --- > drivers/infiniband/core/cm.c | 24 ++++++++++-------- > drivers/infiniband/core/cma.c | 23 +++++++++-------- > drivers/infiniband/core/device.c | 16 ++++++++++-- > drivers/infiniband/core/mad.c | 17 ++++++++++--- > drivers/infiniband/core/multicast.c | 12 ++++----- > drivers/infiniband/core/sa_query.c | 22 ++++++++-------- > drivers/infiniband/core/user_mad.c | 22 ++++++++-------- > drivers/infiniband/core/uverbs_main.c | 24 +++++++++--------- > drivers/infiniband/ulp/ipoib/ipoib_main.c | 15 ++++------- > .../infiniband/ulp/opa_vnic/opa_vnic_vema.c | 12 ++++----- > drivers/infiniband/ulp/srp/ib_srp.c | 21 ++++++++-------- > drivers/infiniband/ulp/srpt/ib_srpt.c | 25 ++++++++----------- > include/rdma/ib_verbs.h | 2 +- > net/rds/ib.c | 21 ++++++++++------ > net/smc/smc_ib.c | 10 +++----- > 15 files changed, 142 insertions(+), 124 deletions(-) Applied to for-next Jason