Lines Matching refs:vdp_instp
78 vdp_profile_lookup_by_linkid(vdp_inst_t *vdp_instp, datalink_id_t id)
82 for (vdp_profp = list_head(&vdp_instp->vdp_inst_profiles);
84 vdp_profp = list_next(&vdp_instp->vdp_inst_profiles, vdp_profp)) {
89 vdp_instp->vdp_inst_phy_link_name);
94 vdp_instp->vdp_inst_phy_link_name);
100 vdp_profile_lookup_by_vsiid(vdp_inst_t *vdp_instp, char *vsiid)
104 for (vdp_profp = list_head(&vdp_instp->vdp_inst_profiles);
106 vdp_profp = list_next(&vdp_instp->vdp_inst_profiles, vdp_profp)) {
121 vdp_create_profile_tlv(vdp_inst_t *vdp_instp, vdp_profile_t *vdp_profp,
165 wptr += vdp_instp->vdp_inst_ecp_offset;
192 vdp_inst_t *vdp_instp = vdp_profp->vdp_prof_instp;
194 list_remove(&vdp_instp->vdp_inst_profiles, vdp_profp);
196 if (list_is_empty(&vdp_instp->vdp_inst_profiles)) {
197 vdp_instp->vdp_inst_state = VDP_REC_DELETED;
198 (void) pthread_cond_signal(&vdp_instp->vdp_inst_cv);
210 vdp_inst_t *vdp_instp = vdp_profp->vdp_prof_instp;
224 vdp_create_profile_tlv(vdp_instp, vdp_profp,
230 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
231 ret = ecp_send(vdp_instp->vdp_inst_ecp_handle,
233 (void) pthread_mutex_lock(&vdp_instp->vdp_inst_lock);
257 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
258 ret = ecp_send(vdp_instp->vdp_inst_ecp_handle,
260 (void) pthread_mutex_lock(&vdp_instp->vdp_inst_lock);
294 vdp_inst_t *vdp_instp = arg;
298 (void) pthread_mutex_lock(&vdp_instp->vdp_inst_lock);
310 if (vdp_instp->vdp_inst_state == VDP_REC_DELETED) {
314 assert(vdp_instp->vdp_inst_tq != NULL);
315 timeout = iu_earliest_timer(vdp_instp->vdp_inst_tq);
317 (void) pthread_cond_wait(&vdp_instp->vdp_inst_cv,
318 &vdp_instp->vdp_inst_lock);
331 (void) pthread_cond_timedwait(&vdp_instp->vdp_inst_cv,
332 &vdp_instp->vdp_inst_lock, &ntime);
335 if (vdp_instp->vdp_inst_state == VDP_REC_DELETED) {
340 iu_tq_destroy(vdp_instp->vdp_inst_tq);
341 vdp_instp->vdp_inst_tq = NULL;
342 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
345 (void) pthread_mutex_lock(&vdp_instp->vdp_inst_lock);
347 ecp_fini(vdp_instp->vdp_inst_ecp_handle);
348 list_remove(&vdp_inst_list, vdp_instp);
349 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
355 (void) close(vdp_instp->vdp_inst_sockfd);
356 free(vdp_instp);
359 (void) iu_expire_timers(vdp_instp->vdp_inst_tq);
379 vdp_inst_t *vdp_instp = instp;
388 (void) pthread_mutex_lock(&vdp_instp->vdp_inst_lock);
389 if (vdp_instp->vdp_inst_state == VDP_REC_DELETED)
443 vdp_profp = vdp_profile_lookup_by_vsiid(vdp_instp, tlv_vsiid);
446 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
450 (void) iu_adjust_timer(vdp_instp->vdp_inst_tq,
454 iu_schedule_timer_ms(vdp_instp->vdp_inst_tq,
457 (void) pthread_cond_signal(&vdp_instp->vdp_inst_cv);
458 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
477 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
489 if (!iu_cancel_timer(vdp_instp->vdp_inst_tq,
500 iu_schedule_timer_ms(vdp_instp->vdp_inst_tq,
502 (void) pthread_cond_signal(&vdp_instp->vdp_inst_cv);
514 vdp_create_profile_tlv(vdp_instp,
518 iu_schedule_timer_ms(vdp_instp->vdp_inst_tq,
521 &vdp_instp->vdp_inst_cv);
524 iu_schedule_timer_ms(vdp_instp->vdp_inst_tq,
528 &vdp_instp->vdp_inst_cv);
543 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
553 vdp_inst_init(vdp_inst_t *vdp_instp, vdpt_arg_t *vdp_argp,
562 bzero(vdp_instp, sizeof (vdp_inst_t));
563 (void) pthread_mutex_init(&vdp_instp->vdp_inst_lock, NULL);
564 (void) pthread_cond_init(&vdp_instp->vdp_inst_cv, NULL);
565 list_create(&vdp_instp->vdp_inst_profiles, sizeof (vdp_profile_t),
568 (void) strlcpy(vdp_instp->vdp_inst_phy_link_name,
570 vdp_instp->vdp_inst_phy_id = vdp_argp->vdpt_phy_link_id;
571 vdp_instp->vdp_inst_lphysaddr_len = link_infop->vli_phy_link_maclen;
572 bcopy(link_infop->vli_phy_link_mac, vdp_instp->vdp_inst_lphysaddr,
573 vdp_instp->vdp_inst_lphysaddr_len);
574 vdp_instp->vdp_inst_sockfd = socket(PF_PACKET, SOCK_RAW, ETHERTYPE_ECP);
575 if (vdp_instp->vdp_inst_sockfd < 0) {
576 vdp_instp->vdp_inst_sockfd = 0;
583 sll.sll_ifindex = (int32_t)vdp_instp->vdp_inst_phy_id;
585 if (bind(vdp_instp->vdp_inst_sockfd, (struct sockaddr *)&sll,
587 (void) close(vdp_instp->vdp_inst_sockfd);
593 pmreq.mr_ifindex = vdp_instp->vdp_inst_phy_id;
598 if (setsockopt(vdp_instp->vdp_inst_sockfd, SOL_PACKET,
601 (void) close(vdp_instp->vdp_inst_sockfd);
606 pmreq.mr_ifindex = vdp_instp->vdp_inst_phy_id;
609 if (setsockopt(vdp_instp->vdp_inst_sockfd, SOL_PACKET,
612 (void) close(vdp_instp->vdp_inst_sockfd);
616 vdp_instp->vdp_inst_state = VDP_REC_INIT;
617 vdp_instp->vdp_inst_tq = iu_tq_create();
620 (void) pthread_create(&vdp_instp->vdp_inst_timeout_process_thread,
621 &attr, vdp_inst_timeout_process_thr, (void *)vdp_instp);
622 vdp_instp->vdp_inst_ecp_handle = ecp_init(&dst_addr,
623 (struct ether_addr *)vdp_instp->vdp_inst_lphysaddr, ECP_VDP,
624 vdp_instp->vdp_inst_sockfd, ECP_MAX_TRIES, vdp_ecp_cb, vdp_instp,
626 vdp_instp->vdp_inst_ecp_offset = ecp_offset();
627 (void) pthread_mutex_lock(&vdp_instp->vdp_inst_lock);
628 list_insert_tail(&vdp_inst_list, vdp_instp);
632 (void) pthread_mutex_destroy(&vdp_instp->vdp_inst_lock);
633 (void) pthread_cond_destroy(&vdp_instp->vdp_inst_cv);
634 list_destroy(&vdp_instp->vdp_inst_profiles);
646 vdp_inst_t *vdp_instp;
649 for (vdp_instp = list_head(&vdp_inst_list); vdp_instp != NULL;
650 vdp_instp = list_next(&vdp_inst_list, vdp_instp)) {
652 (void) pthread_mutex_lock(&vdp_instp->vdp_inst_lock);
653 if (vdp_instp->vdp_inst_state == VDP_REC_DELETED) {
654 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
657 if (vdp_instp->vdp_inst_phy_id == vdp_arg->vdpt_phy_link_id)
659 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
662 if ((vdp_instp == NULL) && (link_infop != NULL)) {
663 vdp_instp = malloc(sizeof (vdp_inst_t));
664 if (vdp_instp == NULL) {
667 if (vdp_inst_init(vdp_instp, vdp_arg,
669 free(vdp_instp);
670 vdp_instp = NULL;
676 assert(vdp_instp == NULL ||
677 vdp_instp->vdp_inst_state != VDP_REC_DELETED);
680 return (vdp_instp);
684 vdp_inst_release(vdp_inst_t *vdp_instp)
686 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
696 vdp_inst_t *vdp_instp;
701 vdp_instp = vdp_inst_lookup(vdp_argp, NULL);
702 if (vdp_instp == NULL)
705 vdp_profp = vdp_profile_lookup_by_linkid(vdp_instp,
708 vdp_inst_release(vdp_instp);
715 vstats->vs_ipkts = vdp_instp->vdp_inst_ipkts;
716 vstats->vs_opkts = vdp_instp->vdp_inst_opkts;
717 vstats->vs_kas = vdp_instp->vdp_inst_kas;
719 vdp_inst_release(vdp_instp);
730 vdp_inst_t *vdp_instp;
735 vdp_instp = vdp_inst_lookup(vdp_argp, NULL);
736 if (vdp_instp == NULL)
738 ecp_stats(vdp_instp->vdp_inst_ecp_handle, estats);
739 vdp_inst_release(vdp_instp);
765 vdp_inst_t *vdp_instp;
777 for (vdp_instp = list_head(&vdp_inst_list); vdp_instp != NULL;
778 vdp_instp = list_next(&vdp_inst_list, vdp_instp)) {
779 (void) pthread_mutex_lock(&vdp_instp->vdp_inst_lock);
780 if (vdp_instp->vdp_inst_state == VDP_REC_DELETED) {
781 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
785 vdp_instp->vdp_inst_phy_link_name);
789 vdp_instp->vdp_inst_phy_id)) {
790 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
794 for (vdp_profp = list_head(&vdp_instp->vdp_inst_profiles);
796 vdp_profp = list_next(&vdp_instp->vdp_inst_profiles,
804 ecp_get_config(vdp_instp->vdp_inst_ecp_handle, &ecpc);
808 vdp_instp->vdp_inst_phy_link_name);
823 &vdp_instp->vdp_inst_lock);
834 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
853 vdp_inst_t *vdp_instp;
864 for (vdp_instp = list_head(&vdp_inst_list); vdp_instp != NULL;
865 vdp_instp = list_next(&vdp_inst_list, vdp_instp)) {
866 (void) pthread_mutex_lock(&vdp_instp->vdp_inst_lock);
867 if (vdp_instp->vdp_inst_state == VDP_REC_DELETED) {
868 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
872 vdp_instp->vdp_inst_phy_link_name);
875 vdp_instp->vdp_inst_phy_id)) {
876 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
880 for (vdp_profp = list_head(&vdp_instp->vdp_inst_profiles);
882 vdp_profp = list_next(&vdp_instp->vdp_inst_profiles,
895 vdp_instp->vdp_inst_phy_link_name);
932 &vdp_instp->vdp_inst_lock);
938 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
955 i_vdp_tlv_del_locked(vdp_inst_t *vdp_instp, vdp_profile_t *vdp_profp)
974 (void) iu_cancel_timer(vdp_instp->vdp_inst_tq,
990 (void) iu_adjust_timer(vdp_instp->vdp_inst_tq,
992 (void) pthread_cond_signal(&vdp_instp->vdp_inst_cv);
1001 vdp_inst_t *vdp_instp;
1006 for (vdp_instp = list_head(&vdp_inst_list); vdp_instp != NULL;
1007 vdp_instp = list_next(&vdp_inst_list, vdp_instp)) {
1008 (void) pthread_mutex_lock(&vdp_instp->vdp_inst_lock);
1009 if (vdp_instp->vdp_inst_state == VDP_REC_DELETED) {
1010 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
1013 for (vdp_profp = list_head(&vdp_instp->vdp_inst_profiles);
1015 vdp_profp = list_next(&vdp_instp->vdp_inst_profiles,
1019 if (i_vdp_tlv_del_locked(vdp_instp, vdp_profp)) {
1021 &vdp_instp->vdp_inst_lock);
1025 (void) pthread_mutex_unlock(&vdp_instp->vdp_inst_lock);
1040 vdp_inst_t *vdp_instp;
1044 vdp_instp = vdp_inst_lookup(vdp_argp, NULL);
1045 if (vdp_instp == NULL)
1048 vdp_profp = vdp_profile_lookup_by_linkid(vdp_instp,
1051 vdp_inst_release(vdp_instp);
1054 (void) i_vdp_tlv_del_locked(vdp_instp, vdp_profp);
1055 vdp_inst_release(vdp_instp);
1065 vdp_inst_t *vdp_instp;
1073 vdp_instp = vdp_inst_lookup(vdp_argp, link_infop);
1074 if (vdp_instp == NULL)
1077 vdp_profp = vdp_profile_lookup_by_linkid(vdp_instp,
1080 vdp_inst_release(vdp_instp);
1086 vdp_inst_release(vdp_instp);
1100 vdp_inst_release(vdp_instp);
1110 vdp_inst_release(vdp_instp);
1123 vdp_inst_release(vdp_instp);
1174 vdp_profp->vdp_prof_instp = vdp_instp;
1175 list_insert_tail(&vdp_instp->vdp_inst_profiles, vdp_profp);
1180 iu_schedule_timer_ms(vdp_instp->vdp_inst_tq, 0,
1182 (void) pthread_cond_signal(&vdp_instp->vdp_inst_cv);
1183 vdp_inst_release(vdp_instp);