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

Function bridge_enqueue

freebsd/net/if_bridge.c:1952–1996  ·  view source on GitHub ↗

* bridge_enqueue: * * Enqueue a packet on a bridge member interface. * */

Source from the content-addressed store, hash-verified

1950 *
1951 */
1952static int
1953bridge_enqueue(struct bridge_softc *sc, struct ifnet *dst_ifp, struct mbuf *m)
1954{
1955 int len, err = 0;
1956 short mflags;
1957 struct mbuf *m0;
1958
1959 /* We may be sending a fragment so traverse the mbuf */
1960 for (; m; m = m0) {
1961 m0 = m->m_nextpkt;
1962 m->m_nextpkt = NULL;
1963 len = m->m_pkthdr.len;
1964 mflags = m->m_flags;
1965
1966 /*
1967 * If underlying interface can not do VLAN tag insertion itself
1968 * then attach a packet tag that holds it.
1969 */
1970 if ((m->m_flags & M_VLANTAG) &&
1971 (dst_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) {
1972 m = ether_vlanencap(m, m->m_pkthdr.ether_vtag);
1973 if (m == NULL) {
1974 if_printf(dst_ifp,
1975 "unable to prepend VLAN header\n");
1976 if_inc_counter(dst_ifp, IFCOUNTER_OERRORS, 1);
1977 continue;
1978 }
1979 m->m_flags &= ~M_VLANTAG;
1980 }
1981
1982 M_ASSERTPKTHDR(m); /* We shouldn't transmit mbuf without pkthdr */
1983 if ((err = dst_ifp->if_transmit(dst_ifp, m))) {
1984 m_freem(m0);
1985 if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
1986 break;
1987 }
1988
1989 if_inc_counter(sc->sc_ifp, IFCOUNTER_OPACKETS, 1);
1990 if_inc_counter(sc->sc_ifp, IFCOUNTER_OBYTES, len);
1991 if (mflags & M_MCAST)
1992 if_inc_counter(sc->sc_ifp, IFCOUNTER_OMCASTS, 1);
1993 }
1994
1995 return (err);
1996}
1997
1998/*
1999 * bridge_dummynet:

Callers 6

bridge_dummynetFunction · 0.85
bridge_outputFunction · 0.85
bridge_transmitFunction · 0.85
bridge_forwardFunction · 0.85
bridge_broadcastFunction · 0.85
bridge_spanFunction · 0.85

Calls 4

if_printfFunction · 0.85
if_inc_counterFunction · 0.85
ether_vlanencapFunction · 0.70
m_freemFunction · 0.50

Tested by

no test coverage detected