@@ -98,9 +98,10 @@ static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon)
9898void wfx_configure_filter (struct ieee80211_hw * hw , unsigned int changed_flags ,
9999 unsigned int * total_flags , u64 unused )
100100{
101- struct wfx_vif * wvif = NULL ;
102- struct wfx_dev * wdev = hw -> priv ;
103101 bool filter_bssid , filter_prbreq , filter_beacon ;
102+ struct ieee80211_vif * vif = NULL ;
103+ struct wfx_dev * wdev = hw -> priv ;
104+ struct wfx_vif * wvif = NULL ;
104105
105106 /* Notes:
106107 * - Probe responses (FIF_BCN_PRBRESP_PROMISC) are never filtered
@@ -131,8 +132,9 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
131132 else
132133 filter_bssid = true;
133134
135+ vif = wvif_to_vif (wvif );
134136 /* In AP mode, chip can reply to probe request itself */
135- if (* total_flags & FIF_PROBE_REQ && wvif -> vif -> type == NL80211_IFTYPE_AP ) {
137+ if (* total_flags & FIF_PROBE_REQ && vif -> type == NL80211_IFTYPE_AP ) {
136138 dev_dbg (wdev -> dev , "do not forward probe request in AP mode\n" );
137139 * total_flags &= ~FIF_PROBE_REQ ;
138140 }
@@ -152,19 +154,28 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
152154{
153155 struct ieee80211_channel * chan0 = NULL , * chan1 = NULL ;
154156 struct ieee80211_conf * conf = & wvif -> wdev -> hw -> conf ;
157+ struct ieee80211_vif * vif = wvif_to_vif (wvif );
155158
156- WARN (!wvif -> vif -> bss_conf .assoc && enable_ps ,
159+ WARN (!vif -> bss_conf .assoc && enable_ps ,
157160 "enable_ps is reliable only if associated" );
158- if (wdev_to_wvif (wvif -> wdev , 0 ))
159- chan0 = wdev_to_wvif (wvif -> wdev , 0 )-> vif -> bss_conf .chandef .chan ;
160- if (wdev_to_wvif (wvif -> wdev , 1 ))
161- chan1 = wdev_to_wvif (wvif -> wdev , 1 )-> vif -> bss_conf .chandef .chan ;
162- if (chan0 && chan1 && wvif -> vif -> type != NL80211_IFTYPE_AP ) {
161+ if (wdev_to_wvif (wvif -> wdev , 0 )) {
162+ struct wfx_vif * wvif_ch0 = wdev_to_wvif (wvif -> wdev , 0 );
163+ struct ieee80211_vif * vif_ch0 = wvif_to_vif (wvif_ch0 );
164+
165+ chan0 = vif_ch0 -> bss_conf .chandef .chan ;
166+ }
167+ if (wdev_to_wvif (wvif -> wdev , 1 )) {
168+ struct wfx_vif * wvif_ch1 = wdev_to_wvif (wvif -> wdev , 1 );
169+ struct ieee80211_vif * vif_ch1 = wvif_to_vif (wvif_ch1 );
170+
171+ chan1 = vif_ch1 -> bss_conf .chandef .chan ;
172+ }
173+ if (chan0 && chan1 && vif -> type != NL80211_IFTYPE_AP ) {
163174 if (chan0 -> hw_value == chan1 -> hw_value ) {
164175 /* It is useless to enable PS if channels are the same. */
165176 if (enable_ps )
166177 * enable_ps = false;
167- if (wvif -> vif -> bss_conf .assoc && wvif -> vif -> bss_conf .ps )
178+ if (vif -> bss_conf .assoc && vif -> bss_conf .ps )
168179 dev_info (wvif -> wdev -> dev , "ignoring requested PS mode" );
169180 return -1 ;
170181 }
@@ -177,19 +188,20 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
177188 return 30 ;
178189 }
179190 if (enable_ps )
180- * enable_ps = wvif -> vif -> bss_conf .ps ;
181- if (wvif -> vif -> bss_conf .assoc && wvif -> vif -> bss_conf .ps )
191+ * enable_ps = vif -> bss_conf .ps ;
192+ if (vif -> bss_conf .assoc && vif -> bss_conf .ps )
182193 return conf -> dynamic_ps_timeout ;
183194 else
184195 return -1 ;
185196}
186197
187198int wfx_update_pm (struct wfx_vif * wvif )
188199{
200+ struct ieee80211_vif * vif = wvif_to_vif (wvif );
189201 int ps_timeout ;
190202 bool ps ;
191203
192- if (!wvif -> vif -> bss_conf .assoc )
204+ if (!vif -> bss_conf .assoc )
193205 return 0 ;
194206 ps_timeout = wfx_get_ps_timeout (wvif , & ps );
195207 if (!ps )
@@ -215,7 +227,8 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
215227 mutex_lock (& wdev -> conf_mutex );
216228 assign_bit (queue , & wvif -> uapsd_mask , params -> uapsd );
217229 wfx_hif_set_edca_queue_params (wvif , queue , params );
218- if (wvif -> vif -> type == NL80211_IFTYPE_STATION && old_uapsd != wvif -> uapsd_mask ) {
230+ if (vif -> type == NL80211_IFTYPE_STATION &&
231+ old_uapsd != wvif -> uapsd_mask ) {
219232 wfx_hif_set_uapsd_info (wvif , wvif -> uapsd_mask );
220233 wfx_update_pm (wvif );
221234 }
@@ -238,24 +251,26 @@ void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi)
238251 /* RSSI: signed Q8.0, RCPI: unsigned Q7.1
239252 * RSSI = RCPI / 2 - 110
240253 */
254+ struct ieee80211_vif * vif = wvif_to_vif (wvif );
241255 int rcpi_rssi ;
242256 int cqm_evt ;
243257
244258 rcpi_rssi = raw_rcpi_rssi / 2 - 110 ;
245- if (rcpi_rssi <= wvif -> vif -> bss_conf .cqm_rssi_thold )
259+ if (rcpi_rssi <= vif -> bss_conf .cqm_rssi_thold )
246260 cqm_evt = NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW ;
247261 else
248262 cqm_evt = NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH ;
249- ieee80211_cqm_rssi_notify (wvif -> vif , cqm_evt , rcpi_rssi , GFP_KERNEL );
263+ ieee80211_cqm_rssi_notify (vif , cqm_evt , rcpi_rssi , GFP_KERNEL );
250264}
251265
252266static void wfx_beacon_loss_work (struct work_struct * work )
253267{
254268 struct wfx_vif * wvif = container_of (to_delayed_work (work ), struct wfx_vif ,
255269 beacon_loss_work );
256- struct ieee80211_bss_conf * bss_conf = & wvif -> vif -> bss_conf ;
270+ struct ieee80211_vif * vif = wvif_to_vif (wvif );
271+ struct ieee80211_bss_conf * bss_conf = & vif -> bss_conf ;
257272
258- ieee80211_beacon_loss (wvif -> vif );
273+ ieee80211_beacon_loss (vif );
259274 schedule_delayed_work (to_delayed_work (work ), msecs_to_jiffies (bss_conf -> beacon_int ));
260275}
261276
@@ -321,15 +336,16 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ie
321336
322337static int wfx_upload_ap_templates (struct wfx_vif * wvif )
323338{
339+ struct ieee80211_vif * vif = wvif_to_vif (wvif );
324340 struct sk_buff * skb ;
325341
326- skb = ieee80211_beacon_get (wvif -> wdev -> hw , wvif -> vif );
342+ skb = ieee80211_beacon_get (wvif -> wdev -> hw , vif );
327343 if (!skb )
328344 return - ENOMEM ;
329345 wfx_hif_set_template_frame (wvif , skb , HIF_TMPLT_BCN , API_RATE_INDEX_B_1MBPS );
330346 dev_kfree_skb (skb );
331347
332- skb = ieee80211_proberesp_get (wvif -> wdev -> hw , wvif -> vif );
348+ skb = ieee80211_proberesp_get (wvif -> wdev -> hw , vif );
333349 if (!skb )
334350 return - ENOMEM ;
335351 wfx_hif_set_template_frame (wvif , skb , HIF_TMPLT_PRBRES , API_RATE_INDEX_B_1MBPS );
@@ -339,7 +355,8 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif)
339355
340356static void wfx_set_mfp_ap (struct wfx_vif * wvif )
341357{
342- struct sk_buff * skb = ieee80211_beacon_get (wvif -> wdev -> hw , wvif -> vif );
358+ struct ieee80211_vif * vif = wvif_to_vif (wvif );
359+ struct sk_buff * skb = ieee80211_beacon_get (wvif -> wdev -> hw , vif );
343360 const int ieoffset = offsetof(struct ieee80211_mgmt , u .beacon .variable );
344361 const u16 * ptr = (u16 * )cfg80211_find_ie (WLAN_EID_RSN , skb -> data + ieoffset ,
345362 skb -> len - ieoffset );
@@ -388,12 +405,13 @@ void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
388405
389406static void wfx_join (struct wfx_vif * wvif )
390407{
391- int ret ;
392- struct ieee80211_bss_conf * conf = & wvif -> vif -> bss_conf ;
408+ struct ieee80211_vif * vif = wvif_to_vif ( wvif ) ;
409+ struct ieee80211_bss_conf * conf = & vif -> bss_conf ;
393410 struct cfg80211_bss * bss = NULL ;
394411 u8 ssid [IEEE80211_MAX_SSID_LEN ];
395412 const u8 * ssidie = NULL ;
396413 int ssidlen = 0 ;
414+ int ret ;
397415
398416 wfx_tx_lock_flush (wvif -> wdev );
399417
@@ -420,7 +438,7 @@ static void wfx_join(struct wfx_vif *wvif)
420438 wvif -> join_in_progress = true;
421439 ret = wfx_hif_join (wvif , conf , wvif -> channel , ssid , ssidlen );
422440 if (ret ) {
423- ieee80211_connection_loss (wvif -> vif );
441+ ieee80211_connection_loss (vif );
424442 wfx_reset (wvif );
425443 } else {
426444 /* Due to beacon filtering it is possible that the AP's beacon is not known for the
@@ -434,13 +452,14 @@ static void wfx_join(struct wfx_vif *wvif)
434452
435453static void wfx_join_finalize (struct wfx_vif * wvif , struct ieee80211_bss_conf * info )
436454{
455+ struct ieee80211_vif * vif = wvif_to_vif (wvif );
437456 struct ieee80211_sta * sta = NULL ;
438457 int ampdu_density = 0 ;
439458 bool greenfield = false;
440459
441460 rcu_read_lock (); /* protect sta */
442461 if (info -> bssid && !info -> ibss_joined )
443- sta = ieee80211_find_sta (wvif -> vif , info -> bssid );
462+ sta = ieee80211_find_sta (vif , info -> bssid );
444463 if (sta && sta -> deflink .ht_cap .ht_supported )
445464 ampdu_density = sta -> deflink .ht_cap .ampdu_density ;
446465 if (sta && sta -> deflink .ht_cap .ht_supported &&
@@ -561,11 +580,13 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
561580
562581static int wfx_update_tim (struct wfx_vif * wvif )
563582{
583+ struct ieee80211_vif * vif = wvif_to_vif (wvif );
564584 struct sk_buff * skb ;
565585 u16 tim_offset , tim_length ;
566586 u8 * tim_ptr ;
567587
568- skb = ieee80211_beacon_get_tim (wvif -> wdev -> hw , wvif -> vif , & tim_offset , & tim_length );
588+ skb = ieee80211_beacon_get_tim (wvif -> wdev -> hw , vif , & tim_offset ,
589+ & tim_length );
569590 if (!skb )
570591 return - ENOENT ;
571592 tim_ptr = skb -> data + tim_offset ;
@@ -707,8 +728,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
707728 return - EOPNOTSUPP ;
708729 }
709730
710- /* FIXME: prefer use of container_of() to get vif */
711- wvif -> vif = vif ;
712731 wvif -> wdev = wdev ;
713732
714733 wvif -> link_id_map = 1 ; /* link-id 0 is reserved for multicast */
@@ -767,7 +786,6 @@ void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
767786
768787 cancel_delayed_work_sync (& wvif -> beacon_loss_work );
769788 wdev -> vif [wvif -> id ] = NULL ;
770- wvif -> vif = NULL ;
771789
772790 mutex_unlock (& wdev -> conf_mutex );
773791
0 commit comments