Lines Matching refs:ifp

115 	struct	ifnet *ifp;		/* Our interface */
123 static void ng_iface_start(struct ifnet *ifp);
124 static int ng_iface_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
125 static int ng_iface_output(struct ifnet *ifp, struct mbuf *m0,
127 static void ng_iface_bpftap(struct ifnet *ifp,
129 static int ng_iface_send(struct ifnet *ifp, struct mbuf *m,
132 static void ng_iface_print_ioctl(struct ifnet *ifp, int cmd, caddr_t data);
286 ng_iface_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
292 ng_iface_print_ioctl(ifp, command, data);
298 ifp->if_flags |= IFF_UP;
299 ifp->if_drv_flags |= IFF_DRV_RUNNING;
300 ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE);
312 if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
313 ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE);
314 ifp->if_drv_flags |= IFF_DRV_RUNNING;
317 if (ifp->if_drv_flags & IFF_DRV_RUNNING)
318 ifp->if_drv_flags &= ~(IFF_DRV_RUNNING |
329 ifp->if_mtu = ifr->ifr_mtu;
355 ng_iface_output(struct ifnet *ifp, struct mbuf *m,
363 if (!((ifp->if_flags & IFF_UP) &&
364 (ifp->if_drv_flags & IFF_DRV_RUNNING))) {
372 if (*(struct ifnet **)(mtag + 1) == ifp) {
373 log(LOG_NOTICE, "Loop detected on %s\n", ifp->if_xname);
384 *(struct ifnet **)(mtag + 1) = ifp;
394 ng_iface_bpftap(ifp, m, af);
396 if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
399 IFQ_LOCK(&ifp->if_snd);
400 IFQ_INC_DROPS(&ifp->if_snd);
401 IFQ_UNLOCK(&ifp->if_snd);
402 ifp->if_oerrors++;
406 error = (ifp->if_transmit)(ifp, m);
408 error = ng_iface_send(ifp, m, af);
417 ng_iface_start(struct ifnet *ifp)
422 KASSERT(ALTQ_IS_ENABLED(&ifp->if_snd), ("%s without ALTQ", __func__));
425 IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
430 ng_iface_send(ifp, m, sa);
439 ng_iface_bpftap(struct ifnet *ifp, struct mbuf *m, sa_family_t family)
442 if (bpf_peers_present(ifp->if_bpf)) {
444 bpf_mtap2(ifp->if_bpf, &family4, sizeof(family4), m);
454 ng_iface_send(struct ifnet *ifp, struct mbuf *m, sa_family_t sa)
456 const priv_p priv = (priv_p) ifp->if_softc;
464 log(LOG_WARNING, "%s: can't handle af%d\n", ifp->if_xname, sa);
478 ifp->if_obytes += len;
479 ifp->if_opackets++;
491 ng_iface_print_ioctl(struct ifnet *ifp, int command, caddr_t data)
512 ifp->if_xname,
530 struct ifnet *ifp;
535 ifp = if_alloc(IFT_PROPVIRTUAL);
536 if (ifp == NULL) {
542 ifp->if_softc = priv;
543 priv->ifp = ifp;
553 if_initname(ifp, NG_IFACE_IFACE_NAME, priv->unit);
554 ifp->if_output = ng_iface_output;
555 ifp->if_start = ng_iface_start;
556 ifp->if_ioctl = ng_iface_ioctl;
557 ifp->if_mtu = NG_IFACE_MTU_DEFAULT;
558 ifp->if_flags = (IFF_SIMPLEX|IFF_POINTOPOINT|IFF_NOARP|IFF_MULTICAST);
559 ifp->if_type = IFT_PROPVIRTUAL; /* XXX */
560 ifp->if_addrlen = 0; /* XXX */
561 ifp->if_hdrlen = 0; /* XXX */
562 ifp->if_baudrate = 64000; /* XXX */
563 IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
564 ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
565 IFQ_SET_READY(&ifp->if_snd);
568 if (ng_name_node(node, ifp->if_xname) != 0)
570 ifp->if_xname);
573 if_attach(ifp);
574 bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
607 struct ifnet *const ifp = priv->ifp;
622 strlcpy(resp->data, ifp->if_xname, IFNAMSIZ);
630 if ((ifp->if_flags & IFF_UP) != 0)
636 ifp->if_flags |= IFF_POINTOPOINT;
637 ifp->if_flags &= ~IFF_BROADCAST;
640 ifp->if_flags &= ~IFF_POINTOPOINT;
641 ifp->if_flags |= IFF_BROADCAST;
653 *((uint32_t *)resp->data) = priv->ifp->if_index;
668 if_addr_rlock(ifp);
669 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
686 if_addr_runlock(ifp);
701 ifp->if_drv_flags |= IFF_DRV_RUNNING;
704 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
727 struct ifnet *const ifp = priv->ifp;
736 if ((ifp->if_flags & IFF_UP) == 0) {
742 ifp->if_ipackets++;
743 ifp->if_ibytes += m->m_pkthdr.len;
746 m->m_pkthdr.rcvif = ifp;
749 ng_iface_bpftap(ifp, m, iffam->family);
779 M_SETFIB(m, ifp->if_fib);
796 CURVNET_SET_QUIET(priv->ifp->if_vnet);
797 bpfdetach(priv->ifp);
798 if_detach(priv->ifp);
799 if_free(priv->ifp);
801 priv->ifp = NULL;