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=-6.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 86A54CA90AF for ; Wed, 13 May 2020 12:38:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D49A20659 for ; Wed, 13 May 2020 12:38:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pHYejaVJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729646AbgEMMim (ORCPT ); Wed, 13 May 2020 08:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728887AbgEMMim (ORCPT ); Wed, 13 May 2020 08:38:42 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BC44C061A0C for ; Wed, 13 May 2020 05:38:42 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id w19so13551821wmc.1 for ; Wed, 13 May 2020 05:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=MLbRHg0vMKKZUqJflw/agCDoZns+eMawKPDb9MYNVig=; b=pHYejaVJdMyggBEdyO1jAUixVv7CprkHHlysVKS72hf1F0MMSayfzOp/AY4TfagwDA RWqNPEX0cb9L4xuO+AuS5YQ113XMYBaDuCF4Xywc1PhjQm1bNzyM6qBazxx7dykw59Yh +7BsKtny0G4cXHY8UIVG1cz8I7j+RGh4bZ8BV2AneDIaAFXFFmttrQzZ3RVf5tc70UsP ot06njj5P/nc3i8DFaqjbu4Hw0j+HFGre/EPVzNkNp73tiKae3ptKmpXZ6BUA0WigWl5 A3QoaMoBR/jNR2759dadPjeARsoUT649ZctI6f0JzPqZLtTgVidTW9vL8zNSigpp8McX 5l8Q== 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; bh=MLbRHg0vMKKZUqJflw/agCDoZns+eMawKPDb9MYNVig=; b=rsDzYLoeBRySPHaw1JTEeqqlFh6OjPhRe7rkfQbdPwVZTkJ8vleMnwn3qx4WGJx+Le lwheRdKsQpF/DzsWZVKOPk3f8tk0wtV3LctjNrmdhJS07suWxQ7DkPNaZt7Y+9aCBMu8 vZ3pjvfn4auSP0CYIyYcrFXbT1hEhuDdzu/gwJ7V6/3TAx19mEXwO1PbzwGCNo407Gvo JVITx2+0aC43wqcH40L590Mv3By6E6b417JMG6tc2gi1bl/9wXTfW20H+FXjQNwDaRkj g7ykeSu/LnR5tsXzTYyw41XyGnYuz6wI8X5/PPrPOZNfzk5c8n1HW/aVJr39yozUGntx U7CA== X-Gm-Message-State: AGi0PubX3xBPzbZOgzg8pO3biuHZ46SBbHCtwYV9g9qkRa5ws43C4R1E /To40PTIfeHou6sr2CwN8ww= X-Google-Smtp-Source: APiQypLLUjAGQtcfN1/BUcdfqbMEN++X0jVGblx2Qh8VceUGjvb6WQwgc8RZmLYV7pYW60xRs7NDWQ== X-Received: by 2002:a05:600c:293:: with SMTP id 19mr23532358wmk.71.1589373520912; Wed, 13 May 2020 05:38:40 -0700 (PDT) Received: from kheib-workstation ([37.142.4.4]) by smtp.gmail.com with ESMTPSA id r11sm25515748wrv.14.2020.05.13.05.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 05:38:40 -0700 (PDT) Date: Wed, 13 May 2020 15:38:37 +0300 From: Kamal Heib To: Leon Romanovsky Cc: linux-rdma@vger.kernel.org, Doug Ledford , Jason Gunthorpe , Bart Van Assche Subject: Re: [PATCH for-rc] RDMA/srpt: Fix disabling device management Message-ID: <20200513123837.GA123854@kheib-workstation> References: <20200511222918.62576-1-kamalheib1@gmail.com> <20200513072203.GR4814@unreal> <20200513100204.GA92901@kheib-workstation> <20200513102132.GW4814@unreal> <20200513104536.GA120318@kheib-workstation> <20200513105045.GX4814@unreal> <20200513111435.GA121070@kheib-workstation> <20200513113118.GY4814@unreal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200513113118.GY4814@unreal> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Wed, May 13, 2020 at 02:31:18PM +0300, Leon Romanovsky wrote: > On Wed, May 13, 2020 at 02:14:35PM +0300, Kamal Heib wrote: > > On Wed, May 13, 2020 at 01:50:45PM +0300, Leon Romanovsky wrote: > > > On Wed, May 13, 2020 at 01:45:36PM +0300, Kamal Heib wrote: > > > > On Wed, May 13, 2020 at 01:21:32PM +0300, Leon Romanovsky wrote: > > > > > On Wed, May 13, 2020 at 01:02:04PM +0300, Kamal Heib wrote: > > > > > > On Wed, May 13, 2020 at 10:22:03AM +0300, Leon Romanovsky wrote: > > > > > > > On Tue, May 12, 2020 at 01:29:18AM +0300, Kamal Heib wrote: > > > > > > > > Avoid disabling device management for devices that don't support > > > > > > > > Management datagrams (MADs) by checking if the "mad_agent" pointer is > > > > > > > > initialized before calling ib_modify_port, also change the error message > > > > > > > > to a warning and make it more informative. > > > > > > > > > > > > > > > > Fixes: 09f8a1486dca ("RDMA/srpt: Fix handling of SR-IOV and iWARP ports") > > > > > > > > Signed-off-by: Kamal Heib > > > > > > > > --- > > > > > > > > drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++-- > > > > > > > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > > > > > > > > > > > > > diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c > > > > > > > > index 7ed38d1cb997..7b21792ab6f7 100644 > > > > > > > > --- a/drivers/infiniband/ulp/srpt/ib_srpt.c > > > > > > > > +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c > > > > > > > > @@ -625,14 +625,18 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev) > > > > > > > > .clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP, > > > > > > > > }; > > > > > > > > struct srpt_port *sport; > > > > > > > > + int ret; > > > > > > > > int i; > > > > > > > > > > > > > > > > for (i = 1; i <= sdev->device->phys_port_cnt; i++) { > > > > > > > > sport = &sdev->port[i - 1]; > > > > > > > > WARN_ON(sport->port != i); > > > > > > > > - if (ib_modify_port(sdev->device, i, 0, &port_modify) < 0) > > > > > > > > - pr_err("disabling MAD processing failed.\n"); > > > > > > > > if (sport->mad_agent) { > > > > > > > > + ret = ib_modify_port(sdev->device, i, 0, &port_modify); > > > > > > > > + if (ret < 0) > > > > > > > > + pr_warn("%s-%d: disabling device management failed (%d). Note: this is expected if SR-IOV is enabled.\n", > > > > > > > > + dev_name(&sport->sdev->device->dev), > > > > > > > > > > > > > > The ib_modify_port() shouldn't be called if it expected to fail. > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > OK, Do you know if there is a way to check if the created ib device is > > > > > > for VF to avoid calling ib_modify_port()? > > > > > > > > > > The "is_virtfn" field inside pci_dev will give this information, > > > > > but I don't know why it is expected to fail here. > > > > > > > > > > Thanks > > > > > > > > > > > > > Looks like there a more trivial way, I mean checking if > > > > IB_DEVICE_VIRTUAL_FUNCTION cap is set, probably there is a need to make > > > > to sure that this cap is set for all providers when the IB device is > > > > created for a VF. > > > > > > > > With regards to why it is expected to fail, as stated in the commit > > > > message and the in "Fixes" commit message there is some devices (VF) > > > > that don't support MADs. > > > > > > So shouldn't you test that device support MAD instead of testing VF cap? > > > > > > Thanks > > > > Correct me if I'm wrong, Do you mean check the return value from > > rdma_cap_ib_mad()? > > I think so. > > Thanks > Well, this function will not help in the case of VFs, because the flag that is checked in rdma_cap_ib_mad() is RDMA_CORE_CAP_IB_MAD which is set almost for each create IB device as part of RDMA_CORE_PORT_IBA_IB or RDMA_CORE_PORT_IBA_ROCE or RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP. Thanks, Kamal > > > > Thanks, > > Kamal > > > > > > > > > > > Thanks, > > > > Kamal > > > > > > > > > > > > > > > > Thanks, > > > > > > Kamal > > > > > > > > > > > > > > > > > > > > > + sport->port, ret); > > > > > > > > ib_unregister_mad_agent(sport->mad_agent); > > > > > > > > sport->mad_agent = NULL; > > > > > > > > } > > > > > > > > -- > > > > > > > > 2.25.4 > > > > > > > >