Lines Matching defs:lsc

256 	struct lacp_softc *lsc = lp->lp_lsc;
311 LACP_LOCK(lsc);
313 LACP_UNLOCK(lsc);
447 struct lacp_softc *lsc = lp->lp_lsc;
460 LACP_LOCK(lsc);
485 LACP_UNLOCK(lsc);
491 struct lacp_softc *lsc = arg;
494 LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) {
505 callout_reset(&lsc->lsc_callout, hz, lacp_tick, lsc);
512 struct lacp_softc *lsc = LACP_SOFTC(sc);
542 LACP_LOCK(lsc);
546 lp->lp_lsc = lsc;
549 LIST_INSERT_HEAD(&lsc->lsc_ports, lp, lp_next);
558 LACP_UNLOCK(lsc);
568 struct lacp_softc *lsc = lp->lp_lsc;
571 LACP_LOCK(lsc);
585 LACP_UNLOCK(lsc);
593 struct lacp_softc *lsc = LACP_SOFTC(sc);
603 if (NULL == lsc)
606 la = lsc->lsc_active_aggregator;
607 LACP_LOCK(lsc);
625 LACP_UNLOCK(lsc);
633 struct lacp_softc *lsc = lp->lp_lsc;
635 LACP_LOCK(lsc);
651 LACP_UNLOCK(lsc);
672 struct lacp_softc *lsc = lp->lp_lsc;
673 struct lagg_softc *sc = lsc->lsc_softc;
676 LACP_LOCK_ASSERT(lsc);
695 if (lsc->lsc_active_aggregator == la) {
696 lacp_suppress_distributing(lsc, la);
697 lacp_select_active_aggregator(lsc);
699 lacp_update_portmap(lsc);
709 struct lacp_softc *lsc = lp->lp_lsc;
710 struct lagg_softc *sc = lsc->lsc_softc;
713 LACP_LOCK_ASSERT(lsc);
731 if (lsc->lsc_active_aggregator == la) {
732 lacp_suppress_distributing(lsc, la);
733 lacp_update_portmap(lsc);
736 lacp_select_active_aggregator(lsc);
742 struct lacp_softc *lsc = vp;
744 LACP_LOCK_ASSERT(lsc);
748 lsc->lsc_suppress_distributing = FALSE;
752 lacp_attach_sysctl(struct lacp_softc *lsc, struct sysctl_oid *p_oid)
754 struct lagg_softc *sc = lsc->lsc_softc;
759 &lsc->lsc_strict_mode,
760 lsc->lsc_strict_mode,
765 lacp_attach_sysctl_debug(struct lacp_softc *lsc, struct sysctl_oid *p_oid)
767 struct lagg_softc *sc = lsc->lsc_softc;
777 &lsc->lsc_debug.lsc_rx_test,
778 lsc->lsc_debug.lsc_rx_test,
783 &lsc->lsc_debug.lsc_tx_test,
784 lsc->lsc_debug.lsc_tx_test,
791 struct lacp_softc *lsc;
794 lsc = malloc(sizeof(struct lacp_softc),
796 if (lsc == NULL)
799 sc->sc_psc = (caddr_t)lsc;
800 lsc->lsc_softc = sc;
802 lsc->lsc_hashkey = arc4random();
803 lsc->lsc_active_aggregator = NULL;
804 lsc->lsc_strict_mode = 1;
805 LACP_LOCK_INIT(lsc);
806 TAILQ_INIT(&lsc->lsc_aggregators);
807 LIST_INIT(&lsc->lsc_ports);
814 lacp_attach_sysctl(lsc, oid);
815 lacp_attach_sysctl_debug(lsc, oid);
817 callout_init_mtx(&lsc->lsc_transit_callout, &lsc->lsc_mtx, 0);
818 callout_init_mtx(&lsc->lsc_callout, &lsc->lsc_mtx, 0);
830 struct lacp_softc *lsc = LACP_SOFTC(sc);
832 KASSERT(TAILQ_EMPTY(&lsc->lsc_aggregators),
834 KASSERT(lsc->lsc_active_aggregator == NULL,
838 callout_drain(&lsc->lsc_transit_callout);
839 callout_drain(&lsc->lsc_callout);
841 LACP_LOCK_DESTROY(lsc);
842 free(lsc, M_DEVBUF);
849 struct lacp_softc *lsc = LACP_SOFTC(sc);
851 LACP_LOCK(lsc);
852 callout_reset(&lsc->lsc_callout, hz, lacp_tick, lsc);
853 LACP_UNLOCK(lsc);
859 struct lacp_softc *lsc = LACP_SOFTC(sc);
861 LACP_LOCK(lsc);
862 callout_stop(&lsc->lsc_transit_callout);
863 callout_stop(&lsc->lsc_callout);
864 LACP_UNLOCK(lsc);
870 struct lacp_softc *lsc = LACP_SOFTC(sc);
875 if (__predict_false(lsc->lsc_suppress_distributing)) {
880 pm = &lsc->lsc_pmap[lsc->lsc_activemap];
890 hash = lagg_hashmbuf(sc, m, lsc->lsc_hashkey);
905 lacp_suppress_distributing(struct lacp_softc *lsc, struct lacp_aggregator *la)
909 if (lsc->lsc_active_aggregator != la) {
915 lsc->lsc_suppress_distributing = TRUE;
918 LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) {
924 callout_reset(&lsc->lsc_transit_callout,
925 LACP_TRANSIT_DELAY * hz / 1000, lacp_transit_expire, lsc);
978 lacp_select_active_aggregator(struct lacp_softc *lsc)
987 TAILQ_FOREACH(la, &lsc->lsc_aggregators, la_q) {
1008 la == lsc->lsc_active_aggregator)) {
1019 if (lsc->lsc_active_aggregator != best_la) {
1022 lacp_format_lagid_aggregator(lsc->lsc_active_aggregator,
1030 if (lsc->lsc_active_aggregator != best_la) {
1031 lsc->lsc_active_aggregator = best_la;
1032 lacp_update_portmap(lsc);
1034 lacp_suppress_distributing(lsc, best_la);
1044 lacp_update_portmap(struct lacp_softc *lsc)
1046 struct lagg_softc *sc = lsc->lsc_softc;
1054 newmap = lsc->lsc_activemap == 0 ? 1 : 0;
1055 p = &lsc->lsc_pmap[newmap];
1056 la = lsc->lsc_active_aggregator;
1071 atomic_store_rel_int(&lsc->lsc_activemap, newmap);
1073 lsc->lsc_activemap,
1074 lsc->lsc_pmap[lsc->lsc_activemap].pm_count));
1192 lacp_aggregator_addref(struct lacp_softc *lsc, struct lacp_aggregator *la)
1208 lacp_aggregator_delref(struct lacp_softc *lsc, struct lacp_aggregator *la)
1225 KASSERT(lsc->lsc_active_aggregator != la, ("aggregator active"));
1227 TAILQ_REMOVE(&lsc->lsc_aggregators, la, la_q);
1237 lacp_aggregator_get(struct lacp_softc *lsc, struct lacp_port *lp)
1247 TAILQ_INSERT_TAIL(&lsc->lsc_aggregators, la, la_q);
1343 struct lacp_softc *lsc = lp->lp_lsc;
1358 TAILQ_FOREACH(la, &lsc->lsc_aggregators, la_q) {
1365 la = lacp_aggregator_get(lsc, lp);
1381 lacp_aggregator_addref(lsc, la);
1399 struct lacp_softc *lsc = lp->lp_lsc;
1410 lacp_aggregator_delref(lsc, la);
1865 struct lacp_softc *lsc = lp->lp_lsc;
1926 LACP_LOCK(lsc);
1929 if (lsc->lsc_suppress_distributing) {
1931 LIST_FOREACH(lp2, &lsc->lsc_ports, lp_next) {
1941 lsc->lsc_suppress_distributing = FALSE;
1944 LACP_UNLOCK(lsc);