MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ether_input

Function ether_input

freebsd/net/if_ethersubr.c:802–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

800#endif
801
802static void
803ether_input(struct ifnet *ifp, struct mbuf *m)
804{
805 struct epoch_tracker et;
806 struct mbuf *mn;
807 bool needs_epoch;
808
809 needs_epoch = !(ifp->if_flags & IFF_KNOWSEPOCH);
810
811 /*
812 * The drivers are allowed to pass in a chain of packets linked with
813 * m_nextpkt. We split them up into separate packets here and pass
814 * them up. This allows the drivers to amortize the receive lock.
815 */
816 CURVNET_SET_QUIET(ifp->if_vnet);
817 if (__predict_false(needs_epoch))
818 NET_EPOCH_ENTER(et);
819 while (m) {
820 mn = m->m_nextpkt;
821 m->m_nextpkt = NULL;
822
823 /*
824 * We will rely on rcvif being set properly in the deferred
825 * context, so assert it is correct here.
826 */
827 MPASS((m->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0);
828 KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet mismatch m %p "
829 "rcvif %p ifp %p", __func__, m, m->m_pkthdr.rcvif, ifp));
830 netisr_dispatch(NETISR_ETHER, m);
831 m = mn;
832 }
833 if (__predict_false(needs_epoch))
834 NET_EPOCH_EXIT(et);
835 CURVNET_RESTORE();
836}
837
838/*
839 * Upper layer processing for a received Ethernet packet.

Callers

nothing calls this directly

Calls 1

netisr_dispatchFunction · 0.85

Tested by

no test coverage detected