*to_destroy = NULL;
if (cma_family(id_priv) == AF_IB && !rdma_cap_ib_cm(cma_dev->device, 1))
return 0;
+ if (id_priv->restricted_node_type != RDMA_NODE_UNSPECIFIED &&
+ id_priv->restricted_node_type != cma_dev->device->node_type)
+ return 0;
dev_id_priv =
__rdma_create_id(net, cma_listen_handler, id_priv,
if (IS_ERR(dev_id_priv))
return PTR_ERR(dev_id_priv);
+ dev_id_priv->restricted_node_type = id_priv->restricted_node_type;
dev_id_priv->state = RDMA_CM_ADDR_BOUND;
memcpy(cma_src_addr(dev_id_priv), cma_src_addr(id_priv),
rdma_addr_size(cma_src_addr(id_priv)));
}
mutex_lock(&lock);
- if (id_priv->cma_dev)
+ if (READ_ONCE(id_priv->state) != RDMA_CM_IDLE)
ret = -EALREADY;
else
id_priv->restricted_node_type = node_type;
*
* It needs to be called before the RDMA identifier is bound
* to an device, which mean it should be called before
- * rdma_bind_addr(), rdma_bind_addr() and rdma_listen().
+ * rdma_bind_addr(), rdma_resolve_addr() and rdma_listen().
*/
int rdma_restrict_node_type(struct rdma_cm_id *id, u8 node_type);