diff options
author | Ioana Radulescu <ruxandra.radulescu@freescale.com> | 2013-06-21 20:51:00 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-07-22 21:52:34 (GMT) |
commit | b0dbadb589c333361e388ece255626531ce60fd2 (patch) | |
tree | 7ac6e2b60a411a960e3ad38bda1b83f0e10bd14d /drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c | |
parent | 4a1b7311877aca691af8b6f5704256a26555e584 (diff) | |
download | linux-fsl-qoriq-b0dbadb589c333361e388ece255626531ce60fd2.tar.xz |
dpaa_eth: Handle buffer pool depletion
If the system gets into an out-of-memory state, we are unable to
refill the default buffer pool with new buffers. While this lasts,
just release any incoming frame back to the pool without further
processing.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@freescale.com>
Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
Change-Id: Ia7cd0979adfa2d5c6f5be88017ed2bd0bfd202f8
Reviewed-on: http://git.am.freescale.net:8181/3335
Reviewed-by: Radulescu Ruxandra Ioana-B05472 <ruxandra.radulescu@freescale.com>
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Sovaiala Cristian-Constantin-B39531 <Cristian.Sovaiala@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c')
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c index 32086d4..7f0e870 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c @@ -159,7 +159,7 @@ void dpa_make_private_pool(struct dpa_bp *dpa_bp) * Add buffers/(pages) for Rx processing whenever bpool count falls below * REFILL_THRESHOLD. */ -void dpaa_eth_refill_bpools(struct dpa_percpu_priv_s *percpu_priv) +int dpaa_eth_refill_bpools(struct dpa_percpu_priv_s *percpu_priv) { int *countptr = percpu_priv->dpa_bp_count; int count = *countptr; @@ -179,6 +179,11 @@ void dpaa_eth_refill_bpools(struct dpa_percpu_priv_s *percpu_priv) count += new_pages; } *countptr = count; + + if (unlikely(*countptr < CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT)) + return -ENOMEM; + + return 0; } /* Cleanup function for outgoing frame descriptors that were built on Tx path, |