Re: [PATCH 04/10] RDMA/device: Add ib_device_set_netdev() as an alternative to get_netdev

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

 



On Fri, Feb 15, 2019 at 11:03:16AM -0800, Ira Weiny wrote:
> > diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
> > index a28dc1901c8000..e191f3d86b41d5 100644
> > +++ b/drivers/infiniband/core/cache.c
> > @@ -547,21 +547,19 @@ int ib_cache_gid_add(struct ib_device *ib_dev, u8 port,
> >  	unsigned long mask;
> >  	int ret;
> >  
> > -	if (ib_dev->ops.get_netdev) {
> > -		idev = ib_dev->ops.get_netdev(ib_dev, port);
> > -		if (idev && attr->ndev != idev) {
> > -			union ib_gid default_gid;
> > -
> > -			/* Adding default GIDs in not permitted */
> > -			make_default_gid(idev, &default_gid);
> > -			if (!memcmp(gid, &default_gid, sizeof(*gid))) {
> > -				dev_put(idev);
> > -				return -EPERM;
> > -			}
> > -		}
> > -		if (idev)
> > +	idev = ib_device_get_netdev(ib_dev, port);
> > +	if (idev && attr->ndev != idev) {
> > +		union ib_gid default_gid;
> > +
> > +		/* Adding default GIDs in not permitted */
> 
> NIT: "is not"?

Okay, I can fold that into this patch.

> > -static int setup_port_data(struct ib_device *device)
> > +static int alloc_port_data(struct ib_device *device)
> >  {
> >  	unsigned int port;
> > -	int ret;
> > +
> > +	if (device->port_data)
> > +		return 0;
> > +
> > +	/* This can only be called once the physical port range is defined */
> > +	if (WARN_ON(!device->phys_port_cnt))
> > +		return -EINVAL;
> 
> Was this port stuff supposed to be part of the previous patch?

No, this is splitting one function into alloc & setup, the new alloc
function has this extra protection as it would be easy to call it out
of order in the driver conversions.

Jason



[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