Lines Matching full:domain
34 * Handles the domain object callback from the HW.
38 @defgroup domain_sm Domain State Machine: States
46 #define domain_sm_trace(domain) \ argument
48 if (OCS_LOG_ENABLE_DOMAIN_SM_TRACE(domain->ocs)) \
49 ocs_log_info(domain->ocs, "[domain] %-20s %-20s\n", __func__, ocs_sm_event_name(evt)); \
52 #define domain_trace(domain, fmt, ...) \ argument
54 if (OCS_LOG_ENABLE_DOMAIN_SM_TRACE(domain ? domain->ocs : NULL)) \
55 ocs_log_info(domain ? domain->ocs : NULL, fmt, ##__VA_ARGS__); \
58 #define domain_printf(domain, fmt, ...) \ argument
60 ocs_log_info(domain ? domain->ocs : NULL, fmt, ##__VA_ARGS__); \
63 void ocs_mgmt_domain_list(ocs_textbuf_t *textbuf, void *domain);
64 void ocs_mgmt_domain_get_all(ocs_textbuf_t *textbuf, void *domain);
65 int ocs_mgmt_domain_get(ocs_textbuf_t *textbuf, char *parent, char *name, void *domain);
66 int ocs_mgmt_domain_set(char *parent, char *name, char *value, void *domain);
68 void *arg_out, uint32_t arg_out_length, void *domain);
79 * @brief Accept domain callback events from the HW.
82 * HW calls this function with various domain-related events.
85 * @param event Domain event.
95 ocs_domain_t *domain = NULL; in ocs_domain_cb() local
101 domain = data; in ocs_domain_cb()
113 /* lookup domain, or allocate a new one if one doesn't exist already */ in ocs_domain_cb()
114 domain = ocs_domain_find(ocs, fcf_wwn); in ocs_domain_cb()
115 if (domain == NULL) { in ocs_domain_cb()
116 domain = ocs_domain_alloc(ocs, fcf_wwn); in ocs_domain_cb()
117 if (domain == NULL) { in ocs_domain_cb()
122 ocs_sm_transition(&domain->drvsm, __ocs_domain_init, NULL); in ocs_domain_cb()
124 ocs_domain_post_event(domain, OCS_EVT_DOMAIN_FOUND, drec); in ocs_domain_cb()
129 domain_trace(domain, "OCS_HW_DOMAIN_LOST:\n"); in ocs_domain_cb()
130 ocs_domain_hold_frames(domain); in ocs_domain_cb()
131 ocs_domain_post_event(domain, OCS_EVT_DOMAIN_LOST, NULL); in ocs_domain_cb()
135 domain_trace(domain, "OCS_HW_DOMAIN_ALLOC_OK:\n"); in ocs_domain_cb()
136 domain->instance_index = 0; in ocs_domain_cb()
137 ocs_domain_post_event(domain, OCS_EVT_DOMAIN_ALLOC_OK, NULL); in ocs_domain_cb()
142 domain_trace(domain, "OCS_HW_DOMAIN_ALLOC_FAIL:\n"); in ocs_domain_cb()
143 ocs_domain_post_event(domain, OCS_EVT_DOMAIN_ALLOC_FAIL, NULL); in ocs_domain_cb()
147 domain_trace(domain, "OCS_HW_DOMAIN_ATTACH_OK:\n"); in ocs_domain_cb()
148 ocs_domain_post_event(domain, OCS_EVT_DOMAIN_ATTACH_OK, NULL); in ocs_domain_cb()
152 domain_trace(domain, "OCS_HW_DOMAIN_ATTACH_FAIL:\n"); in ocs_domain_cb()
153 ocs_domain_post_event(domain, OCS_EVT_DOMAIN_ATTACH_FAIL, NULL); in ocs_domain_cb()
157 domain_trace(domain, "OCS_HW_DOMAIN_FREE_OK:\n"); in ocs_domain_cb()
158 ocs_domain_post_event(domain, OCS_EVT_DOMAIN_FREE_OK, NULL); in ocs_domain_cb()
162 domain_trace(domain, "OCS_HW_DOMAIN_FREE_FAIL:\n"); in ocs_domain_cb()
163 ocs_domain_post_event(domain, OCS_EVT_DOMAIN_FREE_FAIL, NULL); in ocs_domain_cb()
174 * @brief Find the domain, given its FCF_WWN.
177 * Search the domain_list to find a matching domain object.
182 * @return Returns the pointer to the domain if found; or NULL otherwise.
188 ocs_domain_t *domain = NULL; in ocs_domain_find() local
190 /* Check to see if this domain is already allocated */ in ocs_domain_find()
192 ocs_list_foreach(&ocs->domain_list, domain) { in ocs_domain_find()
193 if (fcf_wwn == domain->fcf_wwn) { in ocs_domain_find()
198 return domain; in ocs_domain_find()
202 * @brief Allocate a domain object.
205 * A domain object is allocated and initialized. It is associated with the
209 * @param fcf_wwn FCF WWN of the domain.
217 ocs_domain_t *domain; in ocs_domain_alloc() local
221 domain = ocs_malloc(ocs, sizeof(*domain), OCS_M_NOWAIT | OCS_M_ZERO); in ocs_domain_alloc()
222 if (domain) { in ocs_domain_alloc()
223 domain->ocs = ocs; in ocs_domain_alloc()
224 domain->instance_index = ocs->domain_instance_count++; in ocs_domain_alloc()
225 domain->drvsm.app = domain; in ocs_domain_alloc()
226 ocs_domain_lock_init(domain); in ocs_domain_alloc()
227 ocs_lock_init(ocs, &domain->lookup_lock, "Domain lookup[%d]", domain->instance_index); in ocs_domain_alloc()
230 domain->lookup = spv_new(ocs); in ocs_domain_alloc()
231 if (domain->lookup == NULL) { in ocs_domain_alloc()
233 ocs_free(ocs, domain, sizeof(*domain)); in ocs_domain_alloc()
237 ocs_list_init(&domain->sport_list, ocs_sport_t, link); in ocs_domain_alloc()
238 domain->fcf_wwn = fcf_wwn; in ocs_domain_alloc()
239 ocs_log_debug(ocs, "Domain allocated: wwn %016" PRIX64 "\n", domain->fcf_wwn); in ocs_domain_alloc()
240 domain->femul_enable = (ocs->ctrlmask & OCS_CTRLMASK_ENABLE_FABRIC_EMULATION) != 0; in ocs_domain_alloc()
243 /* if this is the first domain, then assign it as the "root" domain */ in ocs_domain_alloc()
245 ocs->domain = domain; in ocs_domain_alloc()
247 ocs_list_add_tail(&ocs->domain_list, domain); in ocs_domain_alloc()
250 domain->mgmt_functions = &domain_mgmt_functions; in ocs_domain_alloc()
252 ocs_log_err(ocs, "domain allocation failed\n"); in ocs_domain_alloc()
255 return domain; in ocs_domain_alloc()
259 * @brief Free a domain object.
262 * The domain object is freed.
264 * @param domain Domain object to free.
270 ocs_domain_free(ocs_domain_t *domain) in ocs_domain_free() argument
274 ocs_assert(domain); in ocs_domain_free()
275 ocs_assert(domain->ocs); in ocs_domain_free()
277 /* Hold frames to clear the domain pointer from the xport lookup */ in ocs_domain_free()
278 ocs_domain_hold_frames(domain); in ocs_domain_free()
280 ocs = domain->ocs; in ocs_domain_free()
282 ocs_log_debug(ocs, "Domain free: wwn %016" PRIX64 "\n", domain->fcf_wwn); in ocs_domain_free()
284 spv_del(domain->lookup); in ocs_domain_free()
285 domain->lookup = NULL; in ocs_domain_free()
288 ocs_list_remove(&ocs->domain_list, domain); in ocs_domain_free()
289 if (domain == ocs->domain) { in ocs_domain_free()
290 /* set global domain to the new head */ in ocs_domain_free()
291 ocs->domain = ocs_list_get_head(&ocs->domain_list); in ocs_domain_free()
292 if (ocs->domain) { in ocs_domain_free()
293 ocs_log_debug(ocs, "setting new domain, old=%p new=%p\n", in ocs_domain_free()
294 domain, ocs->domain); in ocs_domain_free()
303 ocs_lock_free(&domain->lookup_lock); in ocs_domain_free()
305 ocs_free(ocs, domain, sizeof(*domain)); in ocs_domain_free()
309 * @brief Free memory resources of a domain object.
312 * After the domain object is freed, its child objects are also freed.
314 * @param domain Pointer to a domain object.
320 ocs_domain_force_free(ocs_domain_t *domain) in ocs_domain_force_free() argument
325 /* Shutdown domain sm */ in ocs_domain_force_free()
326 ocs_sm_disable(&domain->drvsm); in ocs_domain_force_free()
328 ocs_scsi_notify_domain_force_free(domain); in ocs_domain_force_free()
330 ocs_domain_lock(domain); in ocs_domain_force_free()
331 ocs_list_foreach_safe(&domain->sport_list, sport, next) { in ocs_domain_force_free()
334 ocs_domain_unlock(domain); in ocs_domain_force_free()
335 ocs_hw_domain_force_free(&domain->ocs->hw, domain); in ocs_domain_force_free()
336 ocs_domain_free(domain); in ocs_domain_force_free()
365 * @brief Return a pointer to the domain, given the instance index.
368 * A pointer to the domain context, given by the index, is returned.
373 * @return Returns a pointer to the domain; or NULL.
379 ocs_domain_t *domain = NULL; in ocs_domain_get_instance() local
386 ocs_list_foreach(&ocs->domain_list, domain) { in ocs_domain_get_instance()
387 if (domain->instance_index == index) { in ocs_domain_get_instance()
392 return domain; in ocs_domain_get_instance()
397 * @brief Domain state machine: Common event handler.
400 * Common/shared events are handled here for the domain state machine.
403 * @param ctx Domain state machine context.
413 ocs_domain_t *domain = ctx->app; in __ocs_domain_common() local
423 ocs_log_warn(domain->ocs, "%-20s %-20s not handled\n", funcname, ocs_sm_event_name(evt)); in __ocs_domain_common()
432 * @brief Domain state machine: Common shutdown.
448 ocs_domain_t *domain = ctx->app; in __ocs_domain_common_shutdown() local
458 ocs_memcpy(&domain->pending_drec, arg, sizeof(domain->pending_drec)); in __ocs_domain_common_shutdown()
459 domain->domain_found_pending = TRUE; in __ocs_domain_common_shutdown()
464 domain->domain_found_pending = FALSE; in __ocs_domain_common_shutdown()
468 ocs_log_warn(domain->ocs, "%-20s %-20s not handled\n", funcname, ocs_sm_event_name(evt)); in __ocs_domain_common_shutdown()
476 ocs_domain_t *domain = NULL; \
481 domain = ctx->app; \
482 ocs_assert(domain->ocs, NULL); \
483 ocs = domain->ocs; \
488 * @brief Domain state machine: Initial state.
491 * The initial state for a domain. Each domain is initialized to
494 * @param ctx Domain state machine context.
506 domain_sm_trace(domain); in __ocs_domain_init()
510 domain->attached = 0; in __ocs_domain_init()
537 sport = ocs_sport_alloc(domain, my_wwpn, my_wwnn, UINT32_MAX, ocs->enable_ini, ocs->enable_tgt); in __ocs_domain_init()
545 /* If domain is ethernet, then fetch the vlan id value */ in __ocs_domain_init()
566 /* initialize domain object */ in __ocs_domain_init()
567 domain->is_loop = drec->is_loop; in __ocs_domain_init()
568 domain->is_fc = drec->is_fc; in __ocs_domain_init()
575 domain->is_nlport = drec->map.loop[1] == 0x00; in __ocs_domain_init()
577 if (domain->is_loop) { in __ocs_domain_init()
579 drec->is_loop ? (domain->is_nlport ? "public-loop" : "loop") : "other", in __ocs_domain_init()
606 /* Initiate HW domain alloc */ in __ocs_domain_init()
607 if (ocs_hw_domain_alloc(&ocs->hw, domain, drec->index, vlan)) { in __ocs_domain_init()
608 ocs_log_err(ocs, "Failed to initiate HW domain allocation\n"); in __ocs_domain_init()
624 * @brief Domain state machine: Wait for the domain allocation to complete.
627 * Waits for the domain state to be allocated. After the HW domain
629 * that process to complete (i.e. a domain-alloc-ok event).
631 * @param ctx Domain state machine context.
644 domain_sm_trace(domain); in __ocs_domain_wait_alloc()
656 sport = domain->sport; in __ocs_domain_wait_alloc()
660 /* Save the domain service parameters */ in __ocs_domain_wait_alloc()
661 ocs_memcpy(domain->service_params + 4, domain->dma.virt, sizeof(fc_plogi_payload_t) - 4); in __ocs_domain_wait_alloc()
662 ocs_memcpy(sport->service_params + 4, domain->dma.virt, sizeof(fc_plogi_payload_t) - 4); in __ocs_domain_wait_alloc()
667 if (domain->femul_enable) { in __ocs_domain_wait_alloc()
668 …ocs_memcpy(domain->flogi_service_params + 4, domain->service_params + 4, sizeof(fc_plogi_payload_t… in __ocs_domain_wait_alloc()
686 if (domain->is_loop && !domain->is_nlport) { in __ocs_domain_wait_alloc()
690 * the domain. Note that this breaks the normal action/transition in __ocs_domain_wait_alloc()
691 * pattern here to avoid a race with the domain attach callback. in __ocs_domain_wait_alloc()
695 __ocs_domain_attach_internal(domain, sport->fc_id); in __ocs_domain_wait_alloc()
717 domain->req_accept_frames = 1; in __ocs_domain_wait_alloc()
726 ocs_log_err(ocs, "%s recv'd waiting for DOMAIN_ALLOC_OK; shutting down domain\n", in __ocs_domain_wait_alloc()
728 domain->req_domain_free = 1; in __ocs_domain_wait_alloc()
751 * @brief Domain state machine: Wait for the domain attach request.
754 * In this state, the domain has been allocated and is waiting for a domain attach request.
771 domain_sm_trace(domain); in __ocs_domain_allocated()
780 ocs_log_debug(ocs, "Requesting hw domain attach fc_id x%x\n", fc_id); in __ocs_domain_allocated()
782 ocs_lock(&domain->lookup_lock); in __ocs_domain_allocated()
783 spv_set(domain->lookup, fc_id, domain->sport); in __ocs_domain_allocated()
784 ocs_unlock(&domain->lookup_lock); in __ocs_domain_allocated()
787 ocs_node_fcid_display(fc_id, domain->sport->display_name, sizeof(domain->sport->display_name)); in __ocs_domain_allocated()
789 /* Issue domain attach call */ in __ocs_domain_allocated()
790 rc = ocs_hw_domain_attach(&ocs->hw, domain, fc_id); in __ocs_domain_allocated()
809 ocs_domain_lock(domain); in __ocs_domain_allocated()
810 if (!ocs_list_empty(&domain->sport_list)) { in __ocs_domain_allocated()
816 ocs_list_foreach_safe(&domain->sport_list, sport, sport_next) { in __ocs_domain_allocated()
819 ocs_domain_unlock(domain); in __ocs_domain_allocated()
821 ocs_domain_unlock(domain); in __ocs_domain_allocated()
822 /* no sports exist, free domain */ in __ocs_domain_allocated()
824 rc = ocs_hw_domain_free(&ocs->hw, domain); in __ocs_domain_allocated()
844 * @brief Domain state machine: Wait for the HW domain attach to complete.
847 * Waits for the HW domain attach to complete. Forwards attach ok event to the
862 domain_sm_trace(domain); in __ocs_domain_wait_attach()
872 domain->attached = 1; in __ocs_domain_wait_attach()
876 ocs_scsi_tgt_new_domain(domain); in __ocs_domain_wait_attach()
878 ocs_scsi_ini_new_domain(domain); in __ocs_domain_wait_attach()
885 domain->req_accept_frames = 1; in __ocs_domain_wait_attach()
886 /* Set domain notify pending state to avoid duplicate domain event post */ in __ocs_domain_wait_attach()
887 domain->domain_notify_pend = 1; in __ocs_domain_wait_attach()
889 /* Notify all nodes that the domain attach request has completed in __ocs_domain_wait_attach()
893 ocs_domain_lock(domain); in __ocs_domain_wait_attach()
894 ocs_list_foreach_safe(&domain->sport_list, sport, next_sport) { in __ocs_domain_wait_attach()
901 ocs_domain_unlock(domain); in __ocs_domain_wait_attach()
902 domain->domain_notify_pend = 0; in __ocs_domain_wait_attach()
917 /* Domain lost while waiting for an attach to complete, go to a state that waits for in __ocs_domain_wait_attach()
918 * the domain attach to complete, then handle domain lost in __ocs_domain_wait_attach()
937 * @brief Domain state machine: Ready state.
940 * This is a domain ready state. It waits for a domain-lost event, and initiates shutdown.
954 domain_sm_trace(domain); in __ocs_domain_ready()
959 if (ocs_vport_start(domain)) { in __ocs_domain_ready()
960 ocs_log_debug(domain->ocs, "ocs_vport_start() did not start all vports\n"); in __ocs_domain_ready()
966 ocs_domain_lock(domain); in __ocs_domain_ready()
967 if (!ocs_list_empty(&domain->sport_list)) { in __ocs_domain_ready()
973 ocs_list_foreach_safe(&domain->sport_list, sport, sport_next) { in __ocs_domain_ready()
976 ocs_domain_unlock(domain); in __ocs_domain_ready()
978 ocs_domain_unlock(domain); in __ocs_domain_ready()
979 /* no sports exist, free domain */ in __ocs_domain_ready()
981 rc = ocs_hw_domain_free(&ocs->hw, domain); in __ocs_domain_ready()
1002 /* Assume that the domain is attached */ in __ocs_domain_ready()
1003 ocs_assert(domain->attached, NULL); in __ocs_domain_ready()
1006 ocs_assert(domain->sport->fc_id == fc_id, NULL); in __ocs_domain_ready()
1020 * @brief Domain state machine: Wait for nodes to free prior to the domain shutdown.
1023 * All nodes are freed, and ready for a domain shutdown.
1037 domain_sm_trace(domain); in __ocs_domain_wait_sports_free()
1047 rc = ocs_hw_domain_free(&ocs->hw, domain); in __ocs_domain_wait_sports_free()
1063 * @brief Domain state machine: Complete the domain shutdown.
1066 * Waits for a HW domain free to complete.
1080 domain_sm_trace(domain); in __ocs_domain_wait_shutdown()
1085 ocs_scsi_ini_del_domain(domain); in __ocs_domain_wait_shutdown()
1087 ocs_scsi_tgt_del_domain(domain); in __ocs_domain_wait_shutdown()
1090 if (domain->domain_found_pending) { in __ocs_domain_wait_shutdown()
1091 /* save fcf_wwn and drec from this domain, free current domain and allocate in __ocs_domain_wait_shutdown()
1095 uint64_t fcf_wwn = domain->fcf_wwn; in __ocs_domain_wait_shutdown()
1096 ocs_domain_record_t drec = domain->pending_drec; in __ocs_domain_wait_shutdown()
1098 ocs_log_debug(ocs, "Reallocating domain\n"); in __ocs_domain_wait_shutdown()
1099 domain->req_domain_free = 1; in __ocs_domain_wait_shutdown()
1100 domain = ocs_domain_alloc(ocs, fcf_wwn); in __ocs_domain_wait_shutdown()
1102 if (domain == NULL) { in __ocs_domain_wait_shutdown()
1108 * got a new domain; at this point, there are at least two domains in __ocs_domain_wait_shutdown()
1109 * once the req_domain_free flag is processed, the associated domain in __ocs_domain_wait_shutdown()
1112 ocs_sm_transition(&domain->drvsm, __ocs_domain_init, NULL); in __ocs_domain_wait_shutdown()
1113 ocs_sm_post_event(&domain->drvsm, OCS_EVT_DOMAIN_FOUND, &drec); in __ocs_domain_wait_shutdown()
1115 domain->req_domain_free = 1; in __ocs_domain_wait_shutdown()
1130 * @brief Domain state machine: Wait for the domain alloc/attach completion
1131 * after receiving a domain lost.
1134 * This state is entered when receiving a domain lost while waiting for a domain alloc
1135 * or a domain attach to complete.
1149 domain_sm_trace(domain); in __ocs_domain_wait_domain_lost()
1155 ocs_domain_lock(domain); in __ocs_domain_wait_domain_lost()
1156 if (!ocs_list_empty(&domain->sport_list)) { in __ocs_domain_wait_domain_lost()
1162 ocs_list_foreach_safe(&domain->sport_list, sport, sport_next) { in __ocs_domain_wait_domain_lost()
1165 ocs_domain_unlock(domain); in __ocs_domain_wait_domain_lost()
1167 ocs_domain_unlock(domain); in __ocs_domain_wait_domain_lost()
1168 /* no sports exist, free domain */ in __ocs_domain_wait_domain_lost()
1170 rc = ocs_hw_domain_free(&ocs->hw, domain); in __ocs_domain_wait_domain_lost()
1180 ocs_log_err(ocs, "[domain] %-20s: failed\n", ocs_sm_event_name(evt)); in __ocs_domain_wait_domain_lost()
1196 * Service parameters from the fabric FLOGI are saved in the domain's
1199 * @param domain Pointer to the domain.
1206 ocs_domain_save_sparms(ocs_domain_t *domain, void *payload) in ocs_domain_save_sparms() argument
1208 ocs_memcpy(domain->flogi_service_params, payload, sizeof (fc_plogi_payload_t)); in ocs_domain_save_sparms()
1211 * @brief Initiator domain attach. (internal call only)
1213 * Assumes that the domain SM lock is already locked
1216 * The HW domain attach function is started.
1218 * @param domain Pointer to the domain object.
1219 * @param s_id FC_ID of which to register this domain.
1225 __ocs_domain_attach_internal(ocs_domain_t *domain, uint32_t s_id) in __ocs_domain_attach_internal() argument
1227 …ocs_memcpy(domain->dma.virt, ((uint8_t*)domain->flogi_service_params)+4, sizeof (fc_plogi_payload_… in __ocs_domain_attach_internal()
1228 (void)ocs_sm_post_event(&domain->drvsm, OCS_EVT_DOMAIN_REQ_ATTACH, &s_id); in __ocs_domain_attach_internal()
1232 * @brief Initiator domain attach.
1235 * The HW domain attach function is started.
1237 * @param domain Pointer to the domain object.
1238 * @param s_id FC_ID of which to register this domain.
1244 ocs_domain_attach(ocs_domain_t *domain, uint32_t s_id) in ocs_domain_attach() argument
1246 __ocs_domain_attach_internal(domain, s_id); in ocs_domain_attach()
1250 ocs_domain_post_event(ocs_domain_t *domain, ocs_sm_event_t event, void *arg) in ocs_domain_post_event() argument
1256 rc = ocs_sm_post_event(&domain->drvsm, event, arg); in ocs_domain_post_event()
1258 req_domain_free = domain->req_domain_free; in ocs_domain_post_event()
1259 domain->req_domain_free = 0; in ocs_domain_post_event()
1261 accept_frames = domain->req_accept_frames; in ocs_domain_post_event()
1262 domain->req_accept_frames = 0; in ocs_domain_post_event()
1265 ocs_domain_accept_frames(domain); in ocs_domain_post_event()
1269 ocs_domain_free(domain); in ocs_domain_post_event()
1304 * @brief Generate a domain ddump.
1307 * Generates a domain ddump.
1310 * @param domain Pointer to the domain context.
1316 ocs_ddump_domain(ocs_textbuf_t *textbuf, ocs_domain_t *domain) in ocs_ddump_domain() argument
1321 ocs_ddump_section(textbuf, "domain", domain->instance_index); in ocs_ddump_domain()
1322 ocs_ddump_value(textbuf, "display_name", "%s", domain->display_name); in ocs_ddump_domain()
1324 ocs_ddump_value(textbuf, "fcf", "%#x", domain->fcf); in ocs_ddump_domain()
1325 ocs_ddump_value(textbuf, "fcf_indicator", "%#x", domain->fcf_indicator); in ocs_ddump_domain()
1326 ocs_ddump_value(textbuf, "vlan_id", "%#x", domain->vlan_id); in ocs_ddump_domain()
1327 ocs_ddump_value(textbuf, "indicator", "%#x", domain->indicator); in ocs_ddump_domain()
1328 ocs_ddump_value(textbuf, "attached", "%d", domain->attached); in ocs_ddump_domain()
1329 ocs_ddump_value(textbuf, "is_loop", "%d", domain->is_loop); in ocs_ddump_domain()
1330 ocs_ddump_value(textbuf, "is_nlport", "%d", domain->is_nlport); in ocs_ddump_domain()
1332 ocs_scsi_ini_ddump(textbuf, OCS_SCSI_DDUMP_DOMAIN, domain); in ocs_ddump_domain()
1333 ocs_scsi_tgt_ddump(textbuf, OCS_SCSI_DDUMP_DOMAIN, domain); in ocs_ddump_domain()
1335 ocs_display_sparams(NULL, "domain_sparms", 1, textbuf, domain->dma.virt); in ocs_ddump_domain()
1337 if (ocs_domain_lock_try(domain) != TRUE) { in ocs_ddump_domain()
1341 ocs_list_foreach(&domain->sport_list, sport) { in ocs_ddump_domain()
1349 ocs_ddump_ns(textbuf, domain->ocs_ns); in ocs_ddump_domain()
1352 ocs_domain_unlock(domain); in ocs_ddump_domain()
1354 ocs_ddump_endsection(textbuf, "domain", domain->instance_index); in ocs_ddump_domain()
1363 ocs_domain_t *domain = (ocs_domain_t *)object; in ocs_mgmt_domain_list() local
1365 ocs_mgmt_start_section(textbuf, "domain", domain->instance_index); in ocs_mgmt_domain_list()
1380 if (ocs_domain_lock_try(domain) == TRUE) { in ocs_mgmt_domain_list()
1381 /* If we get here, then we are holding the domain lock */ in ocs_mgmt_domain_list()
1382 ocs_list_foreach(&domain->sport_list, sport) { in ocs_mgmt_domain_list()
1387 ocs_domain_unlock(domain); in ocs_mgmt_domain_list()
1390 ocs_mgmt_end_section(textbuf, "domain", domain->instance_index); in ocs_mgmt_domain_list()
1397 ocs_domain_t *domain = (ocs_domain_t *)object; in ocs_mgmt_domain_get() local
1401 ocs_mgmt_start_section(textbuf, "domain", domain->instance_index); in ocs_mgmt_domain_get()
1403 snprintf(qualifier, sizeof(qualifier), "%s/domain[%d]", parent, domain->instance_index); in ocs_mgmt_domain_get()
1411 ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "display_name", domain->display_name); in ocs_mgmt_domain_get()
1414 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "fcf", "%#x", domain->fcf); in ocs_mgmt_domain_get()
1417 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "fcf_indicator", "%#x", domain->fcf_indicator); in ocs_mgmt_domain_get()
1420 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "vlan_id", "%#x", domain->vlan_id); in ocs_mgmt_domain_get()
1423 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "indicator", "%#x", domain->indicator); in ocs_mgmt_domain_get()
1426 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "attached", domain->attached); in ocs_mgmt_domain_get()
1429 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "is_loop", domain->is_loop); in ocs_mgmt_domain_get()
1432 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "is_nlport", domain->is_nlport); in ocs_mgmt_domain_get()
1435 ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "display_name", domain->display_name); in ocs_mgmt_domain_get()
1439 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RW, "femul_enable", "%d", domain->femul_enable); in ocs_mgmt_domain_get()
1443 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "num_sports", "%d", domain->sport_instance_count); in ocs_mgmt_domain_get()
1448 ocs_domain_lock(domain); in ocs_mgmt_domain_get()
1449 ocs_list_foreach(&domain->sport_list, sport) { in ocs_mgmt_domain_get()
1458 ocs_domain_unlock(domain); in ocs_mgmt_domain_get()
1462 ocs_mgmt_end_section(textbuf, "domain", domain->instance_index); in ocs_mgmt_domain_get()
1470 ocs_domain_t *domain = (ocs_domain_t *)object; in ocs_mgmt_domain_get_all() local
1472 ocs_mgmt_start_section(textbuf, "domain", domain->instance_index); in ocs_mgmt_domain_get_all()
1474 ocs_mgmt_emit_string(textbuf, MGMT_MODE_RD, "display_name", domain->display_name); in ocs_mgmt_domain_get_all()
1475 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "fcf", "%#x", domain->fcf); in ocs_mgmt_domain_get_all()
1476 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "fcf_indicator", "%#x", domain->fcf_indicator); in ocs_mgmt_domain_get_all()
1477 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "vlan_id", "%#x", domain->vlan_id); in ocs_mgmt_domain_get_all()
1478 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "indicator", "%#x", domain->indicator); in ocs_mgmt_domain_get_all()
1479 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "attached", domain->attached); in ocs_mgmt_domain_get_all()
1480 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "is_loop", domain->is_loop); in ocs_mgmt_domain_get_all()
1481 ocs_mgmt_emit_boolean(textbuf, MGMT_MODE_RD, "is_nlport", domain->is_nlport); in ocs_mgmt_domain_get_all()
1483 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RW, "femul_enable", "%d", domain->femul_enable); in ocs_mgmt_domain_get_all()
1485 ocs_mgmt_emit_int(textbuf, MGMT_MODE_RD, "num_sports", "%d", domain->sport_instance_count); in ocs_mgmt_domain_get_all()
1487 ocs_domain_lock(domain); in ocs_mgmt_domain_get_all()
1488 ocs_list_foreach(&domain->sport_list, sport) { in ocs_mgmt_domain_get_all()
1493 ocs_domain_unlock(domain); in ocs_mgmt_domain_get_all()
1495 ocs_mgmt_end_unnumbered_section(textbuf, "domain"); in ocs_mgmt_domain_get_all()
1503 ocs_domain_t *domain = (ocs_domain_t *)object; in ocs_mgmt_domain_set() local
1507 snprintf(qualifier, sizeof(qualifier), "%s/domain[%d]", parent, domain->instance_index); in ocs_mgmt_domain_set()
1517 ocs_domain_lock(domain); in ocs_mgmt_domain_set()
1518 ocs_list_foreach(&domain->sport_list, sport) { in ocs_mgmt_domain_set()
1527 ocs_domain_unlock(domain); in ocs_mgmt_domain_set()
1539 ocs_domain_t *domain = (ocs_domain_t *)object; in ocs_mgmt_domain_exec() local
1543 snprintf(qualifier, sizeof(qualifier), "%s.domain%d", parent, domain->instance_index); in ocs_mgmt_domain_exec()
1549 ocs_domain_lock(domain); in ocs_mgmt_domain_exec()
1550 ocs_list_foreach(&domain->sport_list, sport) { in ocs_mgmt_domain_exec()
1559 ocs_domain_unlock(domain); in ocs_mgmt_domain_exec()