On 18-Jan-19 23:22, Jason Gunthorpe wrote: >>>> @@ -920,6 +926,9 @@ int ib_query_port(struct ib_device *device, >>>> union ib_gid gid; >>>> int err; >>>> >>>> + if (!device->ops.query_port) >>>> + return -EOPNOTSUPP; >>> >>> Again, if query_port is not supported then the related sysfs file >>> should not even be created. >> >> Needed for the cache setup as part of ib_register_device. > > Hum, what does the gid cache even do for !kverbs? uverbs uses it I > suppose, but it won't work right at all if kverbs are not present.. > > That probably needs a similar fixing to sysfs, to safely disable the > functionality... Why is the GID cache table dependent on kverbs? EFA for example uses it when querying the GID sysfs. Sure, it can bypass the cache and query the driver, but it's probably better to use the same flow for both kverbs and non-kverbs. I can return 0 instead of -EOPNOTSUPP in ib_query_port in order to pass the device registration successfully. Alternatively, one could argue that if phys_port_cnt > 0 query_port should be implemented as well (and remove the if statement entirely).