Lines Matching refs:sport
203 struct srpt_port *sport; in srpt_event_handler() local
213 sport = &sdev->port[port_num]; in srpt_event_handler()
214 sport->lid = 0; in srpt_event_handler()
215 sport->sm_lid = 0; in srpt_event_handler()
231 sport = &sdev->port[port_num]; in srpt_event_handler()
232 if (!sport->lid && !sport->sm_lid) in srpt_event_handler()
233 schedule_work(&sport->work); in srpt_event_handler()
383 static void srpt_get_ioc(struct srpt_port *sport, u32 slot, in srpt_get_ioc() argument
386 struct srpt_device *sdev = sport->sdev; in srpt_get_ioc()
425 iocp->rdma_size = cpu_to_be32(min(sport->port_attrib.srp_max_rdma_size, in srpt_get_ioc()
538 struct srpt_port *sport = (struct srpt_port *)mad_agent->context; in srpt_mad_recv_handler() local
570 srpt_mgmt_method_get(sport, mad_wc->recv_buf.mad, dm_mad); in srpt_mad_recv_handler()
615 static int srpt_refresh_port(struct srpt_port *sport) in srpt_refresh_port() argument
623 ret = ib_query_port(sport->sdev->device, sport->port, &port_attr); in srpt_refresh_port()
627 sport->sm_lid = port_attr.sm_lid; in srpt_refresh_port()
628 sport->lid = port_attr.lid; in srpt_refresh_port()
630 ret = rdma_query_gid(sport->sdev->device, sport->port, 0, &sport->gid); in srpt_refresh_port()
634 srpt_format_guid(sport->guid_name, ARRAY_SIZE(sport->guid_name), in srpt_refresh_port()
635 &sport->gid.global.interface_id); in srpt_refresh_port()
636 snprintf(sport->gid_name, ARRAY_SIZE(sport->gid_name), in srpt_refresh_port()
638 be64_to_cpu(sport->gid.global.subnet_prefix), in srpt_refresh_port()
639 be64_to_cpu(sport->gid.global.interface_id)); in srpt_refresh_port()
641 if (rdma_protocol_iwarp(sport->sdev->device, sport->port)) in srpt_refresh_port()
648 ret = ib_modify_port(sport->sdev->device, sport->port, 0, &port_modify); in srpt_refresh_port()
651 dev_name(&sport->sdev->device->dev), sport->port, ret); in srpt_refresh_port()
655 if (!sport->mad_agent) { in srpt_refresh_port()
662 mad_agent = ib_register_mad_agent(sport->sdev->device, in srpt_refresh_port()
663 sport->port, in srpt_refresh_port()
668 sport, 0); in srpt_refresh_port()
671 dev_name(&sport->sdev->device->dev), sport->port, in srpt_refresh_port()
673 sport->mad_agent = NULL; in srpt_refresh_port()
676 ib_modify_port(sport->sdev->device, sport->port, 0, in srpt_refresh_port()
681 sport->mad_agent = mad_agent; in srpt_refresh_port()
699 struct srpt_port *sport; in srpt_unregister_mad_agent() local
703 sport = &sdev->port[i - 1]; in srpt_unregister_mad_agent()
704 WARN_ON(sport->port != i); in srpt_unregister_mad_agent()
705 if (sport->mad_agent) { in srpt_unregister_mad_agent()
707 ib_unregister_mad_agent(sport->mad_agent); in srpt_unregister_mad_agent()
708 sport->mad_agent = NULL; in srpt_unregister_mad_agent()
984 ret = rdma_rw_ctx_init(&ctx->rw, ch->qp, ch->sport->port, in srpt_alloc_rw_ctxs()
1013 rdma_rw_ctx_destroy(&ctx->rw, ch->qp, ch->sport->port, in srpt_alloc_rw_ctxs()
1031 rdma_rw_ctx_destroy(&ctx->rw, ch->qp, ch->sport->port, in srpt_free_rw_ctxs()
1189 attr->port_num = ch->sport->port; in srpt_init_ch_qp()
1191 ret = ib_find_cached_pkey(ch->sport->sdev->device, ch->sport->port, in srpt_init_ch_qp()
1697 ib_dma_sync_single_for_cpu(ch->sport->sdev->device, in srpt_handle_new_iu()
1740 srpt_post_recv(ch->sport->sdev, ch, recv_ioctx); in srpt_handle_new_iu()
1850 struct srpt_port *sport = ch->sport; in srpt_create_ch_ib() local
1851 struct srpt_device *sdev = sport->sdev; in srpt_create_ch_ib()
1853 int sq_size = sport->port_attrib.srp_sq_size; in srpt_create_ch_ib()
1891 qp_init->port_num = ch->sport->port; in srpt_create_ch_ib()
2027 struct srpt_port *sport = ch->sport; in srpt_disconnect_ch_sync() local
2034 mutex_lock(&sport->mutex); in srpt_disconnect_ch_sync()
2036 mutex_unlock(&sport->mutex); in srpt_disconnect_ch_sync()
2044 static void __srpt_close_all_ch(struct srpt_port *sport) in __srpt_close_all_ch() argument
2049 lockdep_assert_held(&sport->mutex); in __srpt_close_all_ch()
2051 list_for_each_entry(nexus, &sport->nexus_list, entry) { in __srpt_close_all_ch()
2056 dev_name(&sport->sdev->device->dev), in __srpt_close_all_ch()
2057 sport->port); in __srpt_close_all_ch()
2067 static struct srpt_nexus *srpt_get_nexus(struct srpt_port *sport, in srpt_get_nexus() argument
2074 mutex_lock(&sport->mutex); in srpt_get_nexus()
2075 list_for_each_entry(n, &sport->nexus_list, entry) { in srpt_get_nexus()
2084 &sport->nexus_list); in srpt_get_nexus()
2087 mutex_unlock(&sport->mutex); in srpt_get_nexus()
2106 static void srpt_set_enabled(struct srpt_port *sport, bool enabled) in srpt_set_enabled() argument
2107 __must_hold(&sport->mutex) in srpt_set_enabled()
2109 lockdep_assert_held(&sport->mutex); in srpt_set_enabled()
2111 if (sport->enabled == enabled) in srpt_set_enabled()
2113 sport->enabled = enabled; in srpt_set_enabled()
2115 __srpt_close_all_ch(sport); in srpt_set_enabled()
2118 static void srpt_drop_sport_ref(struct srpt_port *sport) in srpt_drop_sport_ref() argument
2120 if (atomic_dec_return(&sport->refcount) == 0 && sport->freed_channels) in srpt_drop_sport_ref()
2121 complete(sport->freed_channels); in srpt_drop_sport_ref()
2128 srpt_drop_sport_ref(ch->sport); in srpt_free_ch()
2144 struct srpt_port *sport; in srpt_release_channel_work() local
2150 sdev = ch->sport->sdev; in srpt_release_channel_work()
2167 sport = ch->sport; in srpt_release_channel_work()
2168 mutex_lock(&sport->mutex); in srpt_release_channel_work()
2170 mutex_unlock(&sport->mutex); in srpt_release_channel_work()
2178 ch->sport->sdev, ch->rq_size, in srpt_release_channel_work()
2213 struct srpt_port *sport = &sdev->port[port_num - 1]; in srpt_cm_req_recv() local
2233 port_num, &sport->gid, be16_to_cpu(pkey)); in srpt_cm_req_recv()
2235 nexus = srpt_get_nexus(sport, req->initiator_port_id, in srpt_cm_req_recv()
2258 if (!sport->enabled) { in srpt_cm_req_recv()
2261 dev_name(&sport->sdev->device->dev), port_num); in srpt_cm_req_recv()
2287 ch->sport = sport; in srpt_cm_req_recv()
2305 ch->max_rsp_size = ch->sport->port_attrib.srp_max_rsp_size; in srpt_cm_req_recv()
2312 srpt_alloc_ioctx_ring(ch->sport->sdev, ch->rq_size, in srpt_cm_req_recv()
2346 srpt_alloc_ioctx_ring(ch->sport->sdev, ch->rq_size, in srpt_cm_req_recv()
2379 if (sport->guid_id) { in srpt_cm_req_recv()
2380 mutex_lock(&sport->guid_id->mutex); in srpt_cm_req_recv()
2381 list_for_each_entry(stpg, &sport->guid_id->tpg_list, entry) { in srpt_cm_req_recv()
2388 mutex_unlock(&sport->guid_id->mutex); in srpt_cm_req_recv()
2391 if (sport->gid_id) { in srpt_cm_req_recv()
2392 mutex_lock(&sport->gid_id->mutex); in srpt_cm_req_recv()
2393 list_for_each_entry(stpg, &sport->gid_id->tpg_list, entry) { in srpt_cm_req_recv()
2406 mutex_unlock(&sport->gid_id->mutex); in srpt_cm_req_recv()
2425 atomic_inc(&sport->refcount); in srpt_cm_req_recv()
2427 mutex_lock(&sport->mutex); in srpt_cm_req_recv()
2445 if (!sport->enabled) { in srpt_cm_req_recv()
2450 mutex_unlock(&sport->mutex); in srpt_cm_req_recv()
2455 mutex_unlock(&sport->mutex); in srpt_cm_req_recv()
2504 mutex_lock(&sport->mutex); in srpt_cm_req_recv()
2505 if (sport->enabled && ch->state == CH_CONNECTING) { in srpt_cm_req_recv()
2513 mutex_unlock(&sport->mutex); in srpt_cm_req_recv()
2534 ch->sport->sdev, ch->rq_size, in srpt_cm_req_recv()
2542 ch->sport->sdev, ch->rq_size, in srpt_cm_req_recv()
2832 first_wr = rdma_rw_ctx_wrs(&ctx->rw, ch->qp, ch->sport->port, in srpt_write_pending()
2874 struct srpt_device *sdev = ch->sport->sdev; in srpt_queue_response()
2907 ch->sport->port, NULL, first_wr); in srpt_queue_response()
3003 struct srpt_port *sport = container_of(work, struct srpt_port, work); in srpt_refresh_port_work() local
3005 srpt_refresh_port(sport); in srpt_refresh_port_work()
3012 static int srpt_release_sport(struct srpt_port *sport) in srpt_release_sport() argument
3020 sport->freed_channels = &c; in srpt_release_sport()
3022 mutex_lock(&sport->mutex); in srpt_release_sport()
3023 srpt_set_enabled(sport, false); in srpt_release_sport()
3024 mutex_unlock(&sport->mutex); in srpt_release_sport()
3026 while (atomic_read(&sport->refcount) > 0 && in srpt_release_sport()
3029 dev_name(&sport->sdev->device->dev), sport->port, in srpt_release_sport()
3030 atomic_read(&sport->refcount)); in srpt_release_sport()
3032 list_for_each_entry(nexus, &sport->nexus_list, entry) { in srpt_release_sport()
3042 mutex_lock(&sport->mutex); in srpt_release_sport()
3043 list_for_each_entry_safe(nexus, next_n, &sport->nexus_list, entry) { in srpt_release_sport()
3047 mutex_unlock(&sport->mutex); in srpt_release_sport()
3053 struct srpt_port *sport; member
3061 struct srpt_port *sport; in __srpt_lookup_port() local
3070 sport = &sdev->port[i]; in __srpt_lookup_port()
3072 if (strcmp(sport->guid_name, name) == 0) { in __srpt_lookup_port()
3075 sport, &sport->guid_id}; in __srpt_lookup_port()
3077 if (strcmp(sport->gid_name, name) == 0) { in __srpt_lookup_port()
3080 sport, &sport->gid_id}; in __srpt_lookup_port()
3206 struct srpt_port *sport; in srpt_add_one() local
3270 sport = &sdev->port[i - 1]; in srpt_add_one()
3271 INIT_LIST_HEAD(&sport->nexus_list); in srpt_add_one()
3272 mutex_init(&sport->mutex); in srpt_add_one()
3273 sport->sdev = sdev; in srpt_add_one()
3274 sport->port = i; in srpt_add_one()
3275 sport->port_attrib.srp_max_rdma_size = DEFAULT_MAX_RDMA_SIZE; in srpt_add_one()
3276 sport->port_attrib.srp_max_rsp_size = DEFAULT_MAX_RSP_SIZE; in srpt_add_one()
3277 sport->port_attrib.srp_sq_size = DEF_SRPT_SQ_SIZE; in srpt_add_one()
3278 sport->port_attrib.use_srq = false; in srpt_add_one()
3279 INIT_WORK(&sport->work, srpt_refresh_port_work); in srpt_add_one()
3281 ret = srpt_refresh_port(sport); in srpt_add_one()
3373 struct srpt_port *sport = wwn->priv; in srpt_wwn_to_sport_id() local
3375 if (sport->guid_id && &sport->guid_id->wwn == wwn) in srpt_wwn_to_sport_id()
3376 return sport->guid_id; in srpt_wwn_to_sport_id()
3377 if (sport->gid_id && &sport->gid_id->wwn == wwn) in srpt_wwn_to_sport_id()
3378 return sport->gid_id; in srpt_wwn_to_sport_id()
3408 srpt_post_recv(ch->sport->sdev, ch, recv_ioctx); in srpt_release_cmd()
3517 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_max_rdma_size_show() local
3519 return sysfs_emit(page, "%u\n", sport->port_attrib.srp_max_rdma_size); in srpt_tpg_attrib_srp_max_rdma_size_show()
3526 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_max_rdma_size_store() local
3545 sport->port_attrib.srp_max_rdma_size = val; in srpt_tpg_attrib_srp_max_rdma_size_store()
3554 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_max_rsp_size_show() local
3556 return sysfs_emit(page, "%u\n", sport->port_attrib.srp_max_rsp_size); in srpt_tpg_attrib_srp_max_rsp_size_show()
3563 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_max_rsp_size_store() local
3582 sport->port_attrib.srp_max_rsp_size = val; in srpt_tpg_attrib_srp_max_rsp_size_store()
3591 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_sq_size_show() local
3593 return sysfs_emit(page, "%u\n", sport->port_attrib.srp_sq_size); in srpt_tpg_attrib_srp_sq_size_show()
3600 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_srp_sq_size_store() local
3619 sport->port_attrib.srp_sq_size = val; in srpt_tpg_attrib_srp_sq_size_store()
3628 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_use_srq_show() local
3630 return sysfs_emit(page, "%d\n", sport->port_attrib.use_srq); in srpt_tpg_attrib_use_srq_show()
3637 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_tpg_attrib_use_srq_store() local
3638 struct srpt_device *sdev = sport->sdev; in srpt_tpg_attrib_use_srq_store()
3652 ret = mutex_lock_interruptible(&sport->mutex); in srpt_tpg_attrib_use_srq_store()
3655 enabled = sport->enabled; in srpt_tpg_attrib_use_srq_store()
3657 srpt_set_enabled(sport, false); in srpt_tpg_attrib_use_srq_store()
3658 sport->port_attrib.use_srq = val; in srpt_tpg_attrib_use_srq_store()
3659 srpt_use_srq(sdev, sport->port_attrib.use_srq); in srpt_tpg_attrib_use_srq_store()
3660 srpt_set_enabled(sport, enabled); in srpt_tpg_attrib_use_srq_store()
3662 mutex_unlock(&sport->mutex); in srpt_tpg_attrib_use_srq_store()
3773 struct srpt_port *sport = srpt_tpg_to_sport(se_tpg); in srpt_enable_tpg() local
3775 mutex_lock(&sport->mutex); in srpt_enable_tpg()
3776 srpt_set_enabled(sport, enable); in srpt_enable_tpg()
3777 mutex_unlock(&sport->mutex); in srpt_enable_tpg()
3819 struct srpt_port *sport = srpt_tpg_to_sport(tpg); in srpt_drop_tpg() local
3825 sport->enabled = false; in srpt_drop_tpg()
3841 struct srpt_port *sport = papi.sport; in srpt_make_tport() local
3853 srpt_sdev_put(sport->sdev); in srpt_make_tport()
3858 port_id->wwn.priv = sport; in srpt_make_tport()
3859 memcpy(port_id->name, port_id == sport->guid_id ? sport->guid_name : in srpt_make_tport()
3860 sport->gid_name, ARRAY_SIZE(port_id->name)); in srpt_make_tport()
3874 struct srpt_port *sport = wwn->priv; in srpt_drop_tport() local
3876 if (sport->guid_id == port_id) in srpt_drop_tport()
3877 sport->guid_id = NULL; in srpt_drop_tport()
3878 else if (sport->gid_id == port_id) in srpt_drop_tport()
3879 sport->gid_id = NULL; in srpt_drop_tport()
3883 srpt_sdev_put(sport->sdev); in srpt_drop_tport()