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

Function lagg_lb_start

freebsd/net/if_lagg.c:2498–2525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2496}
2497
2498static int
2499lagg_lb_start(struct lagg_softc *sc, struct mbuf *m)
2500{
2501 struct lagg_lb *lb = (struct lagg_lb *)sc->sc_psc;
2502 struct lagg_port *lp = NULL;
2503 uint32_t p = 0;
2504
2505 if ((sc->sc_opts & LAGG_OPT_USE_FLOWID) &&
2506 M_HASHTYPE_GET(m) != M_HASHTYPE_NONE)
2507 p = m->m_pkthdr.flowid >> sc->flowid_shift;
2508 else
2509 p = m_ether_tcpip_hash(sc->sc_flags, m, lb->lb_key);
2510 p %= sc->sc_count;
2511 lp = lb->lb_ports[p];
2512
2513 /*
2514 * Check the port's link state. This will return the next active
2515 * port if the link is down or the port is NULL.
2516 */
2517 if ((lp = lagg_link_active(sc, lp)) == NULL) {
2518 if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
2519 m_freem(m);
2520 return (ENETDOWN);
2521 }
2522
2523 /* Send mbuf */
2524 return (lagg_enqueue(lp->lp_ifp, m));
2525}
2526
2527static struct mbuf *
2528lagg_lb_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m)

Callers

nothing calls this directly

Calls 5

m_ether_tcpip_hashFunction · 0.85
lagg_link_activeFunction · 0.85
if_inc_counterFunction · 0.85
lagg_enqueueFunction · 0.85
m_freemFunction · 0.50

Tested by

no test coverage detected