kernel: add linux 5.10 support
[openwrt/staging/rmilecki.git] / target / linux / generic / pending-5.10 / 770-03-net-ethernet-mtk_eth_soc-fix-unnecessary-tx-queue-st.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 26 Aug 2020 16:55:54 +0200
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: fix unnecessary tx queue
4 stops
5
6 When running short on descriptors, only stop the queue for the netdev that tx
7 was attempted for. By the time the something tries to send on the other netdev,
8 the ring might have some more room already
9
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 ---
12
13 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
14 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
15 @@ -1130,17 +1130,6 @@ static void mtk_wake_queue(struct mtk_et
16 }
17 }
18
19 -static void mtk_stop_queue(struct mtk_eth *eth)
20 -{
21 - int i;
22 -
23 - for (i = 0; i < MTK_MAC_COUNT; i++) {
24 - if (!eth->netdev[i])
25 - continue;
26 - netif_stop_queue(eth->netdev[i]);
27 - }
28 -}
29 -
30 static netdev_tx_t mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
31 {
32 struct mtk_mac *mac = netdev_priv(dev);
33 @@ -1161,7 +1150,7 @@ static netdev_tx_t mtk_start_xmit(struct
34
35 tx_num = mtk_cal_txd_req(skb);
36 if (unlikely(atomic_read(&ring->free_count) <= tx_num)) {
37 - mtk_stop_queue(eth);
38 + netif_stop_queue(dev);
39 netif_err(eth, tx_queued, dev,
40 "Tx Ring full when queue awake!\n");
41 spin_unlock(&eth->page_lock);
42 @@ -1187,7 +1176,7 @@ static netdev_tx_t mtk_start_xmit(struct
43 goto drop;
44
45 if (unlikely(atomic_read(&ring->free_count) <= ring->thresh))
46 - mtk_stop_queue(eth);
47 + netif_stop_queue(dev);
48
49 spin_unlock(&eth->page_lock);
50