Lines Matching defs:vifp
634 struct vif *vifp;
642 vifp = &viftable[vifi];
643 if (!in_nullhost(vifp->v_lcl_addr))
644 reset_vif(vifp);
691 struct vif *vifp;
697 vifp = &viftable[vifi];
698 if (vifp->v_ifp == ifp)
699 reset_vif(vifp);
761 struct vif *vifp;
771 vifp = &viftable[vifcp->vifc_vifi];
772 if (!in_nullhost(vifp->v_lcl_addr))
818 vifp->v_encap_cookie = encap_attach_func(AF_INET, IPPROTO_IPV4,
819 vif_encapcheck, &vif_encapsw, vifp);
821 if (!vifp->v_encap_cookie)
830 memset(&vifp->v_route, 0, sizeof(vifp->v_route));
842 memset(&vifp->v_route, 0, sizeof(vifp->v_route));
861 vifp->tbf_q = NULL;
862 vifp->tbf_t = &vifp->tbf_q;
863 microtime(&vifp->tbf_last_pkt_t);
864 vifp->tbf_n_tok = 0;
865 vifp->tbf_q_len = 0;
866 vifp->tbf_max_q_len = MAXQSIZE;
868 vifp->v_flags = vifcp->vifc_flags;
869 vifp->v_threshold = vifcp->vifc_threshold;
871 vifp->v_rate_limit = vifcp->vifc_rate_limit * 1024 / 1000;
872 vifp->v_lcl_addr = vifcp->vifc_lcl_addr;
873 vifp->v_rmt_addr = vifcp->vifc_rmt_addr;
874 vifp->v_ifp = ifp;
876 vifp->v_pkt_in = 0;
877 vifp->v_pkt_out = 0;
878 vifp->v_bytes_in = 0;
879 vifp->v_bytes_out = 0;
881 callout_init(&vifp->v_repq_ch, 0);
902 reset_vif(struct vif *vifp)
908 callout_stop(&vifp->v_repq_ch);
912 encap_detach(vifp->v_encap_cookie);
914 vifp->v_encap_cookie = NULL;
919 for (m = vifp->tbf_q; m != NULL; m = n) {
924 if (vifp->v_flags & VIFF_TUNNEL)
925 free(vifp->v_ifp, M_MRTABLE);
926 else if (vifp->v_flags & VIFF_REGISTER) {
932 ifp = vifp->v_ifp;
935 memset((void *)vifp, 0, sizeof(*vifp));
944 struct vif *vifp;
951 vifp = &viftable[*vifip];
952 if (in_nullhost(vifp->v_lcl_addr))
957 reset_vif(vifp);
1574 #define MC_SEND(ip, vifp, m) do { \
1575 if ((vifp)->v_flags & VIFF_TUNNEL) \
1576 encap_send((ip), (vifp), (m)); \
1578 phyint_send((ip), (vifp), (m)); \
1589 struct vif *vifp;
1691 for (vifp = viftable, vifi = 0; vifi < numvifs; vifp++, vifi++) {
1694 vifp->v_pkt_out++;
1695 vifp->v_bytes_out += plen;
1697 if (vifp->v_flags & VIFF_REGISTER)
1698 pim_register_send(ip, vifp, m, rt);
1701 MC_SEND(ip, vifp, m);
1721 phyint_send(struct ip *ip, struct vif *vifp, struct mbuf *m)
1736 if (vifp->v_rate_limit <= 0)
1737 tbf_send_packet(vifp, mb_copy);
1739 tbf_control(vifp, mb_copy, mtod(mb_copy, struct ip *),
1744 encap_send(struct ip *ip, struct vif *vifp, struct mbuf *m)
1789 ip_copy->ip_src = vifp->v_lcl_addr;
1790 ip_copy->ip_dst = vifp->v_rmt_addr;
1802 if (vifp->v_rate_limit <= 0)
1803 tbf_send_packet(vifp, mb_copy);
1805 tbf_control(vifp, mb_copy, ip, ntohs(ip_copy->ip_len));
1814 struct vif *vifp = eparg;
1816 KASSERT(vifp != NULL);
1825 m_set_rcvif(m, vifp->v_ifp);
1840 struct vif *vifp;
1858 vifp = (struct vif *)arg;
1866 if (!in_hosteq(vifp->v_rmt_addr, ip.ip_src))
1870 if (!in_hosteq(vifp->v_lcl_addr, ip.ip_dst))
1874 if ((vifp->v_flags & VIFF_TUNNEL) == 0)
1898 tbf_control(struct vif *vifp, struct mbuf *m, struct ip *ip, u_int32_t len)
1908 tbf_update_tokens(vifp);
1914 if (vifp->tbf_q_len == 0) {
1915 if (len <= vifp->tbf_n_tok) {
1916 vifp->tbf_n_tok -= len;
1917 tbf_send_packet(vifp, m);
1920 tbf_queue(vifp, m);
1921 callout_reset(&vifp->v_repq_ch, TBF_REPROCESS,
1922 tbf_reprocess_q, vifp);
1925 if (vifp->tbf_q_len >= vifp->tbf_max_q_len &&
1926 !tbf_dq_sel(vifp, ip)) {
1932 tbf_queue(vifp, m);
1933 tbf_process_q(vifp);
1942 tbf_queue(struct vif *vifp, struct mbuf *m)
1947 *vifp->tbf_t = m;
1948 vifp->tbf_t = &m->m_nextpkt;
1949 vifp->tbf_q_len++;
1958 tbf_process_q(struct vif *vifp)
1968 for (m = vifp->tbf_q; m != NULL; m = vifp->tbf_q) {
1972 if (len <= vifp->tbf_n_tok) {
1977 if ((vifp->tbf_q = m->m_nextpkt) == NULL)
1978 vifp->tbf_t = &vifp->tbf_q;
1979 --vifp->tbf_q_len;
1982 vifp->tbf_n_tok -= len;
1983 tbf_send_packet(vifp, m);
1993 struct vif *vifp = arg;
1998 tbf_update_tokens(vifp);
1999 tbf_process_q(vifp);
2001 if (vifp->tbf_q_len != 0)
2002 callout_reset(&vifp->v_repq_ch, TBF_REPROCESS,
2003 tbf_reprocess_q, vifp);
2010 tbf_dq_sel(struct vif *vifp, struct ip *ip)
2016 p = priority(vifp, ip);
2018 for (mp = &vifp->tbf_q, m = *mp;
2021 if (p > priority(vifp, mtod(m, struct ip *))) {
2023 vifp->tbf_t = mp;
2024 --vifp
2037 tbf_send_packet(struct vif *vifp, struct mbuf *m)
2042 if (vifp->v_flags & VIFF_TUNNEL) {
2044 ip_output(m, NULL, &vifp->v_route, IP_FORWARDING, NULL, NULL);
2049 imo.imo_multicast_if_index = if_get_index(vifp->v_ifp);
2058 (long)(vifp - viftable), error);
2068 tbf_update_tokens(struct vif *vifp)
2076 TV_DELTA(tp, vifp->tbf_last_pkt_t, tm);
2087 vifp->tbf_n_tok += tm * vifp->v_rate_limit / 8192;
2088 vifp->tbf_last_pkt_t = tp;
2090 if (vifp->tbf_n_tok > MAX_BKT_SIZE)
2091 vifp->tbf_n_tok = MAX_BKT_SIZE;
2097 priority(struct vif *vifp, struct ip *ip)
2725 pim_register_send(struct ip *ip, struct vif *vifp, struct mbuf *m,
2749 pim_register_send_rp(ip, vifp, mm, rt);
2751 pim_register_send_upcall(ip, vifp, mm, rt);
2812 pim_register_send_upcall(struct ip *ip, struct vif *vifp,
2840 im->im_vif = vifp - viftable;
2867 pim_register_send_rp(struct ip *ip, struct vif *vifp,
2926 if (vifp->v_rate_limit == 0)
2927 tbf_send_packet(vifp, mb_first);
2929 tbf_control(vifp, mb_first, ip, ntohs(ip_outer->ip_len));
3045 struct ifnet *vifp;
3057 vifp = viftable[reg_vif_num].v_ifp;
3172 /* NB: vifp was collected above; can it change on us? */
3173 looutput(vifp, m, (struct sockaddr *)&dst, NULL);