351-0011-brcmfmac-don-t-remove-interface-on-link-down-firmwar.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  2. Date: Mon, 30 May 2016 06:40:54 +0200
  3. Subject: [PATCH] brcmfmac: don't remove interface on link down firmware event
  4. MIME-Version: 1.0
  5. Content-Type: text/plain; charset=UTF-8
  6. Content-Transfer-Encoding: 8bit
  7. There are two firmware events we handle similarly in brcmfmac:
  8. BRCMF_E_LINK and BRCMF_E_IF. The difference from firmware point of view
  9. is that the first one means BSS remains present in the firmware. Trying
  10. to (re)create it (e.g. when adding new virtual interface) will result in
  11. an error.
  12. Current code treats both events in a similar way. It removes Linux
  13. interface for each of them. It works OK with e.g. BCM43602. Its firmware
  14. generates both events for each interface. It means we get BRCMF_E_LINK
  15. and remove interface. That is soon followed by BRCMF_E_IF which means
  16. BSS was also removed in a firmware. The only downside of this is a
  17. harmless error like:
  18. [ 208.643180] brcmfmac: brcmf_fweh_call_event_handler: no interface object
  19. Unfortunately BCM4366 firmware doesn't automatically remove BSS and so
  20. it doesn't generate BRCMF_E_IF. In such case we incorrectly remove Linux
  21. interface on BRCMF_E_LINK as BSS is still present in the firmware. It
  22. results in an error when trying to re-create virtual interface, e.g.:
  23. > iw phy phy1 interface add wlan1-1 type __ap
  24. [ 3602.929199] brcmfmac: brcmf_ap_add_vif: timeout occurred
  25. command failed: I/O error (-5)
  26. With this patch we don't remove Linux interface while firmware keeps
  27. BSS. Thanks to this we keep a consistent states of host driver and
  28. device firmware.
  29. Further improvement should be to mark BSS as disabled and remove
  30. interface on BRCMF_E_LINK. Then we should add support for reusing
  31. BSS-es.
  32. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  33. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  34. ---
  35. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  36. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  37. @@ -5448,7 +5448,6 @@ brcmf_notify_connect_status_ap(struct br
  38. struct net_device *ndev,
  39. const struct brcmf_event_msg *e, void *data)
  40. {
  41. - struct brcmf_if *ifp = netdev_priv(ndev);
  42. static int generation;
  43. u32 event = e->event_code;
  44. u32 reason = e->reason;
  45. @@ -5459,8 +5458,6 @@ brcmf_notify_connect_status_ap(struct br
  46. ndev != cfg_to_ndev(cfg)) {
  47. brcmf_dbg(CONN, "AP mode link down\n");
  48. complete(&cfg->vif_disabled);
  49. - if (ifp->vif->mbss)
  50. - brcmf_remove_interface(ifp);
  51. return 0;
  52. }