Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bge/if_bge.c
Show First 20 Lines • Show All 4,572 Lines • ▼ Show 20 Lines | bge_txeof(struct bge_softc *sc, uint16_t tx_cons) | ||||
if (sc->bge_txcnt == 0) | if (sc->bge_txcnt == 0) | ||||
sc->bge_timer = 0; | sc->bge_timer = 0; | ||||
} | } | ||||
#ifdef DEVICE_POLLING | #ifdef DEVICE_POLLING | ||||
static int | static int | ||||
bge_poll(if_t ifp, enum poll_cmd cmd, int count) | bge_poll(if_t ifp, enum poll_cmd cmd, int count) | ||||
{ | { | ||||
struct epoch_tracker et; | |||||
struct bge_softc *sc = if_getsoftc(ifp); | struct bge_softc *sc = if_getsoftc(ifp); | ||||
uint16_t rx_prod, tx_cons; | uint16_t rx_prod, tx_cons; | ||||
uint32_t statusword; | uint32_t statusword; | ||||
int rx_npkts = 0; | int rx_npkts = 0; | ||||
BGE_LOCK(sc); | BGE_LOCK(sc); | ||||
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { | if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { | ||||
BGE_UNLOCK(sc); | BGE_UNLOCK(sc); | ||||
Show All 21 Lines | bge_poll(if_t ifp, enum poll_cmd cmd, int count) | ||||
if (cmd == POLL_AND_CHECK_STATUS) | if (cmd == POLL_AND_CHECK_STATUS) | ||||
if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && | if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && | ||||
sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || | sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || | ||||
sc->bge_link_evt || (sc->bge_flags & BGE_FLAG_TBI)) | sc->bge_link_evt || (sc->bge_flags & BGE_FLAG_TBI)) | ||||
bge_link_upd(sc); | bge_link_upd(sc); | ||||
sc->rxcycles = count; | sc->rxcycles = count; | ||||
NET_EPOCH_ENTER(et); | |||||
rx_npkts = bge_rxeof(sc, rx_prod, 1); | rx_npkts = bge_rxeof(sc, rx_prod, 1); | ||||
NET_EPOCH_EXIT(et); | |||||
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { | if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { | ||||
BGE_UNLOCK(sc); | BGE_UNLOCK(sc); | ||||
return (rx_npkts); | return (rx_npkts); | ||||
} | } | ||||
bge_txeof(sc, tx_cons); | bge_txeof(sc, tx_cons); | ||||
if (!if_sendq_empty(ifp)) | if (!if_sendq_empty(ifp)) | ||||
bge_start_locked(ifp); | bge_start_locked(ifp); | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | if (!if_sendq_empty(ifp)) | ||||
bge_start_locked(ifp); | bge_start_locked(ifp); | ||||
} | } | ||||
BGE_UNLOCK(sc); | BGE_UNLOCK(sc); | ||||
} | } | ||||
static void | static void | ||||
bge_intr(void *xsc) | bge_intr(void *xsc) | ||||
{ | { | ||||
struct epoch_tracker et; | |||||
struct bge_softc *sc; | struct bge_softc *sc; | ||||
if_t ifp; | if_t ifp; | ||||
uint32_t statusword; | uint32_t statusword; | ||||
uint16_t rx_prod, tx_cons; | uint16_t rx_prod, tx_cons; | ||||
sc = xsc; | sc = xsc; | ||||
BGE_LOCK(sc); | BGE_LOCK(sc); | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | bus_dmamap_sync(sc->bge_cdata.bge_status_tag, | ||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); | BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); | ||||
if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && | if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && | ||||
sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || | sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || | ||||
statusword || sc->bge_link_evt) | statusword || sc->bge_link_evt) | ||||
bge_link_upd(sc); | bge_link_upd(sc); | ||||
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { | if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { | ||||
NET_EPOCH_ENTER(et); | |||||
/* Check RX return ring producer/consumer. */ | /* Check RX return ring producer/consumer. */ | ||||
bge_rxeof(sc, rx_prod, 1); | bge_rxeof(sc, rx_prod, 1); | ||||
NET_EPOCH_EXIT(et); | |||||
} | } | ||||
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { | if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { | ||||
/* Check TX ring producer/consumer. */ | /* Check TX ring producer/consumer. */ | ||||
bge_txeof(sc, tx_cons); | bge_txeof(sc, tx_cons); | ||||
} | } | ||||
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING && | if (if_getdrvflags(ifp) & IFF_DRV_RUNNING && | ||||
▲ Show 20 Lines • Show All 2,099 Lines • ▼ Show 20 Lines | bge_debugnet_transmit(if_t ifp, struct mbuf *m) | ||||
if (error == 0) | if (error == 0) | ||||
bge_start_tx(sc, prodidx); | bge_start_tx(sc, prodidx); | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
bge_debugnet_poll(if_t ifp, int count) | bge_debugnet_poll(if_t ifp, int count) | ||||
{ | { | ||||
struct epoch_tracker et; | |||||
struct bge_softc *sc; | struct bge_softc *sc; | ||||
uint32_t rx_prod, tx_cons; | uint32_t rx_prod, tx_cons; | ||||
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) | IFF_DRV_RUNNING) | ||||
return (1); | return (1); | ||||
bus_dmamap_sync(sc->bge_cdata.bge_status_tag, | bus_dmamap_sync(sc->bge_cdata.bge_status_tag, | ||||
sc->bge_cdata.bge_status_map, | sc->bge_cdata.bge_status_map, | ||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); | BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); | ||||
rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; | rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; | ||||
tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; | tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; | ||||
bus_dmamap_sync(sc->bge_cdata.bge_status_tag, | bus_dmamap_sync(sc->bge_cdata.bge_status_tag, | ||||
sc->bge_cdata.bge_status_map, | sc->bge_cdata.bge_status_map, | ||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); | BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); | ||||
NET_EPOCH_ENTER(et); | |||||
(void)bge_rxeof(sc, rx_prod, 0); | (void)bge_rxeof(sc, rx_prod, 0); | ||||
NET_EPOCH_EXIT(et); | |||||
bge_txeof(sc, tx_cons); | bge_txeof(sc, tx_cons); | ||||
return (0); | return (0); | ||||
} | } | ||||
#endif /* DEBUGNET */ | #endif /* DEBUGNET */ |