Lines Matching refs:cma_dev
249 void cma_dev_get(struct cma_device *cma_dev) in cma_dev_get() argument
251 refcount_inc(&cma_dev->refcount); in cma_dev_get()
254 void cma_dev_put(struct cma_device *cma_dev) in cma_dev_put() argument
256 if (refcount_dec_and_test(&cma_dev->refcount)) in cma_dev_put()
257 complete(&cma_dev->comp); in cma_dev_put()
263 struct cma_device *cma_dev; in cma_enum_devices_by_ibdev() local
268 list_for_each_entry(cma_dev, &dev_list, list) in cma_enum_devices_by_ibdev()
269 if (filter(cma_dev->device, cookie)) { in cma_enum_devices_by_ibdev()
270 found_cma_dev = cma_dev; in cma_enum_devices_by_ibdev()
280 int cma_get_default_gid_type(struct cma_device *cma_dev, in cma_get_default_gid_type() argument
283 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_get_default_gid_type()
286 return cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)]; in cma_get_default_gid_type()
289 int cma_set_default_gid_type(struct cma_device *cma_dev, in cma_set_default_gid_type() argument
295 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_set_default_gid_type()
299 rdma_protocol_roce_eth_encap(cma_dev->device, port)) in cma_set_default_gid_type()
302 supported_gids = roce_gid_type_mask_support(cma_dev->device, port); in cma_set_default_gid_type()
307 cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)] = in cma_set_default_gid_type()
313 int cma_get_default_roce_tos(struct cma_device *cma_dev, u32 port) in cma_get_default_roce_tos() argument
315 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_get_default_roce_tos()
318 return cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)]; in cma_get_default_roce_tos()
321 int cma_set_default_roce_tos(struct cma_device *cma_dev, u32 port, in cma_set_default_roce_tos() argument
324 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_set_default_roce_tos()
327 cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)] = in cma_set_default_roce_tos()
332 struct ib_device *cma_get_ib_dev(struct cma_device *cma_dev) in cma_get_ib_dev() argument
334 return cma_dev->device; in cma_get_ib_dev()
449 struct cma_device *cma_dev) in _cma_attach_to_dev() argument
451 cma_dev_get(cma_dev); in _cma_attach_to_dev()
452 id_priv->cma_dev = cma_dev; in _cma_attach_to_dev()
453 id_priv->id.device = cma_dev->device; in _cma_attach_to_dev()
455 rdma_node_get_transport(cma_dev->device->node_type); in _cma_attach_to_dev()
456 list_add_tail(&id_priv->device_item, &cma_dev->id_list); in _cma_attach_to_dev()
458 trace_cm_id_attach(id_priv, cma_dev->device); in _cma_attach_to_dev()
462 struct cma_device *cma_dev) in cma_attach_to_dev() argument
464 _cma_attach_to_dev(id_priv, cma_dev); in cma_attach_to_dev()
466 cma_dev->default_gid_type[id_priv->id.port_num - in cma_attach_to_dev()
467 rdma_start_port(cma_dev->device)]; in cma_attach_to_dev()
474 cma_dev_put(id_priv->cma_dev); in cma_release_dev()
475 id_priv->cma_dev = NULL; in cma_release_dev()
611 struct cma_device *cma_dev; in cma_acquire_dev_by_src_ip() local
627 list_for_each_entry(cma_dev, &dev_list, list) { in cma_acquire_dev_by_src_ip()
628 rdma_for_each_port (cma_dev->device, port) { in cma_acquire_dev_by_src_ip()
629 gidp = rdma_protocol_roce(cma_dev->device, port) ? in cma_acquire_dev_by_src_ip()
631 gid_type = cma_dev->default_gid_type[port - 1]; in cma_acquire_dev_by_src_ip()
632 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_acquire_dev_by_src_ip()
637 cma_attach_to_dev(id_priv, cma_dev); in cma_acquire_dev_by_src_ip()
679 gid_type = listen_id_priv->cma_dev->default_gid_type[req->port - 1]; in cma_ib_acquire_dev()
692 cma_attach_to_dev(id_priv, listen_id_priv->cma_dev); in cma_ib_acquire_dev()
703 struct cma_device *cma_dev; in cma_iw_acquire_dev() local
718 cma_dev = listen_id_priv->cma_dev; in cma_iw_acquire_dev()
721 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_iw_acquire_dev()
730 list_for_each_entry(cma_dev, &dev_list, list) { in cma_iw_acquire_dev()
731 rdma_for_each_port (cma_dev->device, port) { in cma_iw_acquire_dev()
732 if (listen_id_priv->cma_dev == cma_dev && in cma_iw_acquire_dev()
736 gid_type = cma_dev->default_gid_type[port - 1]; in cma_iw_acquire_dev()
737 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_iw_acquire_dev()
750 cma_attach_to_dev(id_priv, cma_dev); in cma_iw_acquire_dev()
763 struct cma_device *cma_dev, *cur_dev; in cma_resolve_ib_dev() local
771 cma_dev = NULL; in cma_resolve_ib_dev()
791 cma_dev = cur_dev; in cma_resolve_ib_dev()
797 if (!cma_dev && (gid.global.subnet_prefix == in cma_resolve_ib_dev()
800 cma_dev = cur_dev; in cma_resolve_ib_dev()
812 cma_attach_to_dev(id_priv, cma_dev); in cma_resolve_ib_dev()
1023 BUG_ON(id_priv->cma_dev->device != id_priv->id.device); in cma_modify_qp_rtr()
1802 if (cma_any_addr(cma_src_addr(id_priv)) && !id_priv->cma_dev) in cma_cancel_operation()
1878 if (id_priv->cma_dev) { in _destroy_id()
2533 struct cma_device *cma_dev, in cma_listen_on_dev() argument
2543 if (cma_family(id_priv) == AF_IB && !rdma_cap_ib_cm(cma_dev->device, 1)) in cma_listen_on_dev()
2556 _cma_attach_to_dev(dev_id_priv, cma_dev); in cma_listen_on_dev()
2574 dev_warn(&cma_dev->device->dev, "RDMA CMA: %s, error %d\n", __func__, ret); in cma_listen_on_dev()
2581 struct cma_device *cma_dev; in cma_listen_on_all() local
2586 list_for_each_entry(cma_dev, &dev_list, list) { in cma_listen_on_all()
2587 ret = cma_listen_on_dev(id_priv, cma_dev, &to_destroy); in cma_listen_on_all()
3068 u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num - in cma_resolve_iboe_route()
3069 rdma_start_port(id_priv->cma_dev->device)]; in cma_resolve_iboe_route()
3204 struct cma_device *cma_dev, *cur_dev; in cma_bind_loopback() local
3211 cma_dev = NULL; in cma_bind_loopback()
3218 if (!cma_dev) in cma_bind_loopback()
3219 cma_dev = cur_dev; in cma_bind_loopback()
3224 cma_dev = cur_dev; in cma_bind_loopback()
3230 if (!cma_dev) { in cma_bind_loopback()
3238 ret = rdma_query_gid(cma_dev->device, p, 0, &gid); in cma_bind_loopback()
3242 ret = ib_get_cached_pkey(cma_dev->device, p, 0, &pkey); in cma_bind_loopback()
3247 (rdma_protocol_ib(cma_dev->device, p)) ? in cma_bind_loopback()
3253 cma_attach_to_dev(id_priv, cma_dev); in cma_bind_loopback()
3282 if (!status && !id_priv->cma_dev) { in addr_handler()
3321 if (!id_priv->cma_dev) { in cma_resolve_loopback()
3346 if (!id_priv->cma_dev) { in cma_resolve_ib_addr()
3840 if (id_priv->cma_dev) { in rdma_listen()
3922 if (id_priv->cma_dev) in rdma_bind_addr()
4585 id_priv->cma_dev in cma_make_mc_event()
4588 id_priv->cma_dev->device)]; in cma_make_mc_event()
4746 gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - in cma_iboe_join_multicast()
4747 rdma_start_port(id_priv->cma_dev->device)]; in cma_iboe_join_multicast()
4850 WARN_ON(id_priv->cma_dev->device != id->device); in rdma_leave_multicast()
4888 struct cma_device *cma_dev; in cma_netdev_callback() local
4899 list_for_each_entry(cma_dev, &dev_list, list) in cma_netdev_callback()
4900 list_for_each_entry(id_priv, &cma_dev->id_list, device_item) { in cma_netdev_callback()
4955 static void cma_process_remove(struct cma_device *cma_dev) in cma_process_remove() argument
4958 while (!list_empty(&cma_dev->id_list)) { in cma_process_remove()
4960 &cma_dev->id_list, struct rdma_id_private, device_item); in cma_process_remove()
4973 cma_dev_put(cma_dev); in cma_process_remove()
4974 wait_for_completion(&cma_dev->comp); in cma_process_remove()
4991 struct cma_device *cma_dev; in cma_add_one() local
5000 cma_dev = kmalloc(sizeof(*cma_dev), GFP_KERNEL); in cma_add_one()
5001 if (!cma_dev) in cma_add_one()
5004 cma_dev->device = device; in cma_add_one()
5005 cma_dev->default_gid_type = kcalloc(device->phys_port_cnt, in cma_add_one()
5006 sizeof(*cma_dev->default_gid_type), in cma_add_one()
5008 if (!cma_dev->default_gid_type) { in cma_add_one()
5013 cma_dev->default_roce_tos = kcalloc(device->phys_port_cnt, in cma_add_one()
5014 sizeof(*cma_dev->default_roce_tos), in cma_add_one()
5016 if (!cma_dev->default_roce_tos) { in cma_add_one()
5025 cma_dev->default_gid_type[i - rdma_start_port(device)] = in cma_add_one()
5028 cma_dev->default_gid_type[i - rdma_start_port(device)] = in cma_add_one()
5030 cma_dev->default_roce_tos[i - rdma_start_port(device)] = 0; in cma_add_one()
5033 init_completion(&cma_dev->comp); in cma_add_one()
5034 refcount_set(&cma_dev->refcount, 1); in cma_add_one()
5035 INIT_LIST_HEAD(&cma_dev->id_list); in cma_add_one()
5036 ib_set_client_data(device, &cma_client, cma_dev); in cma_add_one()
5039 list_add_tail(&cma_dev->list, &dev_list); in cma_add_one()
5041 ret = cma_listen_on_dev(id_priv, cma_dev, &to_destroy); in cma_add_one()
5051 list_del(&cma_dev->list); in cma_add_one()
5055 cma_process_remove(cma_dev); in cma_add_one()
5056 kfree(cma_dev->default_roce_tos); in cma_add_one()
5058 kfree(cma_dev->default_gid_type); in cma_add_one()
5061 kfree(cma_dev); in cma_add_one()
5067 struct cma_device *cma_dev = client_data; in cma_remove_one() local
5072 list_del(&cma_dev->list); in cma_remove_one()
5075 cma_process_remove(cma_dev); in cma_remove_one()
5076 kfree(cma_dev->default_roce_tos); in cma_remove_one()
5077 kfree(cma_dev->default_gid_type); in cma_remove_one()
5078 kfree(cma_dev); in cma_remove_one()