050-net-mvneta-fix-changing-MTU-when-using-per-cpu-proce.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. After enabling per-cpu processing it appeared that under heavy load
  5. changing MTU can result in blocking all port's interrupts and
  6. transmitting data is not possible after the change.
  7. This commit fixes above issue by disabling percpu interrupts for the
  8. time, when TXQs and RXQs are reconfigured.
  9. Signed-off-by: Marcin Wojtas <mw@semihalf.com>
  10. Signed-off-by: David S. Miller <davem@davemloft.net>
  11. ---
  12. --- a/drivers/net/ethernet/marvell/mvneta.c
  13. +++ b/drivers/net/ethernet/marvell/mvneta.c
  14. @@ -3045,6 +3045,20 @@ static int mvneta_check_mtu_valid(struct
  15. return mtu;
  16. }
  17. +static void mvneta_percpu_enable(void *arg)
  18. +{
  19. + struct mvneta_port *pp = arg;
  20. +
  21. + enable_percpu_irq(pp->dev->irq, IRQ_TYPE_NONE);
  22. +}
  23. +
  24. +static void mvneta_percpu_disable(void *arg)
  25. +{
  26. + struct mvneta_port *pp = arg;
  27. +
  28. + disable_percpu_irq(pp->dev->irq);
  29. +}
  30. +
  31. /* Change the device mtu */
  32. static int mvneta_change_mtu(struct net_device *dev, int mtu)
  33. {
  34. @@ -3069,6 +3083,7 @@ static int mvneta_change_mtu(struct net_
  35. * reallocation of the queues
  36. */
  37. mvneta_stop_dev(pp);
  38. + on_each_cpu(mvneta_percpu_disable, pp, true);
  39. mvneta_cleanup_txqs(pp);
  40. mvneta_cleanup_rxqs(pp);
  41. @@ -3092,6 +3107,7 @@ static int mvneta_change_mtu(struct net_
  42. return ret;
  43. }
  44. + on_each_cpu(mvneta_percpu_enable, pp, true);
  45. mvneta_start_dev(pp);
  46. netdev_update_features(dev);
  47. @@ -3244,20 +3260,6 @@ static void mvneta_mdio_remove(struct mv
  48. pp->phy_dev = NULL;
  49. }
  50. -static void mvneta_percpu_enable(void *arg)
  51. -{
  52. - struct mvneta_port *pp = arg;
  53. -
  54. - enable_percpu_irq(pp->dev->irq, IRQ_TYPE_NONE);
  55. -}
  56. -
  57. -static void mvneta_percpu_disable(void *arg)
  58. -{
  59. - struct mvneta_port *pp = arg;
  60. -
  61. - disable_percpu_irq(pp->dev->irq);
  62. -}
  63. -
  64. /* Electing a CPU must be done in an atomic way: it should be done
  65. * after or before the removal/insertion of a CPU and this function is
  66. * not reentrant.