Lines Matching refs:rdi
92 struct rvt_dev_info *rdi; in rvt_alloc_device() local
94 rdi = container_of(_ib_alloc_device(size), struct rvt_dev_info, ibdev); in rvt_alloc_device()
95 if (!rdi) in rvt_alloc_device()
96 return rdi; in rvt_alloc_device()
98 rdi->ports = kcalloc(nports, sizeof(*rdi->ports), GFP_KERNEL); in rvt_alloc_device()
99 if (!rdi->ports) in rvt_alloc_device()
100 ib_dealloc_device(&rdi->ibdev); in rvt_alloc_device()
102 return rdi; in rvt_alloc_device()
112 void rvt_dealloc_device(struct rvt_dev_info *rdi) in rvt_dealloc_device() argument
114 kfree(rdi->ports); in rvt_dealloc_device()
115 ib_dealloc_device(&rdi->ibdev); in rvt_dealloc_device()
123 struct rvt_dev_info *rdi = ib_to_rvt(ibdev); in rvt_query_device() local
130 *props = rdi->dparms.props; in rvt_query_device()
157 struct rvt_dev_info *rdi = ib_to_rvt(ibdev); in rvt_query_port() local
164 rvp = rdi->ports[port_index]; in rvt_query_port()
170 props->pkey_tbl_len = rvt_get_npkeys(rdi); in rvt_query_port()
177 return rdi->driver_f.query_port_state(rdi, port_num, props); in rvt_query_port()
192 struct rvt_dev_info *rdi = ib_to_rvt(ibdev); in rvt_modify_port() local
200 rvp = rdi->ports[port_index]; in rvt_modify_port()
210 rdi->driver_f.cap_mask_chg(rdi, port_num); in rvt_modify_port()
212 ret = rdi->driver_f.shut_down_port(rdi, port_num); in rvt_modify_port()
237 struct rvt_dev_info *rdi = ib_to_rvt(ibdev); in rvt_query_pkey() local
244 if (index >= rvt_get_npkeys(rdi)) in rvt_query_pkey()
247 *pkey = rvt_get_pkey(rdi, port_index, index); in rvt_query_pkey()
263 struct rvt_dev_info *rdi; in rvt_query_gid() local
276 rdi = ib_to_rvt(ibdev); in rvt_query_gid()
277 rvp = rdi->ports[port_index]; in rvt_query_gid()
281 return rdi->driver_f.get_guid_be(rdi, rvp, guid_index, in rvt_query_gid()
307 struct rvt_dev_info *rdi = ib_to_rvt(ibdev); in rvt_get_port_immutable() local
315 immutable->core_cap_flags = rdi->dparms.core_cap_flags; in rvt_get_port_immutable()
323 immutable->max_mad_size = rdi->dparms.max_mad_size; in rvt_get_port_immutable()
426 static noinline int check_support(struct rvt_dev_info *rdi, int verb) in check_support() argument
434 if ((!rdi->ibdev.ops.init_port) || in check_support()
435 (!rdi->driver_f.get_pci_dev)) in check_support()
444 if (!rdi->ibdev.ops.modify_device) in check_support()
449 if (!rdi->ibdev.ops.query_port) in check_support()
450 if (!rdi->driver_f.query_port_state) in check_support()
455 if (!rdi->ibdev.ops.modify_port) in check_support()
456 if (!rdi->driver_f.cap_mask_chg || in check_support()
457 !rdi->driver_f.shut_down_port) in check_support()
462 if (!rdi->ibdev.ops.query_gid) in check_support()
463 if (!rdi->driver_f.get_guid_be) in check_support()
468 if (!rdi->ibdev.ops.create_qp) in check_support()
469 if (!rdi->driver_f.qp_priv_alloc || in check_support()
470 !rdi->driver_f.qp_priv_free || in check_support()
471 !rdi->driver_f.notify_qp_reset || in check_support()
472 !rdi->driver_f.flush_qp_waiters || in check_support()
473 !rdi->driver_f.stop_send_queue || in check_support()
474 !rdi->driver_f.quiesce_qp) in check_support()
479 if (!rdi->ibdev.ops.modify_qp) in check_support()
480 if (!rdi->driver_f.notify_qp_reset || in check_support()
481 !rdi->driver_f.schedule_send || in check_support()
482 !rdi->driver_f.get_pmtu_from_attr || in check_support()
483 !rdi->driver_f.flush_qp_waiters || in check_support()
484 !rdi->driver_f.stop_send_queue || in check_support()
485 !rdi->driver_f.quiesce_qp || in check_support()
486 !rdi->driver_f.notify_error_qp || in check_support()
487 !rdi->driver_f.mtu_from_qp || in check_support()
488 !rdi->driver_f.mtu_to_path_mtu) in check_support()
493 if (!rdi->ibdev.ops.destroy_qp) in check_support()
494 if (!rdi->driver_f.qp_priv_free || in check_support()
495 !rdi->driver_f.notify_qp_reset || in check_support()
496 !rdi->driver_f.flush_qp_waiters || in check_support()
497 !rdi->driver_f.stop_send_queue || in check_support()
498 !rdi->driver_f.quiesce_qp) in check_support()
503 if (!rdi->ibdev.ops.post_send) in check_support()
504 if (!rdi->driver_f.schedule_send || in check_support()
505 !rdi->driver_f.do_send || in check_support()
506 !rdi->post_parms) in check_support()
524 int rvt_register_device(struct rvt_dev_info *rdi) in rvt_register_device() argument
528 if (!rdi) in rvt_register_device()
536 if (check_support(rdi, i)) { in rvt_register_device()
541 ib_set_device_ops(&rdi->ibdev, &rvt_dev_ops); in rvt_register_device()
544 trace_rvt_dbg(rdi, "Driver attempting registration"); in rvt_register_device()
545 rvt_mmap_init(rdi); in rvt_register_device()
548 ret = rvt_driver_qp_init(rdi); in rvt_register_device()
555 spin_lock_init(&rdi->n_ahs_lock); in rvt_register_device()
556 rdi->n_ahs_allocated = 0; in rvt_register_device()
559 rvt_driver_srq_init(rdi); in rvt_register_device()
562 rvt_driver_mcast_init(rdi); in rvt_register_device()
565 ret = rvt_driver_mr_init(rdi); in rvt_register_device()
572 ret = rvt_wss_init(rdi); in rvt_register_device()
574 rvt_pr_err(rdi, "Error in WSS init.\n"); in rvt_register_device()
579 spin_lock_init(&rdi->n_cqs_lock); in rvt_register_device()
582 spin_lock_init(&rdi->n_pds_lock); in rvt_register_device()
583 rdi->n_pds_allocated = 0; in rvt_register_device()
591 rdi->ibdev.uverbs_cmd_mask = in rvt_register_device()
622 rdi->ibdev.node_type = RDMA_NODE_IB_CA; in rvt_register_device()
623 if (!rdi->ibdev.num_comp_vectors) in rvt_register_device()
624 rdi->ibdev.num_comp_vectors = 1; in rvt_register_device()
627 ret = ib_register_device(&rdi->ibdev, dev_name(&rdi->ibdev.dev), NULL); in rvt_register_device()
629 rvt_pr_err(rdi, "Failed to register driver with ib core.\n"); in rvt_register_device()
633 rvt_create_mad_agents(rdi); in rvt_register_device()
635 rvt_pr_info(rdi, "Registration with rdmavt done.\n"); in rvt_register_device()
639 rvt_wss_exit(rdi); in rvt_register_device()
641 rvt_mr_exit(rdi); in rvt_register_device()
644 rvt_qp_exit(rdi); in rvt_register_device()
654 void rvt_unregister_device(struct rvt_dev_info *rdi) in rvt_unregister_device() argument
656 trace_rvt_dbg(rdi, "Driver is unregistering."); in rvt_unregister_device()
657 if (!rdi) in rvt_unregister_device()
660 rvt_free_mad_agents(rdi); in rvt_unregister_device()
662 ib_unregister_device(&rdi->ibdev); in rvt_unregister_device()
663 rvt_wss_exit(rdi); in rvt_unregister_device()
664 rvt_mr_exit(rdi); in rvt_unregister_device()
665 rvt_qp_exit(rdi); in rvt_unregister_device()
681 int rvt_init_port(struct rvt_dev_info *rdi, struct rvt_ibport *port, in rvt_init_port() argument
685 rdi->ports[port_index] = port; in rvt_init_port()
686 rdi->ports[port_index]->pkey_table = pkey_table; in rvt_init_port()