All of lore.kernel.org
 help / color / mirror / Atom feed
From: Long Li <longli@microsoft.com>
To: Jason Gunthorpe <jgg@ziepe.ca>,
	"sharmaajay@linuxonhyperv.com" <sharmaajay@linuxonhyperv.com>
Cc: Leon Romanovsky <leon@kernel.org>,
	Dexuan Cui <decui@microsoft.com>, Wei Liu <wei.liu@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Ajay Sharma <sharmaajay@microsoft.com>
Subject: RE: [Patch v7 2/5] RDMA/mana_ib: Register Mana IB  device with Management SW
Date: Fri, 27 Oct 2023 21:59:42 +0000	[thread overview]
Message-ID: <MN0PR21MB3264DD5A4F35B5A579D43966CEDCA@MN0PR21MB3264.namprd21.prod.outlook.com> (raw)
In-Reply-To: <20231023181918.GJ691768@ziepe.ca>

> Subject: Re: [Patch v7 2/5] RDMA/mana_ib: Register Mana IB device with
> Management SW
> 
> On Mon, Oct 16, 2023 at 03:11:59PM -0700,
> sharmaajay@linuxonhyperv.com wrote:
> 
> > diff --git a/drivers/infiniband/hw/mana/device.c
> > b/drivers/infiniband/hw/mana/device.c
> > index 083f27246ba8..ea4c8c8fc10d 100644
> > --- a/drivers/infiniband/hw/mana/device.c
> > +++ b/drivers/infiniband/hw/mana/device.c
> > @@ -78,22 +78,34 @@ static int mana_ib_probe(struct auxiliary_device
> *adev,
> >  	mib_dev->ib_dev.num_comp_vectors = 1;
> >  	mib_dev->ib_dev.dev.parent = mdev->gdma_context->dev;
> >
> > -	ret = ib_register_device(&mib_dev->ib_dev, "mana_%d",
> > -				 mdev->gdma_context->dev);
> > +	ret = mana_gd_register_device(&mib_dev->gc->mana_ib);
> >  	if (ret) {
> > -		ib_dealloc_device(&mib_dev->ib_dev);
> > -		return ret;
> > +		ibdev_err(&mib_dev->ib_dev, "Failed to register device,
> ret %d",
> > +			  ret);
> > +		goto free_ib_device;
> >  	}
> >
> > +	ret = ib_register_device(&mib_dev->ib_dev, "mana_%d",
> > +				 mdev->gdma_context->dev);
> > +	if (ret)
> > +		goto deregister_device;
> > +
> >  	dev_set_drvdata(&adev->dev, mib_dev);
> >
> >  	return 0;
> > +
> > +deregister_device:
> > +	mana_gd_deregister_device(&mib_dev->gc->mana_ib);
> > +free_ib_device:
> > +	ib_dealloc_device(&mib_dev->ib_dev);
> > +	return ret;
> >  }
> >
> >  static void mana_ib_remove(struct auxiliary_device *adev)  {
> >  	struct mana_ib_dev *mib_dev = dev_get_drvdata(&adev->dev);
> >
> > +	mana_gd_deregister_device(&mib_dev->gc->mana_ib);
> >  	ib_unregister_device(&mib_dev->ib_dev);
> >  	ib_dealloc_device(&mib_dev->ib_dev);
> >  }
> 
> That's definitely in the wrong order
> 
> Are you shure these things should just be part of
> ops->enable_driver/dealloc_driver?

I think we want to register with the management interface before calling ib_register_device(). Because we need to communicate with PF to respond to query_device().

But the order in mana_ib_remove() is wrong, the call to mana_gd_deregister_device() should be moved after calling ib_unregister_device().

Thanks,

Long

  reply	other threads:[~2023-10-27 21:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 22:11 [Patch v7 0/5] RDMA/mana_ib sharmaajay
2023-10-16 22:11 ` [Patch v7 1/5] RDMA/mana_ib: Rename all mana_ib_dev type variables to mib_dev sharmaajay
2023-10-23 18:14   ` Jason Gunthorpe
2023-10-27 22:00     ` Long Li
2023-10-16 22:11 ` [Patch v7 2/5] RDMA/mana_ib: Register Mana IB device with Management SW sharmaajay
2023-10-23 18:19   ` Jason Gunthorpe
2023-10-27 21:59     ` Long Li [this message]
2023-10-16 22:12 ` [Patch v7 3/5] RDMA/mana_ib: Create adapter and Add error eq sharmaajay
2023-10-23 18:21   ` Jason Gunthorpe
2023-10-16 22:12 ` [Patch v7 4/5] RDMA/mana_ib: Query adapter capabilities sharmaajay
2023-10-17  4:31   ` Kalesh Anakkur Purayil
     [not found]     ` <87330A78-CDF0-4B49-8192-DBDF006DB8A7@microsoft.com>
2023-10-18  4:10       ` [EXTERNAL] " Kalesh Anakkur Purayil
     [not found]         ` <MN0PR21MB360603822A844951D3400C1AD6D5A@MN0PR21MB3606.namprd21.prod.outlook.com>
2023-10-18 17:25           ` Kalesh Anakkur Purayil
2023-10-16 22:12 ` [Patch v7 5/5] RDMA/mana_ib: Send event to qp sharmaajay
2023-10-23 18:23   ` Jason Gunthorpe
2023-10-25 19:59     ` [EXTERNAL] " Ajay Sharma
2023-10-27 21:35       ` Long Li
2023-10-30 12:42         ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN0PR21MB3264DD5A4F35B5A579D43966CEDCA@MN0PR21MB3264.namprd21.prod.outlook.com \
    --to=longli@microsoft.com \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=edumazet@google.com \
    --cc=jgg@ziepe.ca \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sharmaajay@linuxonhyperv.com \
    --cc=sharmaajay@microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.