kernel: update 4.4 to 4.4.89
[openwrt/openwrt.git] / target / linux / mvebu / patches-4.4 / 050-net-mvneta-fix-changing-MTU-when-using-per-cpu-proce.patch
1 From: Marcin Wojtas <mw@semihalf.com>
2 Date: Fri, 1 Apr 2016 15:21:18 +0200
3 Subject: [PATCH] net: mvneta: fix changing MTU when using per-cpu processing
4
5 After enabling per-cpu processing it appeared that under heavy load
6 changing MTU can result in blocking all port's interrupts and
7 transmitting data is not possible after the change.
8
9 This commit fixes above issue by disabling percpu interrupts for the
10 time, when TXQs and RXQs are reconfigured.
11
12 Signed-off-by: Marcin Wojtas <mw@semihalf.com>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 ---
15
16 --- a/drivers/net/ethernet/marvell/mvneta.c
17 +++ b/drivers/net/ethernet/marvell/mvneta.c
18 @@ -3040,6 +3040,20 @@ static int mvneta_check_mtu_valid(struct
19 return mtu;
20 }
21
22 +static void mvneta_percpu_enable(void *arg)
23 +{
24 + struct mvneta_port *pp = arg;
25 +
26 + enable_percpu_irq(pp->dev->irq, IRQ_TYPE_NONE);
27 +}
28 +
29 +static void mvneta_percpu_disable(void *arg)
30 +{
31 + struct mvneta_port *pp = arg;
32 +
33 + disable_percpu_irq(pp->dev->irq);
34 +}
35 +
36 /* Change the device mtu */
37 static int mvneta_change_mtu(struct net_device *dev, int mtu)
38 {
39 @@ -3064,6 +3078,7 @@ static int mvneta_change_mtu(struct net_
40 * reallocation of the queues
41 */
42 mvneta_stop_dev(pp);
43 + on_each_cpu(mvneta_percpu_disable, pp, true);
44
45 mvneta_cleanup_txqs(pp);
46 mvneta_cleanup_rxqs(pp);
47 @@ -3087,6 +3102,7 @@ static int mvneta_change_mtu(struct net_
48 return ret;
49 }
50
51 + on_each_cpu(mvneta_percpu_enable, pp, true);
52 mvneta_start_dev(pp);
53 mvneta_port_up(pp);
54
55 @@ -3240,20 +3256,6 @@ static void mvneta_mdio_remove(struct mv
56 pp->phy_dev = NULL;
57 }
58
59 -static void mvneta_percpu_enable(void *arg)
60 -{
61 - struct mvneta_port *pp = arg;
62 -
63 - enable_percpu_irq(pp->dev->irq, IRQ_TYPE_NONE);
64 -}
65 -
66 -static void mvneta_percpu_disable(void *arg)
67 -{
68 - struct mvneta_port *pp = arg;
69 -
70 - disable_percpu_irq(pp->dev->irq);
71 -}
72 -
73 /* Electing a CPU must be done in an atomic way: it should be done
74 * after or before the removal/insertion of a CPU and this function is
75 * not reentrant.