1 From: Hante Meuleman <meuleman@broadcom.com>
2 Date: Fri, 18 Sep 2015 22:08:11 +0200
3 Subject: [PATCH] brcmfmac: Workaround in change vif for wpa_supplicant
6 Different wpa_supplicants have different behavior and expectations
7 regarding the change_virtual_intf behavior. This patch implements
8 a workaround for the different versions and possible brcmfmac
11 Reviewed-by: Arend Van Spriel <arend@broadcom.com>
12 Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
13 Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
14 Signed-off-by: Arend van Spriel <arend@broadcom.com>
15 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
18 --- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
19 +++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
20 @@ -776,6 +776,37 @@ brcmf_cfg80211_change_iface(struct wiphy
23 brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
25 + /* WAR: There are a number of p2p interface related problems which
26 + * need to be handled initially (before doing the validate).
27 + * wpa_supplicant tends to do iface changes on p2p device/client/go
28 + * which are not always possible/allowed. However we need to return
29 + * OK otherwise the wpa_supplicant wont start. The situation differs
30 + * on configuration and setup (p2pon=1 module param). The first check
31 + * is to see if the request is a change to station for p2p iface.
33 + if ((type == NL80211_IFTYPE_STATION) &&
34 + ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) ||
35 + (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) ||
36 + (vif->wdev.iftype == NL80211_IFTYPE_P2P_DEVICE))) {
37 + brcmf_dbg(TRACE, "Ignoring cmd for p2p if\n");
38 + /* Now depending on whether module param p2pon=1 was used the
39 + * response needs to be either 0 or EOPNOTSUPP. The reason is
40 + * that if p2pon=1 is used, but a newer supplicant is used then
41 + * we should return an error, as this combination wont work.
42 + * In other situations 0 is returned and supplicant will start
43 + * normally. It will give a trace in cfg80211, but it is the
44 + * only way to get it working. Unfortunately this will result
45 + * in situation where we wont support new supplicant in
46 + * combination with module param p2pon=1, but that is the way
47 + * it is. If the user tries this then unloading of driver might
50 + if (cfg->p2p.p2pdev_dynamically)
55 err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
57 brcmf_err("iface validation failed: err=%d\n", err);
58 @@ -791,18 +822,6 @@ brcmf_cfg80211_change_iface(struct wiphy
61 case NL80211_IFTYPE_STATION:
62 - /* Ignore change for p2p IF. Unclear why supplicant does this */
63 - if ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) ||
64 - (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO)) {
65 - brcmf_dbg(TRACE, "Ignoring cmd for p2p if\n");
66 - /* WAR: It is unexpected to get a change of VIF for P2P
67 - * IF, but it happens. The request can not be handled
68 - * but returning EPERM causes a crash. Returning 0
69 - * without setting ieee80211_ptr->iftype causes trace
70 - * (WARN_ON) but it works with wpa_supplicant
76 case NL80211_IFTYPE_AP: