summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorMugunthan V N <mugunthanvnm@ti.com>2014-09-10 15:08:09 +0400
committerDavid S. Miller <davem@davemloft.net>2014-09-11 00:59:34 +0400
commita0e2c822bf0a1095dc250b5875e39ac0662a5df6 (patch)
tree2222391d87a780d1260bd2486b6abfd5f0477040 /drivers/net/ethernet
parented3bfdfdced76aa7edb0b05c0d739ee3a2a6e619 (diff)
downloadlinux-a0e2c822bf0a1095dc250b5875e39ac0662a5df6.tar.xz
drivers: net: cpsw: dual_emac: fix reducing of rx descriptor during ifdown
In Dual EMAC, when both interface are up and while doing ifdown with heavy traffic then skbs already processed by DMA from that slave emac has to be requeued as still the other interface is up and running. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/ti/cpsw.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 999fb72688d2..411232f07c3f 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -699,6 +699,28 @@ static void cpsw_rx_handler(void *token, int len, int status)
cpsw_dual_emac_src_port_detect(status, priv, ndev, skb);
if (unlikely(status < 0) || unlikely(!netif_running(ndev))) {
+ bool ndev_status = false;
+ struct cpsw_slave *slave = priv->slaves;
+ int n;
+
+ if (priv->data.dual_emac) {
+ /* In dual emac mode check for all interfaces */
+ for (n = priv->data.slaves; n; n--, slave++)
+ if (netif_running(slave->ndev))
+ ndev_status = true;
+ }
+
+ if (ndev_status && (status >= 0)) {
+ /* The packet received is for the interface which
+ * is already down and the other interface is up
+ * and running, intead of freeing which results
+ * in reducing of the number of rx descriptor in
+ * DMA engine, requeue skb back to cpdma.
+ */
+ new_skb = skb;
+ goto requeue;
+ }
+
/* the interface is going down, skbs are purged */
dev_kfree_skb_any(skb);
return;
@@ -717,6 +739,7 @@ static void cpsw_rx_handler(void *token, int len, int status)
new_skb = skb;
}
+requeue:
ret = cpdma_chan_submit(priv->rxch, new_skb, new_skb->data,
skb_tailroom(new_skb), 0);
if (WARN_ON(ret < 0))