Lines Matching refs:sport

140 	struct srpt_port *sport;  in srpt_event_handler()  local
150 sport = &sdev->port[port_num]; in srpt_event_handler()
151 sport->lid = 0; in srpt_event_handler()
152 sport->sm_lid = 0; in srpt_event_handler()
168 sport = &sdev->port[port_num]; in srpt_event_handler()
169 if (!sport->lid && !sport->sm_lid) in srpt_event_handler()
170 schedule_work(&sport->work); in srpt_event_handler()
318 static void srpt_get_ioc(struct srpt_port *sport, u32 slot, in srpt_get_ioc() argument
321 struct srpt_device *sdev = sport->sdev; in srpt_get_ioc()
360 iocp->rdma_size = cpu_to_be32(min(sport->port_attrib.srp_max_rdma_size, in srpt_get_ioc()
473 struct srpt_port *sport = (struct srpt_port *)mad_agent->context; in srpt_mad_recv_handler() local
505 srpt_mgmt_method_get(sport, mad_wc->recv_buf.mad, dm_mad); in srpt_mad_recv_handler()
550 static int srpt_refresh_port(struct srpt_port *sport) in srpt_refresh_port() argument
557 ret = ib_query_port(sport->sdev->device, sport->port, &port_attr); in srpt_refresh_port()
561 sport->sm_lid = port_attr.sm_lid; in srpt_refresh_port()
562 sport->lid = port_attr.lid; in srpt_refresh_port()
564 ret = rdma_query_gid(sport->sdev->device, sport->port, 0, &sport->gid); in srpt_refresh_port()
568 sport->port_guid_id.wwn.priv = sport; in srpt_refresh_port()
569 srpt_format_guid(sport->port_guid_id.name, in srpt_refresh_port()
570 sizeof(sport->port_guid_id.name), in srpt_refresh_port()
571 &sport->gid.global.interface_id); in srpt_refresh_port()
572 sport->port_gid_id.wwn.priv = sport; in srpt_refresh_port()
573 snprintf(sport->port_gid_id.name, sizeof(sport->port_gid_id.name), in srpt_refresh_port()
575 be64_to_cpu(sport->gid.global.subnet_prefix), in srpt_refresh_port()
576 be64_to_cpu(sport->gid.global.interface_id)); in srpt_refresh_port()
578 if (rdma_protocol_iwarp(sport->sdev->device, sport->port)) in srpt_refresh_port()
585 ret = ib_modify_port(sport->sdev->device, sport->port, 0, &port_modify); in srpt_refresh_port()
588 dev_name(&sport->sdev->device->dev), sport->port, ret); in srpt_refresh_port()
592 if (!sport->mad_agent) { in srpt_refresh_port()
599 sport->mad_agent = ib_register_mad_agent(sport->sdev->device, in srpt_refresh_port()
600 sport->port, in srpt_refresh_port()
605 sport, 0); in srpt_refresh_port()
606 if (IS_ERR(sport->mad_agent)) { in srpt_refresh_port()
608 dev_name(&sport->sdev->device->dev), sport->port, in srpt_refresh_port()
609 PTR_ERR(sport->mad_agent)); in srpt_refresh_port()
610 sport->mad_agent = NULL; in srpt_refresh_port()
613 ib_modify_port(sport->sdev->device, sport->port, 0, in srpt_refresh_port()
634 struct srpt_port *sport; in srpt_unregister_mad_agent() local
638 sport = &sdev->port[i - 1]; in srpt_unregister_mad_agent()
639 WARN_ON(sport->port != i); in srpt_unregister_mad_agent()
640 if (sport->mad_agent) { in srpt_unregister_mad_agent()
642 ib_unregister_mad_agent(sport->mad_agent); in srpt_unregister_mad_agent()
643 sport->mad_agent = NULL; in srpt_unregister_mad_agent()
919 ret = rdma_rw_ctx_init(&ctx->rw, ch->qp, ch->sport->port, in srpt_alloc_rw_ctxs()
948 rdma_rw_ctx_destroy(&ctx->rw, ch->qp, ch->sport->port, in srpt_alloc_rw_ctxs()
966 rdma_rw_ctx_destroy(&ctx->rw, ch->qp, ch->sport->port, in srpt_free_rw_ctxs()
1124 attr->port_num = ch->sport->port; in srpt_init_ch_qp()
1126 ret = ib_find_cached_pkey(ch->sport->sdev->device, ch->sport->port, in srpt_init_ch_qp()
1632 ib_dma_sync_single_for_cpu(ch->sport->sdev->device, in srpt_handle_new_iu()
1675 srpt_post_recv(ch->sport->sdev, ch, recv_ioctx); in srpt_handle_new_iu()
1785 struct srpt_port *sport = ch->sport; in srpt_create_ch_ib() local
1786 struct srpt_device *sdev = sport->sdev; in srpt_create_ch_ib()
1788 int sq_size = sport->port_attrib.srp_sq_size; in srpt_create_ch_ib()
1827 qp_init->port_num = ch->sport->port; in srpt_create_ch_ib()
1963 struct srpt_port *sport = ch->sport; in srpt_disconnect_ch_sync() local
1970 mutex_lock(&sport->mutex); in srpt_disconnect_ch_sync()
1972 mutex_unlock(&sport->mutex); in srpt_disconnect_ch_sync()
1980 static void __srpt_close_all_ch(struct srpt_port *sport) in __srpt_close_all_ch() argument
1985 lockdep_assert_held(&sport->mutex); in __srpt_close_all_ch()
1987 list_for_each_entry(nexus, &sport->nexus_list, entry) { in __srpt_close_all_ch()
1992 dev_name(&sport->sdev->device->dev), in __srpt_close_all_ch()
1993 sport->port); in __srpt_close_all_ch()
2003 static struct srpt_nexus *srpt_get_nexus(struct srpt_port *sport, in srpt_get_nexus() argument
2010 mutex_lock(&sport->mutex); in srpt_get_nexus()
2011 list_for_each_entry(n, &sport->nexus_list, entry) { in srpt_get_nexus()
2020 &sport->nexus_list); in srpt_get_nexus()
2023 mutex_unlock(&sport->mutex); in srpt_get_nexus()
2042 static void srpt_set_enabled(struct srpt_port *sport, bool enabled) in srpt_set_enabled() argument
2043 __must_hold(&sport->mutex) in srpt_set_enabled()
2045 lockdep_assert_held(&sport->mutex); in srpt_set_enabled()
2047 if (sport->enabled == enabled) in srpt_set_enabled()
2049 sport->enabled = enabled; in srpt_set_enabled()
2051 __srpt_close_all_ch(sport); in srpt_set_enabled()
2054 static void srpt_drop_sport_ref(struct srpt_port *sport) in srpt_drop_sport_ref() argument
2056 if (atomic_dec_return(&sport->refcount) == 0 && sport->freed_channels) in srpt_drop_sport_ref()
2057 complete(sport->freed_channels); in srpt_drop_sport_ref()
2064 srpt_drop_sport_ref(ch->sport); in srpt_free_ch()
2080 struct srpt_port *sport; in srpt_release_channel_work() local
2086 sdev = ch->sport->sdev; in srpt_release_channel_work()
2103 sport = ch->sport; in srpt_release_channel_work()
2104 mutex_lock(&sport->mutex); in srpt_release_channel_work()
2106 mutex_unlock(&sport->mutex); in srpt_release_channel_work()
2114 ch->sport->sdev, ch->rq_size, in srpt_release_channel_work()
2149 struct srpt_port *sport = &sdev->port[port_num - 1]; in srpt_cm_req_recv() local
2169 port_num, &sport->gid, be16_to_cpu(pkey)); in srpt_cm_req_recv()
2171 nexus = srpt_get_nexus(sport, req->initiator_port_id, in srpt_cm_req_recv()
2194 if (!sport->enabled) { in srpt_cm_req_recv()
2197 dev_name(&sport->sdev->device->dev), port_num); in srpt_cm_req_recv()
2223 ch->sport = sport; in srpt_cm_req_recv()
2241 ch->max_rsp_size = ch->sport->port_attrib.srp_max_rsp_size; in srpt_cm_req_recv()
2249 srpt_alloc_ioctx_ring(ch->sport->sdev, ch->rq_size, in srpt_cm_req_recv()
2284 srpt_alloc_ioctx_ring(ch->sport->sdev, ch->rq_size, in srpt_cm_req_recv()
2317 mutex_lock(&sport->port_guid_id.mutex); in srpt_cm_req_recv()
2318 list_for_each_entry(stpg, &sport->port_guid_id.tpg_list, entry) { in srpt_cm_req_recv()
2325 mutex_unlock(&sport->port_guid_id.mutex); in srpt_cm_req_recv()
2327 mutex_lock(&sport->port_gid_id.mutex); in srpt_cm_req_recv()
2328 list_for_each_entry(stpg, &sport->port_gid_id.tpg_list, entry) { in srpt_cm_req_recv()
2341 mutex_unlock(&sport->port_gid_id.mutex); in srpt_cm_req_recv()
2359 atomic_inc(&sport->refcount); in srpt_cm_req_recv()
2361 mutex_lock(&sport->mutex); in srpt_cm_req_recv()
2379 if (!sport->enabled) { in srpt_cm_req_recv()
2384 mutex_unlock(&sport->mutex); in srpt_cm_req_recv()
2389 mutex_unlock(&sport->mutex); in srpt_cm_req_recv()
2438 mutex_lock(&sport->mutex); in srpt_cm_req_recv()
2439 if (sport->enabled && ch->state == CH_CONNECTING) { in srpt_cm_req_recv()
2447 mutex_unlock(&sport->mutex); in srpt_cm_req_recv()
2468 ch->sport->sdev, ch->rq_size, in srpt_cm_req_recv()
2476 ch->sport->sdev, ch->rq_size, in srpt_cm_req_recv()
2766 first_wr = rdma_rw_ctx_wrs(&ctx->rw, ch->qp, ch->sport->port, in srpt_write_pending()
2808 struct srpt_device *sdev = ch->sport->sdev; in srpt_queue_response()
2841 ch->sport->port, NULL, first_wr); in srpt_queue_response()
2937 struct srpt_port *sport = container_of(work, struct srpt_port, work); in srpt_refresh_port_work() local
2939 srpt_refresh_port(sport); in srpt_refresh_port_work()
2946 static int srpt_release_sport(struct srpt_port *sport) in srpt_release_sport() argument
2954 sport->freed_channels = &c; in srpt_release_sport()
2956 mutex_lock(&sport->mutex); in srpt_release_sport()
2957 srpt_set_enabled(sport, false); in srpt_release_sport()
2958 mutex_unlock(&sport->mutex); in srpt_release_sport()
2960 while (atomic_read(&sport->refcount) > 0 && in srpt_release_sport()
2963 dev_name(&sport->sdev->device->dev), sport->port, in srpt_release_sport()
2964 atomic_read(&sport->refcount)); in srpt_release_sport()
2966 list_for_each_entry(nexus, &sport->nexus_list, entry) { in srpt_release_sport()
2976 mutex_lock(&sport->mutex); in srpt_release_sport()
2977 list_for_each_entry_safe(nexus, next_n, &sport->nexus_list, entry) { in srpt_release_sport()
2981 mutex_unlock(&sport->mutex); in srpt_release_sport()
2990 struct srpt_port *sport; in __srpt_lookup_wwn() local
2999 sport = &sdev->port[i]; in __srpt_lookup_wwn()
3001 if (strcmp(sport->port_guid_id.name, name) == 0) in __srpt_lookup_wwn()
3002 return &sport->port_guid_id.wwn; in __srpt_lookup_wwn()
3003 if (strcmp(sport->port_gid_id.name, name) == 0) in __srpt_lookup_wwn()
3004 return &sport->port_gid_id.wwn; in __srpt_lookup_wwn()
3111 struct srpt_port *sport; in srpt_add_one() local
3175 sport = &sdev->port[i - 1]; in srpt_add_one()
3176 INIT_LIST_HEAD(&sport->nexus_list); in srpt_add_one()
3177 mutex_init(&sport->mutex); in srpt_add_one()
3178 sport->sdev = sdev; in srpt_add_one()
3179 sport->port = i; in srpt_add_one()
3180 sport->port_attrib.srp_max_rdma_size = DEFAULT_MAX_RDMA_SIZE; in srpt_add_one()
3181 sport->port_attrib.srp_max_rsp_size = DEFAULT_MAX_RSP_SIZE; in srpt_add_one()
3182 sport->port_attrib.srp_sq_size = DEF_SRPT_SQ_SIZE; in srpt_add_one()
3183 sport->port_attrib.use_srq = false; in srpt_add_one()
3184 INIT_WORK(&sport->work, srpt_refresh_port_work); in srpt_add_one()
3185 mutex_init(&sport->port_guid_id.mutex); in srpt_add_one()
3186 INIT_LIST_HEAD(&sport->port_guid_id.tpg_list); in srpt_add_one()
3187 mutex_init(&sport->port_gid_id.mutex); in srpt_add_one()
3188 INIT_LIST_HEAD(&sport->port_gid_id.tpg_list); in srpt_add_one()
3190 ret = srpt_refresh_port(sport); in srpt_add_one()
3287 struct srpt_port *sport = wwn->priv; in srpt_wwn_to_sport_id() local
3289 if (wwn == &sport->port_guid_id.wwn) in srpt_wwn_to_sport_id()
3290 return &sport->port_guid_id; in srpt_wwn_to_sport_id()
3291 if (wwn == &sport->port_gid_id.wwn) in srpt_wwn_to_sport_id()
3292 return &sport->port_gid_id; in srpt_wwn_to_sport_id()
3327 srpt_post_recv(ch->sport->sdev, ch, recv_ioctx); in srpt_release_cmd()
3454 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_max_rdma_size_show() local
3456 return sysfs_emit(page, "%u\n", sport->port_attrib.srp_max_rdma_size); in srpt_tpg_attrib_srp_max_rdma_size_show()
3463 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_max_rdma_size_store() local
3482 sport->port_attrib.srp_max_rdma_size = val; in srpt_tpg_attrib_srp_max_rdma_size_store()
3491 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_max_rsp_size_show() local
3493 return sysfs_emit(page, "%u\n", sport->port_attrib.srp_max_rsp_size); in srpt_tpg_attrib_srp_max_rsp_size_show()
3500 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_max_rsp_size_store() local
3519 sport->port_attrib.srp_max_rsp_size = val; in srpt_tpg_attrib_srp_max_rsp_size_store()
3528 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_sq_size_show() local
3530 return sysfs_emit(page, "%u\n", sport->port_attrib.srp_sq_size); in srpt_tpg_attrib_srp_sq_size_show()
3537 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_sq_size_store() local
3556 sport->port_attrib.srp_sq_size = val; in srpt_tpg_attrib_srp_sq_size_store()
3565 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_use_srq_show() local
3567 return sysfs_emit(page, "%d\n", sport->port_attrib.use_srq); in srpt_tpg_attrib_use_srq_show()
3574 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_use_srq_store() local
3575 struct srpt_device *sdev = sport->sdev; in srpt_tpg_attrib_use_srq_store()
3589 ret = mutex_lock_interruptible(&sport->mutex); in srpt_tpg_attrib_use_srq_store()
3592 enabled = sport->enabled; in srpt_tpg_attrib_use_srq_store()
3594 srpt_set_enabled(sport, false); in srpt_tpg_attrib_use_srq_store()
3595 sport->port_attrib.use_srq = val; in srpt_tpg_attrib_use_srq_store()
3596 srpt_use_srq(sdev, sport->port_attrib.use_srq); in srpt_tpg_attrib_use_srq_store()
3597 srpt_set_enabled(sport, enabled); in srpt_tpg_attrib_use_srq_store()
3599 mutex_unlock(&sport->mutex); in srpt_tpg_attrib_use_srq_store()
3710 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_enable_tpg() local
3712 mutex_lock(&sport->mutex); in srpt_enable_tpg()
3713 srpt_set_enabled(sport, enable); in srpt_enable_tpg()
3714 mutex_unlock(&sport->mutex); in srpt_enable_tpg()
3756 struct srpt_port *sport = srpt_tpg_to_sport(tpg); in srpt_drop_tpg() local
3762 sport->enabled = false; in srpt_drop_tpg()