@@ -164,6 +164,7 @@ mt7925_connac_mcu_set_wow_ctrl(struct mt76_phy *phy, struct ieee80211_vif *vif,
164
164
bool suspend , struct cfg80211_wowlan * wowlan )
165
165
{
166
166
struct mt76_vif_link * mvif = (struct mt76_vif_link * )vif -> drv_priv ;
167
+ struct ieee80211_scan_ies ies = {};
167
168
struct mt76_dev * dev = phy -> dev ;
168
169
struct {
169
170
struct {
@@ -194,7 +195,7 @@ mt7925_connac_mcu_set_wow_ctrl(struct mt76_phy *phy, struct ieee80211_vif *vif,
194
195
req .wow_ctrl_tlv .trigger |= (UNI_WOW_DETECT_TYPE_DISCONNECT |
195
196
UNI_WOW_DETECT_TYPE_BCN_LOST );
196
197
if (wowlan -> nd_config ) {
197
- mt7925_mcu_sched_scan_req (phy , vif , wowlan -> nd_config );
198
+ mt7925_mcu_sched_scan_req (phy , vif , wowlan -> nd_config , & ies );
198
199
req .wow_ctrl_tlv .trigger |= UNI_WOW_DETECT_TYPE_SCH_SCAN_HIT ;
199
200
mt7925_mcu_sched_scan_enable (phy , vif , suspend );
200
201
}
@@ -2818,6 +2819,54 @@ int mt7925_mcu_set_dbdc(struct mt76_phy *phy, bool enable)
2818
2819
return err ;
2819
2820
}
2820
2821
2822
+ static void
2823
+ mt7925_mcu_build_scan_ie_tlv (struct mt76_dev * mdev ,
2824
+ struct sk_buff * skb ,
2825
+ struct ieee80211_scan_ies * scan_ies )
2826
+ {
2827
+ u32 max_len = sizeof (struct scan_ie_tlv ) + MT76_CONNAC_SCAN_IE_LEN ;
2828
+ struct scan_ie_tlv * ie ;
2829
+ enum nl80211_band i ;
2830
+ struct tlv * tlv ;
2831
+ const u8 * ies ;
2832
+ u16 ies_len ;
2833
+
2834
+ for (i = 0 ; i <= NL80211_BAND_6GHZ ; i ++ ) {
2835
+ if (i == NL80211_BAND_60GHZ )
2836
+ continue ;
2837
+
2838
+ ies = scan_ies -> ies [i ];
2839
+ ies_len = scan_ies -> len [i ];
2840
+
2841
+ if (!ies || !ies_len )
2842
+ continue ;
2843
+
2844
+ if (ies_len > max_len )
2845
+ return ;
2846
+
2847
+ tlv = mt76_connac_mcu_add_tlv (skb , UNI_SCAN_IE ,
2848
+ sizeof (* ie ) + ies_len );
2849
+ ie = (struct scan_ie_tlv * )tlv ;
2850
+
2851
+ memcpy (ie -> ies , ies , ies_len );
2852
+ ie -> ies_len = cpu_to_le16 (ies_len );
2853
+
2854
+ switch (i ) {
2855
+ case NL80211_BAND_2GHZ :
2856
+ ie -> band = 1 ;
2857
+ break ;
2858
+ case NL80211_BAND_6GHZ :
2859
+ ie -> band = 3 ;
2860
+ break ;
2861
+ default :
2862
+ ie -> band = 2 ;
2863
+ break ;
2864
+ }
2865
+
2866
+ max_len -= (sizeof (* ie ) + ies_len );
2867
+ }
2868
+ }
2869
+
2821
2870
int mt7925_mcu_hw_scan (struct mt76_phy * phy , struct ieee80211_vif * vif ,
2822
2871
struct ieee80211_scan_request * scan_req )
2823
2872
{
@@ -2843,7 +2892,8 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
2843
2892
2844
2893
max_len = sizeof (* hdr ) + sizeof (* req ) + sizeof (* ssid ) +
2845
2894
sizeof (* bssid ) * MT7925_RNR_SCAN_MAX_BSSIDS +
2846
- sizeof (* chan_info ) + sizeof (* misc ) + sizeof (* ie );
2895
+ sizeof (* chan_info ) + sizeof (* misc ) + sizeof (* ie ) +
2896
+ MT76_CONNAC_SCAN_IE_LEN ;
2847
2897
2848
2898
skb = mt76_mcu_msg_alloc (mdev , NULL , max_len );
2849
2899
if (!skb )
@@ -2925,13 +2975,6 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
2925
2975
}
2926
2976
chan_info -> channel_type = sreq -> n_channels ? 4 : 0 ;
2927
2977
2928
- tlv = mt76_connac_mcu_add_tlv (skb , UNI_SCAN_IE , sizeof (* ie ));
2929
- ie = (struct scan_ie_tlv * )tlv ;
2930
- if (sreq -> ie_len > 0 ) {
2931
- memcpy (ie -> ies , sreq -> ie , sreq -> ie_len );
2932
- ie -> ies_len = cpu_to_le16 (sreq -> ie_len );
2933
- }
2934
-
2935
2978
req -> scan_func |= SCAN_FUNC_SPLIT_SCAN ;
2936
2979
2937
2980
tlv = mt76_connac_mcu_add_tlv (skb , UNI_SCAN_MISC , sizeof (* misc ));
@@ -2942,6 +2985,9 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
2942
2985
req -> scan_func |= SCAN_FUNC_RANDOM_MAC ;
2943
2986
}
2944
2987
2988
+ /* Append scan probe IEs as the last tlv */
2989
+ mt7925_mcu_build_scan_ie_tlv (mdev , skb , & scan_req -> ies );
2990
+
2945
2991
err = mt76_mcu_skb_send_msg (mdev , skb , MCU_UNI_CMD (SCAN_REQ ),
2946
2992
true);
2947
2993
if (err < 0 )
@@ -2953,7 +2999,8 @@ EXPORT_SYMBOL_GPL(mt7925_mcu_hw_scan);
2953
2999
2954
3000
int mt7925_mcu_sched_scan_req (struct mt76_phy * phy ,
2955
3001
struct ieee80211_vif * vif ,
2956
- struct cfg80211_sched_scan_request * sreq )
3002
+ struct cfg80211_sched_scan_request * sreq ,
3003
+ struct ieee80211_scan_ies * ies )
2957
3004
{
2958
3005
struct mt76_vif_link * mvif = (struct mt76_vif_link * )vif -> drv_priv ;
2959
3006
struct ieee80211_channel * * scan_list = sreq -> channels ;
@@ -3041,12 +3088,8 @@ int mt7925_mcu_sched_scan_req(struct mt76_phy *phy,
3041
3088
}
3042
3089
chan_info -> channel_type = sreq -> n_channels ? 4 : 0 ;
3043
3090
3044
- tlv = mt76_connac_mcu_add_tlv (skb , UNI_SCAN_IE , sizeof (* ie ));
3045
- ie = (struct scan_ie_tlv * )tlv ;
3046
- if (sreq -> ie_len > 0 ) {
3047
- memcpy (ie -> ies , sreq -> ie , sreq -> ie_len );
3048
- ie -> ies_len = cpu_to_le16 (sreq -> ie_len );
3049
- }
3091
+ /* Append scan probe IEs as the last tlv */
3092
+ mt7925_mcu_build_scan_ie_tlv (mdev , skb , ies );
3050
3093
3051
3094
return mt76_mcu_skb_send_msg (mdev , skb , MCU_UNI_CMD (SCAN_REQ ),
3052
3095
true);
0 commit comments