Lines Matching defs:ifp

40  * - ifp->if_reassign function once we can test with vimage. Depending on
133 struct ifnet *ifp; /* This ifp. */
134 struct ifnet *oifp; /* other ifp of pair. */
149 struct ifnet *ifp;
234 cpuid_from_ifp(struct ifnet *ifp)
238 if (ifp == NULL)
240 sc = ifp->if_softc;
251 struct ifnet *ifp;
254 ifp = m->m_pkthdr.rcvif;
255 (*ifp->if_input)(ifp, m);
256 sc = ifp->if_softc;
259 ("%s: ifp=%p sc->refcount not >= 1: %d",
260 __func__, ifp, sc->refcount));
261 DPRINTF("ifp=%p refcount=%u\n", ifp, sc->refcount);
278 struct ifnet *ifp;
290 ifp = elm->ifp;
292 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
293 epair_start_locked(ifp);
295 IFQ_LOCK(&ifp->if_snd);
296 if (IFQ_IS_EMPTY(&ifp->if_snd)) {
301 /* The cached ifp goes off the list. */
302 sc = ifp->if_softc;
305 ("%s: ifp=%p sc->refcount not >= 1: %d",
306 __func__, ifp, sc->refcount));
309 IFQ_UNLOCK(&ifp->if_snd);
311 if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) != 0) {
326 epair_remove_ifp_from_draining(struct ifnet *ifp)
337 if (ifp == elm->ifp) {
343 /* The cached ifp goes off the list. */
344 sc = ifp->if_softc;
347 ("%s: ifp=%p sc->refcount not >= 1: %d",
348 __func__, ifp, sc->refcount));
357 epair_add_ifp_for_draining(struct ifnet *ifp)
363 sc = ifp->if_softc;
367 if (elm->ifp == ifp)
369 /* If the ifp is there already, return success. */
377 elm->ifp = ifp;
378 /* Add a reference for the ifp pointer on the list. */
386 epair_start_locked(struct ifnet *ifp)
394 DPRINTF("ifp=%p\n", ifp);
395 sc = ifp->if_softc;
399 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
401 if ((ifp->if_flags & IFF_UP) == 0)
412 IFQ_DEQUEUE(&ifp->if_snd, m);
415 BPF_MTAP(ifp, m);
423 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
427 DPRINTF("packet %s -> %s\n", ifp->if_xname, oifp->if_xname);
439 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
445 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
446 (void) epair_add_ifp_for_draining(ifp);
447 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
450 ("%s: ifp=%p sc->refcount not >= 1: %d",
457 epair_start(struct ifnet *ifp)
461 epair_dpcpu = DPCPU_ID_PTR(cpuid_from_ifp(ifp), epair_dpcpu);
463 epair_start_locked(ifp);
468 epair_transmit_locked(struct ifnet *ifp, struct mbuf *m)
476 DPRINTF("ifp=%p m=%p\n", ifp, m);
477 sc = ifp->if_softc;
490 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
494 if ((ifp->if_flags & IFF_UP) == 0) {
499 BPF_MTAP(ifp, m);
508 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
514 DPRINTF("packet %s -> %s\n", ifp->if_xname, oifp->if_xname);
518 IF_LOCK(&ifp->if_snd);
519 if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
520 ALTQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
522 if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1);
523 IF_UNLOCK(&ifp->if_snd);
525 if_inc_counter(ifp, IFCOUNTER_OBYTES, len);
527 if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
529 if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0)
530 epair_start_locked(ifp);
532 (void)epair_add_ifp_for_draining(ifp);
536 IF_UNLOCK(&ifp->if_snd);
542 * queuing to the ifq but do not call ifp->if_start.
545 IFQ_ENQUEUE(&ifp->if_snd, m, error);
547 (void)epair_add_ifp_for_draining(ifp);
561 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
567 if_inc_counter(ifp, IFCOUNTER_OBYTES, len);
569 if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
575 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
576 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
579 ("%s: ifp=%p sc->refcount not >= 1: %d",
587 epair_transmit(struct ifnet *ifp, struct mbuf *m)
592 epair_dpcpu = DPCPU_ID_PTR(cpuid_from_ifp(ifp), epair_dpcpu);
594 error = epair_transmit_locked(ifp, m);
600 epair_qflush(struct ifnet *ifp)
604 sc = ifp->if_softc;
605 KASSERT(sc != NULL, ("%s: ifp=%p, epair_softc gone? sc=%p\n",
606 __func__, ifp, sc));
608 * Remove this ifp from all backpointer lists. The interface will not
612 epair_remove_ifp_from_draining(ifp);
615 sc->if_qflush(ifp);
619 epair_media_change(struct ifnet *ifp __unused)
627 epair_media_status(struct ifnet *ifp __unused, struct ifmediareq *imr)
635 epair_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
651 sc = ifp->if_softc;
652 error = ifmedia_ioctl(ifp, ifr, &sc->media, cmd);
657 ifp->if_mtu = ifr->ifr_mtu;
663 error = ether_ioctl(ifp, cmd, data);
710 struct ifnet *ifp;
713 ifp = scb->ifp;
716 eaddr[3] = (ifp->if_index >> 8) & 0xff;
717 eaddr[4] = ifp->if_index & 0xff;
719 ether_ifattach(ifp, eaddr);
721 if_clone_addif(ifc, ifp);
728 struct ifnet *ifp;
776 sca->ifp = if_alloc(IFT_ETHER);
777 if (sca->ifp == NULL) {
785 scb->ifp = if_alloc(IFT_ETHER);
786 if (scb->ifp == NULL) {
788 if_free(sca->ifp);
797 sca->oifp = scb->ifp;
798 scb->oifp = sca->ifp;
807 netisr_get_cpuid(sca->ifp->if_index);
809 netisr_get_cpuid(scb->ifp->if_index);
820 ifp = sca->ifp;
821 ifp->if_softc = sca;
822 strlcpy(ifp->if_xname, name, IFNAMSIZ);
823 ifp->if_dname = epairname;
824 ifp->if_dunit = unit;
825 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
826 ifp->if_capabilities = IFCAP_VLAN_MTU;
827 ifp->if_capenable = IFCAP_VLAN_MTU;
828 ifp->if_start = epair_start;
829 ifp->if_ioctl = epair_ioctl;
830 ifp->if_init = epair_init;
831 ifp->if_snd.ifq_maxlen = ifqmaxlen;
834 eaddr[3] = (ifp->if_index >> 8) & 0xff;
835 eaddr[4] = ifp->if_index & 0xff;
837 ether_ifattach(ifp, eaddr);
838 sca->if_qflush = ifp->if_qflush;
839 ifp->if_qflush = epair_qflush;
840 ifp->if_transmit = epair_transmit;
841 ifp->if_baudrate = IF_Gbps(10); /* arbitrary maximum */
846 ifp = scb->ifp;
847 ifp->if_softc = scb;
848 strlcpy(ifp->if_xname, name, IFNAMSIZ);
849 ifp->if_dname = epairname;
850 ifp->if_dunit = unit;
851 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
852 ifp->if_capabilities = IFCAP_VLAN_MTU;
853 ifp->if_capenable = IFCAP_VLAN_MTU;
854 ifp->if_start = epair_start;
855 ifp->if_ioctl = epair_ioctl;
856 ifp->if_init = epair_init;
857 ifp->if_snd.ifq_maxlen = ifqmaxlen;
862 strlcpy(name, scb->ifp->if_xname, len);
865 scb->if_qflush = ifp->if_qflush;
866 ifp->if_qflush = epair_qflush;
867 ifp->if_transmit = epair_transmit;
868 ifp->if_baudrate = IF_Gbps(10); /* arbitrary maximum */
871 * Restore name to <n>a as the ifp for this will go into the
874 strlcpy(name, sca->ifp->if_xname, len);
878 sca->ifp->if_drv_flags |= IFF_DRV_RUNNING;
879 scb->ifp->if_drv_flags |= IFF_DRV_RUNNING;
880 if_link_state_change(sca->ifp, LINK_STATE_UP);
881 if_link_state_change(scb->ifp, LINK_STATE_UP);
887 epair_clone_destroy(struct if_clone *ifc, struct ifnet *ifp)
893 DPRINTF("ifp=%p\n", ifp);
900 if (ifp->if_softc == NULL)
903 unit = ifp->if_dunit;
904 sca = ifp->if_softc;
908 DPRINTF("ifp=%p oifp=%p\n", ifp, oifp);
909 if_link_state_change(ifp, LINK_STATE_DOWN);
911 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
928 ("%s: ifp=%p scb->refcount!=1: %d", __func__, oifp, scb->refcount));
939 ether_ifdetach(ifp);
945 ("%s: ifp=%p sca->refcount!=1: %d", __func__, ifp, sca->refcount));
946 if_free(ifp);