351-0039-brcmfmac-ignore-11d-configuration-errors.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. From b3589dfe02123a0d0ea82076a9f8ef84a46852c0 Mon Sep 17 00:00:00 2001
  2. From: Hante Meuleman <hante.meuleman@broadcom.com>
  3. Date: Mon, 19 Sep 2016 12:09:51 +0100
  4. Subject: [PATCH] brcmfmac: ignore 11d configuration errors
  5. 802.11d is not always supported by firmware anymore. Currently the
  6. AP configuration of 11d will cause an abort if the ioctl set is
  7. failing. This behavior is not correct and the error should be
  8. ignored.
  9. Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  10. Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  11. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  12. Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  13. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  14. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15. ---
  16. .../broadcom/brcm80211/brcmfmac/cfg80211.c | 27 ++++++++++++----------
  17. 1 file changed, 15 insertions(+), 12 deletions(-)
  18. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20. @@ -4422,6 +4422,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  21. u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef);
  22. bool mbss;
  23. int is_11d;
  24. + bool supports_11d;
  25. brcmf_dbg(TRACE, "ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n",
  26. settings->chandef.chan->hw_value,
  27. @@ -4434,11 +4435,16 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  28. mbss = ifp->vif->mbss;
  29. /* store current 11d setting */
  30. - brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY, &ifp->vif->is_11d);
  31. - country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
  32. - settings->beacon.tail_len,
  33. - WLAN_EID_COUNTRY);
  34. - is_11d = country_ie ? 1 : 0;
  35. + if (brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY,
  36. + &ifp->vif->is_11d)) {
  37. + supports_11d = false;
  38. + } else {
  39. + country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
  40. + settings->beacon.tail_len,
  41. + WLAN_EID_COUNTRY);
  42. + is_11d = country_ie ? 1 : 0;
  43. + supports_11d = true;
  44. + }
  45. memset(&ssid_le, 0, sizeof(ssid_le));
  46. if (settings->ssid == NULL || settings->ssid_len == 0) {
  47. @@ -4497,7 +4503,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  48. /* Parameters shared by all radio interfaces */
  49. if (!mbss) {
  50. - if (is_11d != ifp->vif->is_11d) {
  51. + if ((supports_11d) && (is_11d != ifp->vif->is_11d)) {
  52. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  53. is_11d);
  54. if (err < 0) {
  55. @@ -4539,7 +4545,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  56. brcmf_err("SET INFRA error %d\n", err);
  57. goto exit;
  58. }
  59. - } else if (WARN_ON(is_11d != ifp->vif->is_11d)) {
  60. + } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
  61. /* Multiple-BSS should use same 11d configuration */
  62. err = -EINVAL;
  63. goto exit;
  64. @@ -4673,11 +4679,8 @@ static int brcmf_cfg80211_stop_ap(struct
  65. brcmf_err("setting INFRA mode failed %d\n", err);
  66. if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
  67. brcmf_fil_iovar_int_set(ifp, "mbss", 0);
  68. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  69. - ifp->vif->is_11d);
  70. - if (err < 0)
  71. - brcmf_err("restoring REGULATORY setting failed %d\n",
  72. - err);
  73. + brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  74. + ifp->vif->is_11d);
  75. /* Bring device back up so it can be used again */
  76. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  77. if (err < 0)