Commit 4ae0169f authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller

net: stmmac: Do not keep rearming the coalesce timer in stmmac_xmit

This is cutting down performance. Once the timer is armed it should run
after the time expires for the first packet sent and not the last one.

After this change, running iperf, the performance gain is +/- 24%.
Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Vitor Soares <soares@synopsys.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67e1c406
...@@ -105,6 +105,7 @@ struct stmmac_priv { ...@@ -105,6 +105,7 @@ struct stmmac_priv {
u32 tx_count_frames; u32 tx_count_frames;
u32 tx_coal_frames; u32 tx_coal_frames;
u32 tx_coal_timer; u32 tx_coal_timer;
bool tx_timer_armed;
int tx_coalesce; int tx_coalesce;
int hwts_tx_en; int hwts_tx_en;
......
...@@ -3158,13 +3158,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -3158,13 +3158,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
* element in case of no SG. * element in case of no SG.
*/ */
priv->tx_count_frames += nfrags + 1; priv->tx_count_frames += nfrags + 1;
if (likely(priv->tx_coal_frames > priv->tx_count_frames)) { if (likely(priv->tx_coal_frames > priv->tx_count_frames) &&
!priv->tx_timer_armed) {
mod_timer(&priv->txtimer, mod_timer(&priv->txtimer,
STMMAC_COAL_TIMER(priv->tx_coal_timer)); STMMAC_COAL_TIMER(priv->tx_coal_timer));
priv->tx_timer_armed = true;
} else { } else {
priv->tx_count_frames = 0; priv->tx_count_frames = 0;
stmmac_set_tx_ic(priv, desc); stmmac_set_tx_ic(priv, desc);
priv->xstats.tx_set_ic_bit++; priv->xstats.tx_set_ic_bit++;
priv->tx_timer_armed = false;
} }
skb_tx_timestamp(skb); skb_tx_timestamp(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment