0044-ag71xx-Fix-rx-ring-buffer-stall-on-small-packets-flood-on-qca956x-and-qca953x.patch 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. From: Vittorio Gambaletta <openwrt@vittgam.net>
  2. Date: Sat, 25 Mar 2017 18:08:02 +0100
  3. Subject: ag71xx: Fix rx ring buffer stall on small packets flood on qca956x and qca953x.
  4. Backported from Code Aurora QSDK
  5. Signed-off-by: Vittorio Gambaletta <openwrt@vittgam.net>
  6. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
  7. index a8b19b68b2a46545fdd3ed6bdf14006f8a741185..427de6a50d0fcbc9dae11f8e6921194c0a5b09ed 100644
  8. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
  9. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
  10. @@ -996,6 +996,9 @@ void __init ath79_register_eth(unsigned int id)
  11. pdata->reset_bit = AR934X_RESET_GE0_MAC |
  12. AR934X_RESET_GE0_MDIO;
  13. pdata->set_speed = ar934x_set_speed_ge0;
  14. +
  15. + if (ath79_soc == ATH79_SOC_QCA9533)
  16. + pdata->disable_inline_checksum_engine = 1;
  17. } else {
  18. pdata->reset_bit = AR934X_RESET_GE1_MAC |
  19. AR934X_RESET_GE1_MDIO;
  20. @@ -1097,6 +1100,8 @@ void __init ath79_register_eth(unsigned int id)
  21. pdata->set_speed = qca956x_set_speed_sgmii;
  22. else
  23. pdata->set_speed = ar934x_set_speed_ge0;
  24. +
  25. + pdata->disable_inline_checksum_engine = 1;
  26. } else {
  27. pdata->reset_bit = QCA955X_RESET_GE1_MAC |
  28. QCA955X_RESET_GE1_MDIO;
  29. diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
  30. index 078fa157f242ce4350185d97a61ef5d1f3f16fc5..5fdc59c7b78b84670daefa9fd831b154ded84ddc 100644
  31. --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
  32. +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
  33. @@ -37,7 +37,7 @@ struct ag71xx_platform_data {
  34. u8 is_ar724x:1;
  35. u8 has_ar8216:1;
  36. u8 use_flow_control:1;
  37. - u8 is_qca956x:1;
  38. + u8 disable_inline_checksum_engine:1;
  39. struct ag71xx_switch_platform_data *switch_data;
  40. diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
  41. index 566e9513d8b7c6ef101902ae7d281dcc1c233893..72dd654a691355c881b15d796fad0d640e05fc15 100644
  42. --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
  43. +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
  44. @@ -629,6 +629,22 @@ __ag71xx_link_adjust(struct ag71xx *ag, bool update)
  45. ag71xx_wr(ag, AG71XX_REG_MAC_CFG2, cfg2);
  46. ag71xx_wr(ag, AG71XX_REG_FIFO_CFG5, fifo5);
  47. ag71xx_wr(ag, AG71XX_REG_MAC_IFCTL, ifctl);
  48. +
  49. + if (pdata->disable_inline_checksum_engine) {
  50. + /*
  51. + * The rx ring buffer can stall on small packets on QCA953x and
  52. + * QCA956x. Disabling the inline checksum engine fixes the stall.
  53. + * The wr, rr functions cannot be used since this hidden register
  54. + * is outside of the normal ag71xx register block.
  55. + */
  56. + void __iomem *dam = ioremap_nocache(0xb90001bc, 0x4);
  57. + if (dam) {
  58. + __raw_writel(__raw_readl(dam) & ~BIT(27), dam);
  59. + (void)__raw_readl(dam);
  60. + iounmap(dam);
  61. + }
  62. + }
  63. +
  64. ag71xx_hw_start(ag);
  65. netif_carrier_on(ag->dev);