Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/e1000/if_lem.c
Show First 20 Lines • Show All 537 Lines • ▼ Show 20 Lines | #endif /* BATCH_DISPATCH */ | ||||
adapter->min_frame_size = ETH_ZLEN + ETHERNET_FCS_SIZE; | adapter->min_frame_size = ETH_ZLEN + ETHERNET_FCS_SIZE; | ||||
/* | /* | ||||
* This controls when hardware reports transmit completion | * This controls when hardware reports transmit completion | ||||
* status. | * status. | ||||
*/ | */ | ||||
adapter->hw.mac.report_tx_early = 1; | adapter->hw.mac.report_tx_early = 1; | ||||
tsize = roundup2(adapter->num_tx_desc * sizeof(struct e1000_tx_desc), | /* | ||||
EM_DBA_ALIGN); | * It seems that the descriptor DMA engine on some PCI cards | ||||
* fetches memory past the end of the last descriptor in the | |||||
* ring. These reads are problematic when VT-d (DMAR) busdma | |||||
* is used. Allocate the scratch space to avoid getting | |||||
* faults from DMAR, by requesting scratch memory for one more | |||||
* descriptor. | |||||
*/ | |||||
tsize = roundup2((adapter->num_tx_desc + 1) * | |||||
sizeof(struct e1000_tx_desc), EM_DBA_ALIGN); | |||||
/* Allocate Transmit Descriptor ring */ | /* Allocate Transmit Descriptor ring */ | ||||
if (lem_dma_malloc(adapter, tsize, &adapter->txdma, BUS_DMA_NOWAIT)) { | if (lem_dma_malloc(adapter, tsize, &adapter->txdma, BUS_DMA_NOWAIT)) { | ||||
device_printf(dev, "Unable to allocate tx_desc memory\n"); | device_printf(dev, "Unable to allocate tx_desc memory\n"); | ||||
error = ENOMEM; | error = ENOMEM; | ||||
goto err_tx_desc; | goto err_tx_desc; | ||||
} | } | ||||
adapter->tx_desc_base = | adapter->tx_desc_base = | ||||
(struct e1000_tx_desc *)adapter->txdma.dma_vaddr; | (struct e1000_tx_desc *)adapter->txdma.dma_vaddr; | ||||
rsize = roundup2(adapter->num_rx_desc * sizeof(struct e1000_rx_desc), | /* | ||||
EM_DBA_ALIGN); | * See comment above txdma allocation for rationale behind +1. | ||||
*/ | |||||
rsize = roundup2((adapter->num_rx_desc + 1) * | |||||
sizeof(struct e1000_rx_desc), EM_DBA_ALIGN); | |||||
/* Allocate Receive Descriptor ring */ | /* Allocate Receive Descriptor ring */ | ||||
if (lem_dma_malloc(adapter, rsize, &adapter->rxdma, BUS_DMA_NOWAIT)) { | if (lem_dma_malloc(adapter, rsize, &adapter->rxdma, BUS_DMA_NOWAIT)) { | ||||
device_printf(dev, "Unable to allocate rx_desc memory\n"); | device_printf(dev, "Unable to allocate rx_desc memory\n"); | ||||
error = ENOMEM; | error = ENOMEM; | ||||
goto err_rx_desc; | goto err_rx_desc; | ||||
} | } | ||||
adapter->rx_desc_base = | adapter->rx_desc_base = | ||||
▲ Show 20 Lines • Show All 4,152 Lines • Show Last 20 Lines |