Lines Matching refs:cma_dev
275 void cma_ref_dev(struct cma_device *cma_dev) in cma_ref_dev() argument
277 atomic_inc(&cma_dev->refcount); in cma_ref_dev()
283 struct cma_device *cma_dev; in cma_enum_devices_by_ibdev() local
288 list_for_each_entry(cma_dev, &dev_list, list) in cma_enum_devices_by_ibdev()
289 if (filter(cma_dev->device, cookie)) { in cma_enum_devices_by_ibdev()
290 found_cma_dev = cma_dev; in cma_enum_devices_by_ibdev()
300 int cma_get_default_gid_type(struct cma_device *cma_dev, in cma_get_default_gid_type() argument
303 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_get_default_gid_type()
306 return cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)]; in cma_get_default_gid_type()
309 int cma_set_default_gid_type(struct cma_device *cma_dev, in cma_set_default_gid_type() argument
315 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_set_default_gid_type()
318 supported_gids = roce_gid_type_mask_support(cma_dev->device, port); in cma_set_default_gid_type()
323 cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)] = in cma_set_default_gid_type()
329 int cma_get_default_roce_tos(struct cma_device *cma_dev, unsigned int port) in cma_get_default_roce_tos() argument
331 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_get_default_roce_tos()
334 return cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)]; in cma_get_default_roce_tos()
337 int cma_set_default_roce_tos(struct cma_device *cma_dev, unsigned int port, in cma_set_default_roce_tos() argument
340 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_set_default_roce_tos()
343 cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)] = in cma_set_default_roce_tos()
348 struct ib_device *cma_get_ib_dev(struct cma_device *cma_dev) in cma_get_ib_dev() argument
350 return cma_dev->device; in cma_get_ib_dev()
489 struct cma_device *cma_dev) in _cma_attach_to_dev() argument
491 cma_ref_dev(cma_dev); in _cma_attach_to_dev()
492 id_priv->cma_dev = cma_dev; in _cma_attach_to_dev()
493 id_priv->id.device = cma_dev->device; in _cma_attach_to_dev()
495 rdma_node_get_transport(cma_dev->device->node_type); in _cma_attach_to_dev()
496 list_add_tail(&id_priv->list, &cma_dev->id_list); in _cma_attach_to_dev()
501 struct cma_device *cma_dev) in cma_attach_to_dev() argument
503 _cma_attach_to_dev(id_priv, cma_dev); in cma_attach_to_dev()
505 cma_dev->default_gid_type[id_priv->id.port_num - in cma_attach_to_dev()
506 rdma_start_port(cma_dev->device)]; in cma_attach_to_dev()
509 void cma_deref_dev(struct cma_device *cma_dev) in cma_deref_dev() argument
511 if (atomic_dec_and_test(&cma_dev->refcount)) in cma_deref_dev()
512 complete(&cma_dev->comp); in cma_deref_dev()
527 cma_deref_dev(id_priv->cma_dev); in cma_release_dev()
528 id_priv->cma_dev = NULL; in cma_release_dev()
647 struct cma_device *cma_dev; in cma_acquire_dev() local
665 cma_dev = listen_id_priv->cma_dev; in cma_acquire_dev()
667 gidp = rdma_protocol_roce(cma_dev->device, port) ? in cma_acquire_dev()
670 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_acquire_dev()
680 list_for_each_entry(cma_dev, &dev_list, list) { in cma_acquire_dev()
681 for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) { in cma_acquire_dev()
683 listen_id_priv->cma_dev == cma_dev && in cma_acquire_dev()
687 gidp = rdma_protocol_roce(cma_dev->device, port) ? in cma_acquire_dev()
689 gid_type = cma_dev->default_gid_type[port - 1]; in cma_acquire_dev()
690 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_acquire_dev()
703 cma_attach_to_dev(id_priv, cma_dev); in cma_acquire_dev()
714 struct cma_device *cma_dev, *cur_dev; in cma_resolve_ib_dev() local
722 cma_dev = NULL; in cma_resolve_ib_dev()
742 cma_dev = cur_dev; in cma_resolve_ib_dev()
748 if (!cma_dev && (gid.global.subnet_prefix == in cma_resolve_ib_dev()
751 cma_dev = cur_dev; in cma_resolve_ib_dev()
763 cma_attach_to_dev(id_priv, cma_dev); in cma_resolve_ib_dev()
926 BUG_ON(id_priv->cma_dev->device != id_priv->id.device); in cma_modify_qp_rtr()
1639 if (cma_any_addr(cma_src_addr(id_priv)) && !id_priv->cma_dev) in cma_cancel_operation()
1687 if (rdma_cap_ib_mcast(id_priv->cma_dev->device, in cma_leave_mc_groups()
1713 if (id_priv->cma_dev) { in rdma_destroy_id()
2328 struct cma_device *cma_dev) in cma_listen_on_dev() argument
2335 if (cma_family(id_priv) == AF_IB && !rdma_cap_ib_cm(cma_dev->device, 1)) in cma_listen_on_dev()
2349 _cma_attach_to_dev(dev_id_priv, cma_dev); in cma_listen_on_dev()
2358 ret, cma_dev->device->name); in cma_listen_on_dev()
2363 struct cma_device *cma_dev; in cma_listen_on_all() local
2367 list_for_each_entry(cma_dev, &dev_list, list) in cma_listen_on_all()
2368 cma_listen_on_dev(id_priv, cma_dev); in cma_listen_on_all()
2685 u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num - in cma_resolve_iboe_route()
2686 rdma_start_port(id_priv->cma_dev->device)]; in cma_resolve_iboe_route()
2796 struct cma_device *cma_dev, *cur_dev; in cma_bind_loopback() local
2803 cma_dev = NULL; in cma_bind_loopback()
2810 if (!cma_dev) in cma_bind_loopback()
2811 cma_dev = cur_dev; in cma_bind_loopback()
2816 cma_dev = cur_dev; in cma_bind_loopback()
2822 if (!cma_dev) { in cma_bind_loopback()
2830 ret = rdma_query_gid(cma_dev->device, p, 0, &gid); in cma_bind_loopback()
2834 ret = ib_get_cached_pkey(cma_dev->device, p, 0, &pkey); in cma_bind_loopback()
2839 (rdma_protocol_ib(cma_dev->device, p)) ? in cma_bind_loopback()
2845 cma_attach_to_dev(id_priv, cma_dev); in cma_bind_loopback()
2864 if (!status && !id_priv->cma_dev) { in addr_handler()
2904 if (!id_priv->cma_dev) { in cma_resolve_loopback()
2930 if (!id_priv->cma_dev) { in cma_resolve_ib_addr()
3442 if (id_priv->cma_dev) { in rdma_bind_addr()
3998 id_priv->cma_dev->default_gid_type[id_priv->id.port_num - in cma_ib_mc_handler()
3999 rdma_start_port(id_priv->cma_dev->device)]; in cma_ib_mc_handler()
4183 gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - in cma_iboe_join_multicast()
4184 rdma_start_port(id_priv->cma_dev->device)]; in cma_iboe_join_multicast()
4302 BUG_ON(id_priv->cma_dev->device != id->device); in rdma_leave_multicast()
4347 struct cma_device *cma_dev; in cma_netdev_callback() local
4358 list_for_each_entry(cma_dev, &dev_list, list) in cma_netdev_callback()
4359 list_for_each_entry(id_priv, &cma_dev->id_list, list) { in cma_netdev_callback()
4376 struct cma_device *cma_dev; in cma_add_one() local
4381 cma_dev = kmalloc(sizeof *cma_dev, GFP_KERNEL); in cma_add_one()
4382 if (!cma_dev) in cma_add_one()
4385 cma_dev->device = device; in cma_add_one()
4386 cma_dev->default_gid_type = kcalloc(device->phys_port_cnt, in cma_add_one()
4387 sizeof(*cma_dev->default_gid_type), in cma_add_one()
4389 if (!cma_dev->default_gid_type) in cma_add_one()
4392 cma_dev->default_roce_tos = kcalloc(device->phys_port_cnt, in cma_add_one()
4393 sizeof(*cma_dev->default_roce_tos), in cma_add_one()
4395 if (!cma_dev->default_roce_tos) in cma_add_one()
4402 cma_dev->default_gid_type[i - rdma_start_port(device)] = in cma_add_one()
4405 cma_dev->default_gid_type[i - rdma_start_port(device)] = in cma_add_one()
4407 cma_dev->default_roce_tos[i - rdma_start_port(device)] = 0; in cma_add_one()
4410 init_completion(&cma_dev->comp); in cma_add_one()
4411 atomic_set(&cma_dev->refcount, 1); in cma_add_one()
4412 INIT_LIST_HEAD(&cma_dev->id_list); in cma_add_one()
4413 ib_set_client_data(device, &cma_client, cma_dev); in cma_add_one()
4416 list_add_tail(&cma_dev->list, &dev_list); in cma_add_one()
4418 cma_listen_on_dev(id_priv, cma_dev); in cma_add_one()
4424 kfree(cma_dev->default_gid_type); in cma_add_one()
4427 kfree(cma_dev); in cma_add_one()
4457 static void cma_process_remove(struct cma_device *cma_dev) in cma_process_remove() argument
4463 while (!list_empty(&cma_dev->id_list)) { in cma_process_remove()
4464 id_priv = list_entry(cma_dev->id_list.next, in cma_process_remove()
4481 cma_deref_dev(cma_dev); in cma_process_remove()
4482 wait_for_completion(&cma_dev->comp); in cma_process_remove()
4487 struct cma_device *cma_dev = client_data; in cma_remove_one() local
4489 if (!cma_dev) in cma_remove_one()
4493 list_del(&cma_dev->list); in cma_remove_one()
4496 cma_process_remove(cma_dev); in cma_remove_one()
4497 kfree(cma_dev->default_roce_tos); in cma_remove_one()
4498 kfree(cma_dev->default_gid_type); in cma_remove_one()
4499 kfree(cma_dev); in cma_remove_one()
4508 struct cma_device *cma_dev; in cma_get_id_stats() local
4517 list_for_each_entry(cma_dev, &dev_list, list) { in cma_get_id_stats()
4524 list_for_each_entry(id_priv, &cma_dev->id_list, list) { in cma_get_id_stats()