diff options
author | Ioana Radulescu <ruxandra.radulescu@freescale.com> | 2013-07-31 15:12:03 (GMT) |
---|---|---|
committer | Rivera Jose-B46482 <German.Rivera@freescale.com> | 2013-09-10 23:15:35 (GMT) |
commit | aecc09b49397ce49ddb4b8e77e938b814b20063c (patch) | |
tree | 0e31806c92f1c6fe459693abbfa572da8811d990 /drivers/net/ethernet/freescale/dpa | |
parent | bdd7f3bbbe9aa2168cc8a6f56feee9b295facedb (diff) | |
download | linux-fsl-qoriq-aecc09b49397ce49ddb4b8e77e938b814b20063c.tar.xz |
dpaa_eth: Refill global pool only when below threshold
Don't refill the Rx global pool every time it drops below its target
count, instead wait for the number of buffers to drop below a certain
threshold.
This was not so important until now, but is necessary in view of the
recycling mechanism.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@freescale.com>
Change-Id: I341f6bf7bd746465cf6d17644a4edbd1b3d20aba
Reviewed-on: http://git.am.freescale.net:8181/4189
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Bucur Madalin-Cristian-B32716 <madalin.bucur@freescale.com>
Reviewed-by: Rivera Jose-B46482 <German.Rivera@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/4464
Reviewed-by: Sovaiala Cristian-Constantin-B39531 <Cristian.Sovaiala@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/dpa')
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c index a2fd990..47b22e6 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c @@ -157,22 +157,23 @@ int dpaa_eth_refill_bpools(struct dpa_percpu_priv_s *percpu_priv) int count = *countptr; int new_bufs; - /* Add pages to the buffer pool */ - while (count < CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT) { - new_bufs = _dpa_bp_add_8_bufs(dpa_bp); - if (unlikely(!new_bufs)) { - /* Avoid looping forever if we've temporarily - * run out of memory. We'll try again at the next - * NAPI cycle. - */ - break; - } - count += new_bufs; - } - *countptr = count; + if (unlikely(count < CONFIG_FSL_DPAA_ETH_REFILL_THRESHOLD)) { + do { + new_bufs = _dpa_bp_add_8_bufs(dpa_bp); + if (unlikely(!new_bufs)) { + /* Avoid looping forever if we've temporarily + * run out of memory. We'll try again at the + * next NAPI cycle. + */ + break; + } + count += new_bufs; + } while (count < CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT); - if (unlikely(*countptr < CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT)) - return -ENOMEM; + *countptr = count; + if (unlikely(count < CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT)) + return -ENOMEM; + } return 0; } |