summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorPrabhakar Kushwaha <prabhakar@freescale.com>2015-07-02 11:29:08 +0530
committerYork Sun <yorksun@freescale.com>2015-07-20 11:44:37 -0700
commit56c57cf7e9bc760d6d02b50f8d0b384fbb58d0fb (patch)
treef2cacc65f7a7f8f2c8343617cf9922554c51fe02 /drivers/net
parent0c7c87a4ac3bb532f785fb6a19f68dcc2a588d1c (diff)
downloadu-boot-imx-56c57cf7e9bc760d6d02b50f8d0b384fbb58d0fb.zip
u-boot-imx-56c57cf7e9bc760d6d02b50f8d0b384fbb58d0fb.tar.gz
u-boot-imx-56c57cf7e9bc760d6d02b50f8d0b384fbb58d0fb.tar.bz2
driver/ldpaa_eth:Avoid infinite loop in ldpaa_eth_rx
Change infinite loop mechanism to timer based polling for QBMAN release in ldpaa_eth_rx. Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ldpaa_eth/ldpaa_eth.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 6de5f30..50ca6e4 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -31,6 +31,8 @@ static void ldpaa_eth_rx(struct ldpaa_eth_priv *priv,
uint32_t fd_length;
struct ldpaa_fas *fas;
uint32_t status, err;
+ u32 timeo = (CONFIG_SYS_HZ * 2) / 1000;
+ u32 time_start;
struct qbman_release_desc releasedesc;
struct qbman_swp *swp = dflt_dpio->sw_portal;
@@ -65,10 +67,15 @@ error:
flush_dcache_range(fd_addr, fd_addr + LDPAA_ETH_RX_BUFFER_SIZE);
qbman_release_desc_clear(&releasedesc);
qbman_release_desc_set_bpid(&releasedesc, dflt_dpbp->dpbp_attr.bpid);
+ time_start = get_timer(0);
do {
/* Release buffer into the QBMAN */
err = qbman_swp_release(swp, &releasedesc, &fd_addr, 1);
- } while (err == -EBUSY);
+ } while (get_timer(time_start) < timeo && err == -EBUSY);
+
+ if (err == -EBUSY)
+ printf("Rx frame: QBMAN buffer release fails\n");
+
return;
}