Re: [PATCH v3 1/2] IB/usnic: Implement get_netdev hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 13, 2017 at 10:35:03AM +0300, Yuval Shaia wrote:
> On Tue, Jun 13, 2017 at 10:25:26AM +0300, Leon Romanovsky wrote:
> > On Sun, Jun 11, 2017 at 08:44:49AM +0300, Yuval Shaia wrote:
> > > usnic's get_netdev hook for struct ib_device is missing - add it.
> > >
> > > Signed-off-by: Yuval Shaia <yuval.shaia@xxxxxxxxxx>
> > > ---
> > > Per Moni Shoua's suggestion - create seperate patch for this purpose.
> > > ---
> > >  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  1 +
> > >  drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 10 ++++++++++
> > >  drivers/infiniband/hw/usnic/usnic_ib_verbs.h |  1 +
> > >  3 files changed, 12 insertions(+)
> > >
> > > diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> > > index c0c1e8b..80577b9 100644
> > > --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
> > > +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> > > @@ -409,6 +409,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
> > >  	us_ibdev->ib_dev.query_port = usnic_ib_query_port;
> > >  	us_ibdev->ib_dev.query_pkey = usnic_ib_query_pkey;
> > >  	us_ibdev->ib_dev.query_gid = usnic_ib_query_gid;
> > > +	us_ibdev->ib_dev.get_netdev = usnic_get_netdev;
> > >  	us_ibdev->ib_dev.get_link_layer = usnic_ib_port_link_layer;
> > >  	us_ibdev->ib_dev.alloc_pd = usnic_ib_alloc_pd;
> > >  	us_ibdev->ib_dev.dealloc_pd = usnic_ib_dealloc_pd;
> > > diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
> > > index 4996984..f9dc1e80 100644
> > > --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
> > > +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
> > > @@ -424,6 +424,16 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
> > >  	return 0;
> > >  }
> > >
> > > +struct net_device *usnic_get_netdev(struct ib_device *device, u8 port_num)
> > > +{
> > > +	struct usnic_ib_dev *us_ibdev = to_usdev(device);
> > > +
> > > +	if (us_ibdev->netdev)
> > > +		dev_hold(us_ibdev->netdev);
> >
> > Who will release this reference?
>
> I followed the instructions in struct ib_device so assuming the one that
> calls get_netdev will do it.
> See ib_cache_gid_add as an example.
>
> Patch #2 aslo take care of it.
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux