Lines Matching refs:cma_dev
276 void cma_ref_dev(struct cma_device *cma_dev) in cma_ref_dev() argument
278 atomic_inc(&cma_dev->refcount); in cma_ref_dev()
284 struct cma_device *cma_dev; in cma_enum_devices_by_ibdev() local
289 list_for_each_entry(cma_dev, &dev_list, list) in cma_enum_devices_by_ibdev()
290 if (filter(cma_dev->device, cookie)) { in cma_enum_devices_by_ibdev()
291 found_cma_dev = cma_dev; in cma_enum_devices_by_ibdev()
301 int cma_get_default_gid_type(struct cma_device *cma_dev, in cma_get_default_gid_type() argument
304 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_get_default_gid_type()
307 return cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)]; in cma_get_default_gid_type()
310 int cma_set_default_gid_type(struct cma_device *cma_dev, in cma_set_default_gid_type() argument
316 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_set_default_gid_type()
319 supported_gids = roce_gid_type_mask_support(cma_dev->device, port); in cma_set_default_gid_type()
324 cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)] = in cma_set_default_gid_type()
330 int cma_get_default_roce_tos(struct cma_device *cma_dev, unsigned int port) in cma_get_default_roce_tos() argument
332 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_get_default_roce_tos()
335 return cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)]; in cma_get_default_roce_tos()
338 int cma_set_default_roce_tos(struct cma_device *cma_dev, unsigned int port, in cma_set_default_roce_tos() argument
341 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_set_default_roce_tos()
344 cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)] = in cma_set_default_roce_tos()
349 struct ib_device *cma_get_ib_dev(struct cma_device *cma_dev) in cma_get_ib_dev() argument
351 return cma_dev->device; in cma_get_ib_dev()
490 struct cma_device *cma_dev) in _cma_attach_to_dev() argument
492 cma_ref_dev(cma_dev); in _cma_attach_to_dev()
493 id_priv->cma_dev = cma_dev; in _cma_attach_to_dev()
494 id_priv->id.device = cma_dev->device; in _cma_attach_to_dev()
496 rdma_node_get_transport(cma_dev->device->node_type); in _cma_attach_to_dev()
497 list_add_tail(&id_priv->list, &cma_dev->id_list); in _cma_attach_to_dev()
505 struct cma_device *cma_dev) in cma_attach_to_dev() argument
507 _cma_attach_to_dev(id_priv, cma_dev); in cma_attach_to_dev()
509 cma_dev->default_gid_type[id_priv->id.port_num - in cma_attach_to_dev()
510 rdma_start_port(cma_dev->device)]; in cma_attach_to_dev()
513 void cma_deref_dev(struct cma_device *cma_dev) in cma_deref_dev() argument
515 if (atomic_dec_and_test(&cma_dev->refcount)) in cma_deref_dev()
516 complete(&cma_dev->comp); in cma_deref_dev()
531 cma_deref_dev(id_priv->cma_dev); in cma_release_dev()
532 id_priv->cma_dev = NULL; in cma_release_dev()
663 struct cma_device *cma_dev; in cma_acquire_dev_by_src_ip() local
679 list_for_each_entry(cma_dev, &dev_list, list) { in cma_acquire_dev_by_src_ip()
680 rdma_for_each_port (cma_dev->device, port) { in cma_acquire_dev_by_src_ip()
681 gidp = rdma_protocol_roce(cma_dev->device, port) ? in cma_acquire_dev_by_src_ip()
683 gid_type = cma_dev->default_gid_type[port - 1]; in cma_acquire_dev_by_src_ip()
684 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_acquire_dev_by_src_ip()
689 cma_attach_to_dev(id_priv, cma_dev); in cma_acquire_dev_by_src_ip()
731 gid_type = listen_id_priv->cma_dev->default_gid_type[req->port - 1]; in cma_ib_acquire_dev()
744 cma_attach_to_dev(id_priv, listen_id_priv->cma_dev); in cma_ib_acquire_dev()
754 struct cma_device *cma_dev; in cma_iw_acquire_dev() local
769 cma_dev = listen_id_priv->cma_dev; in cma_iw_acquire_dev()
772 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_iw_acquire_dev()
781 list_for_each_entry(cma_dev, &dev_list, list) { in cma_iw_acquire_dev()
782 for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) { in cma_iw_acquire_dev()
783 if (listen_id_priv->cma_dev == cma_dev && in cma_iw_acquire_dev()
787 gid_type = cma_dev->default_gid_type[port - 1]; in cma_iw_acquire_dev()
788 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_iw_acquire_dev()
801 cma_attach_to_dev(id_priv, cma_dev); in cma_iw_acquire_dev()
812 struct cma_device *cma_dev, *cur_dev; in cma_resolve_ib_dev() local
820 cma_dev = NULL; in cma_resolve_ib_dev()
840 cma_dev = cur_dev; in cma_resolve_ib_dev()
846 if (!cma_dev && (gid.global.subnet_prefix == in cma_resolve_ib_dev()
849 cma_dev = cur_dev; in cma_resolve_ib_dev()
861 cma_attach_to_dev(id_priv, cma_dev); in cma_resolve_ib_dev()
1022 BUG_ON(id_priv->cma_dev->device != id_priv->id.device); in cma_modify_qp_rtr()
1777 if (cma_any_addr(cma_src_addr(id_priv)) && !id_priv->cma_dev) in cma_cancel_operation()
1825 if (rdma_cap_ib_mcast(id_priv->cma_dev->device, in cma_leave_mc_groups()
1852 if (id_priv->cma_dev) { in rdma_destroy_id()
2469 struct cma_device *cma_dev) in cma_listen_on_dev() argument
2476 if (cma_family(id_priv) == AF_IB && !rdma_cap_ib_cm(cma_dev->device, 1)) in cma_listen_on_dev()
2490 _cma_attach_to_dev(dev_id_priv, cma_dev); in cma_listen_on_dev()
2500 dev_warn(&cma_dev->device->dev, in cma_listen_on_dev()
2506 struct cma_device *cma_dev; in cma_listen_on_all() local
2510 list_for_each_entry(cma_dev, &dev_list, list) in cma_listen_on_all()
2511 cma_listen_on_dev(id_priv, cma_dev); in cma_listen_on_all()
2857 u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num - in cma_resolve_iboe_route()
2858 rdma_start_port(id_priv->cma_dev->device)]; in cma_resolve_iboe_route()
2968 struct cma_device *cma_dev, *cur_dev; in cma_bind_loopback() local
2975 cma_dev = NULL; in cma_bind_loopback()
2982 if (!cma_dev) in cma_bind_loopback()
2983 cma_dev = cur_dev; in cma_bind_loopback()
2988 cma_dev = cur_dev; in cma_bind_loopback()
2994 if (!cma_dev) { in cma_bind_loopback()
3002 ret = rdma_query_gid(cma_dev->device, p, 0, &gid); in cma_bind_loopback()
3006 ret = ib_get_cached_pkey(cma_dev->device, p, 0, &pkey); in cma_bind_loopback()
3011 (rdma_protocol_ib(cma_dev->device, p)) ? in cma_bind_loopback()
3017 cma_attach_to_dev(id_priv, cma_dev); in cma_bind_loopback()
3045 if (!status && !id_priv->cma_dev) { in addr_handler()
3085 if (!id_priv->cma_dev) { in cma_resolve_loopback()
3111 if (!id_priv->cma_dev) { in cma_resolve_ib_addr()
3623 if (id_priv->cma_dev) in rdma_bind_addr()
4175 id_priv->cma_dev->default_gid_type[id_priv->id.port_num - in cma_ib_mc_handler()
4176 rdma_start_port(id_priv->cma_dev->device)]; in cma_ib_mc_handler()
4361 gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - in cma_iboe_join_multicast()
4362 rdma_start_port(id_priv->cma_dev->device)]; in cma_iboe_join_multicast()
4480 BUG_ON(id_priv->cma_dev->device != id->device); in rdma_leave_multicast()
4525 struct cma_device *cma_dev; in cma_netdev_callback() local
4536 list_for_each_entry(cma_dev, &dev_list, list) in cma_netdev_callback()
4537 list_for_each_entry(id_priv, &cma_dev->id_list, list) { in cma_netdev_callback()
4554 struct cma_device *cma_dev; in cma_add_one() local
4559 cma_dev = kmalloc(sizeof *cma_dev, GFP_KERNEL); in cma_add_one()
4560 if (!cma_dev) in cma_add_one()
4563 cma_dev->device = device; in cma_add_one()
4564 cma_dev->default_gid_type = kcalloc(device->phys_port_cnt, in cma_add_one()
4565 sizeof(*cma_dev->default_gid_type), in cma_add_one()
4567 if (!cma_dev->default_gid_type) in cma_add_one()
4570 cma_dev->default_roce_tos = kcalloc(device->phys_port_cnt, in cma_add_one()
4571 sizeof(*cma_dev->default_roce_tos), in cma_add_one()
4573 if (!cma_dev->default_roce_tos) in cma_add_one()
4580 cma_dev->default_gid_type[i - rdma_start_port(device)] = in cma_add_one()
4583 cma_dev->default_gid_type[i - rdma_start_port(device)] = in cma_add_one()
4585 cma_dev->default_roce_tos[i - rdma_start_port(device)] = 0; in cma_add_one()
4588 init_completion(&cma_dev->comp); in cma_add_one()
4589 atomic_set(&cma_dev->refcount, 1); in cma_add_one()
4590 INIT_LIST_HEAD(&cma_dev->id_list); in cma_add_one()
4591 ib_set_client_data(device, &cma_client, cma_dev); in cma_add_one()
4594 list_add_tail(&cma_dev->list, &dev_list); in cma_add_one()
4596 cma_listen_on_dev(id_priv, cma_dev); in cma_add_one()
4602 kfree(cma_dev->default_gid_type); in cma_add_one()
4605 kfree(cma_dev); in cma_add_one()
4635 static void cma_process_remove(struct cma_device *cma_dev) in cma_process_remove() argument
4641 while (!list_empty(&cma_dev->id_list)) { in cma_process_remove()
4642 id_priv = list_entry(cma_dev->id_list.next, in cma_process_remove()
4659 cma_deref_dev(cma_dev); in cma_process_remove()
4660 wait_for_completion(&cma_dev->comp); in cma_process_remove()
4665 struct cma_device *cma_dev = client_data; in cma_remove_one() local
4667 if (!cma_dev) in cma_remove_one()
4671 list_del(&cma_dev->list); in cma_remove_one()
4674 cma_process_remove(cma_dev); in cma_remove_one()
4675 kfree(cma_dev->default_roce_tos); in cma_remove_one()
4676 kfree(cma_dev->default_gid_type); in cma_remove_one()
4677 kfree(cma_dev); in cma_remove_one()