diff options
author | Mandy Lavi <mandy.lavi@freescale.com> | 2014-02-27 14:28:17 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-03-07 17:34:38 (GMT) |
commit | 8e33ce9cf3fffa49287c34d0d5a7e15ccf880c8f (patch) | |
tree | 16f73cb3cfe7b3858e77e8edce63a1d0dd99cb83 /drivers/net/ethernet/freescale/fman/Peripherals/FM/Port | |
parent | 8b32a91deffcc4cded99b366449c8139eea39690 (diff) | |
download | linux-fsl-qoriq-8e33ce9cf3fffa49287c34d0d5a7e15ccf880c8f.tar.xz |
fmd: adjust allocation of fifo resources for fmanv3l
Change-Id: I249456d0f157547fab221286e1c18e59ce5345d3
Signed-off-by: Mandy Lavi <mandy.lavi@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/9257
Reviewed-by: Igal Liberman <Igal.Liberman@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Tested-by: Jose Rivera <German.Rivera@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/9448
Diffstat (limited to 'drivers/net/ethernet/freescale/fman/Peripherals/FM/Port')
3 files changed, 13 insertions, 10 deletions
diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c index 4949b79..9924d3b 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c @@ -405,7 +405,7 @@ static t_Error VerifySizeOfFifo(t_FmPort *p_FmPort) /* Verify the size */ if (p_FmPort->fifoBufs.num < minFifoSizeRequired) - DBG(INFO, ("FIFO size is %d and should be enlarged to %d bytes", p_FmPort->fifoBufs.num, minFifoSizeRequired)); + RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("FIFO size should be enlarged to %d bytes", minFifoSizeRequired)); else if (p_FmPort->fifoBufs.num < optFifoSizeForB2B) DBG(INFO, ("For back-to-back frames processing, FIFO size may need to be enlarged to %d bytes", optFifoSizeForB2B)); @@ -2450,7 +2450,7 @@ t_Error FM_PORT_Init(t_Handle h_FmPort) if (p_FmPort->deepSleepVars.autoResMaxSizes) FmPortConfigAutoResForDeepSleepSupport1(p_FmPort); - + return E_OK; } diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h index 7568258..58369a8 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h @@ -147,8 +147,8 @@ #else /* (DPAA_VERSION < 11) */ /* Defaults are registers' reset values */ -#define DEFAULT_PORT_rxFifoPriElevationLevel (256 * KILOBYTE) -#define DEFAULT_PORT_rxFifoThreshold (256 * KILOBYTE) +#define DEFAULT_PORT_rxFifoPriElevationLevel MAX_PORT_FIFO_SIZE +#define DEFAULT_PORT_rxFifoThreshold MAX_PORT_FIFO_SIZE #define DEFAULT_PORT_txFifoMinFillLevel 0 #define DEFAULT_PORT_txFifoLowComfLevel (5 * KILOBYTE) @@ -863,7 +863,6 @@ typedef struct t_FmPortDsarVars { uint32_t fmbm_rfpne; bool dsarEnabledParser; } t_FmPortDsarVars; - typedef struct { struct fman_port port; t_Handle h_Fm; diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fman_port.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fman_port.c index 2e4ff3b..c748a16 100755 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fman_port.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fman_port.c @@ -724,7 +724,9 @@ static uint8_t fman_port_find_bpool(struct fman_port *port, uint8_t bpid) /* Find the pool */ bp_reg = port->bmi_regs->rx.fmbm_ebmpi; - for (i = 0; i < port->ext_pools_num; i++) { + for (i = 0; + (i < port->ext_pools_num && (i < FMAN_PORT_MAX_EXT_POOLS_NUM)); + i++) { tmp = ioread32be(&bp_reg[i]); id = (uint8_t)((tmp & BMI_EXT_BUF_POOL_ID_MASK) >> BMI_EXT_BUF_POOL_ID_SHIFT); @@ -916,7 +918,9 @@ int fman_port_set_bpools(const struct fman_port *port, if (rx_port) { /* Check buffers are provided in ascending order */ - for (i = 0; i < (bp->count-1); i++) { + for (i = 0; + (i < (bp->count-1) && (i < FMAN_PORT_MAX_EXT_POOLS_NUM - 1)); + i++) { if (bp->bpool[i].size > bp->bpool[i+1].size) return -EINVAL; } @@ -1291,7 +1295,7 @@ int fman_port_set_bpool_cnt_mode(struct fman_port *port, /* Find the pool */ index = fman_port_find_bpool(port, bpid); - if (index == port->ext_pools_num) + if (index == port->ext_pools_num || index == FMAN_PORT_MAX_EXT_POOLS_NUM) /* Not found */ return -EINVAL; @@ -1465,7 +1469,7 @@ uint32_t fman_port_get_bpool_counter(struct fman_port *port, uint8_t bpid) /* Find the pool */ index = fman_port_find_bpool(port, bpid); - if (index == port->ext_pools_num) + if (index == port->ext_pools_num || index == FMAN_PORT_MAX_EXT_POOLS_NUM) /* Not found */ return 0; @@ -1489,7 +1493,7 @@ void fman_port_set_bpool_counter(struct fman_port *port, /* Find the pool */ index = fman_port_find_bpool(port, bpid); - if (index == port->ext_pools_num) + if (index == port->ext_pools_num || index == FMAN_PORT_MAX_EXT_POOLS_NUM) /* Not found */ return; |