aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/davinci_emac.c
diff options
context:
space:
mode:
authorSriram <srk@ti.com>2010-07-28 22:33:59 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-31 02:55:37 -0400
commit3725b1fe0b9c7e5ba3c4f6e585cd93a7174c1e07 (patch)
treed294d986150fbd08adf5ee219b714d6123c525e6 /drivers/net/davinci_emac.c
parent84da2658a619c2d96fae6741580879cc6d7a4cd1 (diff)
TI DaVinci EMAC: Fix asymmetric handling of packets in NAPI Poll function.
The current implementation of NAPI poll function in the driver does not service Rx packets, error condition even if a single Tx packet gets serviced in the napi poll call. This behavior severely affects performance for specific use cases. This patch modifies the poll function implementation to service tx/rx packets in an identical manner. Signed-off-by: Sriramakrishnan <srk@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/davinci_emac.c')
-rw-r--r--drivers/net/davinci_emac.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 28633761be21..2ebf1a1dd1e1 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