summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fman_port.c
diff options
context:
space:
mode:
authorMandy Lavi <mandy.lavi@freescale.com>2014-02-27 14:28:17 (GMT)
committerJose Rivera <German.Rivera@freescale.com>2014-03-07 17:34:38 (GMT)
commit8e33ce9cf3fffa49287c34d0d5a7e15ccf880c8f (patch)
tree16f73cb3cfe7b3858e77e8edce63a1d0dd99cb83 /drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fman_port.c
parent8b32a91deffcc4cded99b366449c8139eea39690 (diff)
downloadlinux-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/fman_port.c')
-rwxr-xr-xdrivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fman_port.c14
1 files changed, 9 insertions, 5 deletions
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;