Lines Matching defs:ihp

137 static void iscsi_override_target_default(iscsi_hba_t *ihp,
149 static boolean_t iscsi_cmp_boot_sess_oid(iscsi_hba_t *ihp, uint32_t oid);
152 static boolean_t iscsi_enter_service_zone(iscsi_hba_t *ihp, uint32_t status);
153 static void iscsi_exit_service_zone(iscsi_hba_t *ihp, uint32_t status);
154 static void iscsi_check_miniroot(iscsi_hba_t *ihp);
370 iscsi_hba_t *ihp = NULL;
389 if ((ihp = (iscsi_hba_t *)ddi_get_soft_state(
398 mutex_init(&ihp->hba_discovery_events_mutex, NULL,
402 rval = ldi_ident_from_dip(dip, &ihp->hba_li);
406 mutex_init(&ihp->hba_service_lock, NULL,
408 cv_init(&ihp->hba_service_cv, NULL, CV_DRIVER, NULL);
414 sema_init(&ihp->hba_sendtgts_semaphore, 1, NULL,
417 ihp->hba_sess_list = NULL;
418 rw_init(&ihp->hba_sess_list_rwlock, NULL,
429 ihp->hba_sig = ISCSI_SIG_HBA;
430 ihp->hba_tran = tran;
431 ihp->hba_dip = dip;
433 ihp->hba_service_status =
435 ihp->hba_service_status_overwrite = B_FALSE;
437 ihp->hba_service_status =
439 ihp->hba_service_status_overwrite = B_TRUE;
441 ihp->hba_service_client_count = 0;
444 ihp->hba_oid = iscsi_oid++;
447 ihp->hba_name[0] = '\0';
448 ihp->hba_name_length = 0;
449 ihp->hba_alias_length = 0;
450 ihp->hba_alias[0] = '\0';
453 DDI_DEV_T_ANY, ihp->hba_dip, 0, "so-rcvbuf",
457 DDI_DEV_T_ANY, ihp->hba_dip, 0, "so-sndbuf",
461 DDI_DEV_T_ANY, ihp->hba_dip, 0, "tcp-nodelay",
466 ihp->hba_dip, 0, "tcp-conn-notify-threshold",
470 ddi_prop_get_int(DDI_DEV_T_ANY, ihp->hba_dip,
475 DDI_DEV_T_ANY, ihp->hba_dip, 0,
479 ihp->hba_config_storm_delay = ddi_prop_get_int(
480 DDI_DEV_T_ANY, ihp->hba_dip, 0,
484 (void) ddi_prop_update_int(DDI_DEV_T_NONE, ihp->hba_dip,
487 (void) ddi_prop_update_int(DDI_DEV_T_NONE, ihp->hba_dip,
490 (void) ddi_prop_update_int(DDI_DEV_T_NONE, ihp->hba_dip,
493 (void) ddi_prop_update_int(DDI_DEV_T_NONE, ihp->hba_dip,
497 (void) ddi_prop_update_int(DDI_DEV_T_NONE, ihp->hba_dip,
501 (void) ddi_prop_update_int(DDI_DEV_T_NONE, ihp->hba_dip,
505 (void) ddi_prop_update_int(DDI_DEV_T_NONE, ihp->hba_dip,
507 ihp->hba_config_storm_delay);
510 iscsi_set_default_login_params(&ihp->hba_params);
512 &ihp->hba_tunable_params);
515 iscsid_set_default_initiator_node_settings(ihp, B_TRUE);
518 tran->tran_hba_private = ihp;
549 ihp->hba_mpxio_enabled = B_FALSE;
551 ihp->hba_mpxio_enabled = B_TRUE;
554 (void) iscsi_hba_kstat_init(ihp);
560 ihp->hba_isid[0] = ISCSI_SUN_ISID_0;
561 ihp->hba_isid[1] = ISCSI_SUN_ISID_1;
562 ihp->hba_isid[2] = ISCSI_SUN_ISID_2;
563 ihp->hba_isid[3] = ISCSI_SUN_ISID_3;
564 ihp->hba_isid[4] = ISCSI_SUN_ISID_4;
565 ihp->hba_isid[5] = ISCSI_SUN_ISID_5;
574 ihp->hba_persistent_loaded = B_FALSE;
575 if (iscsid_init(ihp) == B_FALSE) {
582 (char *)ihp->hba_name, ihp->hba_isid[0],
583 ihp->hba_isid[1], ihp->hba_isid[2],
584 ihp->hba_isid[3], ihp->hba_isid[4],
585 ihp->hba_isid[5]);
594 (char *)ihp->hba_name,
606 if (ihp->stats.ks) {
607 (void) iscsi_hba_kstat_term(ihp);
609 if (ihp->hba_mpxio_enabled == B_TRUE) {
612 (void) scsi_hba_detach(ihp->hba_dip);
615 ddi_prop_remove_all(ihp->hba_dip);
618 cv_destroy(&ihp->hba_service_cv);
619 mutex_destroy(&ihp->hba_service_lock);
620 mutex_destroy(&ihp->hba_discovery_events_mutex);
621 sema_destroy(&ihp->hba_sendtgts_semaphore);
622 rw_destroy(&ihp->hba_sess_list_rwlock);
650 iscsi_hba_t *ihp = NULL;
664 if ((ihp = (iscsi_hba_t *)tran->tran_hba_private) == NULL) {
674 if (ihp_check != ihp) {
680 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
681 if (ihp->hba_sess_list != NULL) {
682 rw_exit(&ihp->hba_sess_list_rwlock);
686 rw_exit(&ihp->hba_sess_list_rwlock);
689 if (iscsid_disable_discovery(ihp,
701 (void) isns_dereg(ihp->hba_isid,
720 KSTAT_DEC_HBA_CNTR_SESS(ihp);
722 if (ihp->hba_mpxio_enabled == B_TRUE) {
727 ddi_prop_remove_all(ihp->hba_dip);
729 ldi_ident_release(ihp->hba_li);
731 cv_destroy(&ihp->hba_service_cv);
732 mutex_destroy(&ihp->hba_service_lock);
733 mutex_destroy(&ihp->hba_discovery_events_mutex);
734 rw_destroy(&ihp->hba_sess_list_rwlock);
735 (void) iscsi_hba_kstat_term(ihp);
1166 iscsi_hba_t *ihp = NULL;
1173 ihp = (iscsi_hba_t *)ddi_get_soft_state(iscsi_state,
1175 if (ihp == NULL) {
1179 iscsi_check_miniroot(ihp);
1185 if (iscsi_client_request_service(ihp) == B_FALSE) {
1224 iscsid_config_one(ihp, (name+4), B_TRUE);
1237 iscsid_config_all(ihp, B_TRUE);
1251 iscsi_client_release_service(ihp);
1269 iscsi_hba_t *ihp = NULL;
1272 ihp = (iscsi_hba_t *)ddi_get_soft_state(iscsi_state,
1274 if (ihp == NULL) {
1278 if (iscsi_client_request_service(ihp) == B_FALSE) {
1279 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
1280 if (ihp->hba_sess_list != NULL) {
1283 rw_exit(&ihp->hba_sess_list_rwlock);
1289 iscsi_client_release_service(ihp);
1314 iscsi_hba_t *ihp = NULL;
1325 ihp = (iscsi_hba_t *)ddi_get_soft_state(iscsi_state,
1327 if (ihp == NULL) {
1342 * off the ihp and isp.
1347 for (isp = ihp->hba_sess_list; isp; isp = isp->sess_next) {
1461 iscsi_hba_t *ihp = NULL;
1518 ihp = (iscsi_hba_t *)ddi_get_soft_state(iscsi_state, instance);
1519 if (ihp == NULL)
1522 iscsi_check_miniroot(ihp);
1526 if (iscsi_client_request_service(ihp) == B_FALSE) {
1575 (char *)ihp->hba_name, ISCSI_MAX_NAME_LEN);
1577 if (ihp->hba_alias_length == 0) {
1581 (char *)ihp->hba_alias, ISCSI_MAX_NAME_LEN);
1593 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
1594 if (ilg->g_oid == ihp->hba_oid) {
1596 params = &ihp->hba_params;
1597 name = ihp->hba_name;
1608 rtn = iscsi_sess_get(ilg->g_oid, ihp, &isp);
1611 ilg->g_oid, ihp, &isp);
1642 &ihp->hba_sess_list_rwlock);
1710 (ilg->g_oid != ihp->hba_oid)) {
1711 iscsi_override_target_default(ihp,
1715 rw_exit(&ihp->hba_sess_list_rwlock);
1751 rtn = iscsi_set_params(ils, ihp, B_TRUE);
1761 (char *)ihp->hba_name, ihp->hba_isid[0],
1762 ihp->hba_isid[1], ihp->hba_isid[2],
1763 ihp->hba_isid[3], ihp->hba_isid[4],
1764 ihp->hba_isid[5]);
1767 ihp->hba_dip, SCSI_ADDR_PROP_INITIATOR_PORT,
1772 (char *)ihp->hba_name,
1773 ddi_get_instance(ihp->hba_dip));
1792 ihp, NULL, method, NULL))
1799 (void) isns_dereg(ihp->hba_isid,
1828 (void) isns_reg(ihp->hba_isid,
1835 iscsid_do_isns_query(ihp);
1862 rtn = iscsi_set_params(ils, ihp, B_TRUE);
1864 if (iscsi_cmp_boot_sess_oid(ihp, ils->s_oid)) {
1870 if (!iscsi_reconfig_boot_sess(ihp)) {
1893 if ((e.e_oid != ihp->hba_oid) &&
1903 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
1909 rtn = iscsi_sess_get(e.e_oid, ihp, &isp);
1911 rtn = iscsi_sess_get_by_target(e.e_oid, ihp,
1930 rw_exit(&ihp->hba_sess_list_rwlock);
1950 rw_exit(&ihp->hba_sess_list_rwlock);
1957 rw_exit(&ihp->hba_sess_list_rwlock);
1972 for (isp = ihp->hba_sess_list; isp;
1992 ihp, ics);
2009 isp = ihp->hba_sess_list;
2082 rw_exit(&ihp->hba_sess_list_rwlock);
2084 if (iscsi_cmp_boot_sess_oid(ihp, e.e_oid)) {
2090 if (!iscsi_reconfig_boot_sess(ihp)) {
2129 mutex_enter(&ihp->hba_discovery_events_mutex);
2130 method = ihp->hba_discovery_events;
2133 (ihp->hba_discovery_in_progress == B_FALSE)) {
2134 ihp->hba_discovery_in_progress = B_TRUE;
2135 mutex_exit(&ihp->hba_discovery_events_mutex);
2136 iscsid_poke_discovery(ihp, iSCSIDiscoveryMethodUnknown);
2137 mutex_enter(&ihp->hba_discovery_events_mutex);
2138 ihp->hba_discovery_in_progress = B_FALSE;
2140 mutex_exit(&ihp->hba_discovery_events_mutex);
2192 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
2193 for (isp = ihp->hba_sess_list; isp;
2212 rw_exit(&ihp->hba_sess_list_rwlock);
2248 rtn = iscsi_target_prop_mod(ihp, ipp, cmd);
2284 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
2285 rtn = iscsi_sess_get(ialp->al_oid, ihp, &isp);
2287 rw_exit(&ihp->hba_sess_list_rwlock);
2333 rw_exit(&ihp->hba_sess_list_rwlock);
2355 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
2356 if (chap->c_oid == ihp->hba_oid)
2357 name = ihp->hba_name;
2359 rtn = iscsi_sess_get(chap->c_oid, ihp, &isp);
2362 chap->c_oid, ihp, &isp);
2383 &ihp->hba_sess_list_rwlock);
2393 rw_exit(&ihp->hba_sess_list_rwlock);
2413 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
2414 if (chap->c_oid == ihp->hba_oid)
2415 name = ihp->hba_name;
2417 rtn = iscsi_sess_get(chap->c_oid, ihp, &isp);
2420 chap->c_oid, ihp, &isp);
2439 rw_exit(&ihp->hba_sess_list_rwlock);
2464 &ihp->hba_sess_list_rwlock);
2470 rw_exit(&ihp->hba_sess_list_rwlock);
2474 rw_exit(&ihp->hba_sess_list_rwlock);
2496 if (chap->c_oid == ihp->hba_oid) {
2499 name = ihp->hba_name;
2510 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
2511 for (sessp = ihp->hba_sess_list; sessp;
2517 rw_exit(&ihp->hba_sess_list_rwlock);
2520 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
2526 rtn = iscsi_sess_get(chap->c_oid, ihp, &isp);
2529 ihp, &isp);
2532 rw_exit(&ihp->hba_sess_list_rwlock);
2720 iscsid_poke_discovery(ihp, iSCSIDiscoveryMethodStatic);
2721 (void) iscsid_login_tgt(ihp, (char *)target->te_name,
2772 mutex_enter(&ihp->hba_discovery_events_mutex);
2773 while (ihp->hba_discovery_in_progress ==
2780 &ihp->hba_discovery_events_mutex);
2784 &ihp->hba_discovery_events_mutex);
2791 mutex_exit(&ihp->hba_discovery_events_mutex);
2799 if (iscsid_del(ihp, (char *)name,
2819 iscsid_poke_discovery(ihp,
2821 (void) iscsid_login_tgt(ihp,
2888 (void) isns_reg_one_server(&e, ihp->hba_isid,
2896 iscsid_do_isns_query_one_server(ihp, &e);
2901 (void) iscsid_login_tgt(ihp, NULL,
2947 (void) iscsid_login_tgt(ihp, NULL,
3081 mutex_enter(&ihp->hba_discovery_events_mutex);
3082 while (ihp->hba_discovery_in_progress == B_TRUE) {
3087 mutex_exit(&ihp->hba_discovery_events_mutex);
3089 mutex_enter(&ihp->hba_discovery_events_mutex);
3099 mutex_exit(&ihp->hba_discovery_events_mutex);
3105 if (iscsid_del(ihp, NULL,
3135 mutex_enter(&ihp->hba_discovery_events_mutex);
3136 while (ihp->hba_discovery_in_progress == B_TRUE) {
3141 mutex_exit(&ihp->hba_discovery_events_mutex);
3143 mutex_enter(&ihp->hba_discovery_events_mutex);
3153 mutex_exit(&ihp->hba_discovery_events_mutex);
3160 if (iscsid_del(ihp, NULL, iSCSIDiscoveryMethodISNS,
3231 (void) iscsid_enable_discovery(ihp, method, B_FALSE);
3232 iscsid_poke_discovery(ihp, method);
3233 (void) iscsid_login_tgt(ihp, NULL, method, NULL);
3257 mutex_enter(&ihp->hba_discovery_events_mutex);
3258 while (ihp->hba_discovery_in_progress == B_TRUE) {
3263 mutex_exit(&ihp->hba_discovery_events_mutex);
3265 mutex_enter(&ihp->hba_discovery_events_mutex);
3275 mutex_exit(&ihp->hba_discovery_events_mutex);
3282 if (iscsid_disable_discovery(ihp, method) == B_FALSE) {
3337 for (isp = ihp->hba_sess_list; isp;
3357 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
3358 for (isp = ihp->hba_sess_list; isp; isp = isp->sess_next) {
3386 rw_exit(&ihp->hba_sess_list_rwlock);
3416 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
3417 rtn = iscsi_sess_get(lun->lp_tgt_oid, ihp, &isp);
3419 rw_exit(&ihp->hba_sess_list_rwlock);
3466 rw_exit(&ihp->hba_sess_list_rwlock);
3487 if (iscsi_ioctl_conn_oid_list_get(ihp, cl) ==
3515 if (iscsi_ioctl_conn_props_get(ihp, cp) ==
3552 if (radius->r_oid == ihp->hba_oid) {
3553 name = ihp->hba_name;
3597 if (radius->r_oid == ihp->hba_oid) {
3598 name = ihp->hba_name;
3634 if (auth->a_oid == ihp->hba_oid) {
3635 name = ihp->hba_name;
3638 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
3644 rtn = iscsi_sess_get(auth->a_oid, ihp, &isp);
3647 ihp, &isp);
3649 rw_exit(&ihp->hba_sess_list_rwlock);
3701 if (auth->a_oid == ihp->hba_oid) {
3702 name = ihp->hba_name;
3704 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
3710 rtn = iscsi_sess_get(auth->a_oid, ihp, &isp);
3713 ihp, &isp);
3715 rw_exit(&ihp->hba_sess_list_rwlock);
3759 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
3765 rtn = iscsi_sess_get(auth->a_oid, ihp, &isp);
3767 rtn = iscsi_sess_get_by_target(auth->a_oid, ihp, &isp);
3769 rw_exit(&ihp->hba_sess_list_rwlock);
3871 for (isp = ihp->hba_sess_list; isp; isp =
3883 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
3884 rtn = iscsi_sess_get(target_oid, ihp, &isp);
3886 rtn = iscsi_sess_get_by_target(target_oid, ihp,
3889 rw_exit(&ihp->hba_sess_list_rwlock);
3904 rw_exit(&ihp->hba_sess_list_rwlock);
3924 rw_exit(&ihp->hba_sess_list_rwlock);
4013 rw_exit(&ihp->hba_sess_list_rwlock);
4022 if (ihp->hba_persistent_loaded == B_FALSE) {
4028 mutex_enter(&ihp->hba_service_lock);
4029 if (ihp->hba_service_status_overwrite == B_TRUE) {
4030 ihp->hba_service_status = ISCSI_SERVICE_DISABLED;
4031 ihp->hba_service_status_overwrite = B_FALSE;
4033 mutex_exit(&ihp->hba_service_lock);
4035 if (iscsi_enter_service_zone(ihp, ISCSI_SERVICE_ENABLED) ==
4042 rval = iscsid_start(ihp);
4049 iscsi_exit_service_zone(ihp, ISCSI_SERVICE_ENABLED);
4051 iscsi_exit_service_zone(ihp, ISCSI_SERVICE_DISABLED);
4058 if (iscsi_enter_service_zone(ihp, ISCSI_SERVICE_DISABLED)
4063 rval = iscsid_stop(ihp);
4066 iscsi_exit_service_zone(ihp, ISCSI_SERVICE_DISABLED);
4076 mutex_enter(&ihp->hba_service_lock);
4077 while (ihp->hba_service_status ==
4079 cv_wait(&ihp->hba_service_cv,
4080 &ihp->hba_service_lock);
4082 if (ddi_copyout((void *)&ihp->hba_service_status,
4086 mutex_exit(&ihp->hba_service_lock);
4094 mutex_enter(&ihp->hba_discovery_events_mutex);
4095 method = ihp->hba_discovery_events;
4097 (ihp->hba_discovery_in_progress == B_FALSE)) {
4098 ihp->hba_discovery_in_progress = B_TRUE;
4099 mutex_exit(&ihp->hba_discovery_events_mutex);
4100 iscsid_poke_discovery(ihp, iSCSIDiscoveryMethodUnknown);
4101 mutex_enter(&ihp->hba_discovery_events_mutex);
4102 ihp->hba_discovery_in_progress = B_FALSE;
4103 method = ihp->hba_discovery_events;
4105 mutex_exit(&ihp->hba_discovery_events_mutex);
4142 sema_p(&ihp->hba_sendtgts_semaphore);
4144 rtn = iscsi_ioctl_sendtgts_get(ihp, istl);
4152 sema_v(&ihp->hba_sendtgts_semaphore);
4205 ihp->hba_isid,
4337 rtn = iscsi_ioctl_get_config_sess(ihp, ics);
4348 rtn = iscsi_ioctl_set_config_sess(ihp, ics);
4350 if (iscsi_cmp_boot_sess_oid(ihp,
4357 if (!iscsi_reconfig_boot_sess(ihp)) {
4380 rw_enter(&ihp->hba_sess_list_rwlock,
4382 for (isp = ihp->hba_sess_list; isp;
4392 rw_exit(&ihp->hba_sess_list_rwlock);
4409 iscsi_chk_bootlun_mpxio(ihp);
4470 rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
4471 rtn = iscsi_sess_get(reenum->re_oid, ihp, &isp);
4474 reenum->re_oid, ihp, &isp);
4478 rw_exit(&ihp->hba_sess_list_rwlock);
4494 rw_exit(&ihp->hba_sess_list_rwlock);
4505 rtn = iscsi_ioctl_set_tunable_param(ihp, tpss);
4517 if (tpsg->t_oid == ihp->hba_oid) {
4519 name = ihp->hba_name;
4545 (uchar_t *)ihp->hba_name, tpsg) == -1) {
4570 iscsi_client_release_service(ihp);
4711 iscsi_hba_t *ihp = (iscsi_hba_t *)hba_tran->tran_hba_private;
4740 for (isp = ihp->hba_sess_list; isp; isp = isp->sess_next) {
4842 iscsi_hba_t *ihp = NULL;
4853 ihp = (iscsi_hba_t *)hba_tran->tran_hba_private;
4854 ASSERT(ihp);
4874 for (isp = ihp->hba_sess_list; isp; isp = isp->sess_next) {
5291 iscsi_override_target_default(iscsi_hba_t *ihp, iscsi_param_get_t *ipg)
5297 if (persistent_param_get((char *)ihp->hba_name, pp) == B_TRUE) {
5366 iscsi_cmp_boot_sess_oid(iscsi_hba_t *ihp, uint32_t oid)
5370 if (iscsi_chk_bootlun_mpxio(ihp)) {
5371 for (isp = ihp->hba_sess_list; isp; isp = isp->sess_next) {
5384 if (oid == ihp->hba_oid) {
5402 iscsi_client_request_service(iscsi_hba_t *ihp) {
5405 mutex_enter(&ihp->hba_service_lock);
5406 while ((ihp->hba_service_status == ISCSI_SERVICE_TRANSITION) ||
5407 (ihp->hba_service_client_count == UINT_MAX)) {
5408 cv_wait(&ihp->hba_service_cv, &ihp->hba_service_lock);
5410 if (ihp->hba_service_status == ISCSI_SERVICE_ENABLED) {
5411 ihp->hba_service_client_count++;
5415 mutex_exit(&ihp->hba_service_lock);
5425 iscsi_client_release_service(iscsi_hba_t *ihp) {
5426 mutex_enter(&ihp->hba_service_lock);
5427 ASSERT(ihp->hba_service_client_count > 0);
5428 ihp->hba_service_client_count--;
5429 if (ihp->hba_service_client_count == 0) {
5430 cv_broadcast(&ihp->hba_service_cv);
5432 mutex_exit(&ihp->hba_service_lock);
5442 iscsi_enter_service_zone(iscsi_hba_t *ihp, uint32_t status) {
5448 mutex_enter(&ihp->hba_service_lock);
5449 while (ihp->hba_service_status == ISCSI_SERVICE_TRANSITION) {
5450 cv_wait(&ihp->hba_service_cv, &ihp->hba_service_lock);
5452 if (ihp->hba_service_status == status) {
5453 mutex_exit(&ihp->hba_service_lock);
5456 ihp->hba_service_status = ISCSI_SERVICE_TRANSITION;
5457 while (ihp->hba_service_client_count > 0) {
5458 cv_wait(&ihp->hba_service_cv, &ihp->hba_service_lock);
5460 mutex_exit(&ihp->hba_service_lock);
5468 iscsi_exit_service_zone(iscsi_hba_t *ihp, uint32_t status) {
5474 mutex_enter(&ihp->hba_service_lock);
5475 ASSERT(ihp->hba_service_status == ISCSI_SERVICE_TRANSITION);
5476 ihp->hba_service_status = status;
5477 cv_broadcast(&ihp->hba_service_cv);
5478 mutex_exit(&ihp->hba_service_lock);
5482 iscsi_check_miniroot(iscsi_hba_t *ihp) {
5488 ihp->hba_service_status = ISCSI_SERVICE_ENABLED;