333-v4.20-0002-brcmfmac-fix-for-proper-support-of-160MHz-bandwidth.patch 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. From: Arend van Spriel <arend.vanspriel@broadcom.com>
  2. Date: Wed, 5 Sep 2018 09:48:58 +0200
  3. Subject: [PATCH] brcmfmac: fix for proper support of 160MHz bandwidth
  4. Decoding of firmware channel information was not complete for 160MHz
  5. support. This resulted in the following warning:
  6. WARNING: CPU: 2 PID: 2222 at .../broadcom/brcm80211/brcmutil/d11.c:196
  7. brcmu_d11ac_decchspec+0x2e/0x100 [brcmutil]
  8. Modules linked in: brcmfmac(O) brcmutil(O) sha256_generic cfg80211 ...
  9. CPU: 2 PID: 2222 Comm: kworker/2:0 Tainted: G O
  10. 4.17.0-wt-testing-x64-00002-gf1bed50 #1
  11. Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  12. Workqueue: events request_firmware_work_func
  13. RIP: 0010:brcmu_d11ac_decchspec+0x2e/0x100 [brcmutil]
  14. RSP: 0018:ffffc90000047bd0 EFLAGS: 00010206
  15. RAX: 000000000000e832 RBX: ffff8801146fe910 RCX: ffff8801146fd3c0
  16. RDX: 0000000000002800 RSI: 0000000000000070 RDI: ffffc90000047c30
  17. RBP: ffffc90000047bd0 R08: 0000000000000000 R09: ffffffffa0798c80
  18. R10: ffff88012bca55e0 R11: ffff880110a4ea00 R12: ffff8801146f8000
  19. R13: ffffc90000047c30 R14: ffff8801146fe930 R15: ffff8801138e02e0
  20. FS: 0000000000000000(0000) GS:ffff88012bc80000(0000) knlGS:0000000000000000
  21. CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  22. CR2: 00007f18ce8b8070 CR3: 000000000200a003 CR4: 00000000000206e0
  23. Call Trace:
  24. brcmf_setup_wiphybands+0x212/0x780 [brcmfmac]
  25. brcmf_cfg80211_attach+0xae2/0x11a0 [brcmfmac]
  26. brcmf_attach+0x1fc/0x4b0 [brcmfmac]
  27. ? __kmalloc+0x13c/0x1c0
  28. brcmf_pcie_setup+0x99b/0xe00 [brcmfmac]
  29. brcmf_fw_request_done+0x16a/0x1f0 [brcmfmac]
  30. request_firmware_work_func+0x36/0x60
  31. process_one_work+0x146/0x350
  32. worker_thread+0x4a/0x3b0
  33. kthread+0x102/0x140
  34. ? process_one_work+0x350/0x350
  35. ? kthread_bind+0x20/0x20
  36. ret_from_fork+0x35/0x40
  37. Code: 66 90 0f b7 07 55 48 89 e5 89 c2 88 47 02 88 47 03 66 81 e2 00 38
  38. 66 81 fa 00 18 74 6e 66 81 fa 00 20 74 39 66 81 fa 00 10 74 14 <0f>
  39. 0b 66 25 00 c0 74 20 66 3d 00 c0 75 20 c6 47 04 01 5d c3 66
  40. ---[ end trace 550c46682415b26d ]---
  41. brcmfmac: brcmf_construct_chaninfo: Ignoring unexpected firmware channel 50
  42. This patch adds the missing stuff to properly handle this.
  43. Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  44. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  45. Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  46. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  47. ---
  48. .../net/wireless/broadcom/brcm80211/brcmutil/d11.c | 34 +++++++++++++++++++++-
  49. .../broadcom/brcm80211/include/brcmu_wifi.h | 2 ++
  50. 2 files changed, 35 insertions(+), 1 deletion(-)
  51. --- a/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c
  52. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c
  53. @@ -77,6 +77,8 @@ static u16 d11ac_bw(enum brcmu_chan_bw b
  54. return BRCMU_CHSPEC_D11AC_BW_40;
  55. case BRCMU_CHAN_BW_80:
  56. return BRCMU_CHSPEC_D11AC_BW_80;
  57. + case BRCMU_CHAN_BW_160:
  58. + return BRCMU_CHSPEC_D11AC_BW_160;
  59. default:
  60. WARN_ON(1);
  61. }
  62. @@ -190,8 +192,38 @@ static void brcmu_d11ac_decchspec(struct
  63. break;
  64. }
  65. break;
  66. - case BRCMU_CHSPEC_D11AC_BW_8080:
  67. case BRCMU_CHSPEC_D11AC_BW_160:
  68. + switch (ch->sb) {
  69. + case BRCMU_CHAN_SB_LLL:
  70. + ch->control_ch_num -= CH_70MHZ_APART;
  71. + break;
  72. + case BRCMU_CHAN_SB_LLU:
  73. + ch->control_ch_num -= CH_50MHZ_APART;
  74. + break;
  75. + case BRCMU_CHAN_SB_LUL:
  76. + ch->control_ch_num -= CH_30MHZ_APART;
  77. + break;
  78. + case BRCMU_CHAN_SB_LUU:
  79. + ch->control_ch_num -= CH_10MHZ_APART;
  80. + break;
  81. + case BRCMU_CHAN_SB_ULL:
  82. + ch->control_ch_num += CH_10MHZ_APART;
  83. + break;
  84. + case BRCMU_CHAN_SB_ULU:
  85. + ch->control_ch_num += CH_30MHZ_APART;
  86. + break;
  87. + case BRCMU_CHAN_SB_UUL:
  88. + ch->control_ch_num += CH_50MHZ_APART;
  89. + break;
  90. + case BRCMU_CHAN_SB_UUU:
  91. + ch->control_ch_num += CH_70MHZ_APART;
  92. + break;
  93. + default:
  94. + WARN_ON_ONCE(1);
  95. + break;
  96. + }
  97. + break;
  98. + case BRCMU_CHSPEC_D11AC_BW_8080:
  99. default:
  100. WARN_ON_ONCE(1);
  101. break;
  102. --- a/drivers/net/wireless/broadcom/brcm80211/include/brcmu_wifi.h
  103. +++ b/drivers/net/wireless/broadcom/brcm80211/include/brcmu_wifi.h
  104. @@ -29,6 +29,8 @@
  105. #define CH_UPPER_SB 0x01
  106. #define CH_LOWER_SB 0x02
  107. #define CH_EWA_VALID 0x04
  108. +#define CH_70MHZ_APART 14
  109. +#define CH_50MHZ_APART 10
  110. #define CH_30MHZ_APART 6
  111. #define CH_20MHZ_APART 4
  112. #define CH_10MHZ_APART 2