7021-net-Make-the-netdev-watchdog-aware-of-hardware-multi.patch 2.0 KB

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