Do not re-enable interrupts if receive processing has used its entire budget.

As described in net/core/dev.c, function net_rx_action, drivers must not modify
the NAPI state if they consume their entire weight. Davinci EMAC driver was
re-enabling interrupts in the rare case that it has used its budget, and there
was now no more work to do.

Tested on DM644x EVM.
---
drivers/net/davinci_emac.c |   15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 89ff48b..b3017ef 100755
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2157,7 +2157,8 @@ static int emac_poll(struct napi_struct *napi, int budget)
       struct emac_priv *priv = container_of(napi, struct emac_priv, napi);
       struct net_device *ndev = priv->ndev;
       u32 status = 0;
-       u32 num_pkts = 0;
+       u32 num_txpkts = 0;
+       u32 num_rxpkts = 0;
       u32 txpending = 0;
       u32 rxpending = 0;

@@ -2173,7 +2174,7 @@ static int emac_poll(struct napi_struct *napi, int budget)
               mask = EMAC_DM646X_MAC_IN_VECTOR_TX_INT_VEC;

       if (status & mask) {
-               num_pkts = emac_tx_bdproc(priv, EMAC_DEF_TX_CH,
+               num_txpkts = emac_tx_bdproc(priv, EMAC_DEF_TX_CH,
                                         EMAC_DEF_TX_MAX_SERVICE,
                                         &txpending);
       } /* TX processing */
@@ -2184,7 +2185,7 @@ static int emac_poll(struct napi_struct *napi, int budget)
               mask = EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC;

       if (status & mask) {
-               num_pkts = emac_rx_bdproc(priv, EMAC_DEF_RX_CH,
+               num_rxpkts = emac_rx_bdproc(priv, EMAC_DEF_RX_CH,
                                         budget, &rxpending);
       } /* RX processing */

@@ -2194,8 +2195,10 @@ static int emac_poll(struct napi_struct *napi, int budget)
                       __netif_rx_schedule(&priv->napi);
               }
       } else {
-               netif_rx_complete(napi);
-               emac_int_enable(priv);
+               if (num_rxpkts != budget) {
+                       netif_rx_complete(napi);
+                       emac_int_enable(priv);
+               }
       }

       if (unlikely(status & EMAC_DM644X_MAC_IN_VECTOR_HOST_INT)) {
@@ -2226,7 +2229,7 @@ static int emac_poll(struct napi_struct *napi, int budget)
               }
       } /* Host error processing */

-       return num_pkts;
+       return num_rxpkts;
}


--
1.5.6.3


=======================================================================
This email, including any attachments, is only for the intended
addressee.  It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
altered or corrupted during transmission.
=======================================================================


_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to