@@ -691,6 +691,9 @@ static int add_client_context(struct ib_device *device,
if (!device->kverbs_provider && !client->no_kverbs_req)
return 0;
+ if (client->is_supported && !client->is_supported(device))
+ return 0;
+
down_write(&device->client_data_rwsem);
/*
* So long as the client is registered hold both the client and device
@@ -2756,6 +2756,15 @@ struct ib_client {
const union ib_gid *gid,
const struct sockaddr *addr,
void *client_data);
+ /*
+ * Returns if the client is supported for a given device or not.
+ * @dev: An RDMA device to check if client can support this RDMA or not.
+ *
+ * A client that is interested in specific device attributes, should
+ * implement it to check if client can be supported for this device or
+ * not.
+ */
+ bool (*is_supported)(struct ib_device *dev);
refcount_t uses;
struct completion uses_zero;