o) Clean up FPA pools on module unload.
o) Allocate output buffer pool based on available output queues. Submitted by: Bhanu Prakash (with modifications)
This commit is contained in:
parent
dea2d4206e
commit
64974004ec
@ -153,6 +153,19 @@ static inline void cvmx_fpa_enable(void)
|
||||
cvmx_write_csr(CVMX_FPA_CTL_STATUS, status.u64);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset FPA to disable. Make sure buffers from all FPA pools are freed
|
||||
* before disabling FPA.
|
||||
*/
|
||||
static inline void cvmx_fpa_disable(void)
|
||||
{
|
||||
cvmx_fpa_ctl_status_t status;
|
||||
|
||||
status.u64 = cvmx_read_csr(CVMX_FPA_CTL_STATUS);
|
||||
status.s.reset = 1;
|
||||
cvmx_write_csr(CVMX_FPA_CTL_STATUS, status.u64);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new block from the FPA
|
||||
*
|
||||
|
@ -98,6 +98,11 @@ struct ifnet *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
|
||||
*/
|
||||
static struct taskqueue *cvm_oct_link_taskq;
|
||||
|
||||
/*
|
||||
* Number of buffers in output buffer pool.
|
||||
*/
|
||||
static int cvm_oct_num_output_buffers;
|
||||
|
||||
/**
|
||||
* Function to update link status.
|
||||
*/
|
||||
@ -185,13 +190,13 @@ static void cvm_do_timer(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Configure common hardware for all interfaces
|
||||
*/
|
||||
static void cvm_oct_configure_common_hw(device_t bus)
|
||||
{
|
||||
struct octebus_softc *sc;
|
||||
int pko_queues;
|
||||
int error;
|
||||
int rid;
|
||||
|
||||
@ -199,13 +204,34 @@ static void cvm_oct_configure_common_hw(device_t bus)
|
||||
|
||||
/* Setup the FPA */
|
||||
cvmx_fpa_enable();
|
||||
cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE, num_packet_buffers);
|
||||
cvm_oct_mem_fill_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE, num_packet_buffers);
|
||||
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
|
||||
cvm_oct_mem_fill_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL, CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
|
||||
cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
|
||||
num_packet_buffers);
|
||||
cvm_oct_mem_fill_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
|
||||
num_packet_buffers);
|
||||
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL) {
|
||||
/*
|
||||
* If the FPA uses different pools for output buffers and
|
||||
* packets, size the output buffer pool based on the number
|
||||
* of PKO queues.
|
||||
*/
|
||||
if (OCTEON_IS_MODEL(OCTEON_CN38XX))
|
||||
pko_queues = 128;
|
||||
else if (OCTEON_IS_MODEL(OCTEON_CN3XXX))
|
||||
pko_queues = 32;
|
||||
else if (OCTEON_IS_MODEL(OCTEON_CN50XX))
|
||||
pko_queues = 32;
|
||||
else
|
||||
pko_queues = 256;
|
||||
|
||||
cvm_oct_num_output_buffers = 4 * pko_queues;
|
||||
cvm_oct_mem_fill_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
|
||||
CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE,
|
||||
cvm_oct_num_output_buffers);
|
||||
}
|
||||
|
||||
if (USE_RED)
|
||||
cvmx_helper_setup_red(num_packet_buffers/4, num_packet_buffers/8);
|
||||
cvmx_helper_setup_red(num_packet_buffers/4,
|
||||
num_packet_buffers/8);
|
||||
|
||||
/* Enable the MII interface */
|
||||
if (!octeon_is_simulation())
|
||||
@ -303,11 +329,13 @@ int cvm_oct_init_module(device_t bus)
|
||||
int num_ports = cvmx_helper_ports_on_interface(interface);
|
||||
int port;
|
||||
|
||||
for (port = cvmx_helper_get_ipd_port(interface, 0); port < cvmx_helper_get_ipd_port(interface, num_ports); port++) {
|
||||
for (port = 0; port < num_ports; port++) {
|
||||
cvmx_pip_prt_tagx_t pip_prt_tagx;
|
||||
pip_prt_tagx.u64 = cvmx_read_csr(CVMX_PIP_PRT_TAGX(port));
|
||||
int pkind = cvmx_helper_get_ipd_port(interface, port);
|
||||
|
||||
pip_prt_tagx.u64 = cvmx_read_csr(CVMX_PIP_PRT_TAGX(pkind));
|
||||
pip_prt_tagx.s.grp = pow_receive_group;
|
||||
cvmx_write_csr(CVMX_PIP_PRT_TAGX(port), pip_prt_tagx.u64);
|
||||
cvmx_write_csr(CVMX_PIP_PRT_TAGX(pkind), pip_prt_tagx.u64);
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,4 +503,13 @@ void cvm_oct_cleanup_module(void)
|
||||
cvm_oct_device[port] = NULL;
|
||||
}
|
||||
}
|
||||
/* Free the HW pools */
|
||||
cvm_oct_mem_empty_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE, num_packet_buffers);
|
||||
cvm_oct_mem_empty_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE, num_packet_buffers);
|
||||
|
||||
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
|
||||
cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL, CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, cvm_oct_num_output_buffers);
|
||||
|
||||
/* Disable FPA, all buffers are free, not done by helper shutdown. */
|
||||
cvmx_fpa_disable();
|
||||
}
|
||||
|
@ -45,5 +45,6 @@ AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR W
|
||||
#include <contrib/octeon-sdk/cvmx-helper.h>
|
||||
#include <contrib/octeon-sdk/cvmx-helper-board.h>
|
||||
#include <contrib/octeon-sdk/cvmx-interrupt.h>
|
||||
#include <contrib/octeon-sdk/octeon-model.h>
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user