Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/etherswitch/e6000sw/e6000sw.c
Show First 20 Lines • Show All 315 Lines • ▼ Show 20 Lines | e6000sw_init_interface(e6000sw_softc_t *sc, int port) | ||||
snprintf(name, IFNAMSIZ, "%sport", device_get_nameunit(sc->dev)); | snprintf(name, IFNAMSIZ, "%sport", device_get_nameunit(sc->dev)); | ||||
sc->ifp[port] = if_alloc(IFT_ETHER); | sc->ifp[port] = if_alloc(IFT_ETHER); | ||||
if (sc->ifp[port] == NULL) | if (sc->ifp[port] == NULL) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
sc->ifp[port]->if_softc = sc; | sc->ifp[port]->if_softc = sc; | ||||
sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | | sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST | | ||||
IFF_DRV_RUNNING | IFF_SIMPLEX; | IFF_DRV_RUNNING | IFF_SIMPLEX; | ||||
sc->ifname[port] = malloc(strlen(name) + 1, M_E6000SW, M_WAITOK); | sc->ifname[port] = malloc(strlen(name) + 1, M_E6000SW, M_NOWAIT); | ||||
if (sc->ifname[port] == NULL) | if (sc->ifname[port] == NULL) { | ||||
if_free(sc->ifp[port]); | |||||
return (ENOMEM); | return (ENOMEM); | ||||
} | |||||
memcpy(sc->ifname[port], name, strlen(name) + 1); | memcpy(sc->ifname[port], name, strlen(name) + 1); | ||||
if_initname(sc->ifp[port], sc->ifname[port], port); | if_initname(sc->ifp[port], sc->ifname[port], port); | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
e6000sw_attach_miibus(e6000sw_softc_t *sc, int port) | e6000sw_attach_miibus(e6000sw_softc_t *sc, int port) | ||||
▲ Show 20 Lines • Show All 842 Lines • Show Last 20 Lines |