aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/brcm80211/brcmfmac
diff options
context:
space:
mode:
authorHante Meuleman <meuleman@broadcom.com>2013-02-08 09:54:02 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-02-08 14:51:43 -0500
commit6eda4e2c54255cd26a58d2fcec73ec3bff7a515b (patch)
tree97555c191aefdc92e1530a21c096df971f279bb7 /drivers/net/wireless/brcm80211/brcmfmac
parent4b3a89de8a2e91bf873a0044fa62b2f5afb6693a (diff)
brcmfmac: Add tx p2p off-channel support.
With this patch off-channel action frames can be transmitted. This is needed for p2p when two devices need to find each other while using different social channels. Reviewed-by: Arend Van Spriel <arend@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Piotr Haber <phaber@broadcom.com> Signed-off-by: Hante Meuleman <meuleman@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/p2p.c673
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/p2p.h51
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c76
3 files changed, 707 insertions, 93 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
index 84d6acd99353..4166e642068b 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
@@ -43,6 +43,9 @@
43#define SOCIAL_CHAN_1 1 43#define SOCIAL_CHAN_1 1
44#define SOCIAL_CHAN_2 6 44#define SOCIAL_CHAN_2 6
45#define SOCIAL_CHAN_3 11 45#define SOCIAL_CHAN_3 11
46#define IS_P2P_SOCIAL_CHANNEL(channel) ((channel == SOCIAL_CHAN_1) || \
47 (channel == SOCIAL_CHAN_2) || \
48 (channel == SOCIAL_CHAN_3))
46#define SOCIAL_CHAN_CNT 3 49#define SOCIAL_CHAN_CNT 3
47#define AF_PEER_SEARCH_CNT 2 50#define AF_PEER_SEARCH_CNT 2
48 51
@@ -64,11 +67,12 @@
64#define P2P_AF_MIN_DWELL_TIME 100 67#define P2P_AF_MIN_DWELL_TIME 100
65#define P2P_AF_MED_DWELL_TIME 400 68#define P2P_AF_MED_DWELL_TIME 400
66#define P2P_AF_LONG_DWELL_TIME 1000 69#define P2P_AF_LONG_DWELL_TIME 1000
67#define P2P_AF_TX_MAX_RETRY 5 70#define P2P_AF_TX_MAX_RETRY 1
68#define P2P_AF_MAX_WAIT_TIME 2000 71#define P2P_AF_MAX_WAIT_TIME 2000
69#define P2P_INVALID_CHANNEL -1 72#define P2P_INVALID_CHANNEL -1
70#define P2P_CHANNEL_SYNC_RETRY 5 73#define P2P_CHANNEL_SYNC_RETRY 5
71#define P2P_AF_FRM_SCAN_MAX_WAIT 1500 74#define P2P_AF_FRM_SCAN_MAX_WAIT 1500
75#define P2P_DEFAULT_SLEEP_TIME_VSDB 200
72 76
73/* WiFi P2P Public Action Frame OUI Subtypes */ 77/* WiFi P2P Public Action Frame OUI Subtypes */
74#define P2P_PAF_GON_REQ 0 /* Group Owner Negotiation Req */ 78#define P2P_PAF_GON_REQ 0 /* Group Owner Negotiation Req */
@@ -196,13 +200,15 @@ struct brcmf_p2psd_gas_pub_act_frame {
196/** 200/**
197 * struct brcmf_config_af_params - Action Frame Parameters for tx. 201 * struct brcmf_config_af_params - Action Frame Parameters for tx.
198 * 202 *
199 * @max_tx_retry: max tx retry count if tx no ack.
200 * @mpc_onoff: To make sure to send successfully action frame, we have to 203 * @mpc_onoff: To make sure to send successfully action frame, we have to
201 * turn off mpc 0: off, 1: on, (-1): do nothing 204 * turn off mpc 0: off, 1: on, (-1): do nothing
205 * @search_channel: 1: search peer's channel to send af
206 * extra_listen: keep the dwell time to get af response frame.
202 */ 207 */
203struct brcmf_config_af_params { 208struct brcmf_config_af_params {
204 s32 max_tx_retry;
205 s32 mpc_onoff; 209 s32 mpc_onoff;
210 bool search_channel;
211 bool extra_listen;
206}; 212};
207 213
208/** 214/**
@@ -415,6 +421,30 @@ static void brcmf_p2p_print_actframe(bool tx, void *frame, u32 frame_len)
415 421
416#endif 422#endif
417 423
424
425/**
426 * brcmf_p2p_chnr_to_chspec() - convert channel number to chanspec.
427 *
428 * @channel: channel number
429 */
430static u16 brcmf_p2p_chnr_to_chspec(u16 channel)
431{
432 u16 chanspec;
433
434 chanspec = channel & WL_CHANSPEC_CHAN_MASK;
435
436 if (channel <= CH_MAX_2G_CHANNEL)
437 chanspec |= WL_CHANSPEC_BAND_2G;
438 else
439 chanspec |= WL_CHANSPEC_BAND_5G;
440
441 chanspec |= WL_CHANSPEC_BW_20;
442 chanspec |= WL_CHANSPEC_CTL_SB_NONE;
443
444 return chanspec;
445}
446
447
418/** 448/**
419 * brcmf_p2p_set_firmware() - prepare firmware for peer-to-peer operation. 449 * brcmf_p2p_set_firmware() - prepare firmware for peer-to-peer operation.
420 * 450 *
@@ -811,6 +841,43 @@ exit:
811 return err; 841 return err;
812} 842}
813 843
844
845/**
846 * brcmf_p2p_find_listen_channel() - find listen channel in ie string.
847 *
848 * @ie: string of information elements.
849 * @ie_len: length of string.
850 *
851 * Scan ie for p2p ie and look for attribute 6 channel. If available determine
852 * channel and return it.
853 */
854static s32 brcmf_p2p_find_listen_channel(const u8 *ie, u32 ie_len)
855{
856 u8 channel_ie[5];
857 s32 listen_channel;
858 s32 err;
859
860 err = cfg80211_get_p2p_attr(ie, ie_len,
861 IEEE80211_P2P_ATTR_LISTEN_CHANNEL,
862 channel_ie, sizeof(channel_ie));
863 if (err < 0)
864 return err;
865
866 /* listen channel subel length format: */
867 /* 3(country) + 1(op. class) + 1(chan num) */
868 listen_channel = (s32)channel_ie[3 + 1];
869
870 if (listen_channel == SOCIAL_CHAN_1 ||
871 listen_channel == SOCIAL_CHAN_2 ||
872 listen_channel == SOCIAL_CHAN_3) {
873 brcmf_dbg(INFO, "Found my Listen Channel %d\n", listen_channel);
874 return listen_channel;
875 }
876
877 return -EPERM;
878}
879
880
814/** 881/**
815 * brcmf_p2p_scan_prep() - prepare scan based on request. 882 * brcmf_p2p_scan_prep() - prepare scan based on request.
816 * 883 *
@@ -831,12 +898,13 @@ int brcmf_p2p_scan_prep(struct wiphy *wiphy,
831 898
832 if (brcmf_p2p_scan_is_p2p_request(request)) { 899 if (brcmf_p2p_scan_is_p2p_request(request)) {
833 /* find my listen channel */ 900 /* find my listen channel */
834 err = cfg80211_get_p2p_attr(request->ie, request->ie_len, 901 err = brcmf_p2p_find_listen_channel(request->ie,
835 IEEE80211_P2P_ATTR_LISTEN_CHANNEL, 902 request->ie_len);
836 &p2p->listen_channel, 1);
837 if (err < 0) 903 if (err < 0)
838 return err; 904 return err;
839 905
906 p2p->afx_hdl.my_listen_chan = err;
907
840 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); 908 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
841 brcmf_dbg(INFO, "P2P: GO_NEG_PHASE status cleared\n"); 909 brcmf_dbg(INFO, "P2P: GO_NEG_PHASE status cleared\n");
842 910
@@ -859,13 +927,12 @@ int brcmf_p2p_scan_prep(struct wiphy *wiphy,
859 * brcmf_p2p_discover_listen() - set firmware to discover listen state. 927 * brcmf_p2p_discover_listen() - set firmware to discover listen state.
860 * 928 *
861 * @p2p: p2p device. 929 * @p2p: p2p device.
862 * @freq: center frequency for discover listen. 930 * @channel: channel nr for discover listen.
863 * #@duration: time in ms to stay on channel. 931 * @duration: time in ms to stay on channel.
864 * 932 *
865 */ 933 */
866static s32 934static s32
867brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p, 935brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p, u16 channel, u32 duration)
868 struct ieee80211_channel *channel, u32 duration)
869{ 936{
870 struct brcmf_cfg80211_vif *vif; 937 struct brcmf_cfg80211_vif *vif;
871 s32 err = 0; 938 s32 err = 0;
@@ -884,7 +951,7 @@ brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p,
884 goto exit; 951 goto exit;
885 } 952 }
886 953
887 chanspec = channel_to_chanspec(channel); 954 chanspec = brcmf_p2p_chnr_to_chspec(channel);
888 err = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_LISTEN, 955 err = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_LISTEN,
889 chanspec, (u16)duration); 956 chanspec, (u16)duration);
890 if (!err) { 957 if (!err) {
@@ -911,15 +978,16 @@ int brcmf_p2p_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
911 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 978 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
912 struct brcmf_p2p_info *p2p = &cfg->p2p; 979 struct brcmf_p2p_info *p2p = &cfg->p2p;
913 s32 err; 980 s32 err;
981 u16 channel_nr;
914 982
915 brcmf_dbg(TRACE, "Enter, channel: %d, duration ms (%d)\n", 983 channel_nr = ieee80211_frequency_to_channel(channel->center_freq);
916 ieee80211_frequency_to_channel(channel->center_freq), 984 brcmf_dbg(TRACE, "Enter, channel: %d, duration ms (%d)\n", channel_nr,
917 duration); 985 duration);
918 986
919 err = brcmf_p2p_enable_discovery(p2p); 987 err = brcmf_p2p_enable_discovery(p2p);
920 if (err) 988 if (err)
921 goto exit; 989 goto exit;
922 err = brcmf_p2p_discover_listen(p2p, channel, duration); 990 err = brcmf_p2p_discover_listen(p2p, channel_nr, duration);
923 if (err) 991 if (err)
924 goto exit; 992 goto exit;
925 993
@@ -949,11 +1017,20 @@ int brcmf_p2p_notify_listen_complete(struct brcmf_if *ifp,
949 1017
950 brcmf_dbg(TRACE, "Enter\n"); 1018 brcmf_dbg(TRACE, "Enter\n");
951 if (test_and_clear_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, 1019 if (test_and_clear_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN,
952 &p2p->status)) 1020 &p2p->status)) {
1021 if (test_and_clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN,
1022 &p2p->status)) {
1023 clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME,
1024 &p2p->status);
1025 brcmf_dbg(INFO, "Listen DONE, wake up wait_next_af\n");
1026 complete(&p2p->wait_next_af);
1027 }
1028
953 cfg80211_remain_on_channel_expired(&ifp->vif->wdev, 1029 cfg80211_remain_on_channel_expired(&ifp->vif->wdev,
954 p2p->remain_on_channel_cookie, 1030 p2p->remain_on_channel_cookie,
955 &p2p->remain_on_channel, 1031 &p2p->remain_on_channel,
956 GFP_KERNEL); 1032 GFP_KERNEL);
1033 }
957 return 0; 1034 return 0;
958} 1035}
959 1036
@@ -974,6 +1051,285 @@ void brcmf_p2p_cancel_remain_on_channel(struct brcmf_if *ifp)
974 1051
975 1052
976/** 1053/**
1054 * brcmf_p2p_act_frm_search() - search function for action frame.
1055 *
1056 * @p2p: p2p device.
1057 * channel: channel on which action frame is to be trasmitted.
1058 *
1059 * search function to reach at common channel to send action frame. When
1060 * channel is 0 then all social channels will be used to send af
1061 */
1062static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel)
1063{
1064 s32 err;
1065 u32 channel_cnt;
1066 u16 *default_chan_list;
1067 u32 i;
1068
1069 brcmf_dbg(TRACE, "Enter\n");
1070
1071 if (channel)
1072 channel_cnt = AF_PEER_SEARCH_CNT;
1073 else
1074 channel_cnt = SOCIAL_CHAN_CNT;
1075 default_chan_list = kzalloc(channel_cnt * sizeof(*default_chan_list),
1076 GFP_KERNEL);
1077 if (default_chan_list == NULL) {
1078 brcmf_err("channel list allocation failed\n");
1079 err = -ENOMEM;
1080 goto exit;
1081 }
1082 if (channel) {
1083 /* insert same channel to the chan_list */
1084 for (i = 0; i < channel_cnt; i++)
1085 default_chan_list[i] =
1086 brcmf_p2p_chnr_to_chspec(channel);
1087 } else {
1088 default_chan_list[0] = brcmf_p2p_chnr_to_chspec(SOCIAL_CHAN_1);
1089 default_chan_list[1] = brcmf_p2p_chnr_to_chspec(SOCIAL_CHAN_2);
1090 default_chan_list[2] = brcmf_p2p_chnr_to_chspec(SOCIAL_CHAN_3);
1091 }
1092 err = brcmf_p2p_escan(p2p, channel_cnt, default_chan_list,
1093 WL_P2P_DISC_ST_SEARCH, WL_ESCAN_ACTION_START,
1094 P2PAPI_BSSCFG_DEVICE);
1095 kfree(default_chan_list);
1096exit:
1097 return err;
1098}
1099
1100
1101/**
1102 * brcmf_p2p_afx_handler() - afx worker thread.
1103 *
1104 * @work:
1105 *
1106 */
1107static void brcmf_p2p_afx_handler(struct work_struct *work)
1108{
1109 struct afx_hdl *afx_hdl = container_of(work, struct afx_hdl, afx_work);
1110 struct brcmf_p2p_info *p2p = container_of(afx_hdl,
1111 struct brcmf_p2p_info,
1112 afx_hdl);
1113 s32 err;
1114
1115 if (!afx_hdl->is_active)
1116 return;
1117
1118 if (afx_hdl->is_listen && afx_hdl->my_listen_chan)
1119 /* 100ms ~ 300ms */
1120 err = brcmf_p2p_discover_listen(p2p, afx_hdl->my_listen_chan,
1121 100 * (1 + (random32() % 3)));
1122 else
1123 err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan);
1124
1125 if (err) {
1126 brcmf_err("ERROR occurred! value is (%d)\n", err);
1127 if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
1128 &p2p->status))
1129 complete(&afx_hdl->act_frm_scan);
1130 }
1131}
1132
1133
1134/**
1135 * brcmf_p2p_af_searching_channel() - search channel.
1136 *
1137 * @p2p: p2p device info struct.
1138 *
1139 */
1140static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p)
1141{
1142 struct afx_hdl *afx_hdl = &p2p->afx_hdl;
1143 struct brcmf_cfg80211_vif *pri_vif;
1144 unsigned long duration;
1145 s32 retry;
1146
1147 brcmf_dbg(TRACE, "Enter\n");
1148
1149 pri_vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
1150
1151 INIT_COMPLETION(afx_hdl->act_frm_scan);
1152 set_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status);
1153 afx_hdl->is_active = true;
1154 afx_hdl->peer_chan = P2P_INVALID_CHANNEL;
1155
1156 /* Loop to wait until we find a peer's channel or the
1157 * pending action frame tx is cancelled.
1158 */
1159 retry = 0;
1160 duration = msecs_to_jiffies(P2P_AF_FRM_SCAN_MAX_WAIT);
1161 while ((retry < P2P_CHANNEL_SYNC_RETRY) &&
1162 (afx_hdl->peer_chan == P2P_INVALID_CHANNEL)) {
1163 afx_hdl->is_listen = false;
1164 brcmf_dbg(TRACE, "Scheduling action frame for sending.. (%d)\n",
1165 retry);
1166 /* search peer on peer's listen channel */
1167 schedule_work(&afx_hdl->afx_work);
1168 wait_for_completion_timeout(&afx_hdl->act_frm_scan, duration);
1169 if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) ||
1170 (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
1171 &p2p->status)))
1172 break;
1173
1174 if (afx_hdl->my_listen_chan) {
1175 brcmf_dbg(TRACE, "Scheduling listen peer, channel=%d\n",
1176 afx_hdl->my_listen_chan);
1177 /* listen on my listen channel */
1178 afx_hdl->is_listen = true;
1179 schedule_work(&afx_hdl->afx_work);
1180 wait_for_completion_timeout(&afx_hdl->act_frm_scan,
1181 duration);
1182 }
1183 if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) ||
1184 (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
1185 &p2p->status)))
1186 break;
1187 retry++;
1188
1189 /* if sta is connected or connecting, sleep for a while before
1190 * retry af tx or finding a peer
1191 */
1192 if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &pri_vif->sme_state) ||
1193 test_bit(BRCMF_VIF_STATUS_CONNECTING, &pri_vif->sme_state))
1194 msleep(P2P_DEFAULT_SLEEP_TIME_VSDB);
1195 }
1196
1197 brcmf_dbg(TRACE, "Completed search/listen peer_chan=%d\n",
1198 afx_hdl->peer_chan);
1199 afx_hdl->is_active = false;
1200
1201 clear_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status);
1202
1203 return afx_hdl->peer_chan;
1204}
1205
1206
1207/**
1208 * brcmf_p2p_scan_finding_common_channel() - was escan used for finding channel
1209 *
1210 * @cfg: common configuration struct.
1211 * @bi: bss info struct, result from scan.
1212 *
1213 */
1214bool brcmf_p2p_scan_finding_common_channel(struct brcmf_cfg80211_info *cfg,
1215 struct brcmf_bss_info_le *bi)
1216
1217{
1218 struct brcmf_p2p_info *p2p = &cfg->p2p;
1219 struct afx_hdl *afx_hdl = &p2p->afx_hdl;
1220 u8 *ie;
1221 s32 err;
1222 u8 p2p_dev_addr[ETH_ALEN];
1223
1224 if (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status))
1225 return false;
1226
1227 if (bi == NULL) {
1228 brcmf_dbg(TRACE, "ACTION FRAME SCAN Done\n");
1229 if (afx_hdl->peer_chan == P2P_INVALID_CHANNEL)
1230 complete(&afx_hdl->act_frm_scan);
1231 return true;
1232 }
1233
1234 ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset);
1235 memset(p2p_dev_addr, 0, sizeof(p2p_dev_addr));
1236 err = cfg80211_get_p2p_attr(ie, le32_to_cpu(bi->ie_length),
1237 IEEE80211_P2P_ATTR_DEVICE_INFO,
1238 p2p_dev_addr, sizeof(p2p_dev_addr));
1239 if (err < 0)
1240 err = cfg80211_get_p2p_attr(ie, le32_to_cpu(bi->ie_length),
1241 IEEE80211_P2P_ATTR_DEVICE_ID,
1242 p2p_dev_addr, sizeof(p2p_dev_addr));
1243 if ((err >= 0) &&
1244 (!memcmp(p2p_dev_addr, afx_hdl->tx_dst_addr, ETH_ALEN))) {
1245 afx_hdl->peer_chan = bi->ctl_ch ? bi->ctl_ch :
1246 CHSPEC_CHANNEL(le16_to_cpu(bi->chanspec));
1247 brcmf_dbg(TRACE, "ACTION FRAME SCAN : Peer %pM found, channel : %d\n",
1248 afx_hdl->tx_dst_addr, afx_hdl->peer_chan);
1249 complete(&afx_hdl->act_frm_scan);
1250 }
1251 return true;
1252}
1253
1254/**
1255 * brcmf_p2p_stop_wait_next_action_frame() - finish scan if af tx complete.
1256 *
1257 * @cfg: common configuration struct.
1258 *
1259 */
1260static void
1261brcmf_p2p_stop_wait_next_action_frame(struct brcmf_cfg80211_info *cfg)
1262{
1263 struct brcmf_p2p_info *p2p = &cfg->p2p;
1264 struct net_device *ndev = cfg->escan_info.ndev;
1265
1266 if (test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status) &&
1267 (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status) ||
1268 test_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status))) {
1269 brcmf_dbg(TRACE, "*** Wake UP ** abort actframe iovar\n");
1270 /* if channel is not zero, "actfame" uses off channel scan.
1271 * So abort scan for off channel completion.
1272 */
1273 if (p2p->af_sent_channel)
1274 brcmf_notify_escan_complete(cfg, ndev, true, true);
1275 } else if (test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN,
1276 &p2p->status)) {
1277 brcmf_dbg(TRACE, "*** Wake UP ** abort listen for next af frame\n");
1278 /* So abort scan to cancel listen */
1279 brcmf_notify_escan_complete(cfg, ndev, true, true);
1280 }
1281}
1282
1283
1284/**
1285 * brcmf_p2p_gon_req_collision() - Check if go negotiaton collission
1286 *
1287 * @p2p: p2p device info struct.
1288 *
1289 * return true if recevied action frame is to be dropped.
1290 */
1291static bool
1292brcmf_p2p_gon_req_collision(struct brcmf_p2p_info *p2p, u8 *mac)
1293{
1294 struct brcmf_cfg80211_info *cfg = p2p->cfg;
1295 struct brcmf_if *ifp;
1296
1297 brcmf_dbg(TRACE, "Enter\n");
1298
1299 if (!test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status) ||
1300 !p2p->gon_req_action)
1301 return false;
1302
1303 brcmf_dbg(TRACE, "GO Negotiation Request COLLISION !!!\n");
1304 /* if sa(peer) addr is less than da(my) addr, then this device
1305 * process peer's gon request and block to send gon req.
1306 * if not (sa addr > da addr),
1307 * this device will process gon request and drop gon req of peer.
1308 */
1309 ifp = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif->ifp;
1310 if (memcmp(mac, ifp->mac_addr, ETH_ALEN) < 0) {
1311 brcmf_dbg(INFO, "Block transmit gon req !!!\n");
1312 p2p->block_gon_req_tx = true;
1313 /* if we are finding a common channel for sending af,
1314 * do not scan more to block to send current gon req
1315 */
1316 if (test_and_clear_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
1317 &p2p->status))
1318 complete(&p2p->afx_hdl.act_frm_scan);
1319 if (test_and_clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME,
1320 &p2p->status))
1321 brcmf_p2p_stop_wait_next_action_frame(cfg);
1322 return false;
1323 }
1324
1325 /* drop gon request of peer to process gon request by this device. */
1326 brcmf_dbg(INFO, "Drop received gon req !!!\n");
1327
1328 return true;
1329}
1330
1331
1332/**
977 * brcmf_p2p_notify_action_frame_rx() - received action frame. 1333 * brcmf_p2p_notify_action_frame_rx() - received action frame.
978 * 1334 *
979 * @ifp: interfac control. 1335 * @ifp: interfac control.
@@ -985,14 +1341,20 @@ int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
985 const struct brcmf_event_msg *e, 1341 const struct brcmf_event_msg *e,
986 void *data) 1342 void *data)
987{ 1343{
1344 struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1345 struct brcmf_p2p_info *p2p = &cfg->p2p;
1346 struct afx_hdl *afx_hdl = &p2p->afx_hdl;
988 struct wireless_dev *wdev; 1347 struct wireless_dev *wdev;
989 u32 mgmt_frame_len = e->datalen - sizeof(struct brcmf_rx_mgmt_data); 1348 u32 mgmt_frame_len = e->datalen - sizeof(struct brcmf_rx_mgmt_data);
990 struct brcmf_rx_mgmt_data *rxframe = (struct brcmf_rx_mgmt_data *)data; 1349 struct brcmf_rx_mgmt_data *rxframe = (struct brcmf_rx_mgmt_data *)data;
1350 u8 *frame = (u8 *)(rxframe + 1);
1351 struct brcmf_p2p_pub_act_frame *act_frm;
1352 struct brcmf_p2psd_gas_pub_act_frame *sd_act_frm;
991 u16 chanspec = be16_to_cpu(rxframe->chanspec); 1353 u16 chanspec = be16_to_cpu(rxframe->chanspec);
992 struct ieee80211_mgmt *mgmt_frame; 1354 struct ieee80211_mgmt *mgmt_frame;
993 s32 err;
994 s32 freq; 1355 s32 freq;
995 u16 mgmt_type; 1356 u16 mgmt_type;
1357 u8 action;
996 1358
997 /* Check if wpa_supplicant has registered for this frame */ 1359 /* Check if wpa_supplicant has registered for this frame */
998 brcmf_dbg(INFO, "ifp->vif->mgmt_rx_reg %04x\n", ifp->vif->mgmt_rx_reg); 1360 brcmf_dbg(INFO, "ifp->vif->mgmt_rx_reg %04x\n", ifp->vif->mgmt_rx_reg);
@@ -1000,7 +1362,46 @@ int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
1000 if ((ifp->vif->mgmt_rx_reg & BIT(mgmt_type)) == 0) 1362 if ((ifp->vif->mgmt_rx_reg & BIT(mgmt_type)) == 0)
1001 return 0; 1363 return 0;
1002 1364
1003 brcmf_p2p_print_actframe(false, (u8 *)(rxframe + 1), mgmt_frame_len); 1365 brcmf_p2p_print_actframe(false, frame, mgmt_frame_len);
1366
1367 action = P2P_PAF_SUBTYPE_INVALID;
1368 if (brcmf_p2p_is_pub_action(frame, mgmt_frame_len)) {
1369 act_frm = (struct brcmf_p2p_pub_act_frame *)frame;
1370 action = act_frm->subtype;
1371 if ((action == P2P_PAF_GON_REQ) &&
1372 (brcmf_p2p_gon_req_collision(p2p, (u8 *)e->addr))) {
1373 if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
1374 &p2p->status) &&
1375 (memcmp(afx_hdl->tx_dst_addr, e->addr,
1376 ETH_ALEN) == 0)) {
1377 afx_hdl->peer_chan = CHSPEC_CHANNEL(chanspec);
1378 brcmf_dbg(INFO, "GON request: Peer found, channel=%d\n",
1379 afx_hdl->peer_chan);
1380 complete(&afx_hdl->act_frm_scan);
1381 }
1382 return 0;
1383 }
1384 /* After complete GO Negotiation, roll back to mpc mode */
1385 if ((action == P2P_PAF_GON_CONF) ||
1386 (action == P2P_PAF_PROVDIS_RSP))
1387 brcmf_set_mpc(ifp->ndev, 1);
1388 if (action == P2P_PAF_GON_CONF) {
1389 brcmf_dbg(TRACE, "P2P: GO_NEG_PHASE status cleared\n");
1390 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
1391 }
1392 } else if (brcmf_p2p_is_gas_action(frame, mgmt_frame_len)) {
1393 sd_act_frm = (struct brcmf_p2psd_gas_pub_act_frame *)frame;
1394 action = sd_act_frm->action;
1395 }
1396
1397 if (test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status) &&
1398 (p2p->next_af_subtype == action)) {
1399 brcmf_dbg(TRACE, "We got a right next frame! (%d)\n", action);
1400 clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME,
1401 &p2p->status);
1402 /* Stop waiting for next AF. */
1403 brcmf_p2p_stop_wait_next_action_frame(cfg);
1404 }
1004 1405
1005 mgmt_frame = kzalloc(offsetof(struct ieee80211_mgmt, u) + 1406 mgmt_frame = kzalloc(offsetof(struct ieee80211_mgmt, u) +
1006 mgmt_frame_len, GFP_KERNEL); 1407 mgmt_frame_len, GFP_KERNEL);
@@ -1009,13 +1410,11 @@ int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
1009 return -ENOMEM; 1410 return -ENOMEM;
1010 } 1411 }
1011 memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN); 1412 memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN);
1012 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSSID, mgmt_frame->bssid, 1413 brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSSID, mgmt_frame->bssid,
1013 ETH_ALEN); 1414 ETH_ALEN);
1014 if (err < 0)
1015 brcmf_err("BRCMF_C_GET_BSSID error %d\n", err);
1016 memcpy(mgmt_frame->sa, e->addr, ETH_ALEN); 1415 memcpy(mgmt_frame->sa, e->addr, ETH_ALEN);
1017 mgmt_frame->frame_control = cpu_to_le16(IEEE80211_STYPE_ACTION); 1416 mgmt_frame->frame_control = cpu_to_le16(IEEE80211_STYPE_ACTION);
1018 memcpy(&mgmt_frame->u, (u8 *)(rxframe + 1), mgmt_frame_len); 1417 memcpy(&mgmt_frame->u, frame, mgmt_frame_len);
1019 mgmt_frame_len += offsetof(struct ieee80211_mgmt, u); 1418 mgmt_frame_len += offsetof(struct ieee80211_mgmt, u);
1020 1419
1021 freq = ieee80211_channel_to_frequency(CHSPEC_CHANNEL(chanspec), 1420 freq = ieee80211_channel_to_frequency(CHSPEC_CHANNEL(chanspec),
@@ -1046,15 +1445,29 @@ int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp,
1046 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; 1445 struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1047 struct brcmf_p2p_info *p2p = &cfg->p2p; 1446 struct brcmf_p2p_info *p2p = &cfg->p2p;
1048 1447
1049 brcmf_dbg(INFO, "Enter: status %d\n", e->status); 1448 brcmf_dbg(INFO, "Enter: event %s, status=%d\n",
1449 e->event_code == BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE ?
1450 "ACTION_FRAME_OFF_CHAN_COMPLETE" : "ACTION_FRAME_COMPLETE",
1451 e->status);
1050 1452
1051 if (e->status == BRCMF_E_STATUS_SUCCESS) 1453 if (!test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status))
1052 set_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status); 1454 return 0;
1053 else 1455
1054 set_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); 1456 if (e->event_code == BRCMF_E_ACTION_FRAME_COMPLETE) {
1055 /* for now complete the receiver process here !! */ 1457 if (e->status == BRCMF_E_STATUS_SUCCESS)
1056 complete(&p2p->send_af_done); 1458 set_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED,
1459 &p2p->status);
1460 else {
1461 set_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status);
1462 /* If there is no ack, we don't need to wait for
1463 * WLC_E_ACTION_FRAME_OFFCHAN_COMPLETE event
1464 */
1465 brcmf_p2p_stop_wait_next_action_frame(cfg);
1466 }
1057 1467
1468 } else {
1469 complete(&p2p->send_af_done);
1470 }
1058 return 0; 1471 return 0;
1059} 1472}
1060 1473
@@ -1080,6 +1493,7 @@ static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p,
1080 1493
1081 brcmf_dbg(TRACE, "Enter\n"); 1494 brcmf_dbg(TRACE, "Enter\n");
1082 1495
1496 INIT_COMPLETION(p2p->send_af_done);
1083 clear_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status); 1497 clear_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status);
1084 clear_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); 1498 clear_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status);
1085 1499
@@ -1091,6 +1505,9 @@ static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p,
1091 goto exit; 1505 goto exit;
1092 } 1506 }
1093 1507
1508 p2p->af_sent_channel = le32_to_cpu(af_params->channel);
1509 p2p->af_tx_sent_jiffies = jiffies;
1510
1094 timeout = wait_for_completion_timeout(&p2p->send_af_done, 1511 timeout = wait_for_completion_timeout(&p2p->send_af_done,
1095 msecs_to_jiffies(P2P_AF_MAX_WAIT_TIME)); 1512 msecs_to_jiffies(P2P_AF_MAX_WAIT_TIME));
1096 1513
@@ -1126,16 +1543,21 @@ static s32 brcmf_p2p_pub_af_tx(struct brcmf_cfg80211_info *cfg,
1126 struct brcmf_fil_action_frame_le *action_frame; 1543 struct brcmf_fil_action_frame_le *action_frame;
1127 struct brcmf_p2p_pub_act_frame *act_frm; 1544 struct brcmf_p2p_pub_act_frame *act_frm;
1128 s32 err = 0; 1545 s32 err = 0;
1546 u16 ie_len;
1129 1547
1130 action_frame = &af_params->action_frame; 1548 action_frame = &af_params->action_frame;
1131 act_frm = (struct brcmf_p2p_pub_act_frame *)(action_frame->data); 1549 act_frm = (struct brcmf_p2p_pub_act_frame *)(action_frame->data);
1132 1550
1551 config_af_params->extra_listen = true;
1552
1133 switch (act_frm->subtype) { 1553 switch (act_frm->subtype) {
1134 case P2P_PAF_GON_REQ: 1554 case P2P_PAF_GON_REQ:
1135 brcmf_dbg(TRACE, "P2P: GO_NEG_PHASE status set\n"); 1555 brcmf_dbg(TRACE, "P2P: GO_NEG_PHASE status set\n");
1136 set_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); 1556 set_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
1137 config_af_params->mpc_onoff = 0; 1557 config_af_params->mpc_onoff = 0;
1558 config_af_params->search_channel = true;
1138 p2p->next_af_subtype = act_frm->subtype + 1; 1559 p2p->next_af_subtype = act_frm->subtype + 1;
1560 p2p->gon_req_action = true;
1139 /* increase dwell time to wait for RESP frame */ 1561 /* increase dwell time to wait for RESP frame */
1140 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); 1562 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME);
1141 break; 1563 break;
@@ -1152,8 +1574,10 @@ static s32 brcmf_p2p_pub_af_tx(struct brcmf_cfg80211_info *cfg,
1152 config_af_params->mpc_onoff = 1; 1574 config_af_params->mpc_onoff = 1;
1153 /* minimize dwell time */ 1575 /* minimize dwell time */
1154 af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME); 1576 af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME);
1577 config_af_params->extra_listen = false;
1155 break; 1578 break;
1156 case P2P_PAF_INVITE_REQ: 1579 case P2P_PAF_INVITE_REQ:
1580 config_af_params->search_channel = true;
1157 p2p->next_af_subtype = act_frm->subtype + 1; 1581 p2p->next_af_subtype = act_frm->subtype + 1;
1158 /* increase dwell time */ 1582 /* increase dwell time */
1159 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); 1583 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME);
@@ -1161,8 +1585,10 @@ static s32 brcmf_p2p_pub_af_tx(struct brcmf_cfg80211_info *cfg,
1161 case P2P_PAF_INVITE_RSP: 1585 case P2P_PAF_INVITE_RSP:
1162 /* minimize dwell time */ 1586 /* minimize dwell time */
1163 af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME); 1587 af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME);
1588 config_af_params->extra_listen = false;
1164 break; 1589 break;
1165 case P2P_PAF_DEVDIS_REQ: 1590 case P2P_PAF_DEVDIS_REQ:
1591 config_af_params->search_channel = true;
1166 p2p->next_af_subtype = act_frm->subtype + 1; 1592 p2p->next_af_subtype = act_frm->subtype + 1;
1167 /* maximize dwell time to wait for RESP frame */ 1593 /* maximize dwell time to wait for RESP frame */
1168 af_params->dwell_time = cpu_to_le32(P2P_AF_LONG_DWELL_TIME); 1594 af_params->dwell_time = cpu_to_le32(P2P_AF_LONG_DWELL_TIME);
@@ -1170,8 +1596,15 @@ static s32 brcmf_p2p_pub_af_tx(struct brcmf_cfg80211_info *cfg,
1170 case P2P_PAF_DEVDIS_RSP: 1596 case P2P_PAF_DEVDIS_RSP:
1171 /* minimize dwell time */ 1597 /* minimize dwell time */
1172 af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME); 1598 af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME);
1599 config_af_params->extra_listen = false;
1173 break; 1600 break;
1174 case P2P_PAF_PROVDIS_REQ: 1601 case P2P_PAF_PROVDIS_REQ:
1602 ie_len = le16_to_cpu(action_frame->len) -
1603 offsetof(struct brcmf_p2p_pub_act_frame, elts);
1604 if (cfg80211_get_p2p_attr(&act_frm->elts[0], ie_len,
1605 IEEE80211_P2P_ATTR_GROUP_ID,
1606 NULL, 0) < 0)
1607 config_af_params->search_channel = true;
1175 config_af_params->mpc_onoff = 0; 1608 config_af_params->mpc_onoff = 0;
1176 p2p->next_af_subtype = act_frm->subtype + 1; 1609 p2p->next_af_subtype = act_frm->subtype + 1;
1177 /* increase dwell time to wait for RESP frame */ 1610 /* increase dwell time to wait for RESP frame */
@@ -1182,6 +1615,7 @@ static s32 brcmf_p2p_pub_af_tx(struct brcmf_cfg80211_info *cfg,
1182 p2p->next_af_subtype = P2P_PAF_GON_REQ; 1615 p2p->next_af_subtype = P2P_PAF_GON_REQ;
1183 /* increase dwell time to MED level */ 1616 /* increase dwell time to MED level */
1184 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); 1617 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME);
1618 config_af_params->extra_listen = false;
1185 break; 1619 break;
1186 default: 1620 default:
1187 brcmf_err("Unknown p2p pub act frame subtype: %d\n", 1621 brcmf_err("Unknown p2p pub act frame subtype: %d\n",
@@ -1205,11 +1639,14 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
1205 struct brcmf_p2p_info *p2p = &cfg->p2p; 1639 struct brcmf_p2p_info *p2p = &cfg->p2p;
1206 struct brcmf_fil_action_frame_le *action_frame; 1640 struct brcmf_fil_action_frame_le *action_frame;
1207 struct brcmf_config_af_params config_af_params; 1641 struct brcmf_config_af_params config_af_params;
1642 struct afx_hdl *afx_hdl = &p2p->afx_hdl;
1208 u16 action_frame_len; 1643 u16 action_frame_len;
1209 bool ack = false; 1644 bool ack = false;
1210 u8 category; 1645 u8 category;
1211 u8 action; 1646 u8 action;
1212 s32 tx_retry; 1647 s32 tx_retry;
1648 s32 extra_listen_time;
1649 uint delta_ms;
1213 1650
1214 action_frame = &af_params->action_frame; 1651 action_frame = &af_params->action_frame;
1215 action_frame_len = le16_to_cpu(action_frame->len); 1652 action_frame_len = le16_to_cpu(action_frame->len);
@@ -1226,10 +1663,12 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
1226 1663
1227 /* initialize variables */ 1664 /* initialize variables */
1228 p2p->next_af_subtype = P2P_PAF_SUBTYPE_INVALID; 1665 p2p->next_af_subtype = P2P_PAF_SUBTYPE_INVALID;
1666 p2p->gon_req_action = false;
1229 1667
1230 /* config parameters */ 1668 /* config parameters */
1231 config_af_params.max_tx_retry = P2P_AF_TX_MAX_RETRY;
1232 config_af_params.mpc_onoff = -1; 1669 config_af_params.mpc_onoff = -1;
1670 config_af_params.search_channel = false;
1671 config_af_params.extra_listen = false;
1233 1672
1234 if (brcmf_p2p_is_pub_action(action_frame->data, action_frame_len)) { 1673 if (brcmf_p2p_is_pub_action(action_frame->data, action_frame_len)) {
1235 /* p2p public action frame process */ 1674 /* p2p public action frame process */
@@ -1243,6 +1682,9 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
1243 /* service discovery process */ 1682 /* service discovery process */
1244 if (action == P2PSD_ACTION_ID_GAS_IREQ || 1683 if (action == P2PSD_ACTION_ID_GAS_IREQ ||
1245 action == P2PSD_ACTION_ID_GAS_CREQ) { 1684 action == P2PSD_ACTION_ID_GAS_CREQ) {
1685 /* configure service discovery query frame */
1686 config_af_params.search_channel = true;
1687
1246 /* save next af suptype to cancel */ 1688 /* save next af suptype to cancel */
1247 /* remaining dwell time */ 1689 /* remaining dwell time */
1248 p2p->next_af_subtype = action + 1; 1690 p2p->next_af_subtype = action + 1;
@@ -1268,24 +1710,114 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
1268 return false; 1710 return false;
1269 } 1711 }
1270 1712
1713 /* if connecting on primary iface, sleep for a while before sending
1714 * af tx for VSDB
1715 */
1716 if (test_bit(BRCMF_VIF_STATUS_CONNECTING,
1717 &p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->sme_state))
1718 msleep(50);
1719
1271 /* if scan is ongoing, abort current scan. */ 1720 /* if scan is ongoing, abort current scan. */
1272 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) 1721 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status))
1273 brcmf_abort_scanning(cfg); 1722 brcmf_abort_scanning(cfg);
1274 1723
1724 memcpy(afx_hdl->tx_dst_addr, action_frame->da, ETH_ALEN);
1725
1275 /* To make sure to send successfully action frame, turn off mpc */ 1726 /* To make sure to send successfully action frame, turn off mpc */
1276 if (config_af_params.mpc_onoff == 0) 1727 if (config_af_params.mpc_onoff == 0)
1277 brcmf_set_mpc(ndev, 0); 1728 brcmf_set_mpc(ndev, 0);
1278 1729
1279 /* if failed, retry it. tx_retry_max value is configure by .... */ 1730 /* set status and destination address before sending af */
1731 if (p2p->next_af_subtype != P2P_PAF_SUBTYPE_INVALID) {
1732 /* set status to cancel the remained dwell time in rx process */
1733 set_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status);
1734 }
1735
1736 p2p->af_sent_channel = 0;
1737 set_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status);
1738 /* validate channel and p2p ies */
1739 if (config_af_params.search_channel &&
1740 IS_P2P_SOCIAL_CHANNEL(le32_to_cpu(af_params->channel)) &&
1741 p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif->saved_ie.probe_req_ie_len) {
1742 afx_hdl = &p2p->afx_hdl;
1743 afx_hdl->peer_listen_chan = le32_to_cpu(af_params->channel);
1744
1745 if (brcmf_p2p_af_searching_channel(p2p) ==
1746 P2P_INVALID_CHANNEL) {
1747 brcmf_err("Couldn't find peer's channel.\n");
1748 goto exit;
1749 }
1750
1751 /* Abort scan even for VSDB scenarios. Scan gets aborted in
1752 * firmware but after the check of piggyback algorithm. To take
1753 * care of current piggback algo, lets abort the scan here
1754 * itself.
1755 */
1756 brcmf_notify_escan_complete(cfg, ndev, true, true);
1757
1758 /* update channel */
1759 af_params->channel = cpu_to_le32(afx_hdl->peer_chan);
1760 }
1761
1280 tx_retry = 0; 1762 tx_retry = 0;
1281 while ((ack == false) && (tx_retry < config_af_params.max_tx_retry)) { 1763 while (!p2p->block_gon_req_tx &&
1764 (ack == false) && (tx_retry < P2P_AF_TX_MAX_RETRY)) {
1282 ack = !brcmf_p2p_tx_action_frame(p2p, af_params); 1765 ack = !brcmf_p2p_tx_action_frame(p2p, af_params);
1283 tx_retry++; 1766 tx_retry++;
1284 } 1767 }
1285 if (ack == false) 1768 if (ack == false) {
1286 brcmf_err("Failed to send Action Frame(retry %d)\n", tx_retry); 1769 brcmf_err("Failed to send Action Frame(retry %d)\n", tx_retry);
1770 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
1771 }
1287 1772
1288exit: 1773exit:
1774 clear_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status);
1775
1776 /* WAR: sometimes dongle does not keep the dwell time of 'actframe'.
1777 * if we coundn't get the next action response frame and dongle does
1778 * not keep the dwell time, go to listen state again to get next action
1779 * response frame.
1780 */
1781 if (ack && config_af_params.extra_listen && !p2p->block_gon_req_tx &&
1782 test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status) &&
1783 p2p->af_sent_channel == afx_hdl->my_listen_chan) {
1784 delta_ms = jiffies_to_msecs(jiffies - p2p->af_tx_sent_jiffies);
1785 if (le32_to_cpu(af_params->dwell_time) > delta_ms)
1786 extra_listen_time = le32_to_cpu(af_params->dwell_time) -
1787 delta_ms;
1788 else
1789 extra_listen_time = 0;
1790 if (extra_listen_time > 50) {
1791 set_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN,
1792 &p2p->status);
1793 brcmf_dbg(INFO, "Wait more time! actual af time:%d, calculated extra listen:%d\n",
1794 le32_to_cpu(af_params->dwell_time),
1795 extra_listen_time);
1796 extra_listen_time += 100;
1797 if (!brcmf_p2p_discover_listen(p2p,
1798 p2p->af_sent_channel,
1799 extra_listen_time)) {
1800 unsigned long duration;
1801
1802 extra_listen_time += 100;
1803 duration = msecs_to_jiffies(extra_listen_time);
1804 wait_for_completion_timeout(&p2p->wait_next_af,
1805 duration);
1806 }
1807 clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN,
1808 &p2p->status);
1809 }
1810 }
1811
1812 if (p2p->block_gon_req_tx) {
1813 /* if ack is true, supplicant will wait more time(100ms).
1814 * so we will return it as a success to get more time .
1815 */
1816 p2p->block_gon_req_tx = false;
1817 ack = true;
1818 }
1819
1820 clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status);
1289 /* if all done, turn mpc on again */ 1821 /* if all done, turn mpc on again */
1290 if (config_af_params.mpc_onoff == 1) 1822 if (config_af_params.mpc_onoff == 1)
1291 brcmf_set_mpc(ndev, 1); 1823 brcmf_set_mpc(ndev, 1);
@@ -1293,6 +1825,72 @@ exit:
1293 return ack; 1825 return ack;
1294} 1826}
1295 1827
1828/**
1829 * brcmf_p2p_notify_rx_mgmt_p2p_probereq() - Event handler for p2p probe req.
1830 *
1831 * @ifp: interface pointer for which event was received.
1832 * @e: even message.
1833 * @data: payload of event message (probe request).
1834 */
1835s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp,
1836 const struct brcmf_event_msg *e,
1837 void *data)
1838{
1839 struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1840 struct brcmf_p2p_info *p2p = &cfg->p2p;
1841 struct afx_hdl *afx_hdl = &p2p->afx_hdl;
1842 struct wireless_dev *wdev;
1843 struct brcmf_cfg80211_vif *vif = ifp->vif;
1844 struct brcmf_rx_mgmt_data *rxframe = (struct brcmf_rx_mgmt_data *)data;
1845 u16 chanspec = be16_to_cpu(rxframe->chanspec);
1846 u8 *mgmt_frame;
1847 u32 mgmt_frame_len;
1848 s32 freq;
1849 u16 mgmt_type;
1850
1851 brcmf_dbg(INFO, "Enter: event %d reason %d\n", e->event_code,
1852 e->reason);
1853
1854 if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status) &&
1855 (memcmp(afx_hdl->tx_dst_addr, e->addr, ETH_ALEN) == 0)) {
1856 afx_hdl->peer_chan = CHSPEC_CHANNEL(chanspec);
1857 brcmf_dbg(INFO, "PROBE REQUEST: Peer found, channel=%d\n",
1858 afx_hdl->peer_chan);
1859 complete(&afx_hdl->act_frm_scan);
1860 }
1861
1862 /* Firmware sends us two proberesponses for each idx one. At the */
1863 /* moment anything but bsscfgidx 0 is passed up to supplicant */
1864 if (e->bsscfgidx == 0)
1865 return 0;
1866
1867 /* Filter any P2P probe reqs arriving during the GO-NEG Phase */
1868 if (test_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status)) {
1869 brcmf_dbg(INFO, "Filtering P2P probe_req in GO-NEG phase\n");
1870 return 0;
1871 }
1872
1873 /* Check if wpa_supplicant has registered for this frame */
1874 brcmf_dbg(INFO, "vif->mgmt_rx_reg %04x\n", vif->mgmt_rx_reg);
1875 mgmt_type = (IEEE80211_STYPE_PROBE_REQ & IEEE80211_FCTL_STYPE) >> 4;
1876 if ((vif->mgmt_rx_reg & BIT(mgmt_type)) == 0)
1877 return 0;
1878
1879 mgmt_frame = (u8 *)(rxframe + 1);
1880 mgmt_frame_len = e->datalen - sizeof(*rxframe);
1881 freq = ieee80211_channel_to_frequency(CHSPEC_CHANNEL(chanspec),
1882 CHSPEC_IS2G(chanspec) ?
1883 IEEE80211_BAND_2GHZ :
1884 IEEE80211_BAND_5GHZ);
1885 wdev = ifp->ndev->ieee80211_ptr;
1886 cfg80211_rx_mgmt(wdev, freq, 0, mgmt_frame, mgmt_frame_len, GFP_ATOMIC);
1887
1888 brcmf_dbg(INFO, "mgmt_frame_len (%d) , e->datalen (%d), chanspec (%04x), freq (%d)\n",
1889 mgmt_frame_len, e->datalen, chanspec, freq);
1890
1891 return 0;
1892}
1893
1296 1894
1297/** 1895/**
1298 * brcmf_p2p_attach() - attach for P2P. 1896 * brcmf_p2p_attach() - attach for P2P.
@@ -1362,6 +1960,9 @@ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
1362 } 1960 }
1363 1961
1364 init_completion(&p2p->send_af_done); 1962 init_completion(&p2p->send_af_done);
1963 INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
1964 init_completion(&p2p->afx_hdl.act_frm_scan);
1965 init_completion(&p2p->wait_next_af);
1365 } 1966 }
1366exit: 1967exit:
1367 return err; 1968 return err;
@@ -1622,6 +2223,7 @@ fail:
1622int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) 2223int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
1623{ 2224{
1624 struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); 2225 struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
2226 struct brcmf_p2p_info *p2p = &cfg->p2p;
1625 struct brcmf_cfg80211_vif *vif; 2227 struct brcmf_cfg80211_vif *vif;
1626 unsigned long jiffie_timeout = msecs_to_jiffies(1500); 2228 unsigned long jiffie_timeout = msecs_to_jiffies(1500);
1627 bool wait_for_disable = false; 2229 bool wait_for_disable = false;
@@ -1647,6 +2249,9 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
1647 break; 2249 break;
1648 } 2250 }
1649 2251
2252 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
2253 brcmf_dbg(INFO, "P2P: GO_NEG_PHASE status cleared\n");
2254
1650 if (wait_for_disable) 2255 if (wait_for_disable)
1651 wait_for_completion_timeout(&cfg->vif_disabled, 2256 wait_for_completion_timeout(&cfg->vif_disabled,
1652 msecs_to_jiffies(500)); 2257 msecs_to_jiffies(500));
@@ -1666,7 +2271,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
1666 } 2271 }
1667 brcmf_cfg80211_arm_vif_event(cfg, NULL); 2272 brcmf_cfg80211_arm_vif_event(cfg, NULL);
1668 brcmf_free_vif(vif); 2273 brcmf_free_vif(vif);
1669 cfg->p2p.bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL; 2274 p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
1670 2275
1671 return err; 2276 return err;
1672} 2277}
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
index 9e0e962466bf..6821b26224be 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
@@ -58,6 +58,10 @@ struct p2p_bss {
58 * @BRCMF_P2P_STATUS_ACTION_TX_NOACK: action frame tx not acked. 58 * @BRCMF_P2P_STATUS_ACTION_TX_NOACK: action frame tx not acked.
59 * @BRCMF_P2P_STATUS_GO_NEG_PHASE: P2P GO negotiation ongoing. 59 * @BRCMF_P2P_STATUS_GO_NEG_PHASE: P2P GO negotiation ongoing.
60 * @BRCMF_P2P_STATUS_DISCOVER_LISTEN: P2P listen, remaining on channel. 60 * @BRCMF_P2P_STATUS_DISCOVER_LISTEN: P2P listen, remaining on channel.
61 * @BRCMF_P2P_STATUS_SENDING_ACT_FRAME: In the process of sending action frame.
62 * @BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN: extra listen time for af tx.
63 * @BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME: waiting for action frame response.
64 * @BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL: search channel for AF active.
61 */ 65 */
62enum brcmf_p2p_status { 66enum brcmf_p2p_status {
63 BRCMF_P2P_STATUS_ENABLED, 67 BRCMF_P2P_STATUS_ENABLED,
@@ -69,7 +73,34 @@ enum brcmf_p2p_status {
69 BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, 73 BRCMF_P2P_STATUS_ACTION_TX_COMPLETED,
70 BRCMF_P2P_STATUS_ACTION_TX_NOACK, 74 BRCMF_P2P_STATUS_ACTION_TX_NOACK,
71 BRCMF_P2P_STATUS_GO_NEG_PHASE, 75 BRCMF_P2P_STATUS_GO_NEG_PHASE,
72 BRCMF_P2P_STATUS_DISCOVER_LISTEN 76 BRCMF_P2P_STATUS_DISCOVER_LISTEN,
77 BRCMF_P2P_STATUS_SENDING_ACT_FRAME,
78 BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN,
79 BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME,
80 BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL
81};
82
83/**
84 * struct afx_hdl - action frame off channel storage.
85 *
86 * @afx_work: worker thread for searching channel
87 * @act_frm_scan: thread synchronizing struct.
88 * @is_active: channel searching active.
89 * @peer_chan: current channel.
90 * @is_listen: sets mode for afx worker.
91 * @my_listen_chan: this peers listen channel.
92 * @peer_listen_chan: remote peers listen channel.
93 * @tx_dst_addr: mac address where tx af should be sent to.
94 */
95struct afx_hdl {
96 struct work_struct afx_work;
97 struct completion act_frm_scan;
98 bool is_active;
99 s32 peer_chan;
100 bool is_listen;
101 u16 my_listen_chan;
102 u16 peer_listen_chan;
103 u8 tx_dst_addr[ETH_ALEN];
73}; 104};
74 105
75/** 106/**
@@ -87,6 +118,12 @@ enum brcmf_p2p_status {
87 * @remain_on_channel_cookie: cookie counter for remain on channel cmd 118 * @remain_on_channel_cookie: cookie counter for remain on channel cmd
88 * @next_af_subtype: expected action frame subtype. 119 * @next_af_subtype: expected action frame subtype.
89 * @send_af_done: indication that action frame tx is complete. 120 * @send_af_done: indication that action frame tx is complete.
121 * @afx_hdl: action frame search handler info.
122 * @af_sent_channel: channel action frame is sent.
123 * @af_tx_sent_jiffies: jiffies time when af tx was transmitted.
124 * @wait_next_af: thread synchronizing struct.
125 * @gon_req_action: about to send go negotiation requets frame.
126 * @block_gon_req_tx: drop tx go negotiation requets frame.
90 */ 127 */
91struct brcmf_p2p_info { 128struct brcmf_p2p_info {
92 struct brcmf_cfg80211_info *cfg; 129 struct brcmf_cfg80211_info *cfg;
@@ -101,6 +138,12 @@ struct brcmf_p2p_info {
101 u32 remain_on_channel_cookie; 138 u32 remain_on_channel_cookie;
102 u8 next_af_subtype; 139 u8 next_af_subtype;
103 struct completion send_af_done; 140 struct completion send_af_done;
141 struct afx_hdl afx_hdl;
142 u32 af_sent_channel;
143 unsigned long af_tx_sent_jiffies;
144 struct completion wait_next_af;
145 bool gon_req_action;
146 bool block_gon_req_tx;
104}; 147};
105 148
106s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg); 149s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg);
@@ -132,5 +175,9 @@ int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp,
132bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg, 175bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
133 struct net_device *ndev, 176 struct net_device *ndev,
134 struct brcmf_fil_af_params_le *af_params); 177 struct brcmf_fil_af_params_le *af_params);
135 178bool brcmf_p2p_scan_finding_common_channel(struct brcmf_cfg80211_info *cfg,
179 struct brcmf_bss_info_le *bi);
180s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp,
181 const struct brcmf_event_msg *e,
182 void *data);
136#endif /* WL_CFGP2P_H_ */ 183#endif /* WL_CFGP2P_H_ */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index b5cc15463576..481f41ad7989 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -601,10 +601,8 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
601 cfg80211_scan_done(scan_request, aborted); 601 cfg80211_scan_done(scan_request, aborted);
602 brcmf_set_mpc(ndev, 1); 602 brcmf_set_mpc(ndev, 1);
603 } 603 }
604 if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { 604 if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status))
605 brcmf_err("Scan complete while device not scanning\n"); 605 brcmf_dbg(SCAN, "Scan complete, probably P2P scan\n");
606 return -EPERM;
607 }
608 606
609 return err; 607 return err;
610} 608}
@@ -2525,8 +2523,7 @@ static void brcmf_cfg80211_escan_timeout_worker(struct work_struct *work)
2525 container_of(work, struct brcmf_cfg80211_info, 2523 container_of(work, struct brcmf_cfg80211_info,
2526 escan_timeout_work); 2524 escan_timeout_work);
2527 2525
2528 brcmf_notify_escan_complete(cfg, 2526 brcmf_notify_escan_complete(cfg, cfg->escan_info.ndev, true, true);
2529 cfg->escan_info.ndev, true, true);
2530} 2527}
2531 2528
2532static void brcmf_escan_timeout(unsigned long data) 2529static void brcmf_escan_timeout(unsigned long data)
@@ -2603,11 +2600,6 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
2603 brcmf_err("Invalid escan result (NULL pointer)\n"); 2600 brcmf_err("Invalid escan result (NULL pointer)\n");
2604 goto exit; 2601 goto exit;
2605 } 2602 }
2606 if (!cfg->scan_request) {
2607 brcmf_dbg(SCAN, "result without cfg80211 request\n");
2608 goto exit;
2609 }
2610
2611 if (le16_to_cpu(escan_result_le->bss_count) != 1) { 2603 if (le16_to_cpu(escan_result_le->bss_count) != 1) {
2612 brcmf_err("Invalid bss_count %d: ignoring\n", 2604 brcmf_err("Invalid bss_count %d: ignoring\n",
2613 escan_result_le->bss_count); 2605 escan_result_le->bss_count);
@@ -2615,6 +2607,14 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
2615 } 2607 }
2616 bss_info_le = &escan_result_le->bss_info_le; 2608 bss_info_le = &escan_result_le->bss_info_le;
2617 2609
2610 if (brcmf_p2p_scan_finding_common_channel(cfg, bss_info_le))
2611 goto exit;
2612
2613 if (!cfg->scan_request) {
2614 brcmf_dbg(SCAN, "result without cfg80211 request\n");
2615 goto exit;
2616 }
2617
2618 bi_length = le32_to_cpu(bss_info_le->length); 2618 bi_length = le32_to_cpu(bss_info_le->length);
2619 if (bi_length != (le32_to_cpu(escan_result_le->buflen) - 2619 if (bi_length != (le32_to_cpu(escan_result_le->buflen) -
2620 WL_ESCAN_RESULTS_FIXED_SIZE)) { 2620 WL_ESCAN_RESULTS_FIXED_SIZE)) {
@@ -2653,6 +2653,8 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
2653 list->count++; 2653 list->count++;
2654 } else { 2654 } else {
2655 cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE; 2655 cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
2656 if (brcmf_p2p_scan_finding_common_channel(cfg, NULL))
2657 goto exit;
2656 if (cfg->scan_request) { 2658 if (cfg->scan_request) {
2657 cfg->bss_list = (struct brcmf_scan_results *) 2659 cfg->bss_list = (struct brcmf_scan_results *)
2658 cfg->escan_info.escan_buf; 2660 cfg->escan_info.escan_buf;
@@ -2661,7 +2663,8 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
2661 brcmf_notify_escan_complete(cfg, ndev, aborted, 2663 brcmf_notify_escan_complete(cfg, ndev, aborted,
2662 false); 2664 false);
2663 } else 2665 } else
2664 brcmf_err("Unexpected scan result 0x%x\n", status); 2666 brcmf_dbg(SCAN, "Ignored scan complete result 0x%x\n",
2667 status);
2665 } 2668 }
2666exit: 2669exit:
2667 return err; 2670 return err;
@@ -4038,50 +4041,6 @@ exit:
4038 return err; 4041 return err;
4039} 4042}
4040 4043
4041static s32 brcmf_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp,
4042 const struct brcmf_event_msg *e,
4043 void *data)
4044{
4045 struct wireless_dev *wdev;
4046 struct brcmf_cfg80211_vif *vif = ifp->vif;
4047 struct brcmf_rx_mgmt_data *rxframe = (struct brcmf_rx_mgmt_data *)data;
4048 u16 chanspec = be16_to_cpu(rxframe->chanspec);
4049 u8 *mgmt_frame;
4050 u32 mgmt_frame_len;
4051 s32 freq;
4052 u16 mgmt_type;
4053
4054 brcmf_dbg(INFO,
4055 "Enter: event %d reason %d\n", e->event_code, e->reason);
4056
4057 /* Firmware sends us two proberesponses for each idx one. At the */
4058 /* moment anything but bsscfgidx 0 is passed up to supplicant */
4059 if (e->bsscfgidx == 0)
4060 return 0;
4061
4062 /* Check if wpa_supplicant has registered for this frame */
4063 brcmf_dbg(INFO, "vif->mgmt_rx_reg %04x\n", vif->mgmt_rx_reg);
4064 mgmt_type = (IEEE80211_STYPE_PROBE_REQ & IEEE80211_FCTL_STYPE) >> 4;
4065 if ((vif->mgmt_rx_reg & BIT(mgmt_type)) == 0)
4066 return 0;
4067
4068 mgmt_frame = (u8 *)(rxframe + 1);
4069 mgmt_frame_len = e->datalen - sizeof(*rxframe);
4070 freq = ieee80211_channel_to_frequency(CHSPEC_CHANNEL(chanspec),
4071 CHSPEC_IS2G(chanspec) ?
4072 IEEE80211_BAND_2GHZ :
4073 IEEE80211_BAND_5GHZ);
4074 wdev = ifp->ndev->ieee80211_ptr;
4075 cfg80211_rx_mgmt(wdev, freq, 0, mgmt_frame, mgmt_frame_len, GFP_ATOMIC);
4076
4077 brcmf_dbg(INFO,
4078 "mgmt_frame_len (%d) , e->datalen (%d), chanspec (%04x), freq (%d)\n",
4079 mgmt_frame_len, e->datalen, chanspec, freq);
4080
4081 return 0;
4082}
4083
4084
4085static struct cfg80211_ops wl_cfg80211_ops = { 4044static struct cfg80211_ops wl_cfg80211_ops = {
4086 .add_virtual_intf = brcmf_cfg80211_add_iface, 4045 .add_virtual_intf = brcmf_cfg80211_add_iface,
4087 .del_virtual_intf = brcmf_cfg80211_del_iface, 4046 .del_virtual_intf = brcmf_cfg80211_del_iface,
@@ -4240,6 +4199,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev)
4240 wiphy->cipher_suites = __wl_cipher_suites; 4199 wiphy->cipher_suites = __wl_cipher_suites;
4241 wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites); 4200 wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
4242 wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT | 4201 wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT |
4202 WIPHY_FLAG_OFFCHAN_TX |
4243 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; 4203 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
4244 wiphy->mgmt_stypes = brcmf_txrx_stypes; 4204 wiphy->mgmt_stypes = brcmf_txrx_stypes;
4245 wiphy->max_remain_on_channel_duration = 5000; 4205 wiphy->max_remain_on_channel_duration = 5000;
@@ -4721,13 +4681,15 @@ static void brcmf_register_event_handlers(struct brcmf_cfg80211_info *cfg)
4721 brcmf_fweh_register(cfg->pub, BRCMF_E_IF, 4681 brcmf_fweh_register(cfg->pub, BRCMF_E_IF,
4722 brcmf_notify_vif_event); 4682 brcmf_notify_vif_event);
4723 brcmf_fweh_register(cfg->pub, BRCMF_E_P2P_PROBEREQ_MSG, 4683 brcmf_fweh_register(cfg->pub, BRCMF_E_P2P_PROBEREQ_MSG,
4724 brcmf_notify_rx_mgmt_p2p_probereq); 4684 brcmf_p2p_notify_rx_mgmt_p2p_probereq);
4725 brcmf_fweh_register(cfg->pub, BRCMF_E_P2P_DISC_LISTEN_COMPLETE, 4685 brcmf_fweh_register(cfg->pub, BRCMF_E_P2P_DISC_LISTEN_COMPLETE,
4726 brcmf_p2p_notify_listen_complete); 4686 brcmf_p2p_notify_listen_complete);
4727 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_RX, 4687 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_RX,
4728 brcmf_p2p_notify_action_frame_rx); 4688 brcmf_p2p_notify_action_frame_rx);
4729 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_COMPLETE, 4689 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_COMPLETE,
4730 brcmf_p2p_notify_action_tx_complete); 4690 brcmf_p2p_notify_action_tx_complete);
4691 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE,
4692 brcmf_p2p_notify_action_tx_complete);
4731} 4693}
4732 4694
4733static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_info *cfg) 4695static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_info *cfg)