Lines Matching refs:cma_dev

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