>From d6c3bc9c282eadfa754bd78e7c7447a200dd1737 Mon Sep 17 00:00:00 2001 Message-Id: From: Jose Abreu Date: Tue, 11 Sep 2018 10:15:31 +0200 Subject: [PATCH] fixup_coalesce_4 Signed-off-by: Jose Abreu --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 31 ++++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f6587ee372ab..b6d661f17bd7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1857,17 +1857,14 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv) * @queue: TX queue index * Description: it reclaims the transmit resources after transmission completes. */ -static int stmmac_tx_clean(struct stmmac_priv *priv, int limit, u32 queue, - bool *more) +static bool stmmac_tx_clean(struct stmmac_priv *priv, u32 queue) { struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue]; unsigned int bytes_compl = 0, pkts_compl = 0; + bool has_more = false; unsigned int entry; - netif_tx_lock(priv->dev); - - if (more) - *more = false; + netif_tx_lock_bh(priv->dev); priv->xstats.tx_clean++; @@ -1956,12 +1953,12 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int limit, u32 queue, mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(eee_timer)); } - if (more && (tx_q->dirty_tx != tx_q->cur_tx)) - *more = true; + if (tx_q->dirty_tx != tx_q->cur_tx) + has_more = true; - netif_tx_unlock(priv->dev); + netif_tx_unlock_bh(priv->dev); - return pkts_compl; + return has_more; } /** @@ -2257,10 +2254,9 @@ static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue) static void stmmac_tx_timer(struct timer_list *t) { struct stmmac_tx_queue *tx_q = from_timer(tx_q, t, txtimer); - struct stmmac_priv *priv = tx_q->priv_data; - bool more; - stmmac_tx_clean(priv, ~0, tx_q->queue_index, &more); + if (likely(napi_schedule_prep(&tx_q->napi))) + __napi_schedule(&tx_q->napi); } /** @@ -3562,15 +3558,14 @@ static int stmmac_tx_poll(struct napi_struct *napi, int budget) container_of(napi, struct stmmac_tx_queue, napi); struct stmmac_priv *priv = tx_q->priv_data; u32 chan = tx_q->queue_index; - int work_done = 0; priv->xstats.napi_poll++; - work_done = stmmac_tx_clean(priv, budget, chan, NULL); - if (work_done < budget) - napi_complete_done(napi, work_done); + if (stmmac_tx_clean(priv, chan)) + return budget; - return min(work_done, budget); + napi_complete_done(napi, 0); + return 0; } /** -- 2.7.4