Lines Matching refs:cma_dev

259 void cma_dev_get(struct cma_device *cma_dev)  in cma_dev_get()  argument
261 refcount_inc(&cma_dev->refcount); in cma_dev_get()
264 void cma_dev_put(struct cma_device *cma_dev) in cma_dev_put() argument
266 if (refcount_dec_and_test(&cma_dev->refcount)) in cma_dev_put()
267 complete(&cma_dev->comp); in cma_dev_put()
273 struct cma_device *cma_dev; in cma_enum_devices_by_ibdev() local
278 list_for_each_entry(cma_dev, &dev_list, list) in cma_enum_devices_by_ibdev()
279 if (filter(cma_dev->device, cookie)) { in cma_enum_devices_by_ibdev()
280 found_cma_dev = cma_dev; in cma_enum_devices_by_ibdev()
290 int cma_get_default_gid_type(struct cma_device *cma_dev, in cma_get_default_gid_type() argument
293 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_get_default_gid_type()
296 return cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)]; in cma_get_default_gid_type()
299 int cma_set_default_gid_type(struct cma_device *cma_dev, in cma_set_default_gid_type() argument
305 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_set_default_gid_type()
309 rdma_protocol_roce_eth_encap(cma_dev->device, port)) in cma_set_default_gid_type()
312 supported_gids = roce_gid_type_mask_support(cma_dev->device, port); in cma_set_default_gid_type()
317 cma_dev->default_gid_type[port - rdma_start_port(cma_dev->device)] = in cma_set_default_gid_type()
323 int cma_get_default_roce_tos(struct cma_device *cma_dev, u32 port) in cma_get_default_roce_tos() argument
325 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_get_default_roce_tos()
328 return cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)]; in cma_get_default_roce_tos()
331 int cma_set_default_roce_tos(struct cma_device *cma_dev, u32 port, in cma_set_default_roce_tos() argument
334 if (!rdma_is_port_valid(cma_dev->device, port)) in cma_set_default_roce_tos()
337 cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)] = in cma_set_default_roce_tos()
342 struct ib_device *cma_get_ib_dev(struct cma_device *cma_dev) in cma_get_ib_dev() argument
344 return cma_dev->device; in cma_get_ib_dev()
587 struct cma_device *cma_dev) in _cma_attach_to_dev() argument
589 cma_dev_get(cma_dev); in _cma_attach_to_dev()
590 id_priv->cma_dev = cma_dev; in _cma_attach_to_dev()
591 id_priv->id.device = cma_dev->device; in _cma_attach_to_dev()
593 rdma_node_get_transport(cma_dev->device->node_type); in _cma_attach_to_dev()
594 list_add_tail(&id_priv->device_item, &cma_dev->id_list); in _cma_attach_to_dev()
596 trace_cm_id_attach(id_priv, cma_dev->device); in _cma_attach_to_dev()
600 struct cma_device *cma_dev) in cma_attach_to_dev() argument
602 _cma_attach_to_dev(id_priv, cma_dev); in cma_attach_to_dev()
604 cma_dev->default_gid_type[id_priv->id.port_num - in cma_attach_to_dev()
605 rdma_start_port(cma_dev->device)]; in cma_attach_to_dev()
612 cma_dev_put(id_priv->cma_dev); in cma_release_dev()
613 id_priv->cma_dev = NULL; in cma_release_dev()
761 struct cma_device *cma_dev; in cma_acquire_dev_by_src_ip() local
777 list_for_each_entry(cma_dev, &dev_list, list) { in cma_acquire_dev_by_src_ip()
778 rdma_for_each_port (cma_dev->device, port) { in cma_acquire_dev_by_src_ip()
779 gidp = rdma_protocol_roce(cma_dev->device, port) ? in cma_acquire_dev_by_src_ip()
781 gid_type = cma_dev->default_gid_type[port - 1]; in cma_acquire_dev_by_src_ip()
782 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_acquire_dev_by_src_ip()
787 cma_attach_to_dev(id_priv, cma_dev); in cma_acquire_dev_by_src_ip()
829 gid_type = listen_id_priv->cma_dev->default_gid_type[req->port - 1]; in cma_ib_acquire_dev()
842 cma_attach_to_dev(id_priv, listen_id_priv->cma_dev); in cma_ib_acquire_dev()
853 struct cma_device *cma_dev; in cma_iw_acquire_dev() local
868 cma_dev = listen_id_priv->cma_dev; in cma_iw_acquire_dev()
871 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_iw_acquire_dev()
880 list_for_each_entry(cma_dev, &dev_list, list) { in cma_iw_acquire_dev()
881 rdma_for_each_port (cma_dev->device, port) { in cma_iw_acquire_dev()
882 if (listen_id_priv->cma_dev == cma_dev && in cma_iw_acquire_dev()
886 gid_type = cma_dev->default_gid_type[port - 1]; in cma_iw_acquire_dev()
887 sgid_attr = cma_validate_port(cma_dev->device, port, in cma_iw_acquire_dev()
900 cma_attach_to_dev(id_priv, cma_dev); in cma_iw_acquire_dev()
913 struct cma_device *cma_dev, *cur_dev; in cma_resolve_ib_dev() local
922 cma_dev = NULL; in cma_resolve_ib_dev()
947 cma_dev = cur_dev; in cma_resolve_ib_dev()
953 if (!cma_dev && (gid.global.subnet_prefix == in cma_resolve_ib_dev()
956 cma_dev = cur_dev; in cma_resolve_ib_dev()
968 cma_attach_to_dev(id_priv, cma_dev); in cma_resolve_ib_dev()
1180 BUG_ON(id_priv->cma_dev->device != id_priv->id.device); in cma_modify_qp_rtr()
1959 if (cma_any_addr(cma_src_addr(id_priv)) && !id_priv->cma_dev) in cma_cancel_operation()
2004 gid_type = id_priv->cma_dev->default_gid_type in destroy_mc()
2007 id_priv->cma_dev->device)]; in destroy_mc()
2038 if (id_priv->cma_dev) { in _destroy_id()
2694 struct cma_device *cma_dev, in cma_listen_on_dev() argument
2704 if (cma_family(id_priv) == AF_IB && !rdma_cap_ib_cm(cma_dev->device, 1)) in cma_listen_on_dev()
2717 _cma_attach_to_dev(dev_id_priv, cma_dev); in cma_listen_on_dev()
2735 dev_warn(&cma_dev->device->dev, "RDMA CMA: %s, error %d\n", __func__, ret); in cma_listen_on_dev()
2742 struct cma_device *cma_dev; in cma_listen_on_all() local
2747 list_for_each_entry(cma_dev, &dev_list, list) { in cma_listen_on_all()
2748 ret = cma_listen_on_dev(id_priv, cma_dev, &to_destroy); in cma_listen_on_all()
3279 u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num - in cma_resolve_iboe_route()
3280 rdma_start_port(id_priv->cma_dev->device)]; in cma_resolve_iboe_route()
3418 struct cma_device *cma_dev, *cur_dev; in cma_bind_loopback() local
3425 cma_dev = NULL; in cma_bind_loopback()
3432 if (!cma_dev) in cma_bind_loopback()
3433 cma_dev = cur_dev; in cma_bind_loopback()
3438 cma_dev = cur_dev; in cma_bind_loopback()
3444 if (!cma_dev) { in cma_bind_loopback()
3452 ret = rdma_query_gid(cma_dev->device, p, 0, &gid); in cma_bind_loopback()
3456 ret = ib_get_cached_pkey(cma_dev->device, p, 0, &pkey); in cma_bind_loopback()
3461 (rdma_protocol_ib(cma_dev->device, p)) ? in cma_bind_loopback()
3467 cma_attach_to_dev(id_priv, cma_dev); in cma_bind_loopback()
3496 if (!status && !id_priv->cma_dev) { in addr_handler()
3535 if (!id_priv->cma_dev) { in cma_resolve_loopback()
3560 if (!id_priv->cma_dev) { in cma_resolve_ib_addr()
3947 if (id_priv->cma_dev) { in rdma_listen()
4030 if (id_priv->cma_dev) in rdma_bind_addr_dst()
4817 id_priv->cma_dev in cma_make_mc_event()
4820 id_priv->cma_dev->device)]; in cma_make_mc_event()
4982 gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - in cma_iboe_join_multicast()
4983 rdma_start_port(id_priv->cma_dev->device)]; in cma_iboe_join_multicast()
5089 WARN_ON(id_priv->cma_dev->device != id->device); in rdma_leave_multicast()
5127 struct cma_device *cma_dev; in cma_netdev_callback() local
5138 list_for_each_entry(cma_dev, &dev_list, list) in cma_netdev_callback()
5139 list_for_each_entry(id_priv, &cma_dev->id_list, device_item) { in cma_netdev_callback()
5271 static void cma_process_remove(struct cma_device *cma_dev) in cma_process_remove() argument
5274 while (!list_empty(&cma_dev->id_list)) { in cma_process_remove()
5276 &cma_dev->id_list, struct rdma_id_private, device_item); in cma_process_remove()
5289 cma_dev_put(cma_dev); in cma_process_remove()
5290 wait_for_completion(&cma_dev->comp); in cma_process_remove()
5307 struct cma_device *cma_dev; in cma_add_one() local
5316 cma_dev = kmalloc(sizeof(*cma_dev), GFP_KERNEL); in cma_add_one()
5317 if (!cma_dev) in cma_add_one()
5320 cma_dev->device = device; in cma_add_one()
5321 cma_dev->default_gid_type = kcalloc(device->phys_port_cnt, in cma_add_one()
5322 sizeof(*cma_dev->default_gid_type), in cma_add_one()
5324 if (!cma_dev->default_gid_type) { in cma_add_one()
5329 cma_dev->default_roce_tos = kcalloc(device->phys_port_cnt, in cma_add_one()
5330 sizeof(*cma_dev->default_roce_tos), in cma_add_one()
5332 if (!cma_dev->default_roce_tos) { in cma_add_one()
5341 cma_dev->default_gid_type[i - rdma_start_port(device)] = in cma_add_one()
5344 cma_dev->default_gid_type[i - rdma_start_port(device)] = in cma_add_one()
5346 cma_dev->default_roce_tos[i - rdma_start_port(device)] = 0; in cma_add_one()
5349 init_completion(&cma_dev->comp); in cma_add_one()
5350 refcount_set(&cma_dev->refcount, 1); in cma_add_one()
5351 INIT_LIST_HEAD(&cma_dev->id_list); in cma_add_one()
5352 ib_set_client_data(device, &cma_client, cma_dev); in cma_add_one()
5355 list_add_tail(&cma_dev->list, &dev_list); in cma_add_one()
5357 ret = cma_listen_on_dev(id_priv, cma_dev, &to_destroy); in cma_add_one()
5367 list_del(&cma_dev->list); in cma_add_one()
5371 cma_process_remove(cma_dev); in cma_add_one()
5372 kfree(cma_dev->default_roce_tos); in cma_add_one()
5374 kfree(cma_dev->default_gid_type); in cma_add_one()
5377 kfree(cma_dev); in cma_add_one()
5383 struct cma_device *cma_dev = client_data; in cma_remove_one() local
5388 list_del(&cma_dev->list); in cma_remove_one()
5391 cma_process_remove(cma_dev); in cma_remove_one()
5392 kfree(cma_dev->default_roce_tos); in cma_remove_one()
5393 kfree(cma_dev->default_gid_type); in cma_remove_one()
5394 kfree(cma_dev); in cma_remove_one()