Lines Matching refs:vswp

88 void vsw_hio_init(vsw_t *vswp);
89 void vsw_hio_cleanup(vsw_t *vswp);
90 void vsw_hio_start(vsw_t *vswp, vsw_ldc_t *ldcp);
91 void vsw_hio_stop(vsw_t *vswp, vsw_ldc_t *ldcp);
92 void vsw_process_dds_msg(vsw_t *vswp, vsw_ldc_t *ldcp, void *msg);
93 void vsw_hio_start_ports(vsw_t *vswp);
97 static void vsw_hio_free_all_shares(vsw_t *vswp, boolean_t reboot);
98 static vsw_share_t *vsw_hio_alloc_share(vsw_t *vswp, vsw_ldc_t *ldcp);
100 static vsw_share_t *vsw_hio_find_free_share(vsw_t *vswp);
101 static vsw_share_t *vsw_hio_find_vshare_ldcid(vsw_t *vswp, uint64_t ldc_id);
102 static vsw_share_t *vsw_hio_find_vshare_port(vsw_t *vswp, vsw_port_t *portp);
125 static kstat_t *vsw_hio_setup_kstats(char *ks_mod, char *ks_name, vsw_t *vswp);
126 static void vsw_hio_destroy_kstats(vsw_t *vswp);
135 vsw_hio_init(vsw_t *vswp) in vsw_hio_init() argument
137 vsw_hio_t *hiop = &vswp->vhio; in vsw_hio_init()
141 ASSERT(MUTEX_HELD(&vswp->mac_lock)); in vsw_hio_init()
142 D1(vswp, "%s:enter\n", __func__); in vsw_hio_init()
147 vswp->hio_capable = B_FALSE; in vsw_hio_init()
148 num_shares = mac_share_capable(vswp->mh); in vsw_hio_init()
150 D2(vswp, "%s: %s is not HybridIO capable\n", __func__, in vsw_hio_init()
151 vswp->physname); in vsw_hio_init()
160 hiop->vh_shares[i].vs_vswp = vswp; in vsw_hio_init()
162 vswp->hio_capable = B_TRUE; in vsw_hio_init()
168 vswp->hio_reboot_cb_id = callb_add(vsw_hio_reboot_callb, in vsw_hio_init()
169 (void *)vswp, CB_CL_MDBOOT, "vsw_hio"); in vsw_hio_init()
171 vswp->hio_panic_cb_id = callb_add(vsw_hio_panic_callb, in vsw_hio_init()
172 (void *)vswp, CB_CL_PANIC, "vsw_hio"); in vsw_hio_init()
175 hiop->vh_ksp = vsw_hio_setup_kstats(DRV_NAME, "hio", vswp); in vsw_hio_init()
177 DERR(vswp, "%s: kstats setup failed", __func__); in vsw_hio_init()
180 D2(vswp, "%s: %s is HybridIO capable num_shares=%d\n", __func__, in vsw_hio_init()
181 vswp->physname, hiop->vh_num_shares); in vsw_hio_init()
182 D1(vswp, "%s:exit\n", __func__); in vsw_hio_init()
191 vsw_hio_alloc_share(vsw_t *vswp, vsw_ldc_t *ldcp) in vsw_hio_alloc_share() argument
198 D1(vswp, "%s:enter\n", __func__); in vsw_hio_alloc_share()
199 vsharep = vsw_hio_find_free_share(vswp); in vsw_hio_alloc_share()
219 D1(vswp, "%s:exit\n", __func__); in vsw_hio_alloc_share()
227 vsw_hio_find_free_share(vsw_t *vswp) in vsw_hio_find_free_share() argument
229 vsw_hio_t *hiop = &vswp->vhio; in vsw_hio_find_free_share()
233 D1(vswp, "%s:enter\n", __func__); in vsw_hio_find_free_share()
237 D1(vswp, "%s:Returning free share(%d)\n", in vsw_hio_find_free_share()
242 D1(vswp, "%s:no free share\n", __func__); in vsw_hio_find_free_share()
251 vsw_hio_find_vshare_ldcid(vsw_t *vswp, uint64_t ldc_id) in vsw_hio_find_vshare_ldcid() argument
253 vsw_hio_t *hiop = &vswp->vhio; in vsw_hio_find_vshare_ldcid()
257 D1(vswp, "%s:enter, ldc=0x%lx", __func__, ldc_id); in vsw_hio_find_vshare_ldcid()
264 D1(vswp, "%s:returning share(%d)", in vsw_hio_find_vshare_ldcid()
269 D1(vswp, "%s:returning NULL", __func__); in vsw_hio_find_vshare_ldcid()
278 vsw_hio_find_vshare_port(vsw_t *vswp, vsw_port_t *portp) in vsw_hio_find_vshare_port() argument
280 vsw_hio_t *hiop = &vswp->vhio; in vsw_hio_find_vshare_port()
284 D1(vswp, "%s:enter, portp=0x%p", __func__, portp); in vsw_hio_find_vshare_port()
291 D1(vswp, "%s:returning share(%d)", in vsw_hio_find_vshare_port()
296 D1(vswp, "%s:returning NULL", __func__); in vsw_hio_find_vshare_port()
306 vsw_t *vswp = vsharep->vs_vswp; in vsw_hio_free_share() local
309 D1(vswp, "%s:enter\n", __func__); in vsw_hio_free_share()
319 DERR(vswp, "Share freed for ldc_id=0x%lx Cookie=0x%lX", in vsw_hio_free_share()
321 D1(vswp, "%s:exit\n", __func__); in vsw_hio_free_share()
330 vsw_hio_cleanup(vsw_t *vswp) in vsw_hio_cleanup() argument
332 D1(vswp, "%s:enter\n", __func__); in vsw_hio_cleanup()
335 if (vswp->hio_reboot_cb_id) { in vsw_hio_cleanup()
336 (void) callb_delete(vswp->hio_reboot_cb_id); in vsw_hio_cleanup()
337 vswp->hio_reboot_cb_id = 0; in vsw_hio_cleanup()
339 if (vswp->hio_panic_cb_id) { in vsw_hio_cleanup()
340 (void) callb_delete(vswp->hio_panic_cb_id); in vsw_hio_cleanup()
341 vswp->hio_panic_cb_id = 0; in vsw_hio_cleanup()
343 vsw_hio_free_all_shares(vswp, B_FALSE); in vsw_hio_cleanup()
344 vsw_hio_destroy_kstats(vswp); in vsw_hio_cleanup()
345 D1(vswp, "%s:exit\n", __func__); in vsw_hio_cleanup()
363 vsw_hio_free_all_shares(vsw_t *vswp, boolean_t reboot) in vsw_hio_free_all_shares() argument
365 vsw_hio_t *hiop = &vswp->vhio; in vsw_hio_free_all_shares()
366 vsw_port_list_t *plist = &vswp->plist; in vsw_hio_free_all_shares()
372 D1(vswp, "%s:enter\n", __func__); in vsw_hio_free_all_shares()
380 mutex_enter(&vswp->mac_lock); in vsw_hio_free_all_shares()
385 vswp->hio_capable = B_FALSE; in vsw_hio_free_all_shares()
404 D1(vswp, "%s:sending DEL_SHARE msg for " in vsw_hio_free_all_shares()
423 DWARN(vswp, "%s:All retries failed, " in vsw_hio_free_all_shares()
440 mutex_exit(&vswp->mac_lock); in vsw_hio_free_all_shares()
442 mutex_enter(&vswp->mac_lock); in vsw_hio_free_all_shares()
450 "could not be freed", vswp->instance); in vsw_hio_free_all_shares()
457 mutex_exit(&vswp->mac_lock); in vsw_hio_free_all_shares()
459 D1(vswp, "%s:exit\n", __func__); in vsw_hio_free_all_shares()
467 vsw_hio_start_ports(vsw_t *vswp) in vsw_hio_start_ports() argument
469 vsw_port_list_t *plist = &vswp->plist; in vsw_hio_start_ports()
474 if (vswp->hio_capable == B_FALSE) { in vsw_hio_start_ports()
485 mutex_enter(&vswp->mac_lock); in vsw_hio_start_ports()
486 vsharep = vsw_hio_find_vshare_port(vswp, portp); in vsw_hio_start_ports()
490 mutex_exit(&vswp->mac_lock); in vsw_hio_start_ports()
504 vsw_hio_start(vsw_t *vswp, vsw_ldc_t *ldcp) in vsw_hio_start() argument
510 D1(vswp, "%s:enter ldc=0x%lx", __func__, ldcp->ldc_id); in vsw_hio_start()
511 mutex_enter(&vswp->mac_lock); in vsw_hio_start()
512 if (vswp->hio_capable == B_FALSE) { in vsw_hio_start()
513 mutex_exit(&vswp->mac_lock); in vsw_hio_start()
514 D2(vswp, "%s:not HIO capable", __func__); in vsw_hio_start()
519 vsharep = vsw_hio_find_vshare_ldcid(vswp, ldcp->ldc_id); in vsw_hio_start()
521 mutex_exit(&vswp->mac_lock); in vsw_hio_start()
522 D2(vswp, "%s:Share already allocated to ldc=0x%lx", in vsw_hio_start()
526 vsharep = vsw_hio_alloc_share(vswp, ldcp); in vsw_hio_start()
528 mutex_exit(&vswp->mac_lock); in vsw_hio_start()
529 D2(vswp, "%s: no Share available for ldc=0x%lx", in vsw_hio_start()
541 mutex_exit(&vswp->mac_lock); in vsw_hio_start()
546 mutex_exit(&vswp->mac_lock); in vsw_hio_start()
549 DERR(vswp, "Share allocated for ldc_id=0x%lx Cookie=0x%lX", in vsw_hio_start()
552 D1(vswp, "%s:exit ldc=0x%lx", __func__, ldcp->ldc_id); in vsw_hio_start()
559 vsw_hio_stop(vsw_t *vswp, vsw_ldc_t *ldcp) in vsw_hio_stop() argument
563 D1(vswp, "%s:enter ldc=0x%lx", __func__, ldcp->ldc_id); in vsw_hio_stop()
565 mutex_enter(&vswp->mac_lock); in vsw_hio_stop()
566 vsharep = vsw_hio_find_vshare_ldcid(vswp, ldcp->ldc_id); in vsw_hio_stop()
568 D1(vswp, "%s:no share found for ldc=0x%lx", in vsw_hio_stop()
570 mutex_exit(&vswp->mac_lock); in vsw_hio_stop()
574 mutex_exit(&vswp->mac_lock); in vsw_hio_stop()
576 D1(vswp, "%s:exit ldc=0x%lx", __func__, ldcp->ldc_id); in vsw_hio_stop()
585 vsw_t *vswp = vsharep->vs_vswp; in vsw_hio_send_delshare_msg() local
593 ASSERT(MUTEX_HELD(&vswp->mac_lock)); in vsw_hio_send_delshare_msg()
594 mutex_exit(&vswp->mac_lock); in vsw_hio_send_delshare_msg()
598 mutex_enter(&vswp->mac_lock); in vsw_hio_send_delshare_msg()
604 mutex_enter(&vswp->mac_lock); in vsw_hio_send_delshare_msg()
611 mutex_enter(&vswp->mac_lock); in vsw_hio_send_delshare_msg()
626 vsw_t *vswp = ldcp->ldc_port->p_vswp; in vsw_send_dds_msg() local
631 D1(vswp, "%s:enter\n", __func__); in vsw_send_dds_msg()
642 D1(vswp, "%s:exit rv=%d\n", __func__, rv); in vsw_send_dds_msg()
650 vsw_process_dds_msg(vsw_t *vswp, vsw_ldc_t *ldcp, void *msg) in vsw_process_dds_msg() argument
655 D1(vswp, "%s:enter ldc=0x%lx\n", __func__, ldcp->ldc_id); in vsw_process_dds_msg()
660 mutex_enter(&vswp->mac_lock); in vsw_process_dds_msg()
665 vsharep = vsw_hio_find_vshare_ldcid(vswp, ldcp->ldc_id); in vsw_process_dds_msg()
667 mutex_exit(&vswp->mac_lock); in vsw_process_dds_msg()
674 D1(vswp, "%s:DDS_VNET_ADD_SHARE\n", __func__); in vsw_process_dds_msg()
676 DWARN(vswp, "%s: invalid ADD_SHARE response message " in vsw_process_dds_msg()
682 DWARN(vswp, "%s: invalid req_id in ADD_SHARE response" in vsw_process_dds_msg()
689 DWARN(vswp, "%s: NACK received for ADD_SHARE" in vsw_process_dds_msg()
694 D2(vswp, "%s: ACK received for ADD_SHARE", __func__); in vsw_process_dds_msg()
702 D1(vswp, "%s:DDS_VNET_DEL_SHARE\n", __func__); in vsw_process_dds_msg()
704 DWARN(vswp, "%s: invalid DEL_SHARE response message " in vsw_process_dds_msg()
710 DWARN(vswp, "%s: invalid req_id in DEL_SHARE response" in vsw_process_dds_msg()
716 DWARN(vswp, "%s: NACK received for DEL_SHARE", in vsw_process_dds_msg()
726 D1(vswp, "%s:DDS_VNET_REL_SHARE\n", __func__); in vsw_process_dds_msg()
732 DERR(vswp, "%s: Invalid DDS message type=0x%X", in vsw_process_dds_msg()
736 mutex_exit(&vswp->mac_lock); in vsw_process_dds_msg()
737 D1(vswp, "%s:exit ldc=0x%lx\n", __func__, ldcp->ldc_id); in vsw_process_dds_msg()
746 vsw_t *vswp = ldcp->ldc_port->p_vswp; in vsw_send_dds_resp_msg() local
749 D1(vswp, "%s:enter\n", __func__); in vsw_send_dds_resp_msg()
758 D1(vswp, "%s:exit rv=%d\n", __func__, rv); in vsw_send_dds_resp_msg()
796 vsw_t *vswp = portp->p_vswp; in vsw_hio_stop_port() local
800 D1(vswp, "%s:enter\n", __func__); in vsw_hio_stop_port()
801 mutex_enter(&vswp->mac_lock); in vsw_hio_stop_port()
803 if (vswp->hio_capable == B_FALSE) { in vsw_hio_stop_port()
804 mutex_exit(&vswp->mac_lock); in vsw_hio_stop_port()
808 vsharep = vsw_hio_find_vshare_port(vswp, portp); in vsw_hio_stop_port()
810 mutex_exit(&vswp->mac_lock); in vsw_hio_stop_port()
819 D1(vswp, "%s:sending DEL_SHARE msg for " in vsw_hio_stop_port()
832 DWARN(vswp, "%s:All retries failed, " in vsw_hio_stop_port()
849 mutex_exit(&vswp->mac_lock); in vsw_hio_stop_port()
851 mutex_enter(&vswp->mac_lock); in vsw_hio_stop_port()
861 mutex_exit(&vswp->mac_lock); in vsw_hio_stop_port()
862 D1(vswp, "%s:exit\n", __func__); in vsw_hio_stop_port()
871 vsw_hio_reset_all(vsw_t *vswp) in vsw_hio_reset_all() argument
873 vsw_hio_t *hiop = &vswp->vhio; in vsw_hio_reset_all()
877 D1(vswp, "%s:enter\n", __func__); in vsw_hio_reset_all()
879 if (vswp->hio_capable != B_TRUE) in vsw_hio_reset_all()
893 D1(vswp, "%s:exit\n", __func__); in vsw_hio_reset_all()
904 vsw_t *vswp = arg; in vsw_hio_reboot_callb() local
906 D1(vswp, "%s:enter\n", __func__); in vsw_hio_reboot_callb()
907 vsw_hio_free_all_shares(vswp, B_TRUE); in vsw_hio_reboot_callb()
908 D1(vswp, "%s:exit\n", __func__); in vsw_hio_reboot_callb()
921 vsw_t *vswp = arg; in vsw_hio_panic_callb() local
923 D1(vswp, "%s:enter\n", __func__); in vsw_hio_panic_callb()
924 vsw_hio_reset_all(vswp); in vsw_hio_panic_callb()
925 D1(vswp, "%s:exit\n", __func__); in vsw_hio_panic_callb()
933 vsw_hio_setup_kstats(char *ks_mod, char *ks_name, vsw_t *vswp) in vsw_hio_setup_kstats() argument
942 hiop = &vswp->vhio; in vsw_hio_setup_kstats()
952 ksp = kstat_create(ks_mod, vswp->instance, ks_name, "misc", in vsw_hio_setup_kstats()
982 ksp->ks_private = (void *)vswp; in vsw_hio_setup_kstats()
991 vsw_hio_destroy_kstats(vsw_t *vswp) in vsw_hio_destroy_kstats() argument
996 ASSERT(vswp != NULL); in vsw_hio_destroy_kstats()
998 ksp = vswp->vhio.vh_ksp; in vsw_hio_destroy_kstats()
999 hiop = &vswp->vhio; in vsw_hio_destroy_kstats()
1015 vsw_t *vswp; in vsw_hio_kstats_update() local
1020 vswp = (vsw_t *)ksp->ks_private; in vsw_hio_kstats_update()
1021 ASSERT(vswp != NULL); in vsw_hio_kstats_update()
1023 hiop = &vswp->vhio; in vsw_hio_kstats_update()
1027 if (vswp->hio_capable) { in vsw_hio_kstats_update()
1035 mutex_enter(&vswp->mac_lock); in vsw_hio_kstats_update()
1043 mutex_exit(&vswp->mac_lock); in vsw_hio_kstats_update()