Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_lagg.c
Show First 20 Lines • Show All 673 Lines • ▼ Show 20 Lines | lagg_port_create(struct lagg_softc *sc, struct ifnet *ifp) | ||||
LAGG_XLOCK_ASSERT(sc); | LAGG_XLOCK_ASSERT(sc); | ||||
if (sc->sc_ifp == ifp) { | if (sc->sc_ifp == ifp) { | ||||
if_printf(sc->sc_ifp, | if_printf(sc->sc_ifp, | ||||
"cannot add a lagg to itself as a port\n"); | "cannot add a lagg to itself as a port\n"); | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
if (sc->sc_destroying == 1) | |||||
return (ENXIO); | |||||
/* Limit the maximal number of lagg ports */ | /* Limit the maximal number of lagg ports */ | ||||
if (sc->sc_count >= LAGG_MAX_PORTS) | if (sc->sc_count >= LAGG_MAX_PORTS) | ||||
return (ENOSPC); | return (ENOSPC); | ||||
/* Check if port has already been associated to a lagg */ | /* Check if port has already been associated to a lagg */ | ||||
if (ifp->if_lagg != NULL) { | if (ifp->if_lagg != NULL) { | ||||
/* Port is already in the current lagg? */ | /* Port is already in the current lagg? */ | ||||
lp = (struct lagg_port *)ifp->if_lagg; | lp = (struct lagg_port *)ifp->if_lagg; | ||||
▲ Show 20 Lines • Show All 495 Lines • ▼ Show 20 Lines | lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) | ||||
struct ifreq *ifr = (struct ifreq *)data; | struct ifreq *ifr = (struct ifreq *)data; | ||||
struct lagg_port *lp; | struct lagg_port *lp; | ||||
struct ifnet *tpif; | struct ifnet *tpif; | ||||
struct thread *td = curthread; | struct thread *td = curthread; | ||||
char *buf, *outbuf; | char *buf, *outbuf; | ||||
int count, buflen, len, error = 0, oldmtu; | int count, buflen, len, error = 0, oldmtu; | ||||
bzero(&rpbuf, sizeof(rpbuf)); | bzero(&rpbuf, sizeof(rpbuf)); | ||||
/* XXX: This can race with lagg_clone_destroy. */ | |||||
switch (cmd) { | switch (cmd) { | ||||
case SIOCGLAGG: | case SIOCGLAGG: | ||||
LAGG_XLOCK(sc); | LAGG_XLOCK(sc); | ||||
buflen = sc->sc_count * sizeof(struct lagg_reqport); | buflen = sc->sc_count * sizeof(struct lagg_reqport); | ||||
outbuf = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO); | outbuf = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO); | ||||
ra->ra_proto = sc->sc_proto; | ra->ra_proto = sc->sc_proto; | ||||
lagg_proto_request(sc, &ra->ra_psc); | lagg_proto_request(sc, &ra->ra_psc); | ||||
▲ Show 20 Lines • Show All 1,223 Lines • Show Last 20 Lines |