diff options
-rw-r--r-- | drivers/net/davinci_emac.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 28633761be2..2ebf1a1dd1e 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -2266,7 +2266,7 @@ static int emac_poll(struct napi_struct *napi, int budget) | |||
2266 | struct net_device *ndev = priv->ndev; | 2266 | struct net_device *ndev = priv->ndev; |
2267 | struct device *emac_dev = &ndev->dev; | 2267 | struct device *emac_dev = &ndev->dev; |
2268 | u32 status = 0; | 2268 | u32 status = 0; |
2269 | u32 num_pkts = 0; | 2269 | u32 num_tx_pkts = 0, num_rx_pkts = 0; |
2270 | 2270 | ||
2271 | /* Check interrupt vectors and call packet processing */ | 2271 | /* Check interrupt vectors and call packet processing */ |
2272 | status = emac_read(EMAC_MACINVECTOR); | 2272 | status = emac_read(EMAC_MACINVECTOR); |
@@ -2277,27 +2277,19 @@ static int emac_poll(struct napi_struct *napi, int budget) | |||
2277 | mask = EMAC_DM646X_MAC_IN_VECTOR_TX_INT_VEC; | 2277 | mask = EMAC_DM646X_MAC_IN_VECTOR_TX_INT_VEC; |
2278 | 2278 | ||
2279 | if (status & mask) { | 2279 | if (status & mask) { |
2280 | num_pkts = emac_tx_bdproc(priv, EMAC_DEF_TX_CH, | 2280 | num_tx_pkts = emac_tx_bdproc(priv, EMAC_DEF_TX_CH, |
2281 | EMAC_DEF_TX_MAX_SERVICE); | 2281 | EMAC_DEF_TX_MAX_SERVICE); |
2282 | } /* TX processing */ | 2282 | } /* TX processing */ |
2283 | 2283 | ||
2284 | if (num_pkts) | ||
2285 | return budget; | ||
2286 | |||
2287 | mask = EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC; | 2284 | mask = EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC; |
2288 | 2285 | ||
2289 | if (priv->version == EMAC_VERSION_2) | 2286 | if (priv->version == EMAC_VERSION_2) |
2290 | mask = EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC; | 2287 | mask = EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC; |
2291 | 2288 | ||
2292 | if (status & mask) { | 2289 | if (status & mask) { |
2293 | num_pkts = emac_rx_bdproc(priv, EMAC_DEF_RX_CH, budget); | 2290 | num_rx_pkts = emac_rx_bdproc(priv, EMAC_DEF_RX_CH, budget); |
2294 | } /* RX processing */ | 2291 | } /* RX processing */ |
2295 | 2292 | ||
2296 | if (num_pkts < budget) { | ||
2297 | napi_complete(napi); | ||
2298 | emac_int_enable(priv); | ||
2299 | } | ||
2300 | |||
2301 | mask = EMAC_DM644X_MAC_IN_VECTOR_HOST_INT; | 2293 | mask = EMAC_DM644X_MAC_IN_VECTOR_HOST_INT; |
2302 | if (priv->version == EMAC_VERSION_2) | 2294 | if (priv->version == EMAC_VERSION_2) |
2303 | mask = EMAC_DM646X_MAC_IN_VECTOR_HOST_INT; | 2295 | mask = EMAC_DM646X_MAC_IN_VECTOR_HOST_INT; |
@@ -2328,9 +2320,12 @@ static int emac_poll(struct napi_struct *napi, int budget) | |||
2328 | dev_err(emac_dev, "RX Host error %s on ch=%d\n", | 2320 | dev_err(emac_dev, "RX Host error %s on ch=%d\n", |
2329 | &emac_rxhost_errcodes[cause][0], ch); | 2321 | &emac_rxhost_errcodes[cause][0], ch); |
2330 | } | 2322 | } |
2331 | } /* Host error processing */ | 2323 | } else if (num_rx_pkts < budget) { |
2324 | napi_complete(napi); | ||
2325 | emac_int_enable(priv); | ||
2326 | } | ||
2332 | 2327 | ||
2333 | return num_pkts; | 2328 | return num_rx_pkts; |
2334 | } | 2329 | } |
2335 | 2330 | ||
2336 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2331 | #ifdef CONFIG_NET_POLL_CONTROLLER |