Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/e1000/if_em.c
Show First 20 Lines • Show All 1,202 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* return 0 on success, positive on failure | * return 0 on success, positive on failure | ||||
**********************************************************************/ | **********************************************************************/ | ||||
static void | static void | ||||
em_if_init(if_ctx_t ctx) | em_if_init(if_ctx_t ctx) | ||||
{ | { | ||||
struct adapter *adapter = iflib_get_softc(ctx); | struct adapter *adapter = iflib_get_softc(ctx); | ||||
if_softc_ctx_t scctx = adapter->shared; | |||||
struct ifnet *ifp = iflib_get_ifp(ctx); | struct ifnet *ifp = iflib_get_ifp(ctx); | ||||
struct em_tx_queue *tx_que; | struct em_tx_queue *tx_que; | ||||
int i; | int i; | ||||
INIT_DEBUGOUT("em_if_init: begin"); | INIT_DEBUGOUT("em_if_init: begin"); | ||||
/* Get the latest mac address, User can use a LAA */ | /* Get the latest mac address, User can use a LAA */ | ||||
bcopy(if_getlladdr(ifp), adapter->hw.mac.addr, | bcopy(if_getlladdr(ifp), adapter->hw.mac.addr, | ||||
ETHER_ADDR_LEN); | ETHER_ADDR_LEN); | ||||
Show All 16 Lines | em_if_init(if_ctx_t ctx) | ||||
/* Initialize the hardware */ | /* Initialize the hardware */ | ||||
em_reset(ctx); | em_reset(ctx); | ||||
em_if_update_admin_status(ctx); | em_if_update_admin_status(ctx); | ||||
for (i = 0, tx_que = adapter->tx_queues; i < adapter->tx_num_queues; i++, tx_que++) { | for (i = 0, tx_que = adapter->tx_queues; i < adapter->tx_num_queues; i++, tx_que++) { | ||||
struct tx_ring *txr = &tx_que->txr; | struct tx_ring *txr = &tx_que->txr; | ||||
txr->tx_rs_cidx = txr->tx_rs_pidx = txr->tx_cidx_processed = 0; | txr->tx_rs_cidx = txr->tx_rs_pidx; | ||||
/* Initialize the last processed descriptor to be the end of | |||||
* the ring, rather than the start, so that we avoid an | |||||
* off-by-one error when calculating how many descriptors are | |||||
* done in the credits_update function. | |||||
*/ | |||||
txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; | |||||
} | } | ||||
/* Setup VLAN support, basic and offload if available */ | /* Setup VLAN support, basic and offload if available */ | ||||
E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); | E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); | ||||
/* Clear bad data from Rx FIFOs */ | /* Clear bad data from Rx FIFOs */ | ||||
if (adapter->hw.mac.type >= igb_mac_min) | if (adapter->hw.mac.type >= igb_mac_min) | ||||
e1000_rx_fifo_flush_82575(&adapter->hw); | e1000_rx_fifo_flush_82575(&adapter->hw); | ||||
▲ Show 20 Lines • Show All 3,290 Lines • Show Last 20 Lines |