5353
5454#define DEFAULT_BG_SCAN_PERIOD 60
5555
56+ struct ath6kl_cfg80211_match_probe_ssid {
57+ struct cfg80211_ssid ssid ;
58+ u8 flag ;
59+ };
60+
5661static struct ieee80211_rate ath6kl_rates [] = {
5762 RATETAB_ENT (10 , 0x1 , 0 ),
5863 RATETAB_ENT (20 , 0x2 , 0 ),
@@ -576,6 +581,9 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
576581
577582 vif -> nw_type = vif -> next_mode ;
578583
584+ /* enable enhanced bmiss detection if applicable */
585+ ath6kl_cfg80211_sta_bmiss_enhance (vif , true);
586+
579587 if (vif -> wdev .iftype == NL80211_IFTYPE_P2P_CLIENT )
580588 nw_subtype = SUBTYPE_P2PCLIENT ;
581589
@@ -852,20 +860,6 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason,
852860 }
853861 }
854862
855- /*
856- * Send a disconnect command to target when a disconnect event is
857- * received with reason code other than 3 (DISCONNECT_CMD - disconnect
858- * request from host) to make the firmware stop trying to connect even
859- * after giving disconnect event. There will be one more disconnect
860- * event for this disconnect command with reason code DISCONNECT_CMD
861- * which will be notified to cfg80211.
862- */
863-
864- if (reason != DISCONNECT_CMD ) {
865- ath6kl_wmi_disconnect_cmd (ar -> wmi , vif -> fw_vif_idx );
866- return ;
867- }
868-
869863 clear_bit (CONNECT_PEND , & vif -> flags );
870864
871865 if (vif -> sme_state == SME_CONNECTING ) {
@@ -875,32 +869,96 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason,
875869 WLAN_STATUS_UNSPECIFIED_FAILURE ,
876870 GFP_KERNEL );
877871 } else if (vif -> sme_state == SME_CONNECTED ) {
878- cfg80211_disconnected (vif -> ndev , reason ,
872+ cfg80211_disconnected (vif -> ndev , proto_reason ,
879873 NULL , 0 , GFP_KERNEL );
880874 }
881875
882876 vif -> sme_state = SME_DISCONNECTED ;
877+
878+ /*
879+ * Send a disconnect command to target when a disconnect event is
880+ * received with reason code other than 3 (DISCONNECT_CMD - disconnect
881+ * request from host) to make the firmware stop trying to connect even
882+ * after giving disconnect event. There will be one more disconnect
883+ * event for this disconnect command with reason code DISCONNECT_CMD
884+ * which won't be notified to cfg80211.
885+ */
886+ if (reason != DISCONNECT_CMD )
887+ ath6kl_wmi_disconnect_cmd (ar -> wmi , vif -> fw_vif_idx );
883888}
884889
885890static int ath6kl_set_probed_ssids (struct ath6kl * ar ,
886891 struct ath6kl_vif * vif ,
887- struct cfg80211_ssid * ssids , int n_ssids )
892+ struct cfg80211_ssid * ssids , int n_ssids ,
893+ struct cfg80211_match_set * match_set ,
894+ int n_match_ssid )
888895{
889- u8 i ;
896+ u8 i , j , index_to_add , ssid_found = false;
897+ struct ath6kl_cfg80211_match_probe_ssid ssid_list [MAX_PROBED_SSIDS ];
898+
899+ memset (ssid_list , 0 , sizeof (ssid_list ));
890900
891- if (n_ssids > MAX_PROBED_SSID_INDEX )
901+ if (n_ssids > MAX_PROBED_SSIDS ||
902+ n_match_ssid > MAX_PROBED_SSIDS )
892903 return - EINVAL ;
893904
894905 for (i = 0 ; i < n_ssids ; i ++ ) {
906+ memcpy (ssid_list [i ].ssid .ssid ,
907+ ssids [i ].ssid ,
908+ ssids [i ].ssid_len );
909+ ssid_list [i ].ssid .ssid_len = ssids [i ].ssid_len ;
910+
911+ if (ssids [i ].ssid_len )
912+ ssid_list [i ].flag = SPECIFIC_SSID_FLAG ;
913+ else
914+ ssid_list [i ].flag = ANY_SSID_FLAG ;
915+
916+ if (n_match_ssid == 0 )
917+ ssid_list [i ].flag |= MATCH_SSID_FLAG ;
918+ }
919+
920+ index_to_add = i ;
921+
922+ for (i = 0 ; i < n_match_ssid ; i ++ ) {
923+ ssid_found = false;
924+
925+ for (j = 0 ; j < n_ssids ; j ++ ) {
926+ if ((match_set [i ].ssid .ssid_len ==
927+ ssid_list [j ].ssid .ssid_len ) &&
928+ (!memcmp (ssid_list [j ].ssid .ssid ,
929+ match_set [i ].ssid .ssid ,
930+ match_set [i ].ssid .ssid_len ))) {
931+ ssid_list [j ].flag |= MATCH_SSID_FLAG ;
932+ ssid_found = true;
933+ break ;
934+ }
935+ }
936+
937+ if (ssid_found )
938+ continue ;
939+
940+ if (index_to_add >= MAX_PROBED_SSIDS )
941+ continue ;
942+
943+ ssid_list [index_to_add ].ssid .ssid_len =
944+ match_set [i ].ssid .ssid_len ;
945+ memcpy (ssid_list [index_to_add ].ssid .ssid ,
946+ match_set [i ].ssid .ssid ,
947+ match_set [i ].ssid .ssid_len );
948+ ssid_list [index_to_add ].flag |= MATCH_SSID_FLAG ;
949+ index_to_add ++ ;
950+ }
951+
952+ for (i = 0 ; i < index_to_add ; i ++ ) {
895953 ath6kl_wmi_probedssid_cmd (ar -> wmi , vif -> fw_vif_idx , i ,
896- ssids [i ].ssid_len ?
897- SPECIFIC_SSID_FLAG : ANY_SSID_FLAG ,
898- ssids [i ].ssid_len ,
899- ssids [ i ]. ssid );
954+ ssid_list [i ].flag ,
955+ ssid_list [ i ]. ssid . ssid_len ,
956+ ssid_list [i ].ssid . ssid );
957+
900958 }
901959
902960 /* Make sure no old entries are left behind */
903- for (i = n_ssids ; i < MAX_PROBED_SSID_INDEX ; i ++ ) {
961+ for (i = index_to_add ; i < MAX_PROBED_SSIDS ; i ++ ) {
904962 ath6kl_wmi_probedssid_cmd (ar -> wmi , vif -> fw_vif_idx , i ,
905963 DISABLE_SSID_FLAG , 0 , NULL );
906964 }
@@ -934,7 +992,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
934992 }
935993
936994 ret = ath6kl_set_probed_ssids (ar , vif , request -> ssids ,
937- request -> n_ssids );
995+ request -> n_ssids , NULL , 0 );
938996 if (ret < 0 )
939997 return ret ;
940998
@@ -943,7 +1001,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
9431001 WMI_FRAME_PROBE_REQ ,
9441002 request -> ie , request -> ie_len );
9451003 if (ret ) {
946- ath6kl_err ("failed to set Probe Request appie for scan" );
1004+ ath6kl_err ("failed to set Probe Request appie for scan\n " );
9471005 return ret ;
9481006 }
9491007
@@ -1512,6 +1570,9 @@ static int ath6kl_cfg80211_change_iface(struct wiphy *wiphy,
15121570 }
15131571 }
15141572
1573+ /* need to clean up enhanced bmiss detection fw state */
1574+ ath6kl_cfg80211_sta_bmiss_enhance (vif , false);
1575+
15151576set_iface_type :
15161577 switch (type ) {
15171578 case NL80211_IFTYPE_STATION :
@@ -2074,7 +2135,9 @@ static int ath6kl_wow_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow)
20742135 if (wow && (wow -> n_patterns > WOW_MAX_FILTERS_PER_LIST ))
20752136 return - EINVAL ;
20762137
2077- if (!test_bit (NETDEV_MCAST_ALL_ON , & vif -> flags )) {
2138+ if (!test_bit (NETDEV_MCAST_ALL_ON , & vif -> flags ) &&
2139+ test_bit (ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER ,
2140+ ar -> fw_capabilities )) {
20782141 ret = ath6kl_wmi_mcast_filter_cmd (vif -> ar -> wmi ,
20792142 vif -> fw_vif_idx , false);
20802143 if (ret )
@@ -2209,7 +2272,9 @@ static int ath6kl_wow_resume(struct ath6kl *ar)
22092272
22102273 ar -> state = ATH6KL_STATE_ON ;
22112274
2212- if (!test_bit (NETDEV_MCAST_ALL_OFF , & vif -> flags )) {
2275+ if (!test_bit (NETDEV_MCAST_ALL_OFF , & vif -> flags ) &&
2276+ test_bit (ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER ,
2277+ ar -> fw_capabilities )) {
22132278 ret = ath6kl_wmi_mcast_filter_cmd (vif -> ar -> wmi ,
22142279 vif -> fw_vif_idx , true);
22152280 if (ret )
@@ -2475,7 +2540,7 @@ void ath6kl_check_wow_status(struct ath6kl *ar)
24752540static int ath6kl_set_htcap (struct ath6kl_vif * vif , enum ieee80211_band band ,
24762541 bool ht_enable )
24772542{
2478- struct ath6kl_htcap * htcap = & vif -> htcap ;
2543+ struct ath6kl_htcap * htcap = & vif -> htcap [ band ] ;
24792544
24802545 if (htcap -> ht_enable == ht_enable )
24812546 return 0 ;
@@ -2585,6 +2650,30 @@ static int ath6kl_set_ies(struct ath6kl_vif *vif,
25852650 return 0 ;
25862651}
25872652
2653+ void ath6kl_cfg80211_sta_bmiss_enhance (struct ath6kl_vif * vif , bool enable )
2654+ {
2655+ int err ;
2656+
2657+ if (WARN_ON (!test_bit (WMI_READY , & vif -> ar -> flag )))
2658+ return ;
2659+
2660+ if (vif -> nw_type != INFRA_NETWORK )
2661+ return ;
2662+
2663+ if (!test_bit (ATH6KL_FW_CAPABILITY_BMISS_ENHANCE ,
2664+ vif -> ar -> fw_capabilities ))
2665+ return ;
2666+
2667+ ath6kl_dbg (ATH6KL_DBG_WLAN_CFG , "%s fw bmiss enhance\n" ,
2668+ enable ? "enable" : "disable" );
2669+
2670+ err = ath6kl_wmi_sta_bmiss_enhance_cmd (vif -> ar -> wmi ,
2671+ vif -> fw_vif_idx , enable );
2672+ if (err )
2673+ ath6kl_err ("failed to %s enhanced bmiss detection: %d\n" ,
2674+ enable ? "enable" : "disable" , err );
2675+ }
2676+
25882677static int ath6kl_get_rsn_capab (struct cfg80211_beacon_data * beacon ,
25892678 u8 * rsn_capab )
25902679{
@@ -2665,9 +2754,15 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
26652754
26662755 /* TODO:
26672756 * info->interval
2668- * info->dtim_period
26692757 */
26702758
2759+ ret = ath6kl_wmi_ap_set_dtim_cmd (ar -> wmi , vif -> fw_vif_idx ,
2760+ info -> dtim_period );
2761+
2762+ /* ignore error, just print a warning and continue normally */
2763+ if (ret )
2764+ ath6kl_warn ("Failed to set dtim_period in beacon: %d\n" , ret );
2765+
26712766 if (info -> beacon .head == NULL )
26722767 return - EINVAL ;
26732768 mgmt = (struct ieee80211_mgmt * ) info -> beacon .head ;
@@ -3131,10 +3226,24 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy,
31313226 ath6kl_cfg80211_scan_complete_event (vif , true);
31323227
31333228 ret = ath6kl_set_probed_ssids (ar , vif , request -> ssids ,
3134- request -> n_ssids );
3229+ request -> n_ssids ,
3230+ request -> match_sets ,
3231+ request -> n_match_sets );
31353232 if (ret < 0 )
31363233 return ret ;
31373234
3235+ if (!request -> n_match_sets ) {
3236+ ret = ath6kl_wmi_bssfilter_cmd (ar -> wmi , vif -> fw_vif_idx ,
3237+ ALL_BSS_FILTER , 0 );
3238+ if (ret < 0 )
3239+ return ret ;
3240+ } else {
3241+ ret = ath6kl_wmi_bssfilter_cmd (ar -> wmi , vif -> fw_vif_idx ,
3242+ MATCHED_SSID_FILTER , 0 );
3243+ if (ret < 0 )
3244+ return ret ;
3245+ }
3246+
31383247 /* fw uses seconds, also make sure that it's >0 */
31393248 interval = max_t (u16 , 1 , request -> interval / 1000 );
31403249
@@ -3156,7 +3265,7 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy,
31563265 WMI_FRAME_PROBE_REQ ,
31573266 request -> ie , request -> ie_len );
31583267 if (ret ) {
3159- ath6kl_warn ("Failed to set probe request IE for scheduled scan: %d" ,
3268+ ath6kl_warn ("Failed to set probe request IE for scheduled scan: %d\n " ,
31603269 ret );
31613270 return ret ;
31623271 }
@@ -3188,6 +3297,18 @@ static int ath6kl_cfg80211_sscan_stop(struct wiphy *wiphy,
31883297 return 0 ;
31893298}
31903299
3300+ static int ath6kl_cfg80211_set_bitrate (struct wiphy * wiphy ,
3301+ struct net_device * dev ,
3302+ const u8 * addr ,
3303+ const struct cfg80211_bitrate_mask * mask )
3304+ {
3305+ struct ath6kl * ar = ath6kl_priv (dev );
3306+ struct ath6kl_vif * vif = netdev_priv (dev );
3307+
3308+ return ath6kl_wmi_set_bitrate_mask (ar -> wmi , vif -> fw_vif_idx ,
3309+ mask );
3310+ }
3311+
31913312static const struct ieee80211_txrx_stypes
31923313ath6kl_mgmt_stypes [NUM_NL80211_IFTYPES ] = {
31933314 [NL80211_IFTYPE_STATION ] = {
@@ -3253,6 +3374,7 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = {
32533374 .mgmt_frame_register = ath6kl_mgmt_frame_register ,
32543375 .sched_scan_start = ath6kl_cfg80211_sscan_start ,
32553376 .sched_scan_stop = ath6kl_cfg80211_sscan_stop ,
3377+ .set_bitrate_mask = ath6kl_cfg80211_set_bitrate ,
32563378};
32573379
32583380void ath6kl_cfg80211_stop (struct ath6kl_vif * vif )
@@ -3380,7 +3502,8 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
33803502 vif -> listen_intvl_t = ATH6KL_DEFAULT_LISTEN_INTVAL ;
33813503 vif -> bmiss_time_t = ATH6KL_DEFAULT_BMISS_TIME ;
33823504 vif -> bg_scan_period = 0 ;
3383- vif -> htcap .ht_enable = true;
3505+ vif -> htcap [IEEE80211_BAND_2GHZ ].ht_enable = true;
3506+ vif -> htcap [IEEE80211_BAND_5GHZ ].ht_enable = true;
33843507
33853508 memcpy (ndev -> dev_addr , ar -> mac_addr , ETH_ALEN );
33863509 if (fw_vif_idx != 0 )
@@ -3440,7 +3563,13 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
34403563 }
34413564
34423565 /* max num of ssids that can be probed during scanning */
3443- wiphy -> max_scan_ssids = MAX_PROBED_SSID_INDEX ;
3566+ wiphy -> max_scan_ssids = MAX_PROBED_SSIDS ;
3567+
3568+ /* max num of ssids that can be matched after scan */
3569+ if (test_bit (ATH6KL_FW_CAPABILITY_SCHED_SCAN_MATCH_LIST ,
3570+ ar -> fw_capabilities ))
3571+ wiphy -> max_match_sets = MAX_PROBED_SSIDS ;
3572+
34443573 wiphy -> max_scan_ie_len = 1000 ; /* FIX: what is correct limit? */
34453574 switch (ar -> hw .cap ) {
34463575 case WMI_11AN_CAP :
@@ -3477,6 +3606,17 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
34773606 ath6kl_band_5ghz .ht_cap .cap = 0 ;
34783607 ath6kl_band_5ghz .ht_cap .ht_supported = false;
34793608 }
3609+
3610+ if (ar -> hw .flags & ATH6KL_HW_FLAG_64BIT_RATES ) {
3611+ ath6kl_band_2ghz .ht_cap .mcs .rx_mask [0 ] = 0xff ;
3612+ ath6kl_band_5ghz .ht_cap .mcs .rx_mask [0 ] = 0xff ;
3613+ ath6kl_band_2ghz .ht_cap .mcs .rx_mask [1 ] = 0xff ;
3614+ ath6kl_band_5ghz .ht_cap .mcs .rx_mask [1 ] = 0xff ;
3615+ } else {
3616+ ath6kl_band_2ghz .ht_cap .mcs .rx_mask [0 ] = 0xff ;
3617+ ath6kl_band_5ghz .ht_cap .mcs .rx_mask [0 ] = 0xff ;
3618+ }
3619+
34803620 if (band_2gig )
34813621 wiphy -> bands [IEEE80211_BAND_2GHZ ] = & ath6kl_band_2ghz ;
34823622 if (band_5gig )
@@ -3497,7 +3637,7 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
34973637 wiphy -> wowlan .pattern_min_len = 1 ;
34983638 wiphy -> wowlan .pattern_max_len = WOW_PATTERN_SIZE ;
34993639
3500- wiphy -> max_sched_scan_ssids = MAX_PROBED_SSID_INDEX ;
3640+ wiphy -> max_sched_scan_ssids = MAX_PROBED_SSIDS ;
35013641
35023642 ar -> wiphy -> flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM |
35033643 WIPHY_FLAG_HAVE_AP_SME |
0 commit comments