• Home
  • Raw
  • Download

Lines Matching refs:shca

278 static int ehca_sense_attributes(struct ehca_shca *shca)  in ehca_sense_attributes()  argument
294 shca->ofdev->node->full_name); in ehca_sense_attributes()
295 loc_code = of_get_property(shca->ofdev->node, "ibm,loc-code", NULL); in ehca_sense_attributes()
305 h_ret = hipz_h_query_hca(shca->ipz_hca_handle, rblock); in ehca_sense_attributes()
314 shca->num_ports = 1; in ehca_sense_attributes()
316 shca->num_ports = (u8)rblock->num_ports; in ehca_sense_attributes()
331 shca->hw_level = 0x10 | (revid + 1); in ehca_sense_attributes()
333 shca->hw_level = 0x14; in ehca_sense_attributes()
336 shca->hw_level = 0x21; in ehca_sense_attributes()
338 shca->hw_level = 0x22; in ehca_sense_attributes()
340 shca->hw_level = 0x23; in ehca_sense_attributes()
343 if (!shca->hw_level) { in ehca_sense_attributes()
346 shca->hw_level = 0x22; in ehca_sense_attributes()
349 shca->hw_level = ehca_hw_level; in ehca_sense_attributes()
350 ehca_gen_dbg(" ... hardware level=%x", shca->hw_level); in ehca_sense_attributes()
352 shca->hca_cap = rblock->hca_cap_indicators; in ehca_sense_attributes()
355 if (EHCA_BMASK_GET(hca_cap_descr[i].mask, shca->hca_cap)) in ehca_sense_attributes()
362 ehca_lock_hcalls = !(shca->hca_cap & HCA_CAP_H_ALLOC_RES_SYNC); in ehca_sense_attributes()
365 shca->hca_cap_mr_pgsize = EHCA_PAGESIZE; in ehca_sense_attributes()
368 shca->hca_cap_mr_pgsize |= pgsize_map[i + 1]; in ehca_sense_attributes()
371 if (shca->max_num_qps == -1) in ehca_sense_attributes()
372 shca->max_num_qps = min_t(int, rblock->max_qp, in ehca_sense_attributes()
374 else if (shca->max_num_qps < 1 || shca->max_num_qps > rblock->max_qp) { in ehca_sense_attributes()
378 shca->max_num_qps = rblock->max_qp; in ehca_sense_attributes()
381 if (shca->max_num_cqs == -1) in ehca_sense_attributes()
382 shca->max_num_cqs = min_t(int, rblock->max_cq, in ehca_sense_attributes()
384 else if (shca->max_num_cqs < 1 || shca->max_num_cqs > rblock->max_cq) { in ehca_sense_attributes()
392 h_ret = hipz_h_query_port(shca->ipz_hca_handle, 1, port); in ehca_sense_attributes()
400 shca->max_mtu = port->max_mtu; in ehca_sense_attributes()
407 static int init_node_guid(struct ehca_shca *shca) in init_node_guid() argument
414 ehca_err(&shca->ib_device, "Can't allocate rblock memory."); in init_node_guid()
418 if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) { in init_node_guid()
419 ehca_err(&shca->ib_device, "Can't query device properties"); in init_node_guid()
424 memcpy(&shca->ib_device.node_guid, &rblock->node_guid, sizeof(u64)); in init_node_guid()
431 static int ehca_init_device(struct ehca_shca *shca) in ehca_init_device() argument
435 ret = init_node_guid(shca); in ehca_init_device()
439 strlcpy(shca->ib_device.name, "ehca%d", IB_DEVICE_NAME_MAX); in ehca_init_device()
440 shca->ib_device.owner = THIS_MODULE; in ehca_init_device()
442 shca->ib_device.uverbs_abi_ver = 8; in ehca_init_device()
443 shca->ib_device.uverbs_cmd_mask = in ehca_init_device()
461 shca->ib_device.node_type = RDMA_NODE_IB_CA; in ehca_init_device()
462 shca->ib_device.phys_port_cnt = shca->num_ports; in ehca_init_device()
463 shca->ib_device.num_comp_vectors = 1; in ehca_init_device()
464 shca->ib_device.dma_device = &shca->ofdev->dev; in ehca_init_device()
465 shca->ib_device.query_device = ehca_query_device; in ehca_init_device()
466 shca->ib_device.query_port = ehca_query_port; in ehca_init_device()
467 shca->ib_device.query_gid = ehca_query_gid; in ehca_init_device()
468 shca->ib_device.query_pkey = ehca_query_pkey; in ehca_init_device()
470 shca->ib_device.modify_port = ehca_modify_port; in ehca_init_device()
471 shca->ib_device.alloc_ucontext = ehca_alloc_ucontext; in ehca_init_device()
472 shca->ib_device.dealloc_ucontext = ehca_dealloc_ucontext; in ehca_init_device()
473 shca->ib_device.alloc_pd = ehca_alloc_pd; in ehca_init_device()
474 shca->ib_device.dealloc_pd = ehca_dealloc_pd; in ehca_init_device()
475 shca->ib_device.create_ah = ehca_create_ah; in ehca_init_device()
477 shca->ib_device.query_ah = ehca_query_ah; in ehca_init_device()
478 shca->ib_device.destroy_ah = ehca_destroy_ah; in ehca_init_device()
479 shca->ib_device.create_qp = ehca_create_qp; in ehca_init_device()
480 shca->ib_device.modify_qp = ehca_modify_qp; in ehca_init_device()
481 shca->ib_device.query_qp = ehca_query_qp; in ehca_init_device()
482 shca->ib_device.destroy_qp = ehca_destroy_qp; in ehca_init_device()
483 shca->ib_device.post_send = ehca_post_send; in ehca_init_device()
484 shca->ib_device.post_recv = ehca_post_recv; in ehca_init_device()
485 shca->ib_device.create_cq = ehca_create_cq; in ehca_init_device()
486 shca->ib_device.destroy_cq = ehca_destroy_cq; in ehca_init_device()
487 shca->ib_device.resize_cq = ehca_resize_cq; in ehca_init_device()
488 shca->ib_device.poll_cq = ehca_poll_cq; in ehca_init_device()
490 shca->ib_device.req_notify_cq = ehca_req_notify_cq; in ehca_init_device()
492 shca->ib_device.get_dma_mr = ehca_get_dma_mr; in ehca_init_device()
493 shca->ib_device.reg_phys_mr = ehca_reg_phys_mr; in ehca_init_device()
494 shca->ib_device.reg_user_mr = ehca_reg_user_mr; in ehca_init_device()
495 shca->ib_device.query_mr = ehca_query_mr; in ehca_init_device()
496 shca->ib_device.dereg_mr = ehca_dereg_mr; in ehca_init_device()
497 shca->ib_device.rereg_phys_mr = ehca_rereg_phys_mr; in ehca_init_device()
498 shca->ib_device.alloc_mw = ehca_alloc_mw; in ehca_init_device()
499 shca->ib_device.bind_mw = ehca_bind_mw; in ehca_init_device()
500 shca->ib_device.dealloc_mw = ehca_dealloc_mw; in ehca_init_device()
501 shca->ib_device.alloc_fmr = ehca_alloc_fmr; in ehca_init_device()
502 shca->ib_device.map_phys_fmr = ehca_map_phys_fmr; in ehca_init_device()
503 shca->ib_device.unmap_fmr = ehca_unmap_fmr; in ehca_init_device()
504 shca->ib_device.dealloc_fmr = ehca_dealloc_fmr; in ehca_init_device()
505 shca->ib_device.attach_mcast = ehca_attach_mcast; in ehca_init_device()
506 shca->ib_device.detach_mcast = ehca_detach_mcast; in ehca_init_device()
507 shca->ib_device.process_mad = ehca_process_mad; in ehca_init_device()
508 shca->ib_device.mmap = ehca_mmap; in ehca_init_device()
510 if (EHCA_BMASK_GET(HCA_CAP_SRQ, shca->hca_cap)) { in ehca_init_device()
511 shca->ib_device.uverbs_cmd_mask |= in ehca_init_device()
517 shca->ib_device.create_srq = ehca_create_srq; in ehca_init_device()
518 shca->ib_device.modify_srq = ehca_modify_srq; in ehca_init_device()
519 shca->ib_device.query_srq = ehca_query_srq; in ehca_init_device()
520 shca->ib_device.destroy_srq = ehca_destroy_srq; in ehca_init_device()
521 shca->ib_device.post_srq_recv = ehca_post_srq_recv; in ehca_init_device()
527 static int ehca_create_aqp1(struct ehca_shca *shca, u32 port) in ehca_create_aqp1() argument
529 struct ehca_sport *sport = &shca->sport[port - 1]; in ehca_create_aqp1()
536 ehca_err(&shca->ib_device, "AQP1 CQ is already created."); in ehca_create_aqp1()
540 ibcq = ib_create_cq(&shca->ib_device, NULL, NULL, (void *)(-1), 10, 0); in ehca_create_aqp1()
542 ehca_err(&shca->ib_device, "Cannot create AQP1 CQ."); in ehca_create_aqp1()
548 ehca_err(&shca->ib_device, "AQP1 QP is already created."); in ehca_create_aqp1()
567 ibqp = ib_create_qp(&shca->pd->ib_pd, &qp_init_attr); in ehca_create_aqp1()
569 ehca_err(&shca->ib_device, "Cannot create AQP1 QP."); in ehca_create_aqp1()
635 struct ehca_shca *shca; \
639 shca = dev->driver_data; \
647 if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) { \
683 struct ehca_shca *shca = dev->driver_data; in ehca_show_adapter_handle() local
685 return sprintf(buf, "%llx\n", shca->ipz_hca_handle.handle); in ehca_show_adapter_handle()
716 struct ehca_shca *shca; in ehca_probe() local
735 shca = (struct ehca_shca *)ib_alloc_device(sizeof(*shca)); in ehca_probe()
736 if (!shca) { in ehca_probe()
741 mutex_init(&shca->modify_mutex); in ehca_probe()
742 atomic_set(&shca->num_cqs, 0); in ehca_probe()
743 atomic_set(&shca->num_qps, 0); in ehca_probe()
744 shca->max_num_qps = ehca_max_qp; in ehca_probe()
745 shca->max_num_cqs = ehca_max_cq; in ehca_probe()
747 for (i = 0; i < ARRAY_SIZE(shca->sport); i++) in ehca_probe()
748 spin_lock_init(&shca->sport[i].mod_sqp_lock); in ehca_probe()
750 shca->ofdev = dev; in ehca_probe()
751 shca->ipz_hca_handle.handle = *handle; in ehca_probe()
752 dev->dev.driver_data = shca; in ehca_probe()
754 ret = ehca_sense_attributes(shca); in ehca_probe()
760 ret = ehca_init_device(shca); in ehca_probe()
766 eq_size = 2 * shca->max_num_cqs + 4 * shca->max_num_qps; in ehca_probe()
768 ret = ehca_create_eq(shca, &shca->eq, EHCA_EQ, eq_size); in ehca_probe()
770 ehca_err(&shca->ib_device, "Cannot create EQ."); in ehca_probe()
774 ret = ehca_create_eq(shca, &shca->neq, EHCA_NEQ, 513); in ehca_probe()
776 ehca_err(&shca->ib_device, "Cannot create NEQ."); in ehca_probe()
781 ibpd = ehca_alloc_pd(&shca->ib_device, (void *)(-1), NULL); in ehca_probe()
783 ehca_err(&shca->ib_device, "Cannot create internal PD."); in ehca_probe()
788 shca->pd = container_of(ibpd, struct ehca_pd, ib_pd); in ehca_probe()
789 shca->pd->ib_pd.device = &shca->ib_device; in ehca_probe()
792 ret = ehca_reg_internal_maxmr(shca, shca->pd, &shca->maxmr); in ehca_probe()
795 ehca_err(&shca->ib_device, "Cannot create internal MR ret=%i", in ehca_probe()
800 ret = ib_register_device(&shca->ib_device); in ehca_probe()
802 ehca_err(&shca->ib_device, in ehca_probe()
809 shca->sport[0].port_state = IB_PORT_DOWN; in ehca_probe()
810 ret = ehca_create_aqp1(shca, 1); in ehca_probe()
812 ehca_err(&shca->ib_device, in ehca_probe()
819 if ((ehca_open_aqp1 == 1) && (shca->num_ports == 2)) { in ehca_probe()
820 shca->sport[1].port_state = IB_PORT_DOWN; in ehca_probe()
821 ret = ehca_create_aqp1(shca, 2); in ehca_probe()
823 ehca_err(&shca->ib_device, in ehca_probe()
831 ehca_err(&shca->ib_device, in ehca_probe()
835 list_add(&shca->shca_list, &shca_list); in ehca_probe()
841 ret = ehca_destroy_aqp1(&shca->sport[0]); in ehca_probe()
843 ehca_err(&shca->ib_device, in ehca_probe()
847 ib_unregister_device(&shca->ib_device); in ehca_probe()
850 ret = ehca_dereg_internal_maxmr(shca); in ehca_probe()
852 ehca_err(&shca->ib_device, in ehca_probe()
856 ret = ehca_dealloc_pd(&shca->pd->ib_pd); in ehca_probe()
858 ehca_err(&shca->ib_device, in ehca_probe()
862 ret = ehca_destroy_eq(shca, &shca->neq); in ehca_probe()
864 ehca_err(&shca->ib_device, in ehca_probe()
868 ret = ehca_destroy_eq(shca, &shca->eq); in ehca_probe()
870 ehca_err(&shca->ib_device, in ehca_probe()
874 ib_dealloc_device(&shca->ib_device); in ehca_probe()
881 struct ehca_shca *shca = dev->dev.driver_data; in ehca_remove() local
889 for (i = 0; i < shca->num_ports; i++) { in ehca_remove()
890 ret = ehca_destroy_aqp1(&shca->sport[i]); in ehca_remove()
892 ehca_err(&shca->ib_device, in ehca_remove()
898 ib_unregister_device(&shca->ib_device); in ehca_remove()
900 ret = ehca_dereg_internal_maxmr(shca); in ehca_remove()
902 ehca_err(&shca->ib_device, in ehca_remove()
905 ret = ehca_dealloc_pd(&shca->pd->ib_pd); in ehca_remove()
907 ehca_err(&shca->ib_device, in ehca_remove()
910 ret = ehca_destroy_eq(shca, &shca->eq); in ehca_remove()
912 ehca_err(&shca->ib_device, "Cannot destroy EQ. ret=%i", ret); in ehca_remove()
914 ret = ehca_destroy_eq(shca, &shca->neq); in ehca_remove()
916 ehca_err(&shca->ib_device, "Canot destroy NEQ. ret=%i", ret); in ehca_remove()
918 ib_dealloc_device(&shca->ib_device); in ehca_remove()
921 list_del(&shca->shca_list); in ehca_remove()
949 struct ehca_shca *shca; in ehca_poll_eqs() local
952 list_for_each_entry(shca, &shca_list, shca_list) { in ehca_poll_eqs()
953 if (shca->eq.is_initialized) { in ehca_poll_eqs()
955 struct ehca_eq *eq = &shca->eq; in ehca_poll_eqs()
969 ehca_process_eq(shca, 0); in ehca_poll_eqs()