[openib-general] Re: [PATCH] IPoIB: Add API to retrieve ib device, port, and pkey

Sean Hefty mshefty at ichips.intel.com
Thu Oct 6 12:35:04 PDT 2005


Hal Rosenstock wrote:
> What stops the net_device from being pulled from underneath this ? Seems
> like a similar issue to me. The difference I see is that only
> net_devices need to be tracked rather than perhaps net_devices and
> ib_devices.

A reference on the net_device needs to be held while this is being read. 
Net_devices already have reference counting that comes with them; this would 
need to be added to ib_devices.  E.g.

dev = ip_dev_find(ip);
gid = dev->dev_addr + 4;
pkey = get_pkey(dev->broadcast);
dev_put(dev);

could be used to convert a local IP address to a GID/PKey.

I'm assuming that neigh_lookup() provides the same protection: that neigh->dev 
is valid while a reference on the neigh is held (until neigh_release is called). 
  Does anyone know if this is the case?

- Sean



More information about the general mailing list