aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/nic.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-02-14 20:58:49 -0500
committerBen Hutchings <bhutchings@solarflare.com>2012-02-15 19:25:12 -0500
commit28e47c498a931200125e299e9d60d22e27b4ab0d (patch)
tree871e75c4db7e670c2ceaed7b5fd69b9ef9a5f4c4 /drivers/net/ethernet/sfc/nic.c
parenta9a52506277275b73955504bf4df745502a28b8b (diff)
sfc: Allocate SRAM between buffer table and descriptor caches at init time
Each port has a block of 64-bit SRAM that is divided between buffer table and descriptor cache regions at initialisation time. Currently we use a fixed allocation, but it needs to be changed to support larger numbers of queues. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc/nic.c')
-rw-r--r--drivers/net/ethernet/sfc/nic.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c
index 2bdfb6374ce8..747cf9439164 100644
--- a/drivers/net/ethernet/sfc/nic.c
+++ b/drivers/net/ethernet/sfc/nic.c
@@ -1609,6 +1609,23 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)
1609 free_irq(efx->legacy_irq, efx); 1609 free_irq(efx->legacy_irq, efx);
1610} 1610}
1611 1611
1612void efx_nic_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw)
1613{
1614 unsigned vi_count, buftbl_min;
1615
1616 /* Account for the buffer table entries backing the datapath channels
1617 * and the descriptor caches for those channels.
1618 */
1619 buftbl_min = ((efx->n_rx_channels * EFX_MAX_DMAQ_SIZE +
1620 efx->n_tx_channels * EFX_TXQ_TYPES * EFX_MAX_DMAQ_SIZE +
1621 efx->n_channels * EFX_MAX_EVQ_SIZE)
1622 * sizeof(efx_qword_t) / EFX_BUF_SIZE);
1623 vi_count = max(efx->n_channels, efx->n_tx_channels * EFX_TXQ_TYPES);
1624
1625 efx->tx_dc_base = sram_lim_qw - vi_count * TX_DC_ENTRIES;
1626 efx->rx_dc_base = efx->tx_dc_base - vi_count * RX_DC_ENTRIES;
1627}
1628
1612u32 efx_nic_fpga_ver(struct efx_nic *efx) 1629u32 efx_nic_fpga_ver(struct efx_nic *efx)
1613{ 1630{
1614 efx_oword_t altera_build; 1631 efx_oword_t altera_build;
@@ -1621,11 +1638,9 @@ void efx_nic_init_common(struct efx_nic *efx)
1621 efx_oword_t temp; 1638 efx_oword_t temp;
1622 1639
1623 /* Set positions of descriptor caches in SRAM. */ 1640 /* Set positions of descriptor caches in SRAM. */
1624 EFX_POPULATE_OWORD_1(temp, FRF_AZ_SRM_TX_DC_BASE_ADR, 1641 EFX_POPULATE_OWORD_1(temp, FRF_AZ_SRM_TX_DC_BASE_ADR, efx->tx_dc_base);
1625 efx->type->tx_dc_base / 8);
1626 efx_writeo(efx, &temp, FR_AZ_SRM_TX_DC_CFG); 1642 efx_writeo(efx, &temp, FR_AZ_SRM_TX_DC_CFG);
1627 EFX_POPULATE_OWORD_1(temp, FRF_AZ_SRM_RX_DC_BASE_ADR, 1643 EFX_POPULATE_OWORD_1(temp, FRF_AZ_SRM_RX_DC_BASE_ADR, efx->rx_dc_base);
1628 efx->type->rx_dc_base / 8);
1629 efx_writeo(efx, &temp, FR_AZ_SRM_RX_DC_CFG); 1644 efx_writeo(efx, &temp, FR_AZ_SRM_RX_DC_CFG);
1630 1645
1631 /* Set TX descriptor cache size. */ 1646 /* Set TX descriptor cache size. */