Lines Matching refs:ss

115 static int fcoe_iocmd(fcoe_soft_state_t *ss, intptr_t data, int mode);
305 fcoe_soft_state_t *ss;
316 ss = ddi_get_soft_state(fcoe_state, instance);
317 ss->ss_dip = dip;
320 fcoe_global_ss = ss;
321 fcoe_ret = fcoe_attach_init(ss);
347 fcoe_soft_state_t *ss;
350 ss = ddi_get_soft_state(fcoe_state, instance);
351 if (ss == NULL) {
359 fcoe_ret = fcoe_detach_uninit(ss);
448 fcoe_soft_state_t *ss;
462 ss = ddi_get_soft_state(fcoe_state, instance);
463 if (ss == NULL) {
467 mutex_enter(&ss->ss_ioctl_mutex);
468 if (ss->ss_ioctl_flags & FCOE_IOCTL_FLAG_EXCL) {
473 mutex_exit(&ss->ss_ioctl_mutex);
478 if (ss->ss_ioctl_flags & FCOE_IOCTL_FLAG_OPEN) {
483 mutex_exit(&ss->ss_ioctl_mutex);
486 ss->ss_ioctl_flags |= FCOE_IOCTL_FLAG_EXCL;
489 ss->ss_ioctl_flags |= FCOE_IOCTL_FLAG_OPEN;
490 mutex_exit(&ss->ss_ioctl_mutex);
500 fcoe_soft_state_t *ss;
507 ss = ddi_get_soft_state(fcoe_state, instance);
508 if (ss == NULL) {
512 mutex_enter(&ss->ss_ioctl_mutex);
513 if ((ss->ss_ioctl_flags & FCOE_IOCTL_FLAG_OPEN) == 0) {
514 mutex_exit(&ss->ss_ioctl_mutex);
518 ss->ss_ioctl_flags &= ~FCOE_IOCTL_FLAG_MASK;
519 mutex_exit(&ss->ss_ioctl_mutex);
529 fcoe_soft_state_t *ss;
536 ss = ddi_get_soft_state(fcoe_state, (int32_t)getminor(dev));
537 if (ss == NULL) {
541 mutex_enter(&ss->ss_ioctl_mutex);
542 if ((ss->ss_ioctl_flags & FCOE_IOCTL_FLAG_OPEN) == 0) {
543 mutex_exit(&ss->ss_ioctl_mutex);
546 mutex_exit(&ss->ss_ioctl_mutex);
550 ret = fcoe_iocmd(ss, data, mode);
639 fcoe_iocmd(fcoe_soft_state_t *ss, intptr_t data, int mode)
657 mutex_enter(&ss->ss_ioctl_mutex);
658 if (ss->ss_ioctl_flags & FCOE_IOCTL_FLAG_EXCL) {
659 if (ss->ss_ioctl_flags & FCOE_IOCTL_FLAG_EXCL_BUSY) {
660 mutex_exit(&ss->ss_ioctl_mutex);
665 ss->ss_ioctl_flags |= FCOE_IOCTL_FLAG_EXCL_BUSY;
667 mutex_exit(&ss->ss_ioctl_mutex);
686 mutex_enter(&ss->ss_ioctl_mutex);
689 mutex_exit(&ss->ss_ioctl_mutex);
696 mutex_exit(&ss->ss_ioctl_mutex);
705 mutex_exit(&ss->ss_ioctl_mutex);
745 mutex_exit(&ss->ss_ioctl_mutex);
751 ret = fcoe_create_port(ss->ss_dip,
763 mutex_exit(&ss->ss_ioctl_mutex);
781 mutex_enter(&ss->ss_ioctl_mutex);
782 ret = fcoe_delete_port(ss->ss_dip, fcoeio,
784 mutex_exit(&ss->ss_ioctl_mutex);
800 mutex_enter(&ss->ss_ioctl_mutex);
812 mutex_exit(&ss->ss_ioctl_mutex);
854 fcoe_attach_init(fcoe_soft_state_t *ss)
858 if (ddi_create_minor_node(ss->ss_dip, "admin", S_IFCHR,
859 ddi_get_instance(ss->ss_dip), DDI_PSEUDO, 0) != DDI_SUCCESS) {
869 if ((ss->ss_watchdog_taskq = ddi_taskq_create(NULL,
874 ss->ss_ioctl_flags = 0;
875 mutex_init(&ss->ss_ioctl_mutex, NULL, MUTEX_DRIVER, NULL);
876 list_create(&ss->ss_mac_list, sizeof (fcoe_mac_t),
878 list_create(&ss->ss_pfrm_list, sizeof (fcoe_i_frame_t),
881 mutex_init(&ss->ss_watch_mutex, 0, MUTEX_DRIVER, 0);
882 cv_init(&ss->ss_watch_cv, NULL, CV_DRIVER, NULL);
883 ss->ss_flags &= ~SS_FLAG_TERMINATE_WATCHDOG;
884 (void) ddi_taskq_dispatch(ss->ss_watchdog_taskq,
885 fcoe_watchdog, ss, DDI_SLEEP);
886 while ((ss->ss_flags & SS_FLAG_WATCHDOG_RUNNING) == 0) {
889 fcoe_nworkers = ddi_prop_get_int(DDI_DEV_T_ANY, ss->ss_dip,
896 ddi_report_dev(ss->ss_dip);
904 fcoe_detach_uninit(fcoe_soft_state_t *ss)
907 if (!list_is_empty(&ss->ss_mac_list)) {
919 if (ss->ss_flags & SS_FLAG_WATCHDOG_RUNNING) {
920 mutex_enter(&ss->ss_watch_mutex);
921 ss->ss_flags |= SS_FLAG_TERMINATE_WATCHDOG;
922 cv_broadcast(&ss->ss_watch_cv);
923 mutex_exit(&ss->ss_watch_mutex);
924 while (ss->ss_flags & SS_FLAG_WATCHDOG_RUNNING) {
929 ddi_taskq_destroy(ss->ss_watchdog_taskq);
930 mutex_destroy(&ss->ss_watch_mutex);
931 cv_destroy(&ss->ss_watch_cv);
933 ddi_remove_minor_node(ss->ss_dip, NULL);
934 mutex_destroy(&ss->ss_ioctl_mutex);
935 list_destroy(&ss->ss_mac_list);
1058 fcoe_soft_state_t *ss = (fcoe_soft_state_t *)arg;
1062 FCOE_LOG("fcoe", "fcoe_soft_state is %p", ss);
1064 mutex_enter(&ss->ss_watch_mutex);
1065 ss->ss_flags |= SS_FLAG_WATCHDOG_RUNNING;
1066 while ((ss->ss_flags & SS_FLAG_TERMINATE_WATCHDOG) == 0) {
1067 while (fmi = (fcoe_i_frame_t *)list_head(&ss->ss_pfrm_list)) {
1068 list_remove(&ss->ss_pfrm_list, fmi);
1069 mutex_exit(&ss->ss_watch_mutex);
1074 mutex_enter(&ss->ss_watch_mutex);
1078 ss->ss_flags |= SS_FLAG_DOG_WAITING;
1079 (void) cv_wait(&ss->ss_watch_cv, &ss->ss_watch_mutex);
1080 ss->ss_flags &= ~SS_FLAG_DOG_WAITING;
1083 ss->ss_flags &= ~SS_FLAG_WATCHDOG_RUNNING;
1084 mutex_exit(&ss->ss_watch_mutex);