Lines Matching refs:vsharep

75 #define	VSW_DDS_NEXT_REQID(vsharep)	(++vsharep->vs_req_id)  argument
99 static void vsw_hio_free_share(vsw_share_t *vsharep);
106 static int vsw_hio_send_delshare_msg(vsw_share_t *vsharep);
193 vsw_share_t *vsharep; in vsw_hio_alloc_share() local
199 vsharep = vsw_hio_find_free_share(vswp); in vsw_hio_alloc_share()
200 if (vsharep == NULL) { in vsw_hio_alloc_share()
206 rv = mac_share_bind(portp->p_mch, ldc_id, &vsharep->vs_cookie); in vsw_hio_alloc_share()
213 vsharep->vs_ldcid = ldcp->ldc_id; in vsw_hio_alloc_share()
214 vsharep->vs_macaddr = vnet_macaddr_strtoul( in vsw_hio_alloc_share()
216 vsharep->vs_portp = ldcp->ldc_port; in vsw_hio_alloc_share()
217 vsharep->vs_state |= VSW_SHARE_ASSIGNED; in vsw_hio_alloc_share()
220 return (vsharep); in vsw_hio_alloc_share()
230 vsw_share_t *vsharep; in vsw_hio_find_free_share() local
235 vsharep = &hiop->vh_shares[i]; in vsw_hio_find_free_share()
236 if (vsharep->vs_state == VSW_SHARE_FREE) { in vsw_hio_find_free_share()
238 __func__, vsharep->vs_index); in vsw_hio_find_free_share()
239 return (vsharep); in vsw_hio_find_free_share()
254 vsw_share_t *vsharep; in vsw_hio_find_vshare_ldcid() local
259 vsharep = &hiop->vh_shares[i]; in vsw_hio_find_vshare_ldcid()
260 if (vsharep->vs_state == VSW_SHARE_FREE) { in vsw_hio_find_vshare_ldcid()
263 if (vsharep->vs_ldcid == ldc_id) { in vsw_hio_find_vshare_ldcid()
265 __func__, vsharep->vs_index); in vsw_hio_find_vshare_ldcid()
266 return (vsharep); in vsw_hio_find_vshare_ldcid()
281 vsw_share_t *vsharep; in vsw_hio_find_vshare_port() local
286 vsharep = &hiop->vh_shares[i]; in vsw_hio_find_vshare_port()
287 if (vsharep->vs_state == VSW_SHARE_FREE) { in vsw_hio_find_vshare_port()
290 if (vsharep->vs_portp == portp) { in vsw_hio_find_vshare_port()
292 __func__, vsharep->vs_index); in vsw_hio_find_vshare_port()
293 return (vsharep); in vsw_hio_find_vshare_port()
304 vsw_hio_free_share(vsw_share_t *vsharep) in vsw_hio_free_share() argument
306 vsw_t *vswp = vsharep->vs_vswp; in vsw_hio_free_share()
307 vsw_port_t *portp = vsharep->vs_portp; in vsw_hio_free_share()
314 vsharep->vs_state = VSW_SHARE_FREE; in vsw_hio_free_share()
315 vsharep->vs_macaddr = 0; in vsw_hio_free_share()
316 vsharep->vs_portp = NULL; in vsw_hio_free_share()
320 vsharep->vs_ldcid, vsharep->vs_cookie); in vsw_hio_free_share()
367 vsw_share_t *vsharep; in vsw_hio_free_all_shares() local
390 vsharep = &hiop->vh_shares[i]; in vsw_hio_free_all_shares()
391 if (vsharep->vs_state == VSW_SHARE_FREE) { in vsw_hio_free_all_shares()
400 if (vsharep->vs_state & VSW_SHARE_DDS_ACKD) { in vsw_hio_free_all_shares()
405 "share(%d)", __func__, vsharep->vs_index); in vsw_hio_free_all_shares()
406 rv = vsw_hio_send_delshare_msg(vsharep); in vsw_hio_free_all_shares()
413 vsw_hio_port_reset(vsharep->vs_portp, in vsw_hio_free_all_shares()
425 "share(%d)", __func__, vsharep->vs_index); in vsw_hio_free_all_shares()
426 vsw_hio_port_reset(vsharep->vs_portp, reboot); in vsw_hio_free_all_shares()
471 vsw_share_t *vsharep; in vsw_hio_start_ports() local
486 vsharep = vsw_hio_find_vshare_port(vswp, portp); in vsw_hio_start_ports()
487 if (vsharep == NULL) { in vsw_hio_start_ports()
506 vsw_share_t *vsharep; in vsw_hio_start() local
519 vsharep = vsw_hio_find_vshare_ldcid(vswp, ldcp->ldc_id); in vsw_hio_start()
520 if (vsharep != NULL) { in vsw_hio_start()
526 vsharep = vsw_hio_alloc_share(vswp, ldcp); in vsw_hio_start()
527 if (vsharep == NULL) { in vsw_hio_start()
533 req_id = VSW_DDS_NEXT_REQID(vsharep); in vsw_hio_start()
534 rv = vsw_send_dds_msg(ldcp, DDS_VNET_ADD_SHARE, vsharep->vs_cookie, in vsw_hio_start()
535 vsharep->vs_macaddr, req_id); in vsw_hio_start()
540 vsw_hio_free_share(vsharep); in vsw_hio_start()
544 vsharep->vs_state &= ~VSW_SHARE_DDS_ACKD; in vsw_hio_start()
545 vsharep->vs_state |= VSW_SHARE_DDS_SENT; in vsw_hio_start()
550 ldcp->ldc_id, vsharep->vs_cookie); in vsw_hio_start()
561 vsw_share_t *vsharep; in vsw_hio_stop() local
566 vsharep = vsw_hio_find_vshare_ldcid(vswp, ldcp->ldc_id); in vsw_hio_stop()
567 if (vsharep == NULL) { in vsw_hio_stop()
573 vsw_hio_free_share(vsharep); in vsw_hio_stop()
583 vsw_hio_send_delshare_msg(vsw_share_t *vsharep) in vsw_hio_send_delshare_msg() argument
585 vsw_t *vswp = vsharep->vs_vswp; in vsw_hio_send_delshare_msg()
589 uint64_t cookie = vsharep->vs_cookie; in vsw_hio_send_delshare_msg()
590 uint64_t macaddr = vsharep->vs_macaddr; in vsw_hio_send_delshare_msg()
596 portp = vsharep->vs_portp; in vsw_hio_send_delshare_msg()
603 if ((ldcp == NULL) || (ldcp->ldc_id != vsharep->vs_ldcid)) { in vsw_hio_send_delshare_msg()
607 req_id = VSW_DDS_NEXT_REQID(vsharep); in vsw_hio_send_delshare_msg()
613 vsharep->vs_state &= ~VSW_SHARE_DDS_ACKD; in vsw_hio_send_delshare_msg()
614 vsharep->vs_state |= VSW_SHARE_DDS_SENT; in vsw_hio_send_delshare_msg()
652 vsw_share_t *vsharep; in vsw_process_dds_msg() local
665 vsharep = vsw_hio_find_vshare_ldcid(vswp, ldcp->ldc_id); in vsw_process_dds_msg()
666 if (vsharep == NULL) { in vsw_process_dds_msg()
675 if (!(vsharep->vs_state & VSW_SHARE_DDS_SENT)) { in vsw_process_dds_msg()
677 " share state=0x%X", __func__, vsharep->vs_state); in vsw_process_dds_msg()
681 if (dmsg->dds_req_id != vsharep->vs_req_id) { in vsw_process_dds_msg()
684 __func__, dmsg->dds_req_id, vsharep->vs_req_id); in vsw_process_dds_msg()
692 vsw_hio_free_share(vsharep); in vsw_process_dds_msg()
695 vsharep->vs_state &= ~VSW_SHARE_DDS_SENT; in vsw_process_dds_msg()
696 vsharep->vs_state |= VSW_SHARE_DDS_ACKD; in vsw_process_dds_msg()
703 if (!(vsharep->vs_state & VSW_SHARE_DDS_SENT)) { in vsw_process_dds_msg()
705 " share state=0x%X", __func__, vsharep->vs_state); in vsw_process_dds_msg()
709 if (dmsg->dds_req_id != vsharep->vs_req_id) { in vsw_process_dds_msg()
712 __func__, dmsg->dds_req_id, vsharep->vs_req_id); in vsw_process_dds_msg()
721 vsw_hio_free_share(vsharep); in vsw_process_dds_msg()
729 vsw_hio_free_share(vsharep); in vsw_process_dds_msg()
797 vsw_share_t *vsharep; in vsw_hio_stop_port() local
808 vsharep = vsw_hio_find_vshare_port(vswp, portp); in vsw_hio_stop_port()
809 if (vsharep == NULL) { in vsw_hio_stop_port()
815 if (vsharep->vs_state & VSW_SHARE_DDS_ACKD) { in vsw_hio_stop_port()
820 "share(%d)", __func__, vsharep->vs_index); in vsw_hio_stop_port()
821 rv = vsw_hio_send_delshare_msg(vsharep); in vsw_hio_stop_port()
827 vsw_hio_port_reset(vsharep->vs_portp, B_FALSE); in vsw_hio_stop_port()
834 "share(%d)", __func__, vsharep->vs_index); in vsw_hio_stop_port()
835 vsw_hio_port_reset(vsharep->vs_portp, B_FALSE); in vsw_hio_stop_port()
839 if ((vsharep->vs_portp != portp) || in vsw_hio_stop_port()
840 (vsharep->vs_state == VSW_SHARE_FREE)) { in vsw_hio_stop_port()
854 if ((vsharep->vs_portp != portp) || in vsw_hio_stop_port()
855 (vsharep->vs_state == VSW_SHARE_FREE)) { in vsw_hio_stop_port()
859 } while ((vsharep->vs_state != VSW_SHARE_FREE) && (max_retries > 0)); in vsw_hio_stop_port()
874 vsw_share_t *vsharep; in vsw_hio_reset_all() local
883 vsharep = &hiop->vh_shares[i]; in vsw_hio_reset_all()
884 if (vsharep->vs_state == VSW_SHARE_FREE) { in vsw_hio_reset_all()
891 vsw_hio_port_reset(vsharep->vs_portp, B_TRUE); in vsw_hio_reset_all()