Lines Matching defs:lp

270         struct lagg_port        *lp;
278 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
279 EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
292 struct lagg_port *lp;
300 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
301 EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
392 struct lagg_port *lp;
403 while ((lp = SLIST_FIRST(&sc->sc_ports)) != NULL)
404 lagg_port_destroy(lp, 1);
438 struct lagg_port lp;
455 bzero(&lp, sizeof(lp));
456 lp.lp_ifp = sc->sc_ifp;
457 lp.lp_softc = sc;
459 lagg_port_lladdr(&lp, lladdr);
465 struct lagg_port *lp;
475 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
476 cap &= lp->lp_ifp->if_capabilities;
477 ena &= lp->lp_ifp->if_capenable;
478 hwa &= lp->lp_ifp->if_hwassist;
479 if_hw_tsomax_common(lp->lp_ifp, &hw_tsomax);
501 lagg_port_lladdr(struct lagg_port *lp, uint8_t *lladdr)
503 struct lagg_softc *sc = lp->lp_softc;
504 struct ifnet *ifp = lp->lp_ifp;
512 if (primary == 0 && (lp->lp_detaching ||
588 struct lagg_port *lp, *tlp;
600 lp = (struct lagg_port *)ifp->if_lagg;
601 if (lp->lp_softc == sc)
619 if ((lp = malloc(sizeof(struct lagg_port),
628 free(lp, M_DEVBUF);
632 lp->lp_flags |= LAGG_PORT_STACK;
636 free(lp, M_DEVBUF);
645 lp->lp_iftype = ifp->if_type;
647 ifp->if_lagg = lp;
648 lp->lp_ioctl = ifp->if_ioctl;
650 lp->lp_output = ifp->if_output;
653 lp->lp_ifp = ifp;
654 lp->lp_softc = sc;
657 bcopy(IF_LLADDR(ifp), lp->lp_lladdr, ETHER_ADDR_LEN);
660 sc->sc_primary = lp;
664 lagg_port_lladdr(lp, IF_LLADDR(sc->sc_ifp));
681 SLIST_INSERT_AFTER(tlp, lp, lp_entries);
683 SLIST_INSERT_HEAD(&sc->sc_ports, lp, lp_entries);
691 lagg_ether_cmdmulti(lp, 1);
692 lagg_setflags(lp, 1);
695 error = (*sc->sc_port_create)(lp);
698 lagg_port_destroy(lp, 0);
710 struct lagg_port *lp;
715 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
716 if (lp->lp_flags & LAGG_PORT_STACK) {
717 sc_ptr = (struct lagg_softc *)lp->lp_ifp->if_softc;
727 lagg_port_destroy(struct lagg_port *lp, int runpd)
729 struct lagg_softc *sc = lp->lp_softc;
732 struct ifnet *ifp = lp->lp_ifp;
737 (*sc->sc_port_destroy)(lp);
743 if (!lp->lp_detaching) {
744 lagg_ether_cmdmulti(lp, 0);
745 lagg_setflags(lp, 0);
746 lagg_port_lladdr(lp, lp->lp_lladdr);
750 ifp->if_type = lp->lp_iftype;
751 ifp->if_ioctl = lp->lp_ioctl;
752 ifp->if_output = lp->lp_output;
756 SLIST_REMOVE(&sc->sc_ports, lp, lagg_port, lp_entries);
760 if (lp == sc->sc_primary) {
778 if (lp->lp_detaching) {
789 if (lp->lp_ifflags)
792 free(lp, M_DEVBUF);
806 struct lagg_port *lp = NULL;
812 (lp = ifp->if_lagg) == NULL || (sc = lp->lp_softc) == NULL)
824 if ((lp = ifp->if_lagg) == NULL || lp->lp_softc != sc) {
830 lagg_port2req(lp, rp);
835 if (lp->lp_ioctl == NULL) {
839 error = (*lp->lp_ioctl)(ifp, cmd, data);
861 if (lp != NULL && lp->lp_ioctl != NULL)
862 return ((*lp->lp_ioctl)(ifp, cmd, data));
874 struct lagg_port *lp = ifp->if_lagg;
879 return ((*lp->lp_output)(ifp, m, dst, ro));
890 struct lagg_port *lp;
893 if ((lp = ifp->if_lagg) == NULL)
899 sc = lp->lp_softc;
902 lp->lp_detaching = 1;
903 lagg_port_destroy(lp, 1);
908 lagg_port2req(struct lagg_port *lp, struct lagg_reqport *rp)
910 struct lagg_softc *sc = lp->lp_softc;
913 strlcpy(rp->rp_portname, lp->lp_ifp->if_xname, sizeof(rp->rp_portname));
914 rp->rp_prio = lp->lp_prio;
915 rp->rp_flags = lp->lp_flags;
917 (*sc->sc_portreq)(lp, (caddr_t)&rp->rp_psc);
922 if (lp == sc->sc_primary)
924 if (lp == lagg_link_active(sc, sc->sc_primary))
931 if (LAGG_PORTACTIVE(lp))
937 if (lacp_isactive(lp))
939 if (lacp_iscollecting(lp))
941 if (lacp_isdistributing(lp))
952 struct lagg_port *lp;
962 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
963 lagg_port_lladdr(lp, IF_LLADDR(ifp));
996 struct lagg_port *lp;
1010 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
1025 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
1029 lagg_port2req(lp, &rpbuf);
1108 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
1109 ro->ro_active += LAGG_PORTACTIVE(lp);
1169 struct lacp_port *lp;
1194 LIST_FOREACH(lp, &lsc->lsc_ports, lp_next)
1195 lp->lp_state |= LACP_STATE_TIMEOUT;
1201 LIST_FOREACH(lp, &lsc->lsc_ports, lp_next)
1202 lp->lp_state &= ~LACP_STATE_TIMEOUT;
1234 if ((lp = (struct lagg_port *)tpif->if_lagg) == NULL ||
1235 lp->lp_softc != sc) {
1241 lagg_port2req(lp, rp);
1288 if ((lp = (struct lagg_port *)tpif->if_lagg) == NULL ||
1289 lp->lp_softc != sc) {
1295 error = lagg_port_destroy(lp, 1);
1301 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
1302 lagg_setflags(lp, 1);
1351 struct lagg_port *lp;
1355 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
1357 lagg_ether_cmdmulti(lp, 0);
1359 lagg_ether_cmdmulti(lp, 1);
1365 lagg_ether_cmdmulti(struct lagg_port *lp, int set)
1367 struct lagg_softc *sc = lp->lp_softc;
1368 struct ifnet *ifp = lp->lp_ifp;
1390 SLIST_INSERT_HEAD(&lp->lp_mc_head, mc, mc_entries);
1393 SLIST_FOREACH (mc, &lp->lp_mc_head, mc_entries) {
1400 while ((mc = SLIST_FIRST(&lp->lp_mc_head)) != NULL) {
1401 SLIST_REMOVE(&lp->lp_mc_head, mc, lagg_mc, mc_entries);
1402 if (mc->mc_ifma && !lp->lp_detaching)
1412 lagg_setflag(struct lagg_port *lp, int flag, int status,
1415 struct lagg_softc *sc = lp->lp_softc;
1417 struct ifnet *ifp = lp->lp_ifp;
1434 if (status != (lp->lp_ifflags & flag)) {
1438 lp->lp_ifflags &= ~flag;
1439 lp->lp_ifflags |= status;
1450 lagg_setflags(struct lagg_port *lp, int status)
1455 error = lagg_setflag(lp, lagg_pflags[i].flag,
1508 struct lagg_port *lp = ifp->if_lagg;
1509 struct lagg_softc *sc = lp->lp_softc;
1515 (lp->lp_flags & LAGG_PORT_DISABLED) ||
1524 m = (lp->lp_detaching == 0) ? (*sc->sc_input)(sc, lp, m) : NULL;
1556 struct lagg_port *lp;
1563 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
1564 if (LAGG_PORTACTIVE(lp))
1573 struct lagg_port *lp;
1578 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
1579 if (lp->lp_link_state == LINK_STATE_UP) {
1596 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
1597 speed += lp->lp_ifp->if_baudrate;
1609 struct lagg_port *lp = (struct lagg_port *)ifp->if_lagg;
1612 if (lp != NULL)
1613 sc = lp->lp_softc;
1620 (*sc->sc_linkstate)(lp);
1625 lagg_link_active(struct lagg_softc *sc, struct lagg_port *lp)
1635 if (lp == NULL)
1637 if (LAGG_PORTACTIVE(lp)) {
1638 rval = lp;
1641 if ((lp_next = SLIST_NEXT(lp, lp_entries)) != NULL &&
1820 struct lagg_port *lp;
1825 lp = SLIST_FIRST(&sc->sc_ports);
1827 lp = SLIST_NEXT(lp, lp_entries);
1833 if ((lp = lagg_link_active(sc, lp)) == NULL) {
1839 return (lagg_enqueue(lp->lp_ifp, m));
1843 lagg_rr_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m)
1876 struct lagg_port *lp;
1879 if ((lp = lagg_link_active(sc, sc->sc_primary)) == NULL) {
1885 return (lagg_enqueue(lp->lp_ifp, m));
1889 lagg_fail_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m)
1894 if (lp == sc->sc_primary || V_lagg_failover_rx_all) {
1905 if ((tmp_tp == NULL || tmp_tp == lp)) {
1921 struct lagg_port *lp;
1936 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
1937 lagg_lb_port_create(lp);
1951 lagg_lb_porttable(struct lagg_softc *sc, struct lagg_port *lp)
1959 if (lp_next == lp)
1973 lagg_lb_port_create(struct lagg_port *lp)
1975 struct lagg_softc *sc = lp->lp_softc;
1980 lagg_lb_port_destroy(struct lagg_port *lp)
1982 struct lagg_softc *sc = lp->lp_softc;
1983 lagg_lb_porttable(sc, lp);
1990 struct lagg_port *lp = NULL;
1999 lp = lb->lb_ports[p];
2005 if ((lp = lagg_link_active(sc, lp)) == NULL) {
2011 return (lagg_enqueue(lp->lp_ifp, m));
2015 lagg_lb_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m)
2031 struct lagg_port *lp;
2047 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
2048 lacp_port_create(lp);
2054 struct lagg_port *lp;
2057 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
2058 lacp_port_destroy(lp);
2072 struct lagg_port *lp;
2075 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
2076 lacp_port_destroy(lp);
2079 SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
2080 lacp_port_create(lp);
2086 struct lagg_port *lp;
2088 lp = lacp_select_tx_port(sc, m);
2089 if (lp == NULL) {
2095 return (lagg_enqueue(lp->lp_ifp, m));
2099 lagg_lacp_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m)
2110 m = lacp_input(lp, m);
2119 if (lacp_iscollecting(lp) == 0 || lacp_isactive(lp) == 0) {