Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bxe/bxe.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | |||||
* to associate with a bus type | * to associate with a bus type | ||||
*/ | */ | ||||
static devclass_t bxe_devclass; | static devclass_t bxe_devclass; | ||||
MODULE_DEPEND(bxe, pci, 1, 1, 1); | MODULE_DEPEND(bxe, pci, 1, 1, 1); | ||||
MODULE_DEPEND(bxe, ether, 1, 1, 1); | MODULE_DEPEND(bxe, ether, 1, 1, 1); | ||||
DRIVER_MODULE(bxe, pci, bxe_driver, bxe_devclass, 0, 0); | DRIVER_MODULE(bxe, pci, bxe_driver, bxe_devclass, 0, 0); | ||||
NETDUMP_DEFINE(bxe); | DEBUGNET_DEFINE(bxe); | ||||
/* resources needed for unloading a previously loaded device */ | /* resources needed for unloading a previously loaded device */ | ||||
#define BXE_PREV_WAIT_NEEDED 1 | #define BXE_PREV_WAIT_NEEDED 1 | ||||
struct mtx bxe_prev_mtx; | struct mtx bxe_prev_mtx; | ||||
MTX_SYSINIT(bxe_prev_mtx, &bxe_prev_mtx, "bxe_prev_lock", MTX_DEF); | MTX_SYSINIT(bxe_prev_mtx, &bxe_prev_mtx, "bxe_prev_lock", MTX_DEF); | ||||
struct bxe_prev_list_node { | struct bxe_prev_list_node { | ||||
LIST_ENTRY(bxe_prev_list_node) node; | LIST_ENTRY(bxe_prev_list_node) node; | ||||
▲ Show 20 Lines • Show All 12,870 Lines • ▼ Show 20 Lines | /* XXX */ | ||||
if_setsendqready(ifp); | if_setsendqready(ifp); | ||||
/* XXX */ | /* XXX */ | ||||
sc->ifp = ifp; | sc->ifp = ifp; | ||||
/* attach to the Ethernet interface list */ | /* attach to the Ethernet interface list */ | ||||
ether_ifattach(ifp, sc->link_params.mac_addr); | ether_ifattach(ifp, sc->link_params.mac_addr); | ||||
/* Attach driver netdump methods. */ | /* Attach driver debugnet methods. */ | ||||
NETDUMP_SET(ifp, bxe); | DEBUGNET_SET(ifp, bxe); | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
bxe_deallocate_bars(struct bxe_softc *sc) | bxe_deallocate_bars(struct bxe_softc *sc) | ||||
{ | { | ||||
int i; | int i; | ||||
▲ Show 20 Lines • Show All 6,391 Lines • ▼ Show 20 Lines | switch(cmd) { | ||||
default: | default: | ||||
break; | break; | ||||
} | } | ||||
return (rval); | return (rval); | ||||
} | } | ||||
#ifdef NETDUMP | #ifdef DEBUGNET | ||||
static void | static void | ||||
bxe_netdump_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) | bxe_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) | ||||
{ | { | ||||
struct bxe_softc *sc; | struct bxe_softc *sc; | ||||
sc = if_getsoftc(ifp); | sc = if_getsoftc(ifp); | ||||
BXE_CORE_LOCK(sc); | BXE_CORE_LOCK(sc); | ||||
*nrxr = sc->num_queues; | *nrxr = sc->num_queues; | ||||
*ncl = NETDUMP_MAX_IN_FLIGHT; | *ncl = DEBUGNET_MAX_IN_FLIGHT; | ||||
*clsize = sc->fp[0].mbuf_alloc_size; | *clsize = sc->fp[0].mbuf_alloc_size; | ||||
BXE_CORE_UNLOCK(sc); | BXE_CORE_UNLOCK(sc); | ||||
} | } | ||||
static void | static void | ||||
bxe_netdump_event(struct ifnet *ifp __unused, enum netdump_ev event __unused) | bxe_debugnet_event(struct ifnet *ifp __unused, enum debugnet_ev event __unused) | ||||
{ | { | ||||
} | } | ||||
static int | static int | ||||
bxe_netdump_transmit(struct ifnet *ifp, struct mbuf *m) | bxe_debugnet_transmit(struct ifnet *ifp, struct mbuf *m) | ||||
{ | { | ||||
struct bxe_softc *sc; | struct bxe_softc *sc; | ||||
int error; | int error; | ||||
sc = if_getsoftc(ifp); | sc = if_getsoftc(ifp); | ||||
if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != | if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != | ||||
IFF_DRV_RUNNING || !sc->link_vars.link_up) | IFF_DRV_RUNNING || !sc->link_vars.link_up) | ||||
return (ENOENT); | return (ENOENT); | ||||
error = bxe_tx_encap(&sc->fp[0], &m); | error = bxe_tx_encap(&sc->fp[0], &m); | ||||
if (error != 0 && m != NULL) | if (error != 0 && m != NULL) | ||||
m_freem(m); | m_freem(m); | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
bxe_netdump_poll(struct ifnet *ifp, int count) | bxe_debugnet_poll(struct ifnet *ifp, int count) | ||||
{ | { | ||||
struct bxe_softc *sc; | struct bxe_softc *sc; | ||||
int i; | int i; | ||||
sc = if_getsoftc(ifp); | sc = if_getsoftc(ifp); | ||||
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 || | if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 || | ||||
!sc->link_vars.link_up) | !sc->link_vars.link_up) | ||||
return (ENOENT); | return (ENOENT); | ||||
for (i = 0; i < sc->num_queues; i++) | for (i = 0; i < sc->num_queues; i++) | ||||
(void)bxe_rxeof(sc, &sc->fp[i]); | (void)bxe_rxeof(sc, &sc->fp[i]); | ||||
(void)bxe_txeof(sc, &sc->fp[0]); | (void)bxe_txeof(sc, &sc->fp[0]); | ||||
return (0); | return (0); | ||||
} | } | ||||
#endif /* NETDUMP */ | #endif /* DEBUGNET */ |