Lines Matching refs:cma_dev
258 void cma_dev_get(struct cma_device *cma_dev) in cma_dev_get() argument
260 refcount_inc(&cma_dev->refcount); in cma_dev_get()
263 void cma_dev_put(struct cma_device *cma_dev) in cma_dev_put() argument
265 if (refcount_dec_and_test(&cma_dev->refcount)) in cma_dev_put()
266 complete(&cma_dev->comp); in cma_dev_put()
272 struct cma_device *cma_dev; in cma_enum_devices_by_ibdev() local
277 list_for_each_entry(cma_dev, &dev_list, list) in cma_enum_devices_by_ibdev()
278 if (filter(cma_dev->device, cookie)) { in cma_enum_devices_by_ibdev()
279 found_cma_dev = cma_dev; in cma_enum_devices_by_ibdev()
289 int cma_get_default_gid_type(struct cma_device *cma_dev, in cma_get_default_gid_type() argument
292 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_get_default_gid_type()
295 return cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)]; in cma_get_default_gid_type()
298 int cma_set_default_gid_type(struct cma_device *cma_dev, in cma_set_default_gid_type() argument
304 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_set_default_gid_type()
308 rdma_protocol_roce_eth_encap(cma_dev->device, port)) in cma_set_default_gid_type()
311 supported_gids = roce_gid_type_mask_support(cma_dev->device, port); in cma_set_default_gid_type()
316 cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)] = in cma_set_default_gid_type()
322 int cma_get_default_roce_tos(struct cma_device *cma_dev, unsigned int port) in cma_get_default_roce_tos() argument
324 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_get_default_roce_tos()
327 return cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)]; in cma_get_default_roce_tos()
330 int cma_set_default_roce_tos(struct cma_device *cma_dev, unsigned int port, in cma_set_default_roce_tos() argument
333 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_set_default_roce_tos()
336 cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)] = in cma_set_default_roce_tos()
341 struct ib_device *cma_get_ib_dev(struct cma_device *cma_dev) in cma_get_ib_dev() argument
343 return cma_dev->device; in cma_get_ib_dev()
452 struct cma_device *cma_dev) in _cma_attach_to_dev() argument
454 cma_dev_get(cma_dev); in _cma_attach_to_dev()
455 id_priv->cma_dev = cma_dev; in _cma_attach_to_dev()
456 id_priv->id.device = cma_dev->device; in _cma_attach_to_dev()
458 rdma_node_get_transport(cma_dev->device->node_type); in _cma_attach_to_dev()
459 list_add_tail(&id_priv->list, &cma_dev->id_list); in _cma_attach_to_dev()
462 trace_cm_id_attach(id_priv, cma_dev->device); in _cma_attach_to_dev()
466 struct cma_device *cma_dev) in cma_attach_to_dev() argument
468 _cma_attach_to_dev(id_priv, cma_dev); in cma_attach_to_dev()
470 cma_dev->default_gid_type[id_priv->id.port_num - in cma_attach_to_dev()
471 rdma_start_port(cma_dev->device)]; in cma_attach_to_dev()
478 cma_dev_put(id_priv->cma_dev); in cma_release_dev()
479 id_priv->cma_dev = NULL; in cma_release_dev()
610 struct cma_device *cma_dev; in cma_acquire_dev_by_src_ip() local
626 list_for_each_entry(cma_dev, &dev_list, list) { in cma_acquire_dev_by_src_ip()
627 rdma_for_each_port (cma_dev->device, port) { in cma_acquire_dev_by_src_ip()
628 gidp = rdma_protocol_roce(cma_dev->device, port) ? in cma_acquire_dev_by_src_ip()
630 gid_type = cma_dev->default_gid_type[port - 1]; in cma_acquire_dev_by_src_ip()
631 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_acquire_dev_by_src_ip()
636 cma_attach_to_dev(id_priv, cma_dev); in cma_acquire_dev_by_src_ip()
678 gid_type = listen_id_priv->cma_dev->default_gid_type[req->port - 1]; in cma_ib_acquire_dev()
691 cma_attach_to_dev(id_priv, listen_id_priv->cma_dev); in cma_ib_acquire_dev()
701 struct cma_device *cma_dev; in cma_iw_acquire_dev() local
716 cma_dev = listen_id_priv->cma_dev; in cma_iw_acquire_dev()
719 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_iw_acquire_dev()
728 list_for_each_entry(cma_dev, &dev_list, list) { in cma_iw_acquire_dev()
729 rdma_for_each_port (cma_dev->device, port) { in cma_iw_acquire_dev()
730 if (listen_id_priv->cma_dev == cma_dev && in cma_iw_acquire_dev()
734 gid_type = cma_dev->default_gid_type[port - 1]; in cma_iw_acquire_dev()
735 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_iw_acquire_dev()
748 cma_attach_to_dev(id_priv, cma_dev); in cma_iw_acquire_dev()
759 struct cma_device *cma_dev, *cur_dev; in cma_resolve_ib_dev() local
767 cma_dev = NULL; in cma_resolve_ib_dev()
787 cma_dev = cur_dev; in cma_resolve_ib_dev()
793 if (!cma_dev && (gid.global.subnet_prefix == in cma_resolve_ib_dev()
796 cma_dev = cur_dev; in cma_resolve_ib_dev()
808 cma_attach_to_dev(id_priv, cma_dev); in cma_resolve_ib_dev()
1016 BUG_ON(id_priv->cma_dev->device != id_priv->id.device); in cma_modify_qp_rtr()
1775 if (cma_any_addr(cma_src_addr(id_priv)) && !id_priv->cma_dev) in cma_cancel_operation()
1843 if (id_priv->cma_dev) { in _destroy_id()
2499 struct cma_device *cma_dev) in cma_listen_on_dev() argument
2507 if (cma_family(id_priv) == AF_IB && !rdma_cap_ib_cm(cma_dev->device, 1)) in cma_listen_on_dev()
2520 _cma_attach_to_dev(dev_id_priv, cma_dev); in cma_listen_on_dev()
2530 dev_warn(&cma_dev->device->dev, in cma_listen_on_dev()
2536 struct cma_device *cma_dev; in cma_listen_on_all() local
2540 list_for_each_entry(cma_dev, &dev_list, list) in cma_listen_on_all()
2541 cma_listen_on_dev(id_priv, cma_dev); in cma_listen_on_all()
2941 u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num - in cma_resolve_iboe_route()
2942 rdma_start_port(id_priv->cma_dev->device)]; in cma_resolve_iboe_route()
3067 struct cma_device *cma_dev, *cur_dev; in cma_bind_loopback() local
3074 cma_dev = NULL; in cma_bind_loopback()
3081 if (!cma_dev) in cma_bind_loopback()
3082 cma_dev = cur_dev; in cma_bind_loopback()
3087 cma_dev = cur_dev; in cma_bind_loopback()
3093 if (!cma_dev) { in cma_bind_loopback()
3101 ret = rdma_query_gid(cma_dev->device, p, 0, &gid); in cma_bind_loopback()
3105 ret = ib_get_cached_pkey(cma_dev->device, p, 0, &pkey); in cma_bind_loopback()
3110 (rdma_protocol_ib(cma_dev->device, p)) ? in cma_bind_loopback()
3116 cma_attach_to_dev(id_priv, cma_dev); in cma_bind_loopback()
3144 if (!status && !id_priv->cma_dev) { in addr_handler()
3182 if (!id_priv->cma_dev) { in cma_resolve_loopback()
3207 if (!id_priv->cma_dev) { in cma_resolve_ib_addr()
3759 if (id_priv->cma_dev) in rdma_bind_addr()
4417 id_priv->cma_dev in cma_make_mc_event()
4420 id_priv->cma_dev->device)]; in cma_make_mc_event()
4597 gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - in cma_iboe_join_multicast()
4598 rdma_start_port(id_priv->cma_dev->device)]; in cma_iboe_join_multicast()
4711 WARN_ON(id_priv->cma_dev->device != id->device); in rdma_leave_multicast()
4749 struct cma_device *cma_dev; in cma_netdev_callback() local
4760 list_for_each_entry(cma_dev, &dev_list, list) in cma_netdev_callback()
4761 list_for_each_entry(id_priv, &cma_dev->id_list, list) { in cma_netdev_callback()
4778 struct cma_device *cma_dev; in cma_add_one() local
4784 cma_dev = kmalloc(sizeof *cma_dev, GFP_KERNEL); in cma_add_one()
4785 if (!cma_dev) in cma_add_one()
4788 cma_dev->device = device; in cma_add_one()
4789 cma_dev->default_gid_type = kcalloc(device->phys_port_cnt, in cma_add_one()
4790 sizeof(*cma_dev->default_gid_type), in cma_add_one()
4792 if (!cma_dev->default_gid_type) { in cma_add_one()
4797 cma_dev->default_roce_tos = kcalloc(device->phys_port_cnt, in cma_add_one()
4798 sizeof(*cma_dev->default_roce_tos), in cma_add_one()
4800 if (!cma_dev->default_roce_tos) { in cma_add_one()
4809 cma_dev->default_gid_type[i - rdma_start_port(device)] = in cma_add_one()
4812 cma_dev->default_gid_type[i - rdma_start_port(device)] = in cma_add_one()
4814 cma_dev->default_roce_tos[i - rdma_start_port(device)] = 0; in cma_add_one()
4817 init_completion(&cma_dev->comp); in cma_add_one()
4818 refcount_set(&cma_dev->refcount, 1); in cma_add_one()
4819 INIT_LIST_HEAD(&cma_dev->id_list); in cma_add_one()
4820 ib_set_client_data(device, &cma_client, cma_dev); in cma_add_one()
4823 list_add_tail(&cma_dev->list, &dev_list); in cma_add_one()
4825 cma_listen_on_dev(id_priv, cma_dev); in cma_add_one()
4832 kfree(cma_dev->default_gid_type); in cma_add_one()
4835 kfree(cma_dev); in cma_add_one()
4879 static void cma_process_remove(struct cma_device *cma_dev) in cma_process_remove() argument
4882 while (!list_empty(&cma_dev->id_list)) { in cma_process_remove()
4884 &cma_dev->id_list, struct rdma_id_private, list); in cma_process_remove()
4897 cma_dev_put(cma_dev); in cma_process_remove()
4898 wait_for_completion(&cma_dev->comp); in cma_process_remove()
4903 struct cma_device *cma_dev = client_data; in cma_remove_one() local
4908 list_del(&cma_dev->list); in cma_remove_one()
4911 cma_process_remove(cma_dev); in cma_remove_one()
4912 kfree(cma_dev->default_roce_tos); in cma_remove_one()
4913 kfree(cma_dev->default_gid_type); in cma_remove_one()
4914 kfree(cma_dev); in cma_remove_one()