Re: [PATCH v5 for-next 3/3] IB/core: Obtain subnet_prefix from cache in IB devices

From: Anand Khoje
Date: Wed Jun 23 2021 - 09:03:52 EST


On 6/22/2021 5:19 AM, Jason Gunthorpe wrote:
On Wed, Jun 16, 2021 at 09:15:09PM +0530, Anand Khoje wrote:
@@ -1523,13 +1524,21 @@ static int config_non_roce_gid_cache(struct ib_device *device,
device->port_data[port].cache.lmc = tprops->lmc;
device->port_data[port].cache.port_state = tprops->state;
- device->port_data[port].cache.subnet_prefix = tprops->subnet_prefix;
+ ret = rdma_query_gid(device, port, 0, &gid);
+ if (ret) {

This is quite a bit different than just calling ops.query_gid() - why
are you changing it? I'm not sure all the additional tests will pass,
the 0 gid entry is not required to be valid..

Hi Jason,

We have opted for rdma_query_gid(), as during ib_cache_update() the code calls ops.query_gid() earlier in config_non_roce_gid_cache(), thereby updating the value of GID in cache. We utilize this updated value, instead of calling ops->query_gid() again.

I'm not sure all the additional tests will pass,
the 0 gid entry is not required to be valid..

To get subnet_prefix __ib_query_port() does indeed obtain zero index GID.

https://elixir.bootlin.com/linux/v5.13-rc5/source/drivers/infiniband/core/device.c#L2067

@@ -1629,6 +1638,7 @@ int ib_cache_setup_one(struct ib_device *device)
err = ib_cache_update(device, p, true, true, true);
if (err)
return err;
+ device->port_data[p].cache_is_initialized = 1;
}

And I would much prefer things be re-organized so the cache can be
valid sooner to adding this variable. What is the earlier call that is
motivating this?

Jason


During device load and when cache is yet to be updated, ib_query_port() should have a mechanism to identify if the cache entry is valid or invalid (uninitialized), we have added this variable just to ensure the validity of cache.

Thanks,
Anand