35bad5d39e2c92a2ea2eb8bd3385b43071969aed
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.4 / 7021-net-Make-the-netdev-watchdog-aware-of-hardware-multi.patch
1 From 6aa1eca98ca44f515e10d8058d0ff6db3c8a3c11 Mon Sep 17 00:00:00 2001
2 From: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
3 Date: Fri, 28 Sep 2012 17:04:33 +0300
4 Subject: [PATCH 21/70] net: Make the netdev watchdog aware of hardware
5 multiqueue devices
6
7 If the netdev declares the NETIF_F_HW_ACCEL_MQ (accelerated multiqueue)
8 capability, tell the watchdog to consider the per-netdev trans_start
9 field rather than any individual multiqueue's timestamp. That is
10 justified by the fact that queues only go in and out of congestion
11 in groups, not individually, as far as the net device is concerned.
12
13 Change-Id: I07a6693bf1f0bb1e9396c5e232452223a511ecc1
14 Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
15 Reviewed-on: http://git.am.freescale.net:8181/1033
16 Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
17 Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
18 ---
19 net/sched/sch_generic.c | 17 ++++++++++++++++-
20 1 file changed, 16 insertions(+), 1 deletion(-)
21
22 --- a/net/sched/sch_generic.c
23 +++ b/net/sched/sch_generic.c
24 @@ -334,8 +334,23 @@ static void dev_watchdog(unsigned long a
25 txq = netdev_get_tx_queue(dev, i);
26 /*
27 * old device drivers set dev->trans_start
28 + *
29 + * (Actually, not only "old" devices, but also
30 + * those which perform queue management in a
31 + * separate hw accelerator. So even though the
32 + * net device itself is single-queued, it makes
33 + * sense (and is safe, too) to use kernel's
34 + * multiqueue interface, specifically to avoid
35 + * unnecessary device locking in SMP systems.
36 + * In this case, we ought to consider not an
37 + * individual txq's timestamp as a congestion
38 + * indicator, but the "old" per-netdev field.)
39 */
40 - trans_start = txq->trans_start ? : dev->trans_start;
41 + if (dev->features & NETIF_F_HW_ACCEL_MQ)
42 + trans_start = dev->trans_start;
43 + else
44 + trans_start = txq->trans_start ? :
45 + dev->trans_start;
46 if (netif_xmit_stopped(txq) &&
47 time_after(jiffies, (trans_start +
48 dev->watchdog_timeo))) {