aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/mediatek/mtk_eth_soc.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index a4982e497ea6..4ebc42e0271a 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -684,6 +684,28 @@ static inline int mtk_cal_txd_req(struct sk_buff *skb)
684 return nfrags; 684 return nfrags;
685} 685}
686 686
687static void mtk_wake_queue(struct mtk_eth *eth)
688{
689 int i;
690
691 for (i = 0; i < MTK_MAC_COUNT; i++) {
692 if (!eth->netdev[i])
693 continue;
694 netif_wake_queue(eth->netdev[i]);
695 }
696}
697
698static void mtk_stop_queue(struct mtk_eth *eth)
699{
700 int i;
701
702 for (i = 0; i < MTK_MAC_COUNT; i++) {
703 if (!eth->netdev[i])
704 continue;
705 netif_stop_queue(eth->netdev[i]);
706 }
707}
708
687static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev) 709static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
688{ 710{
689 struct mtk_mac *mac = netdev_priv(dev); 711 struct mtk_mac *mac = netdev_priv(dev);
@@ -695,7 +717,7 @@ static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
695 717
696 tx_num = mtk_cal_txd_req(skb); 718 tx_num = mtk_cal_txd_req(skb);
697 if (unlikely(atomic_read(&ring->free_count) <= tx_num)) { 719 if (unlikely(atomic_read(&ring->free_count) <= tx_num)) {
698 netif_stop_queue(dev); 720 mtk_stop_queue(eth);
699 netif_err(eth, tx_queued, dev, 721 netif_err(eth, tx_queued, dev,
700 "Tx Ring full when queue awake!\n"); 722 "Tx Ring full when queue awake!\n");
701 return NETDEV_TX_BUSY; 723 return NETDEV_TX_BUSY;
@@ -720,10 +742,10 @@ static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
720 goto drop; 742 goto drop;
721 743
722 if (unlikely(atomic_read(&ring->free_count) <= ring->thresh)) { 744 if (unlikely(atomic_read(&ring->free_count) <= ring->thresh)) {
723 netif_stop_queue(dev); 745 mtk_stop_queue(eth);
724 if (unlikely(atomic_read(&ring->free_count) > 746 if (unlikely(atomic_read(&ring->free_count) >
725 ring->thresh)) 747 ring->thresh))
726 netif_wake_queue(dev); 748 mtk_wake_queue(eth);
727 } 749 }
728 750
729 return NETDEV_TX_OK; 751 return NETDEV_TX_OK;
@@ -897,13 +919,8 @@ static int mtk_poll_tx(struct mtk_eth *eth, int budget, bool *tx_again)
897 if (!total) 919 if (!total)
898 return 0; 920 return 0;
899 921
900 for (i = 0; i < MTK_MAC_COUNT; i++) { 922 if (atomic_read(&ring->free_count) > ring->thresh)
901 if (!eth->netdev[i] || 923 mtk_wake_queue(eth);
902 unlikely(!netif_queue_stopped(eth->netdev[i])))
903 continue;
904 if (atomic_read(&ring->free_count) > ring->thresh)
905 netif_wake_queue(eth->netdev[i]);
906 }
907 924
908 return total; 925 return total;
909} 926}