Skip to content

Commit 52b6a4f

Browse files
Ioana Radulescudavem330
authored andcommitted
dpaa2-eth: Poll Tx pending frames counter on if down
Starting with firmware version MC10.18.0, a new counter for in flight Tx frames is offered. Use it when bringing down the interface to determine when all pending Tx frames have been processed by hardware instead of sleeping a fixed amount of time. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d84c3a4 commit 52b6a4f

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ static u32 ingress_fq_count(struct dpaa2_eth_priv *priv)
13481348
return total;
13491349
}
13501350

1351-
static void wait_for_fq_empty(struct dpaa2_eth_priv *priv)
1351+
static void wait_for_ingress_fq_empty(struct dpaa2_eth_priv *priv)
13521352
{
13531353
int retries = 10;
13541354
u32 pending;
@@ -1360,6 +1360,31 @@ static void wait_for_fq_empty(struct dpaa2_eth_priv *priv)
13601360
} while (pending && --retries);
13611361
}
13621362

1363+
#define DPNI_TX_PENDING_VER_MAJOR 7
1364+
#define DPNI_TX_PENDING_VER_MINOR 13
1365+
static void wait_for_egress_fq_empty(struct dpaa2_eth_priv *priv)
1366+
{
1367+
union dpni_statistics stats;
1368+
int retries = 10;
1369+
int err;
1370+
1371+
if (dpaa2_eth_cmp_dpni_ver(priv, DPNI_TX_PENDING_VER_MAJOR,
1372+
DPNI_TX_PENDING_VER_MINOR) < 0)
1373+
goto out;
1374+
1375+
do {
1376+
err = dpni_get_statistics(priv->mc_io, 0, priv->mc_token, 6,
1377+
&stats);
1378+
if (err)
1379+
goto out;
1380+
if (stats.page_6.tx_pending_frames == 0)
1381+
return;
1382+
} while (--retries);
1383+
1384+
out:
1385+
msleep(500);
1386+
}
1387+
13631388
static int dpaa2_eth_stop(struct net_device *net_dev)
13641389
{
13651390
struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
@@ -1379,7 +1404,7 @@ static int dpaa2_eth_stop(struct net_device *net_dev)
13791404
* on WRIOP. After it finishes, wait until all remaining frames on Rx
13801405
* and Tx conf queues are consumed on NAPI poll.
13811406
*/
1382-
msleep(500);
1407+
wait_for_egress_fq_empty(priv);
13831408

13841409
do {
13851410
dpni_disable(priv->mc_io, 0, priv->mc_token);
@@ -1395,7 +1420,7 @@ static int dpaa2_eth_stop(struct net_device *net_dev)
13951420
*/
13961421
}
13971422

1398-
wait_for_fq_empty(priv);
1423+
wait_for_ingress_fq_empty(priv);
13991424
disable_ch_napi(priv);
14001425

14011426
/* Empty the buffer pool */

0 commit comments

Comments
 (0)