mac80211 cleanups and fixes
Subsystems (2)
Johannes Berg
maintainercover mac80211 cleanups and fixes
Hi,
Here's another series to clean up a bit including a few things that I've been meaning to do for a long time:
* mac80211: move ieee80211_set_freq to utils
* mac80211: make bridge_packets a virtual interface option
* mac80211: clean up some comments
* mac80211: inform driver of basic rateset
* mac80211: use nl80211 interface types
I'd been talking with Sujith about this one:
* mac80211: share STA information with driver
and decided to just do it; as it stands it's not very useful but I expect it to be used soon, if not we can remove the EXPORT_SYMBOL again.
johannes
Johannes Berg
maintainerPATCH 1/18 mac80211: move ieee80211_sta_expire
ieee80211_sta_expire uses the internal __sta_info_unlink function which can become static if this function is moved to sta_info.c.
--- net/mac80211/mlme.c | 26 -------------------------- net/mac80211/sta_info.c | 28 +++++++++++++++++++++++++++- net/mac80211/sta_info.h | 3 ++- 3 files changed, 29 insertions(+), 28 deletions(-)
net/mac80211/mlme.c +0 -26
@@ -1944,32 +1944,6 @@ static int ieee80211_sta_active_ibss(str } -static void ieee80211_sta_expire (struct ieee80211_sub_if_data *sdata,unsigned long exp_time) -{ -struct ieee80211_local *local = sdata->local; -struct sta_info *sta, *tmp; -LIST_HEAD (tmp_list); -DECLARE_MAC_BUF (mac); -unsigned long flags; - -spin_lock_irqsave (&local->sta_lock, flags); -list_for_each_entry_safe (sta, tmp, &local->sta_list, list) -if (time_after (jiffies, sta->last_rx + exp_time)) { -#ifdef CONFIG_MAC80211_IBSS_DEBUG -printk (KERN_DEBUG "%s: expiring inactive STA %s\n" , - sdata->dev->name,print_mac (mac, sta->addr)); -#endif -__sta_info_unlink (&sta); -if (sta) -list_add (&sta->list, &tmp_list); - } -spin_unlock_irqrestore (&local->sta_lock, flags); - -list_for_each_entry_safe (sta, tmp, &tmp_list, list) -sta_info_destroy (sta); -} - -static void ieee80211_sta_merge_ibss (struct ieee80211_sub_if_data *sdata,struct ieee80211_if_sta *ifsta) {
net/mac80211/sta_info.c +27 -1
@@ -424,7 +424,7 @@ void sta_info_clear_tim_bit(struct sta_ispin_unlock_irqrestore (&sta->local->sta_lock, flags); } -void __sta_info_unlink (struct sta_info **sta) +static void __sta_info_unlink (struct sta_info **sta) {struct ieee80211_local *local = (*sta)->local;struct ieee80211_sub_if_data *sdata = (*sta)->sdata;
@@ -802,3 +802,29 @@ void sta_info_flush_delayed(struct ieee8schedule_work (&local->sta_flush_work);spin_unlock_irqrestore (&local->sta_lock, flags); } + +void ieee80211_sta_expire (struct ieee80211_sub_if_data *sdata, +unsigned long exp_time) +{ +struct ieee80211_local *local = sdata->local; +struct sta_info *sta, *tmp; +LIST_HEAD (tmp_list); +DECLARE_MAC_BUF (mac); +unsigned long flags; + +spin_lock_irqsave (&local->sta_lock, flags); +list_for_each_entry_safe (sta, tmp, &local->sta_list, list) +if (time_after (jiffies, sta->last_rx + exp_time)) { +#ifdef CONFIG_MAC80211_IBSS_DEBUG +printk (KERN_DEBUG "%s: expiring inactive STA %s\n" , + sdata->dev->name,print_mac (mac, sta->addr)); +#endif +__sta_info_unlink (&sta); +if (sta) +list_add (&sta->list, &tmp_list); + } +spin_unlock_irqrestore (&local->sta_lock, flags); + +list_for_each_entry_safe (sta, tmp, &tmp_list, list) +sta_info_destroy (sta); +}
net/mac80211/sta_info.h +2 -1
@@ -452,7 +452,6 @@ int sta_info_insert(struct sta_info *sta* has already unlinked it. */ void sta_info_unlink (struct sta_info **sta); -void __sta_info_unlink (struct sta_info **sta);void sta_info_destroy (struct sta_info *sta);void sta_info_set_tim_bit (struct sta_info *sta);
@@ -464,5 +463,7 @@ void sta_info_stop(struct ieee80211_locaint sta_info_flush (struct ieee80211_local *local,struct ieee80211_sub_if_data *sdata);void sta_info_flush_delayed (struct ieee80211_sub_if_data *sdata); +void ieee80211_sta_expire (struct ieee80211_sub_if_data *sdata, +unsigned long exp_time);#endif /* STA_INFO_H */
Johannes Berg
maintainerPATCH 2/18 mac80211: move STA timer restart
In reply to Johannes BergThis I shouldn't have moved to the scan implementation, move it back to the MLME where it belongs, to the notification.
--- net/mac80211/mlme.c | 13 +++++++++++++ net/mac80211/scan.c | 14 -------------- 2 files changed, 13 insertions(+), 14 deletions(-)
net/mac80211/mlme.c +13 -0
@@ -2625,6 +2625,13 @@ void ieee80211_sta_work(struct work_stru } } +static void ieee80211_restart_sta_timer (struct ieee80211_sub_if_data *sdata) +{ +if (sdata->vif.type ==IEEE80211_IF_TYPE_STA || +ieee80211_vif_is_mesh (&sdata->vif)) +ieee80211_sta_timer ((unsigned long )sdata); +} +void ieee80211_mlme_notify_scan_completed (struct ieee80211_local *local) {struct ieee80211_sub_if_data *sdata = local->scan_sdata;
@@ -2637,4 +2644,10 @@ void ieee80211_mlme_notify_scan_complete !ieee80211_sta_active_ibss(sdata)))ieee80211_sta_find_ibss (sdata, ifsta); } + +/* Restart STA timers */ +rcu_read_lock (); +list_for_each_entry_rcu (sdata, &local->interfaces, list) +ieee80211_restart_sta_timer (sdata); +rcu_read_unlock (); }
net/mac80211/scan.c +0 -14
@@ -424,13 +424,6 @@ static void ieee80211_send_nullfunc(struieee80211_tx_skb (sdata, skb,0 ); } -static void ieee80211_restart_sta_timer (struct ieee80211_sub_if_data *sdata) -{ -if (sdata->vif.type ==IEEE80211_IF_TYPE_STA || -ieee80211_vif_is_mesh (&sdata->vif)) -ieee80211_sta_timer ((unsigned long )sdata); -} -void ieee80211_scan_completed (struct ieee80211_hw *hw) {struct ieee80211_local *local =hw_to_local (hw);
@@ -446,11 +439,6 @@ void ieee80211_scan_completed(struct ieeif (ieee80211_hw_config (local))printk (KERN_DEBUG "%s: failed to restore operational " "channel after scan\n" ,wiphy_name (local->hw.wiphy)); -/* Restart STA timer for HW scan case */ -rcu_read_lock (); -list_for_each_entry_rcu (sdata, &local->interfaces, list) -ieee80211_restart_sta_timer (sdata); -rcu_read_unlock (); goto done; }
@@ -483,8 +471,6 @@ void ieee80211_scan_completed(struct iee } }else netif_tx_wake_all_queues (sdata->dev); - -ieee80211_restart_sta_timer (sdata); }rcu_read_unlock ();
Johannes Berg
maintainerPATCH 3/18 mac80211: dont set REQ_RUN when scan finishes
In reply to Johannes BergThe timer restart is done wrongly, we shouldn't set the REQ_RUN bit when the scan has finished if it hadn't been set before the scan started. If the timer fires during the scan, it will set REQ_RUN and then we can run the work for it, if it didn't fire then we shouldn't run its work either.
--- net/mac80211/mlme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/mlme.c +2 -1
@@ -2629,7 +2629,8 @@ static void ieee80211_restart_sta_timer( {if (sdata->vif.type ==IEEE80211_IF_TYPE_STA ||ieee80211_vif_is_mesh (&sdata->vif)) -ieee80211_sta_timer ((unsigned long )sdata); +queue_work (sdata->local->hw.workqueue, + &sdata->u.sta.work); }void ieee80211_mlme_notify_scan_completed (struct ieee80211_local *local)
Johannes Berg
maintainerPATCH 4/18 mac80211: split off mesh handling entirely
In reply to Johannes BergThis patch splits off mesh handling from the STA/IBSS. Unfortunately it increases mesh code size a bit, but I think it makes things clearer. The patch also reduces per-interface run-time memory usage.
Also clean up a few places where ifdef is not required.
--- net/mac80211/cfg.c | 6 net/mac80211/debugfs_netdev.c | 38 ++-- net/mac80211/ieee80211_i.h | 101 ++++++------ net/mac80211/iface.c | 13 - net/mac80211/main.c | 13 + net/mac80211/mesh.c | 326 +++++++++++++++++++++++++++++++++------- net/mac80211/mesh.h | 15 + net/mac80211/mesh_hwmp.c | 98 ++++++------ net/mac80211/mesh_pathtbl.c | 8 net/mac80211/mesh_plink.c | 18 +- net/mac80211/mlme.c | 83 ---------- net/mac80211/rc80211_pid_algo.c | 7 net/mac80211/rx.c | 8 net/mac80211/scan.c | 1 net/mac80211/tx.c | 8 15 files changed, 451 insertions(+), 292 deletions(-)
net/mac80211/ieee80211_i.h +54 -47
@@ -308,7 +308,6 @@ enum ieee80211_sta_mlme_state {IEEE80211_STA_MLME_ASSOCIATED ,IEEE80211_STA_MLME_IBSS_SEARCH , IEEE80211_STA_MLME_IBSS_JOINED, - IEEE80211_STA_MLME_MESH_UP };/* bitfield of allowed auth algs */
@@ -325,34 +324,6 @@ struct ieee80211_if_sta {size_t ssid_len;u8 scan_ssid[IEEE80211_MAX_SSID_LEN ];size_t scan_ssid_len; -#ifdef CONFIG_MAC80211_MESH -struct timer_list mesh_path_timer; -u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN ]; -size_t mesh_id_len; -/* Active Path Selection Protocol Identifier */ -u8 mesh_pp_id[4 ]; -/* Active Path Selection Metric Identifier */ -u8 mesh_pm_id[4 ]; -/* Congestion Control Mode Identifier */ -u8 mesh_cc_id[4 ]; -/* Local mesh Destination Sequence Number */ -u32 dsn; -/* Last used PREQ ID */ -u32 preq_id; -atomic_t mpaths; -/* Timestamp of last DSN update */ -unsigned long last_dsn_update; -/* Timestamp of last DSN sent */ -unsigned long last_preq; -struct mesh_rmc *rmc; -spinlock_t mesh_preq_queue_lock; -struct mesh_preq_queue preq_queue; -int preq_queue_len; -struct mesh_stats mshstats; -struct mesh_config mshcfg; -u32 mesh_seqnum; -bool accepting_plinks; -#endif u16 aid;u16 ap_capab, capab;u8 *extra_ie;/* to be added to the end of AssocReq */
@@ -387,20 +358,47 @@ struct ieee80211_if_sta {int num_beacons;/* number of TXed beacon frames by this STA */ }; -static inline void ieee80211_if_sta_set_mesh_id (struct ieee80211_if_sta *ifsta, -u8 mesh_id_len,u8 *mesh_id) -{ -#ifdef CONFIG_MAC80211_MESH - ifsta->mesh_id_len = mesh_id_len; -memcpy (ifsta->mesh_id, mesh_id, mesh_id_len); -#endif -} +struct ieee80211_if_mesh { +struct work_struct work; +struct timer_list housekeeping_timer; +struct timer_list mesh_path_timer; +struct sk_buff_head skb_queue; + +bool housekeeping; + +u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN ]; +size_t mesh_id_len; +/* Active Path Selection Protocol Identifier */ +u8 mesh_pp_id[4 ]; +/* Active Path Selection Metric Identifier */ +u8 mesh_pm_id[4 ]; +/* Congestion Control Mode Identifier */ +u8 mesh_cc_id[4 ]; +/* Local mesh Destination Sequence Number */ +u32 dsn; +/* Last used PREQ ID */ +u32 preq_id; +atomic_t mpaths; +/* Timestamp of last DSN update */ +unsigned long last_dsn_update; +/* Timestamp of last DSN sent */ +unsigned long last_preq; +struct mesh_rmc *rmc; +spinlock_t mesh_preq_queue_lock; +struct mesh_preq_queue preq_queue; +int preq_queue_len; +struct mesh_stats mshstats; +struct mesh_config mshcfg; +u32 mesh_seqnum; +bool accepting_plinks; +int num_beacons; +};#ifdef CONFIG_MAC80211_MESH -#define IEEE80211_IFSTA_MESH_CTR_INC (sta, name) \ - do { (sta)->mshstats.name++; } while (0) +#define IEEE80211_IFSTA_MESH_CTR_INC (msh, name) \ + do { (msh)->mshstats.name++; } while (0)#else -#define IEEE80211_IFSTA_MESH_CTR_INC (sta, name) \ +#define IEEE80211_IFSTA_MESH_CTR_INC (msh, name) \ do { } while (0)#endif
@@ -455,6 +453,9 @@ struct ieee80211_sub_if_data {struct ieee80211_if_wds wds;struct ieee80211_if_vlan vlan;struct ieee80211_if_sta sta; +#ifdef CONFIG_MAC80211_MESH +struct ieee80211_if_mesh mesh; +#endif u32 mntr_flags; } u;
@@ -548,6 +549,19 @@ struct ieee80211_sub_if_data *vif_to_sda return container_of(p, struct ieee80211_sub_if_data, vif); } +static inline void +ieee80211_sdata_set_mesh_id (struct ieee80211_sub_if_data *sdata, +u8 mesh_id_len,u8 *mesh_id) +{ +#ifdef CONFIG_MAC80211_MESH +struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; + ifmsh->mesh_id_len = mesh_id_len; +memcpy (ifmsh->mesh_id, mesh_id, mesh_id_len); +#else +WARN_ON (1 ); +#endif +} +enum {IEEE80211_RX_MSG =1 ,IEEE80211_TX_STATUS_MSG =2 ,
@@ -935,13 +949,6 @@ ieee80211_rx_bss_get(struct ieee80211_lovoid ieee80211_rx_bss_put (struct ieee80211_local *local,struct ieee80211_sta_bss *bss); -#ifdef CONFIG_MAC80211_MESH -void ieee80211_start_mesh (struct ieee80211_sub_if_data *sdata); -#else -static inline void ieee80211_start_mesh (struct ieee80211_sub_if_data *sdata) -{} -#endif -/* interface handling */ void ieee80211_if_setup (struct net_device *dev); int ieee80211_if_add(struct ieee80211_local *local, const char *name,
net/mac80211/cfg.c +3 -3
@@ -109,9 +109,9 @@ static int ieee80211_change_iface(structreturn ret;if (ieee80211_vif_is_mesh (&sdata->vif) && params->mesh_id_len) -ieee80211_if_sta_set_mesh_id (&sdata->u.sta, - params->mesh_id_len, - params->mesh_id); +ieee80211_sdata_set_mesh_id (sdata, + params->mesh_id_len, + params->mesh_id);if (sdata->vif.type !=IEEE80211_IF_TYPE_MNTR || !flags)return 0 ;
net/mac80211/debugfs_netdev.c +19 -19
@@ -207,37 +207,37 @@ IEEE80211_IF_FILE(peer, u.wds.remote_add#ifdef CONFIG_MAC80211_MESH /* Mesh stats attributes */ -IEEE80211_IF_FILE (fwded_frames, u.sta.mshstats.fwded_frames,DEC ); -IEEE80211_IF_FILE (dropped_frames_ttl, u.sta.mshstats.dropped_frames_ttl,DEC ); +IEEE80211_IF_FILE (fwded_frames, u.mesh.mshstats.fwded_frames,DEC ); +IEEE80211_IF_FILE (dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl,DEC );IEEE80211_IF_FILE (dropped_frames_no_route, - u.sta.mshstats.dropped_frames_no_route,DEC ); -IEEE80211_IF_FILE (estab_plinks, u.sta.mshstats.estab_plinks,ATOMIC ); + u.mesh.mshstats.dropped_frames_no_route,DEC ); +IEEE80211_IF_FILE (estab_plinks, u.mesh.mshstats.estab_plinks,ATOMIC );/* Mesh parameters */ IEEE80211_IF_WFILE (dot11MeshMaxRetries, - u.sta.mshcfg.dot11MeshMaxRetries,DEC , u8); + u.mesh.mshcfg.dot11MeshMaxRetries,DEC , u8);IEEE80211_IF_WFILE (dot11MeshRetryTimeout, - u.sta.mshcfg.dot11MeshRetryTimeout,DEC , u16); + u.mesh.mshcfg.dot11MeshRetryTimeout,DEC , u16);IEEE80211_IF_WFILE (dot11MeshConfirmTimeout, - u.sta.mshcfg.dot11MeshConfirmTimeout,DEC , u16); + u.mesh.mshcfg.dot11MeshConfirmTimeout,DEC , u16);IEEE80211_IF_WFILE (dot11MeshHoldingTimeout, - u.sta.mshcfg.dot11MeshHoldingTimeout,DEC , u16); -IEEE80211_IF_WFILE (dot11MeshTTL, u.sta.mshcfg.dot11MeshTTL,DEC , u8); -IEEE80211_IF_WFILE (auto_open_plinks, u.sta.mshcfg.auto_open_plinks,DEC , u8); + u.mesh.mshcfg.dot11MeshHoldingTimeout,DEC , u16); +IEEE80211_IF_WFILE (dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL,DEC , u8); +IEEE80211_IF_WFILE (auto_open_plinks, u.mesh.mshcfg.auto_open_plinks,DEC , u8);IEEE80211_IF_WFILE (dot11MeshMaxPeerLinks, - u.sta.mshcfg.dot11MeshMaxPeerLinks,DEC , u16); + u.mesh.mshcfg.dot11MeshMaxPeerLinks,DEC , u16);IEEE80211_IF_WFILE (dot11MeshHWMPactivePathTimeout, - u.sta.mshcfg.dot11MeshHWMPactivePathTimeout,DEC , u32); + u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout,DEC , u32);IEEE80211_IF_WFILE (dot11MeshHWMPpreqMinInterval, - u.sta.mshcfg.dot11MeshHWMPpreqMinInterval,DEC , u16); + u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval,DEC , u16);IEEE80211_IF_WFILE (dot11MeshHWMPnetDiameterTraversalTime, - u.sta.mshcfg.dot11MeshHWMPnetDiameterTraversalTime,DEC , u16); + u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime,DEC , u16);IEEE80211_IF_WFILE (dot11MeshHWMPmaxPREQretries, - u.sta.mshcfg.dot11MeshHWMPmaxPREQretries,DEC , u8); + u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries,DEC , u8);IEEE80211_IF_WFILE (path_refresh_time, - u.sta.mshcfg.path_refresh_time,DEC , u32); + u.mesh.mshcfg.path_refresh_time,DEC , u32);IEEE80211_IF_WFILE (min_discovery_timeout, - u.sta.mshcfg.min_discovery_timeout,DEC , u16); + u.mesh.mshcfg.min_discovery_timeout,DEC , u16);#endif
@@ -350,7 +350,7 @@ static void add_files(struct ieee80211_sadd_mesh_stats (sdata);add_mesh_config (sdata);#endif -/* fall through */ +break ;case IEEE80211_IF_TYPE_STA :case IEEE80211_IF_TYPE_IBSS :add_sta_files (sdata);
@@ -487,7 +487,7 @@ static void del_files(struct ieee80211_sdel_mesh_stats (sdata);del_mesh_config (sdata);#endif -/* fall through */ +break ;case IEEE80211_IF_TYPE_STA :case IEEE80211_IF_TYPE_IBSS :del_sta_files (sdata);
net/mac80211/iface.c +6 -7
@@ -54,10 +54,9 @@ static void ieee80211_teardown_sdata(strbreak ;case IEEE80211_IF_TYPE_MESH_POINT : -/* Allow compiler to elide mesh_rmc_free call. */ if (ieee80211_vif_is_mesh (&sdata->vif))mesh_rmc_free (sdata); -/* fall through */ +break ;case IEEE80211_IF_TYPE_STA :case IEEE80211_IF_TYPE_IBSS :kfree (sdata->u.sta.extra_ie);
@@ -100,7 +99,6 @@ static void ieee80211_setup_sdata(structskb_queue_head_init (&sdata->u.ap.ps_bc_buf);INIT_LIST_HEAD (&sdata->u.ap.vlans);break ; -case IEEE80211_IF_TYPE_MESH_POINT :case IEEE80211_IF_TYPE_STA :case IEEE80211_IF_TYPE_IBSS : ifsta = &sdata->u.sta;
@@ -117,7 +115,8 @@ static void ieee80211_setup_sdata(structIEEE80211_STA_AUTO_CHANNEL_SEL ;if (ieee80211_num_regular_queues (&sdata->local->hw) >=4 ) ifsta->flags |=IEEE80211_STA_WMM_ENABLED ; - +break ; +case IEEE80211_IF_TYPE_MESH_POINT :if (ieee80211_vif_is_mesh (&sdata->vif))ieee80211_mesh_init_sdata (sdata);break ;
@@ -225,9 +224,9 @@ int ieee80211_if_add(struct ieee80211_loif (ieee80211_vif_is_mesh (&sdata->vif) && params && params->mesh_id_len) -ieee80211_if_sta_set_mesh_id (&sdata->u.sta, - params->mesh_id_len, - params->mesh_id); +ieee80211_sdata_set_mesh_id (sdata, + params->mesh_id_len, + params->mesh_id);list_add_tail_rcu (&sdata->list, &local->interfaces);
net/mac80211/mesh.c +272 -54
443 lines not on this page · raw message
net/mac80211/mesh.h +12 -3
@@ -206,7 +206,7 @@ int mesh_rmc_check(u8 *addr, struct ieee struct ieee80211_sub_if_data *sdata);bool mesh_matches_local (struct ieee802_11_elems *ie,struct ieee80211_sub_if_data *sdata); -void mesh_ids_set_default (struct ieee80211_if_sta *sta); +void mesh_ids_set_default (struct ieee80211_if_mesh *mesh);void mesh_mgmt_ies_add (struct sk_buff *skb,struct ieee80211_sub_if_data *sdata);void mesh_rmc_free (struct ieee80211_sub_if_data *sdata);
@@ -214,6 +214,11 @@ int mesh_rmc_init(struct ieee80211_sub_ivoid ieee80211s_init (void );void ieee80211s_stop (void );void ieee80211_mesh_init_sdata (struct ieee80211_sub_if_data *sdata); +ieee80211_rx_result +ieee80211_mesh_rx_mgmt (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb, +struct ieee80211_rx_status *rx_status); +void ieee80211_start_mesh (struct ieee80211_sub_if_data *sdata); +void ieee80211_stop_mesh (struct ieee80211_sub_if_data *sdata);/* Mesh paths */ int mesh_nexthop_lookup(struct sk_buff *skb,
@@ -269,8 +274,8 @@ extern int mesh_allocated;static inline int mesh_plink_free_count (struct ieee80211_sub_if_data *sdata) { -return sdata->u.sta.mshcfg.dot11MeshMaxPeerLinks - -atomic_read (&sdata->u.sta.mshstats.estab_plinks); +return sdata->u.mesh.mshcfg.dot11MeshMaxPeerLinks - +atomic_read (&sdata->u.mesh.mshstats.estab_plinks); }static inline bool mesh_plink_availables (struct ieee80211_sub_if_data *sdata)
@@ -288,8 +293,12 @@ static inline void mesh_path_activate(stfor (i =0 ; i <= x->hash_mask; i++) \ hlist_for_each_entry_rcu(node, p, &x->hash_buckets[i], list) +void ieee80211_mesh_notify_scan_completed (struct ieee80211_local *local); +#else #define mesh_allocated 0 +static inline void +ieee80211_mesh_notify_scan_completed (struct ieee80211_local *local) {}#endif #endif /* IEEE80211S_H */
net/mac80211/mlme.c +3 -80
159 lines not on this page · raw message
net/mac80211/rx.c +5 -3
@@ -1404,7 +1404,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80if (rx->flags &IEEE80211_RX_RA_MATCH ) {if (!mesh_hdr->ttl) -IEEE80211_IFSTA_MESH_CTR_INC (&rx->sdata->u.sta, +IEEE80211_IFSTA_MESH_CTR_INC (&rx->sdata->u.mesh, dropped_frames_ttl);else {struct ieee80211_hdr *fwd_hdr;
@@ -1591,9 +1591,11 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_if (!(rx->flags &IEEE80211_RX_RA_MATCH ))return RX_DROP_MONITOR ; +if (ieee80211_vif_is_mesh (&sdata->vif)) +return ieee80211_mesh_rx_mgmt (sdata, rx->skb, rx->status); +if (sdata->vif.type !=IEEE80211_IF_TYPE_STA && - sdata->vif.type !=IEEE80211_IF_TYPE_IBSS && - sdata->vif.type !=IEEE80211_IF_TYPE_MESH_POINT ) + sdata->vif.type !=IEEE80211_IF_TYPE_IBSS )return RX_DROP_MONITOR ;if (sdata->flags &IEEE80211_SDATA_USERSPACE_MLME )
net/mac80211/tx.c +4 -4
@@ -1330,7 +1330,7 @@ int ieee80211_master_start_xmit(struct sif (mesh_nexthop_lookup (skb, osdata))return 0 ;if (memcmp (odev->dev_addr, hdr->addr4,ETH_ALEN ) !=0 ) -IEEE80211_IFSTA_MESH_CTR_INC (&osdata->u.sta, +IEEE80211_IFSTA_MESH_CTR_INC (&osdata->u.mesh, fwded_frames); } }
@@ -1483,9 +1483,9 @@ int ieee80211_subif_start_xmit(struct skmemcpy (hdr.addr2, dev->dev_addr,ETH_ALEN );memcpy (hdr.addr3, skb->data,ETH_ALEN );memcpy (hdr.addr4, skb->data +ETH_ALEN ,ETH_ALEN ); -if (!sdata->u.sta.mshcfg.dot11MeshTTL) { +if (!sdata->u.mesh.mshcfg.dot11MeshTTL) {/* Do not send frames with mesh_ttl == 0 */ - sdata->u.sta.mshstats.dropped_frames_ttl++; + sdata->u.mesh.mshstats.dropped_frames_ttl++; ret =0 ; goto fail; }
@@ -1910,7 +1910,7 @@ struct sk_buff *ieee80211_beacon_get(strmesh_mgmt_ies_add (skb, sdata); - num_beacons = &sdata->u.sta.num_beacons; + num_beacons = &sdata->u.mesh.num_beacons; }else {WARN_ON (1 ); goto out;
net/mac80211/mesh_hwmp.c +49 -49
232 lines not on this page · raw message
net/mac80211/mesh_pathtbl.c +4 -4
@@ -153,7 +153,7 @@ int mesh_path_add(u8 *dst, struct ieee80if (is_multicast_ether_addr (dst))return -ENOTSUPP ; -if (atomic_add_unless (&sdata->u.sta.mpaths,1 ,MESH_MAX_MPATHS ) ==0 ) +if (atomic_add_unless (&sdata->u.mesh.mpaths,1 ,MESH_MAX_MPATHS ) ==0 )return -ENOSPC ; err = -ENOMEM ;
@@ -221,7 +221,7 @@ err_exists: err_node_alloc:kfree (new_mpath); err_path_alloc: -atomic_dec (&sdata->u.sta.mpaths); +atomic_dec (&sdata->u.mesh.mpaths);return err; }
@@ -306,7 +306,7 @@ static void mesh_path_node_reclaim(strucstruct ieee80211_sub_if_data *sdata = node->mpath->sdata;del_timer_sync (&node->mpath->timer); -atomic_dec (&sdata->u.sta.mpaths); +atomic_dec (&sdata->u.mesh.mpaths);kfree (node->mpath);kfree (node); }
@@ -401,7 +401,7 @@ void mesh_path_discard_frame(struct sk_b }kfree_skb (skb); - sdata->u.sta.mshstats.dropped_frames_no_route++; + sdata->u.mesh.mshstats.dropped_frames_no_route++; }/**
net/mac80211/mesh_plink.c +9 -9
@@ -36,11 +36,11 @@#define MESH_SECURITY_AUTHENTICATION_IMPOSSIBLE 9#define MESH_SECURITY_FAILED_VERIFICATION 10 -#define dot11MeshMaxRetries (s) (s->u.sta.mshcfg.dot11MeshMaxRetries) -#define dot11MeshRetryTimeout (s) (s->u.sta.mshcfg.dot11MeshRetryTimeout) -#define dot11MeshConfirmTimeout (s) (s->u.sta.mshcfg.dot11MeshConfirmTimeout) -#define dot11MeshHoldingTimeout (s) (s->u.sta.mshcfg.dot11MeshHoldingTimeout) -#define dot11MeshMaxPeerLinks (s) (s->u.sta.mshcfg.dot11MeshMaxPeerLinks) +#define dot11MeshMaxRetries (s) (s->u.mesh.mshcfg.dot11MeshMaxRetries) +#define dot11MeshRetryTimeout (s) (s->u.mesh.mshcfg.dot11MeshRetryTimeout) +#define dot11MeshConfirmTimeout (s) (s->u.mesh.mshcfg.dot11MeshConfirmTimeout) +#define dot11MeshHoldingTimeout (s) (s->u.mesh.mshcfg.dot11MeshHoldingTimeout) +#define dot11MeshMaxPeerLinks (s) (s->u.mesh.mshcfg.dot11MeshMaxPeerLinks)enum plink_frame_type {PLINK_OPEN =0 ,
@@ -63,14 +63,14 @@ enum plink_event {static inline void mesh_plink_inc_estab_count (struct ieee80211_sub_if_data *sdata) { -atomic_inc (&sdata->u.sta.mshstats.estab_plinks); +atomic_inc (&sdata->u.mesh.mshstats.estab_plinks);mesh_accept_plinks_update (sdata); }static inline void mesh_plink_dec_estab_count (struct ieee80211_sub_if_data *sdata) { -atomic_dec (&sdata->u.sta.mshstats.estab_plinks); +atomic_dec (&sdata->u.mesh.mshstats.estab_plinks);mesh_accept_plinks_update (sdata); }
@@ -245,8 +245,8 @@ void mesh_neighbour_update(u8 *hw_addr, sta->last_rx = jiffies; sta->supp_rates[local->hw.conf.channel->band] = rates;if (peer_accepting_plinks && sta->plink_state ==PLINK_LISTEN && - sdata->u.sta.accepting_plinks && - sdata->u.sta.mshcfg.auto_open_plinks) + sdata->u.mesh.accepting_plinks && + sdata->u.mesh.mshcfg.auto_open_plinks)mesh_plink_open (sta);rcu_read_unlock ();
net/mac80211/rc80211_pid_algo.c +1 -6
@@ -148,9 +148,7 @@ static void rate_control_pid_sample(strustruct ieee80211_local *local, struct sta_info *sta) { -#ifdef CONFIG_MAC80211_MESH struct ieee80211_sub_if_data *sdata = sta->sdata; -#endif struct rc_pid_sta_info *spinfo = sta->rate_ctrl_priv;struct rc_pid_rateinfo *rinfo = pinfo->rinfo;struct ieee80211_supported_band *sband;
@@ -181,11 +179,8 @@ static void rate_control_pid_sample(stru pf = spinfo->last_pf; else { pf = spinfo->tx_num_failed *100 / spinfo->tx_num_xmit; -#ifdef CONFIG_MAC80211_MESH -if (pf ==100 && - sdata->vif.type ==IEEE80211_IF_TYPE_MESH_POINT ) +if (ieee80211_vif_is_mesh (&sdata->vif) && pf ==100 )mesh_plink_broken (sta); -#endif pf <<=RC_PID_ARITH_SHIFT ; sta->fail_avg = ((pf + (spinfo->last_pf <<3 )) /9 ) >>RC_PID_ARITH_SHIFT ;
net/mac80211/scan.c +1 -0
@@ -476,6 +476,7 @@ void ieee80211_scan_completed(struct iee done:ieee80211_mlme_notify_scan_completed (local); +ieee80211_mesh_notify_scan_completed (local); }EXPORT_SYMBOL (ieee80211_scan_completed);
net/mac80211/main.c +9 -4
@@ -252,6 +252,8 @@ static int ieee80211_open(struct net_dev sdata->bss = &sdata->u.ap;break ;case IEEE80211_IF_TYPE_MESH_POINT : +if (!ieee80211_vif_is_mesh (&sdata->vif)) +break ;/* mesh ifaces must set allmulti to forward mcast traffic */ atomic_inc (&local->iff_allmultis);break ;
@@ -540,10 +542,6 @@ static int ieee80211_stop(struct net_devieee80211_configure_filter (local);netif_addr_unlock_bh (local->mdev);break ; -case IEEE80211_IF_TYPE_MESH_POINT : -/* allmulti is always set on mesh ifaces */ -atomic_dec (&local->iff_allmultis); -/* fall through */ case IEEE80211_IF_TYPE_STA :case IEEE80211_IF_TYPE_IBSS : sdata->u.sta.state =IEEE80211_STA_MLME_DISABLED ;
@@ -571,6 +569,13 @@ static int ieee80211_stop(struct net_dev sdata->u.sta.extra_ie =NULL ; sdata->u.sta.extra_ie_len =0 ;/* fall through */ +case IEEE80211_IF_TYPE_MESH_POINT : +if (ieee80211_vif_is_mesh (&sdata->vif)) { +/* allmulti is always set on mesh ifaces */ +atomic_dec (&local->iff_allmultis); +ieee80211_stop_mesh (sdata); + } +/* fall through */ default : conf.vif = &sdata->vif; conf.type = sdata->vif.type;
Johannes Berg
maintainerPATCH 5/18 mac80211: fix work race
In reply to Johannes BergWhen we stop an interface, the work on it may still be pending or running. We do cancel the timer, but we do not currently protect against the work struct. The race is very unlikely to hit -- it'll happen only when the driver is using mac80211's workqueue to run long-running tasks and the sta/mesh works are delayed for quite a bit.
This patch fixes it by cancelling the work explicitly.
--- net/mac80211/main.c | 8 ++++++++ net/mac80211/mesh.c | 9 +++++++++ 2 files changed, 17 insertions(+)
net/mac80211/main.c +8 -0
@@ -548,6 +548,14 @@ static int ieee80211_stop(struct net_devmemset (sdata->u.sta.bssid,0 ,ETH_ALEN );del_timer_sync (&sdata->u.sta.timer);/* +* If the timer fired while we waited for it, it will have +* requeued the work. Now the work will be running again +* but will not rearm the timer again because it checks +* whether the interface is running, which, at this point, +* it no longer is. +*/ +cancel_work_sync (&sdata->u.sta.work); +/* * When we get here, the interface is marked down. * Call synchronize_rcu() to wait for the RX path * should it be using the interface and enqueuing
net/mac80211/mesh.c +9 -0
@@ -449,6 +449,15 @@ void ieee80211_stop_mesh(struct ieee8021 {del_timer_sync (&sdata->u.mesh.housekeeping_timer);/* +* If the timer fired while we waited for it, it will have +* requeued the work. Now the work will be running again +* but will not rearm the timer again because it checks +* whether the interface is running, which, at this point, +* it no longer is. +*/ +cancel_work_sync (&sdata->u.mesh.work); + +/* * When we get here, the interface is marked down. * Call synchronize_rcu() to wait for the RX path * should it be using the interface and enqueuing
Johannes Berg
maintainerPATCH 6/18 mac80211: fix scan vs. interface removal race
In reply to Johannes BergWhen we remove an interface, we can currently end up having a pointer to it left in local->scan_sdata after it has been set down, and then with a hardware scan the scan completion can try to access it which is a bug. Alternatively, a scan that started as a hardware scan may terminate as though it was a software scan, if the timing is just right.
On SMP systems, software scan also has a similar problem, just canceling the delayed work and setting a flag isn't enough since it may be running concurrently; in this case we would also never restore state of other interfaces.
This patch hopefully fixes the problems by always invoking ieee80211_scan_completed or requiring it to be invoked by the driver, I suspect the drivers that have ->hw_scan() are buggy. The bug will not manifest itself unless you remove the interface while hw-scanning which will also turn off the hw, and then add a new interface which will be unusable until you scan once.
--- include/net/mac80211.h | 4 +++- net/mac80211/main.c | 33 +++++++++++++++++++++++++-------- net/mac80211/mlme.c | 2 +- net/mac80211/scan.c | 38 +++++++++++++++++++++++++++----------- 4 files changed, 56 insertions(+), 21 deletions(-)
net/mac80211/main.c +25 -8
@@ -564,14 +564,6 @@ static int ieee80211_stop(struct net_devsynchronize_rcu ();skb_queue_purge (&sdata->u.sta.skb_queue); -if (local->scan_sdata == sdata) { -if (!local->ops->hw_scan) { - local->sta_sw_scanning =0 ; -cancel_delayed_work (&local->scan_work); - }else - local->sta_hw_scanning =0 ; - } - sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED ;kfree (sdata->u.sta.extra_ie); sdata->u.sta.extra_ie =NULL ;
@@ -585,6 +577,31 @@ static int ieee80211_stop(struct net_dev }/* fall through */ default : +if (local->scan_sdata == sdata) { +if (!local->ops->hw_scan) +cancel_delayed_work_sync (&local->scan_work); +/* +* The software scan can no longer run now, so we can +* clear out the scan_sdata reference. However, the +* hardware scan may still be running. The complete +* function must be prepared to handle a NULL value. +*/ + local->scan_sdata =NULL ; +/* +* The memory barrier guarantees that another CPU +* that is hardware-scanning will now see the fact +* that this interface is gone. +*/ +smp_mb (); +/* +* If software scanning, complete the scan but since +* the scan_sdata is NULL already don't send out a +* scan event to userspace -- the scan is incomplete. +*/ +if (local->sta_sw_scanning) +ieee80211_scan_completed (&local->hw); + } + conf.vif = &sdata->vif; conf.type = sdata->vif.type; conf.mac_addr = dev->dev_addr;
net/mac80211/mlme.c +1 -1
@@ -2561,7 +2561,7 @@ void ieee80211_mlme_notify_scan_completestruct ieee80211_sub_if_data *sdata = local->scan_sdata;struct ieee80211_if_sta *ifsta; -if (sdata->vif.type ==IEEE80211_IF_TYPE_IBSS ) { +if (sdata && sdata->vif.type ==IEEE80211_IF_TYPE_IBSS ) { ifsta = &sdata->u.sta; if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || (!(ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED) &&
net/mac80211/scan.c +27 -11
@@ -430,9 +430,20 @@ void ieee80211_scan_completed(struct ieestruct ieee80211_sub_if_data *sdata;union iwreq_data wrqu; +if (WARN_ON (!local->sta_hw_scanning && !local->sta_sw_scanning)) +return ; + local->last_scan_completed = jiffies;memset (&wrqu,0 ,sizeof (wrqu)); -wireless_send_event (local->scan_sdata->dev,SIOCGIWSCAN , &wrqu,NULL ); + +/* +* local->scan_sdata could have been NULLed by the interface +* down code in case we were scanning on an interface that is +* being taken down. +*/ + sdata = local->scan_sdata; +if (sdata) +wireless_send_event (sdata->dev,SIOCGIWSCAN , &wrqu,NULL );if (local->sta_hw_scanning) { local->sta_hw_scanning =0 ;
@@ -491,7 +502,10 @@ void ieee80211_sta_scan_work(struct workint skip;unsigned long next_delay =0 ; -if (!local->sta_sw_scanning) +/* +* Avoid re-scheduling when the sdata is going away. +*/ +if (!netif_running (sdata->dev))return ;switch (local->scan_state) {
@@ -570,9 +584,8 @@ void ieee80211_sta_scan_work(struct workbreak ; } -if (local->sta_sw_scanning) -queue_delayed_work (local->hw.workqueue, &local->scan_work, - next_delay); +queue_delayed_work (local->hw.workqueue, &local->scan_work, + next_delay); }
@@ -609,13 +622,16 @@ int ieee80211_sta_start_scan(struct ieee }if (local->ops->hw_scan) { -int rc = local->ops->hw_scan (local_to_hw (local), - ssid, ssid_len); -if (!rc) { - local->sta_hw_scanning =1 ; - local->scan_sdata = scan_sdata; +int rc; + + local->sta_hw_scanning =1 ; + rc = local->ops->hw_scan (local_to_hw (local), ssid, ssid_len); +if (rc) { + local->sta_hw_scanning =0 ; +return rc; } -return rc; + local->scan_sdata = scan_sdata; +return 0 ; } local->sta_sw_scanning =1 ;
include/net/mac80211.h +3 -1
@@ -1122,7 +1122,9 @@ enum ieee80211_ampdu_mlme_action {* @hw_scan: Ask the hardware to service the scan request, no need to start * the scan state machine in stack. The scan must honour the channel * configuration done by the regulatory agent in the wiphy's registered -* bands. +* bands. When the scan finishes, ieee80211_scan_completed() must be +* called; note that it also must be called when the scan cannot finish +* because the hardware is turned off! Anything else is a bug! * * @get_stats: return low-level statistics *
Johannes Berg
maintainerPATCH 7/18 mac80211: reorder MLME code more
In reply to Johannes BergThis way all the utility functions are at the top, then the state machine and externally callable functions are moved to the bottom. Also clean up ieee80211_i.h a bit and add a few comments about which functions are called from where.
--- net/mac80211/ieee80211_i.h | 39 +- net/mac80211/iface.c | 17 - net/mac80211/mlme.c | 702 +++++++++++++++++++++++---------------------- 3 files changed, 385 insertions(+), 373 deletions(-)
net/mac80211/ieee80211_i.h +20 -19
@@ -882,54 +882,53 @@ static inline int ieee80211_bssid_match( } -/* ieee80211.c */ int ieee80211_hw_config (struct ieee80211_local *local);int ieee80211_if_config (struct ieee80211_sub_if_data *sdata,u32 changed);void ieee80211_tx_set_protected (struct ieee80211_tx_data *tx);u32 ieee80211_handle_ht (struct ieee80211_local *local,int enable_ht,struct ieee80211_ht_info *req_ht_cap,struct ieee80211_ht_bss_info *req_bss_cap); +void ieee80211_bss_info_change_notify (struct ieee80211_sub_if_data *sdata, +u32 changed); -/* ieee80211_ioctl.c */ +/* wireless extensions */ extern const struct iw_handler_def ieee80211_iw_handler_def;int ieee80211_set_freq (struct ieee80211_sub_if_data *sdata,int freq); -/* ieee80211_sta.c */ -void ieee80211_sta_timer (unsigned long data); -void ieee80211_sta_work (struct work_struct *work); +/* STA/IBSS code */ +void ieee80211_sta_setup_sdata (struct ieee80211_sub_if_data *sdata);void ieee80211_sta_scan_work (struct work_struct *work);void ieee80211_sta_rx_mgmt (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb,struct ieee80211_rx_status *rx_status);int ieee80211_sta_set_ssid (struct ieee80211_sub_if_data *sdata,char *ssid,size_t len);int ieee80211_sta_get_ssid (struct ieee80211_sub_if_data *sdata,char *ssid,size_t *len);int ieee80211_sta_set_bssid (struct ieee80211_sub_if_data *sdata,u8 *bssid); -int ieee80211_sta_req_scan (struct ieee80211_sub_if_data *sdata,u8 *ssid,size_t ssid_len);void ieee80211_sta_req_auth (struct ieee80211_sub_if_data *sdata,struct ieee80211_if_sta *ifsta); -int ieee80211_sta_scan_results (struct ieee80211_local *local, -struct iw_request_info *info, -char *buf,size_t len); -ieee80211_rx_result ieee80211_sta_rx_scan ( -struct ieee80211_sub_if_data *sdata,struct sk_buff *skb, -struct ieee80211_rx_status *rx_status); -void ieee80211_rx_bss_list_init (struct ieee80211_local *local); -void ieee80211_rx_bss_list_deinit (struct ieee80211_local *local); -int ieee80211_sta_set_extra_ie (struct ieee80211_sub_if_data *sdata,char *ie,size_t len);struct sta_info *ieee80211_ibss_add_sta (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb,u8 *bssid,u8 *addr,u64 supp_rates);int ieee80211_sta_deauthenticate (struct ieee80211_sub_if_data *sdata,u16 reason);int ieee80211_sta_disassociate (struct ieee80211_sub_if_data *sdata,u16 reason); -void ieee80211_bss_info_change_notify (struct ieee80211_sub_if_data *sdata, -u32 changed);u32 ieee80211_reset_erp_info (struct ieee80211_sub_if_data *sdata);u64 ieee80211_sta_get_rates (struct ieee80211_local *local,struct ieee802_11_elems *elems,enum ieee80211_band band);void ieee80211_send_probe_req (struct ieee80211_sub_if_data *sdata,u8 *dst,u8 *ssid,size_t ssid_len); -void ieee802_11_parse_elems (u8 *start,size_t len, -struct ieee802_11_elems *elems); + +/* scan/BSS handling */ +int ieee80211_sta_req_scan (struct ieee80211_sub_if_data *sdata,u8 *ssid,size_t ssid_len); +int ieee80211_sta_scan_results (struct ieee80211_local *local, +struct iw_request_info *info, +char *buf,size_t len); +ieee80211_rx_result ieee80211_sta_rx_scan ( +struct ieee80211_sub_if_data *sdata,struct sk_buff *skb, +struct ieee80211_rx_status *rx_status); +void ieee80211_rx_bss_list_init (struct ieee80211_local *local); +void ieee80211_rx_bss_list_deinit (struct ieee80211_local *local); +int ieee80211_sta_set_extra_ie (struct ieee80211_sub_if_data *sdata,char *ie,size_t len); +void ieee80211_mlme_notify_scan_completed (struct ieee80211_local *local);int ieee80211_sta_start_scan (struct ieee80211_sub_if_data *scan_sdata,u8 *ssid,size_t ssid_len);
@@ -1007,6 +1006,8 @@ void mac80211_ev_michael_mic_failure(strvoid ieee80211_set_wmm_default (struct ieee80211_sub_if_data *sdata);void ieee80211_tx_skb (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb,int encrypt); +void ieee802_11_parse_elems (u8 *start,size_t len, +struct ieee802_11_elems *elems);#ifdef CONFIG_MAC80211_NOINLINE #define debug_noinline noinline
net/mac80211/iface.c +1 -16
@@ -83,8 +83,6 @@ static void ieee80211_teardown_sdata(strstatic void ieee80211_setup_sdata (struct ieee80211_sub_if_data *sdata,enum ieee80211_if_types type) { -struct ieee80211_if_sta *ifsta; -/* clear type-dependent union */ memset (&sdata->u,0 ,sizeof (sdata->u));
@@ -101,20 +99,7 @@ static void ieee80211_setup_sdata(structbreak ;case IEEE80211_IF_TYPE_STA :case IEEE80211_IF_TYPE_IBSS : - ifsta = &sdata->u.sta; -INIT_WORK (&ifsta->work, ieee80211_sta_work); -setup_timer (&ifsta->timer, ieee80211_sta_timer, - (unsigned long ) sdata); -skb_queue_head_init (&ifsta->skb_queue); - - ifsta->capab =WLAN_CAPABILITY_ESS ; - ifsta->auth_algs =IEEE80211_AUTH_ALG_OPEN | -IEEE80211_AUTH_ALG_SHARED_KEY ; - ifsta->flags |=IEEE80211_STA_CREATE_IBSS | -IEEE80211_STA_AUTO_BSSID_SEL | -IEEE80211_STA_AUTO_CHANNEL_SEL ; -if (ieee80211_num_regular_queues (&sdata->local->hw) >=4 ) - ifsta->flags |=IEEE80211_STA_WMM_ENABLED ; +ieee80211_sta_setup_sdata (sdata);break ;case IEEE80211_IF_TYPE_MESH_POINT :if (ieee80211_vif_is_mesh (&sdata->vif))
net/mac80211/mlme.c +364 -338
805 lines not on this page · raw message
Johannes Berg
maintainerPATCH 8/18 mac80211: move ieee80211_set_freq to utils
In reply to Johannes BergIt really doesn't belong into the wireless extensions code.
--- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/util.c | 28 ++++++++++++++++++++++++++++ net/mac80211/wext.c | 28 ---------------------------- 3 files changed, 29 insertions(+), 29 deletions(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -893,7 +893,6 @@ void ieee80211_bss_info_change_notify(st/* wireless extensions */ extern const struct iw_handler_def ieee80211_iw_handler_def; -int ieee80211_set_freq (struct ieee80211_sub_if_data *sdata,int freq);/* STA/IBSS code */ void ieee80211_sta_setup_sdata (struct ieee80211_sub_if_data *sdata);
@@ -1008,6 +1007,7 @@ void ieee80211_tx_skb(struct ieee80211_s int encrypt);void ieee802_11_parse_elems (u8 *start,size_t len,struct ieee802_11_elems *elems); +int ieee80211_set_freq (struct ieee80211_sub_if_data *sdata,int freq);#ifdef CONFIG_MAC80211_NOINLINE #define debug_noinline noinline
net/mac80211/util.c +28 -0
@@ -612,3 +612,31 @@ void ieee80211_tx_skb(struct ieee80211_sdev_queue_xmit (skb); } + +int ieee80211_set_freq (struct ieee80211_sub_if_data *sdata,int freqMHz) +{ +int ret = -EINVAL ; +struct ieee80211_channel *chan; +struct ieee80211_local *local = sdata->local; + + chan =ieee80211_get_channel (local->hw.wiphy, freqMHz); + +if (chan && !(chan->flags &IEEE80211_CHAN_DISABLED )) { +if (sdata->vif.type ==IEEE80211_IF_TYPE_IBSS && + chan->flags &IEEE80211_CHAN_NO_IBSS ) { +printk (KERN_DEBUG "%s: IBSS not allowed on frequency " +"%d MHz\n" , sdata->dev->name, chan->center_freq); +return ret; + } + local->oper_channel = chan; + +if (local->sta_sw_scanning || local->sta_hw_scanning) + ret =0 ; +else + ret =ieee80211_hw_config (local); + +rate_control_clear (local); + } + +return ret; +}
net/mac80211/wext.c +0 -28
@@ -330,34 +330,6 @@ static int ieee80211_ioctl_giwmode(strucreturn 0 ; } -int ieee80211_set_freq (struct ieee80211_sub_if_data *sdata,int freqMHz) -{ -int ret = -EINVAL ; -struct ieee80211_channel *chan; -struct ieee80211_local *local = sdata->local; - - chan =ieee80211_get_channel (local->hw.wiphy, freqMHz); - -if (chan && !(chan->flags &IEEE80211_CHAN_DISABLED )) { -if (sdata->vif.type ==IEEE80211_IF_TYPE_IBSS && - chan->flags &IEEE80211_CHAN_NO_IBSS ) { -printk (KERN_DEBUG "%s: IBSS not allowed on frequency " -"%d MHz\n" , sdata->dev->name, chan->center_freq); -return ret; - } - local->oper_channel = chan; - -if (local->sta_sw_scanning || local->sta_hw_scanning) - ret =0 ; -else - ret =ieee80211_hw_config (local); - -rate_control_clear (local); - } - -return ret; -} -static int ieee80211_ioctl_siwfreq (struct net_device *dev,struct iw_request_info *info,struct iw_freq *freq,char *extra)
Johannes Berg
maintainerPATCH 9/18 mac80211: make bridge_packets a virtual interface option
In reply to Johannes BergThe bridge_packets configuration really should be per virtual interface (theoretically per AP/VLAN, but this is much easier); there currently is no way to set it yet though. Also invert the option to "NO_BRIDGE_PACKETS" so the default is to bridge.
While at it, also document the flags properly.
--- net/mac80211/debugfs.c | 4 ---- net/mac80211/ieee80211_i.h | 29 +++++++++++++++++++---------- net/mac80211/main.c | 2 -- net/mac80211/rx.c | 5 +++-- 4 files changed, 22 insertions(+), 18 deletions(-)
net/mac80211/ieee80211_i.h +19 -10
@@ -402,11 +402,25 @@ struct ieee80211_if_mesh { do { } while (0)#endif -/* flags used in struct ieee80211_sub_if_data.flags */ -#define IEEE80211_SDATA_ALLMULTI BIT(0) -#define IEEE80211_SDATA_PROMISC BIT(1) -#define IEEE80211_SDATA_USERSPACE_MLME BIT(2) -#define IEEE80211_SDATA_OPERATING_GMODE BIT(3) +/** +* enum ieee80211_sub_if_data_flags - virtual interface flags +* +* @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets +* @IEEE80211_SDATA_PROMISC: interface is promisc +* @IEEE80211_SDATA_USERSPACE_MLME: userspace MLME is active +* @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode +* @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between +* associated stations and deliver multicast frames both +* back to wireless media and to the local net stack. +*/ +enum ieee80211_sub_if_data_flags { +IEEE80211_SDATA_ALLMULTI =BIT (0 ), +IEEE80211_SDATA_PROMISC =BIT (1 ), +IEEE80211_SDATA_USERSPACE_MLME =BIT (2 ), +IEEE80211_SDATA_OPERATING_GMODE =BIT (3 ), +IEEE80211_SDATA_DONT_BRIDGE_PACKETS =BIT (4 ), +}; +struct ieee80211_sub_if_data {struct list_head list;
@@ -635,10 +649,6 @@ struct ieee80211_local {struct crypto_blkcipher *wep_rx_tfm;u32 wep_iv; -int bridge_packets;/* bridge packets between associated stations and -* deliver multicast frames both back to wireless -* media and to the local net stack */ -struct list_head interfaces;/*
@@ -726,7 +736,6 @@ struct ieee80211_local {struct dentry *frequency;struct dentry *antenna_sel_tx;struct dentry *antenna_sel_rx; -struct dentry *bridge_packets;struct dentry *rts_threshold;struct dentry *fragmentation_threshold;struct dentry *short_retry_limit;
net/mac80211/main.c +0 -2
@@ -1280,8 +1280,6 @@ struct ieee80211_hw *ieee80211_alloc_hw( local->hw.queues =1 ;/* default */ - local->bridge_packets =1 ; - local->rts_threshold =IEEE80211_MAX_RTS_THRESHOLD ; local->fragmentation_threshold =IEEE80211_MAX_FRAG_THRESHOLD ; local->short_retry_limit =7 ;
net/mac80211/rx.c +3 -2
@@ -1221,8 +1221,9 @@ ieee80211_deliver_skb(struct ieee80211_r skb = rx->skb; xmit_skb =NULL ; -if (local->bridge_packets && (sdata->vif.type ==IEEE80211_IF_TYPE_AP || - sdata->vif.type ==IEEE80211_IF_TYPE_VLAN ) && +if ((sdata->vif.type ==IEEE80211_IF_TYPE_AP || + sdata->vif.type ==IEEE80211_IF_TYPE_VLAN ) && + !(sdata->flags &IEEE80211_SDATA_DONT_BRIDGE_PACKETS ) && (rx->flags &IEEE80211_RX_RA_MATCH )) {if (is_multicast_ether_addr (ehdr->h_dest)) {/*
net/mac80211/debugfs.c +0 -4
@@ -51,8 +51,6 @@ DEBUGFS_READONLY_FILE(antenna_sel_tx, 20 local->hw.conf.antenna_sel_tx);DEBUGFS_READONLY_FILE (antenna_sel_rx,20 ,"%d" , local->hw.conf.antenna_sel_rx); -DEBUGFS_READONLY_FILE (bridge_packets,20 ,"%d" , - local->bridge_packets);DEBUGFS_READONLY_FILE (rts_threshold,20 ,"%d" , local->rts_threshold); DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
@@ -206,7 +204,6 @@ void debugfs_hw_add(struct ieee80211_locDEBUGFS_ADD (frequency);DEBUGFS_ADD (antenna_sel_tx);DEBUGFS_ADD (antenna_sel_rx); -DEBUGFS_ADD (bridge_packets);DEBUGFS_ADD (rts_threshold);DEBUGFS_ADD (fragmentation_threshold);DEBUGFS_ADD (short_retry_limit);
@@ -263,7 +260,6 @@ void debugfs_hw_del(struct ieee80211_locDEBUGFS_DEL (frequency);DEBUGFS_DEL (antenna_sel_tx);DEBUGFS_DEL (antenna_sel_rx); -DEBUGFS_DEL (bridge_packets);DEBUGFS_DEL (rts_threshold);DEBUGFS_DEL (fragmentation_threshold);DEBUGFS_DEL (short_retry_limit);
Johannes Berg
maintainerPATCH 10/18 mac80211: clean up scan namespace
In reply to Johannes BergMost of the scan functions are called ieee80211_sta_scan_* or similar, make clean it up so they are all just called ieee80211_scan_*.
--- net/mac80211/ieee80211_i.h | 53 ++++++++------- net/mac80211/main.c | 6 - net/mac80211/mesh.c | 2 net/mac80211/mlme.c | 51 +++++++-------- net/mac80211/rx.c | 10 +- net/mac80211/scan.c | 153 ++++++++++++++++++++++----------------------- net/mac80211/tx.c | 2 net/mac80211/util.c | 2 net/mac80211/wext.c | 6 - 9 files changed, 145 insertions(+), 140 deletions(-)
net/mac80211/ieee80211_i.h +28 -25
@@ -71,9 +71,9 @@ struct ieee80211_fragment_entry { }; -struct ieee80211_sta_bss { +struct ieee80211_bss {struct list_head list; -struct ieee80211_sta_bss *hnext; +struct ieee80211_bss *hnext;size_t ssid_len;atomic_t users;
@@ -112,7 +112,7 @@ struct ieee80211_sta_bss {u8 erp_value; }; -static inline u8 *bss_mesh_cfg (struct ieee80211_sta_bss *bss) +static inline u8 *bss_mesh_cfg (struct ieee80211_bss *bss) {#ifdef CONFIG_MAC80211_MESH return bss->mesh_cfg;
@@ -120,7 +120,7 @@ static inline u8 *bss_mesh_cfg(struct iereturn NULL ; } -static inline u8 *bss_mesh_id (struct ieee80211_sta_bss *bss) +static inline u8 *bss_mesh_id (struct ieee80211_bss *bss) {#ifdef CONFIG_MAC80211_MESH return bss->mesh_id;
@@ -128,7 +128,7 @@ static inline u8 *bss_mesh_id(struct ieereturn NULL ; } -static inline u8 bss_mesh_id_len (struct ieee80211_sta_bss *bss) +static inline u8 bss_mesh_id_len (struct ieee80211_bss *bss) {#ifdef CONFIG_MAC80211_MESH return bss->mesh_id_len;
@@ -658,8 +658,8 @@ struct ieee80211_local {spinlock_t key_lock; -bool sta_sw_scanning; -bool sta_hw_scanning; +/* Scanning and BSS list */ +bool sw_scanning, hw_scanning;int scan_channel_idx;enum ieee80211_band scan_band;
@@ -670,9 +670,9 @@ struct ieee80211_local {struct ieee80211_channel *oper_channel, *scan_channel;u8 scan_ssid[IEEE80211_MAX_SSID_LEN ];size_t scan_ssid_len; -struct list_head sta_bss_list; -struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE ]; -spinlock_t sta_bss_lock; +struct list_head bss_list; +struct ieee80211_bss *bss_hash[STA_HASH_SIZE ]; +spinlock_t bss_lock;/* SNMP counters */ /* dot11CountersTable */
@@ -905,7 +905,7 @@ extern const struct iw_handler_def ieee8/* STA/IBSS code */ void ieee80211_sta_setup_sdata (struct ieee80211_sub_if_data *sdata); -void ieee80211_sta_scan_work (struct work_struct *work); +void ieee80211_scan_work (struct work_struct *work);void ieee80211_sta_rx_mgmt (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb,struct ieee80211_rx_status *rx_status);int ieee80211_sta_set_ssid (struct ieee80211_sub_if_data *sdata,char *ssid,size_t len);
@@ -926,35 +926,38 @@ void ieee80211_send_probe_req(struct iee u8 *ssid, size_t ssid_len);/* scan/BSS handling */ -int ieee80211_sta_req_scan (struct ieee80211_sub_if_data *sdata,u8 *ssid,size_t ssid_len); -int ieee80211_sta_scan_results (struct ieee80211_local *local, -struct iw_request_info *info, -char *buf,size_t len); -ieee80211_rx_result ieee80211_sta_rx_scan ( -struct ieee80211_sub_if_data *sdata,struct sk_buff *skb, -struct ieee80211_rx_status *rx_status); +int ieee80211_request_scan (struct ieee80211_sub_if_data *sdata, +u8 *ssid,size_t ssid_len); +int ieee80211_scan_results (struct ieee80211_local *local, +struct iw_request_info *info, +char *buf,size_t len); +ieee80211_rx_result +ieee80211_scan_rx (struct ieee80211_sub_if_data *sdata, +struct sk_buff *skb, +struct ieee80211_rx_status *rx_status);void ieee80211_rx_bss_list_init (struct ieee80211_local *local);void ieee80211_rx_bss_list_deinit (struct ieee80211_local *local); -int ieee80211_sta_set_extra_ie (struct ieee80211_sub_if_data *sdata,char *ie,size_t len); +int ieee80211_sta_set_extra_ie (struct ieee80211_sub_if_data *sdata, +char *ie,size_t len);void ieee80211_mlme_notify_scan_completed (struct ieee80211_local *local); -int ieee80211_sta_start_scan (struct ieee80211_sub_if_data *scan_sdata, -u8 *ssid,size_t ssid_len); -struct ieee80211_sta_bss * +int ieee80211_start_scan (struct ieee80211_sub_if_data *scan_sdata, +u8 *ssid,size_t ssid_len); +struct ieee80211_bss *ieee80211_bss_info_update (struct ieee80211_local *local,struct ieee80211_rx_status *rx_status,struct ieee80211_mgmt *mgmt,size_t len,struct ieee802_11_elems *elems,int freq,bool beacon); -struct ieee80211_sta_bss * +struct ieee80211_bss *ieee80211_rx_bss_add (struct ieee80211_local *local,u8 *bssid,int freq,u8 *ssid,u8 ssid_len); -struct ieee80211_sta_bss * +struct ieee80211_bss *ieee80211_rx_bss_get (struct ieee80211_local *local,u8 *bssid,int freq,u8 *ssid,u8 ssid_len);void ieee80211_rx_bss_put (struct ieee80211_local *local, -struct ieee80211_sta_bss *bss); +struct ieee80211_bss *bss);/* interface handling */ void ieee80211_if_setup (struct net_device *dev);
net/mac80211/main.c +3 -3
@@ -598,7 +598,7 @@ static int ieee80211_stop(struct net_dev* the scan_sdata is NULL already don't send out a * scan event to userspace -- the scan is incomplete. */ -if (local->sta_sw_scanning) +if (local->sw_scanning)ieee80211_scan_completed (&local->hw); }
@@ -732,7 +732,7 @@ int ieee80211_hw_config(struct ieee80211struct ieee80211_channel *chan;int ret =0 ; -if (local->sta_sw_scanning) +if (local->sw_scanning) chan = local->scan_channel;else chan = local->oper_channel;
@@ -1290,7 +1290,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(spin_lock_init (&local->key_lock); -INIT_DELAYED_WORK (&local->scan_work, ieee80211_sta_scan_work); +INIT_DELAYED_WORK (&local->scan_work, ieee80211_scan_work);sta_info_init (local);
net/mac80211/mesh.c +1 -1
@@ -566,7 +566,7 @@ static void ieee80211_mesh_work(struct wif (!netif_running (sdata->dev))return ; -if (local->sta_sw_scanning || local->sta_hw_scanning) +if (local->sw_scanning || local->hw_scanning)return ;while ((skb =skb_dequeue (&ifmsh->skb_queue)))
net/mac80211/mlme.c +26 -25
181 lines not on this page · raw message
net/mac80211/rx.c +5 -5
@@ -403,12 +403,12 @@ ieee80211_rx_h_passive_scan(struct ieee8struct ieee80211_local *local = rx->local;struct sk_buff *skb = rx->skb; -if (unlikely (local->sta_hw_scanning)) -return ieee80211_sta_rx_scan (rx->sdata, skb, rx->status); +if (unlikely (local->hw_scanning)) +return ieee80211_scan_rx (rx->sdata, skb, rx->status); -if (unlikely (local->sta_sw_scanning)) { +if (unlikely (local->sw_scanning)) {/* drop all the other packets during a software scan anyway */ -if (ieee80211_sta_rx_scan (rx->sdata, skb, rx->status) +if (ieee80211_scan_rx (rx->sdata, skb, rx->status) !=RX_QUEUED )dev_kfree_skb (skb);return RX_QUEUED ;
@@ -1918,7 +1918,7 @@ static void __ieee80211_rx_handle_packetreturn ; } -if (unlikely (local->sta_sw_scanning || local->sta_hw_scanning)) +if (unlikely (local->sw_scanning || local->hw_scanning)) rx.flags |=IEEE80211_RX_IN_SCAN ;ieee80211_parse_qos (&rx);
net/mac80211/scan.c +77 -76
379 lines not on this page · raw message
net/mac80211/tx.c +1 -1
@@ -222,7 +222,7 @@ ieee80211_tx_h_check_assoc(struct ieee80if (unlikely (info->flags &IEEE80211_TX_CTL_INJECTED ))return TX_CONTINUE ; -if (unlikely (tx->local->sta_sw_scanning) && +if (unlikely (tx->local->sw_scanning) && !ieee80211_is_probe_req (hdr->frame_control))return TX_DROP ;
net/mac80211/util.c +1 -1
@@ -630,7 +630,7 @@ int ieee80211_set_freq(struct ieee80211_ } local->oper_channel = chan; -if (local->sta_sw_scanning || local->sta_hw_scanning) +if (local->sw_scanning || local->hw_scanning) ret =0 ;else ret =ieee80211_hw_config (local);
net/mac80211/wext.c +3 -3
@@ -552,7 +552,7 @@ static int ieee80211_ioctl_siwscan(struc ssid_len = req->essid_len; } -return ieee80211_sta_req_scan (sdata, ssid, ssid_len); +return ieee80211_request_scan (sdata, ssid, ssid_len); }
@@ -566,10 +566,10 @@ static int ieee80211_ioctl_giwscan(struc sdata =IEEE80211_DEV_TO_SUB_IF (dev); -if (local->sta_sw_scanning || local->sta_hw_scanning) +if (local->sw_scanning || local->hw_scanning)return -EAGAIN ; - res =ieee80211_sta_scan_results (local, info, extra, data->length); + res =ieee80211_scan_results (local, info, extra, data->length);if (res >=0 ) { data->length = res;return 0 ;
Johannes Berg
maintainerPATCH 11/18 mac80211: clean up some comments
In reply to Johannes BergSome comments refer to 80211.o or similar; also remove a comment about implementing fragments better, we really have better things to do.
--- net/mac80211/ieee80211_i.h | 7 ++----- net/mac80211/rx.c | 4 ++-- net/mac80211/tx.c | 15 +-------------- net/mac80211/wme.h | 1 - 4 files changed, 5 insertions(+), 22 deletions(-)
net/mac80211/rx.c +2 -2
@@ -501,8 +501,8 @@ ieee80211_rx_h_check(struct ieee80211_rx/* Drop disallowed frame classes based on STA auth/assoc state; * IEEE 802.11, Chap 5.5. * -* 80211.o does filtering only based on association state, i.e., it -* drops Class 3 frames from not associated stations. hostapd sends +* mac80211 filters only based on association state, i.e. it drops +* Class 3 frames from not associated stations. hostapd sends * deauth/disassoc frames when needed. In addition, hostapd is * responsible for filtering on both auth and assoc states. */
net/mac80211/tx.c +1 -14
@@ -111,7 +111,7 @@ static __le16 ieee80211_duration(struct hdr = (struct ieee80211_hdr *)tx->skb->data;if (ieee80211_is_ctl (hdr->frame_control)) {/* TODO: These control frames are not currently sent by -* 80211.o, but should they be implemented, this function +* mac80211, but should they be implemented, this function * needs to be updated to support duration field calculation. * * RTS: time needed to transmit pending data/mgmt frame plus
@@ -1580,19 +1580,6 @@ int ieee80211_subif_start_xmit(struct sk nh_pos -= skip_header_bytes; h_pos -= skip_header_bytes; -/* TODO: implement support for fragments so that there is no need to -* reallocate and copy payload; it might be enough to support one -* extra fragment that would be copied in the beginning of the frame -* data.. anyway, it would be nice to include this into skb structure -* somehow -* -* There are few options for this: -* use skb->cb as an extra space for 802.11 header -* allocate new buffer if not enough headroom -* make sure that there is enough headroom in every skb by increasing -* build in headroom in __dev_alloc_skb() (linux/skbuff.h) and -* alloc_skb() (net/core/skbuff.c) -*/ head_need = hdrlen + encaps_len + meshhdrlen -skb_headroom (skb);/*
net/mac80211/wme.h +0 -1
@@ -1,5 +1,4 @@/* -* IEEE 802.11 driver (80211.o) - QoS datatypes * Copyright 2004, Instant802 Networks, Inc. * Copyright 2005, Devicescape Software, Inc. *
net/mac80211/ieee80211_i.h +2 -5
@@ -29,9 +29,6 @@#include "key.h" #include "sta_info.h" -/* ieee80211.o internal definitions, etc. These are not included into -* low-level drivers. */ -struct ieee80211_local ;/* Maximum number of broadcast/multicast frames to buffer when some of the
@@ -293,13 +290,13 @@ struct mesh_config {#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11)#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)#define IEEE80211_STA_PRIVACY_INVOKED BIT(13) -/* flags for MLME request*/ +/* flags for MLME request */ #define IEEE80211_STA_REQ_SCAN 0#define IEEE80211_STA_REQ_DIRECT_PROBE 1#define IEEE80211_STA_REQ_AUTH 2#define IEEE80211_STA_REQ_RUN 3 -/* flags used for setting mlme state */ +/* STA/IBSS MLME states */ enum ieee80211_sta_mlme_state {IEEE80211_STA_MLME_DISABLED ,IEEE80211_STA_MLME_DIRECT_PROBE ,
Johannes Berg
maintainerPATCH 12/18 mac80211: inform driver of basic rateset
In reply to Johannes BergDrivers need to know the basic rateset to be able to configure the ACK/CTS programming in hardware correctly.
--- include/net/mac80211.h | 6 ++++++ net/mac80211/ieee80211_i.h | 7 ++----- net/mac80211/iface.c | 4 +++- net/mac80211/mlme.c | 40 +++++++++------------------------------- net/mac80211/tx.c | 4 ++-- net/mac80211/util.c | 28 ++++++++++++++++++++++++++++ 6 files changed, 50 insertions(+), 39 deletions(-)
include/net/mac80211.h +6 -0
@@ -160,6 +160,7 @@ struct ieee80211_low_level_stats {* @BSS_CHANGED_ERP_PREAMBLE: preamble changed * @BSS_CHANGED_ERP_SLOT: slot timing changed * @BSS_CHANGED_HT: 802.11n parameters changed +* @BSS_CHANGED_BASIC_RATES: Basic rateset changed */ enum ieee80211_bss_change {BSS_CHANGED_ASSOC =1 <<0 ,
@@ -167,6 +168,7 @@ enum ieee80211_bss_change {BSS_CHANGED_ERP_PREAMBLE =1 <<2 ,BSS_CHANGED_ERP_SLOT =1 <<3 ,BSS_CHANGED_HT =1 <<4 , + BSS_CHANGED_BASIC_RATES = 1<<5, };/**
@@ -187,6 +189,9 @@ enum ieee80211_bss_change {* @assoc_ht: association in HT mode * @ht_conf: ht capabilities * @ht_bss_conf: ht extended capabilities +* @basic_rates: bitmap of basic rates, each bit stands for an +* index into the rate table configured by the driver in +* the current band. */ struct ieee80211_bss_conf {/* association related data */
@@ -200,6 +205,7 @@ struct ieee80211_bss_conf {u16 beacon_int;u16 assoc_capability;u64 timestamp; +u64 basic_rates;/* ht related data */ bool assoc_ht;struct ieee80211_ht_info *ht_conf;
net/mac80211/ieee80211_i.h +2 -5
@@ -433,11 +433,6 @@ struct ieee80211_sub_if_data {int drop_unencrypted; -/* -* basic rates of this AP or the AP we're associated to -*/ -u64 basic_rates; -/* Fragment table for host-based reassembly */ struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX ];unsigned int fragment_next;
@@ -1017,6 +1012,8 @@ void ieee80211_tx_skb(struct ieee80211_svoid ieee802_11_parse_elems (u8 *start,size_t len,struct ieee802_11_elems *elems);int ieee80211_set_freq (struct ieee80211_sub_if_data *sdata,int freq); +u64 ieee80211_mandatory_rates (struct ieee80211_local *local, +enum ieee80211_band band);#ifdef CONFIG_MAC80211_NOINLINE #define debug_noinline noinline
net/mac80211/iface.c +3 -1
@@ -144,7 +144,9 @@ int ieee80211_if_change_type(struct ieeeieee80211_setup_sdata (sdata, type);/* reset some values that shouldn't be kept across type changes */ - sdata->basic_rates =0 ; + sdata->bss_conf.basic_rates = +ieee80211_mandatory_rates (sdata->local, + sdata->local->hw.conf.channel->band); sdata->drop_unencrypted =0 ;return 0 ;
net/mac80211/mlme.c +9 -31
@@ -741,6 +741,12 @@ static void ieee80211_set_associated(strieee80211_led_assoc (local,1 ); sdata->bss_conf.assoc =1 ; +/* +* For now just always ask the driver to update the basic rateset +* when we have associated, we aren't checking whether it actually +* changed or not. +*/ + changed |=BSS_CHANGED_BASIC_RATES ;ieee80211_bss_info_change_notify (sdata, changed);netif_tx_start_all_queues (sdata->dev);
@@ -1327,7 +1333,7 @@ static void ieee80211_rx_mgmt_assoc_resp } sta->supp_rates[local->hw.conf.channel->band] = rates; - sdata->basic_rates = basic_rates; + sdata->bss_conf.basic_rates = basic_rates;/* cf. IEEE 802.11 9.2.12 */ if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
@@ -1484,34 +1490,6 @@ static int ieee80211_sta_join_ibss(strucreturn res; } -static u64 ieee80211_sta_get_mandatory_rates (struct ieee80211_local *local, -enum ieee80211_band band) -{ -struct ieee80211_supported_band *sband; -struct ieee80211_rate *bitrates; -u64 mandatory_rates; -enum ieee80211_rate_flags mandatory_flag; -int i; - - sband = local->hw.wiphy->bands[band]; -if (!sband) { -WARN_ON (1 ); - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - } - -if (band ==IEEE80211_BAND_2GHZ ) - mandatory_flag =IEEE80211_RATE_MANDATORY_B ; -else - mandatory_flag =IEEE80211_RATE_MANDATORY_A ; - - bitrates = sband->bitrates; - mandatory_rates =0 ; -for (i =0 ; i < sband->n_bitrates; i++) -if (bitrates[i].flags & mandatory_flag) - mandatory_rates |=BIT (i); -return mandatory_rates; -} - static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt, size_t len,
@@ -1553,7 +1531,7 @@ static void ieee80211_rx_bss_info(struct prev_rates = sta->supp_rates[band];/* make sure mandatory rates are always added */ sta->supp_rates[band] = supp_rates | -ieee80211_sta_get_mandatory_rates (local, band); +ieee80211_mandatory_rates (local, band);#ifdef CONFIG_MAC80211_IBSS_DEBUG if (sta->supp_rates[band] != prev_rates)
@@ -2392,7 +2370,7 @@ struct sta_info *ieee80211_ibss_add_sta(/* make sure mandatory rates are always added */ sta->supp_rates[band] = supp_rates | -ieee80211_sta_get_mandatory_rates (local, band); +ieee80211_mandatory_rates (local, band);rate_control_rate_init (sta, local);
net/mac80211/tx.c +2 -2
@@ -153,7 +153,7 @@ static __le16 ieee80211_duration(structif (r->bitrate > txrate->bitrate)break ; -if (tx->sdata->basic_rates &BIT (i)) +if (tx->sdata->bss_conf.basic_rates &BIT (i)) rate = r->bitrate;switch (sband->band) {
@@ -594,7 +594,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_for (idx =0 ; idx < sband->n_bitrates; idx++) {if (sband->bitrates[idx].bitrate > rate->bitrate)continue ; -if (tx->sdata->basic_rates &BIT (idx) && +if (tx->sdata->bss_conf.basic_rates &BIT (idx) && (baserate <0 || (sband->bitrates[baserate].bitrate < sband->bitrates[idx].bitrate)))
net/mac80211/util.c +28 -0
@@ -640,3 +640,31 @@ int ieee80211_set_freq(struct ieee80211_return ret; } + +u64 ieee80211_mandatory_rates (struct ieee80211_local *local, +enum ieee80211_band band) +{ +struct ieee80211_supported_band *sband; +struct ieee80211_rate *bitrates; +u64 mandatory_rates; +enum ieee80211_rate_flags mandatory_flag; +int i; + + sband = local->hw.wiphy->bands[band]; +if (!sband) { +WARN_ON (1 ); + sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; + } + +if (band ==IEEE80211_BAND_2GHZ ) + mandatory_flag =IEEE80211_RATE_MANDATORY_B ; +else + mandatory_flag =IEEE80211_RATE_MANDATORY_A ; + + bitrates = sband->bitrates; + mandatory_rates =0 ; +for (i =0 ; i < sband->n_bitrates; i++) +if (bitrates[i].flags & mandatory_flag) + mandatory_rates |=BIT (i); +return mandatory_rates; +}
Johannes Berg
maintainerPATCH 13/18 mac80211: use nl80211 interface types
In reply to Johannes BergThere's really no reason for mac80211 to be using its own interface type defines. Use the nl80211 types and simplify the configuration code a bit: there's no need to translate them any more now.
--- drivers/net/wireless/adm8211.c | 22 +++--- drivers/net/wireless/at76_usb.c | 2 drivers/net/wireless/ath5k/ath5k.h | 4 - drivers/net/wireless/ath5k/attach.c | 2 drivers/net/wireless/ath5k/base.c | 50 +++++++-------- drivers/net/wireless/ath5k/base.h | 2 drivers/net/wireless/ath5k/pcu.c | 12 +-- drivers/net/wireless/ath5k/reset.c | 2 drivers/net/wireless/ath9k/main.c | 28 ++++---- drivers/net/wireless/b43/main.c | 38 +++++------ drivers/net/wireless/b43/phy_common.c | 4 - drivers/net/wireless/b43legacy/main.c | 30 ++++----- drivers/net/wireless/b43legacy/phy.c | 4 - drivers/net/wireless/ipw2100.c | 2 drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 2 drivers/net/wireless/iwlwifi/iwl-3945.c | 6 - drivers/net/wireless/iwlwifi/iwl-3945.h | 2 drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 8 +- drivers/net/wireless/iwlwifi/iwl-agn.c | 64 ++++++++++---------- drivers/net/wireless/iwlwifi/iwl-core.c | 8 +- drivers/net/wireless/iwlwifi/iwl-dev.h | 2 drivers/net/wireless/iwlwifi/iwl-power.c | 2 drivers/net/wireless/iwlwifi/iwl-rx.c | 8 +- drivers/net/wireless/iwlwifi/iwl-scan.c | 4 - drivers/net/wireless/iwlwifi/iwl-sta.c | 20 +++--- drivers/net/wireless/iwlwifi/iwl-tx.c | 4 - drivers/net/wireless/iwlwifi/iwl3945-base.c | 84 +++++++++++++------------- drivers/net/wireless/libertas_tf/main.c | 18 ++--- drivers/net/wireless/mac80211_hwsim.c | 2 drivers/net/wireless/p54/p54common.c | 14 ++-- drivers/net/wireless/p54/p54pci.c | 4 - drivers/net/wireless/rt2x00/rt2500usb.c | 2 drivers/net/wireless/rt2x00/rt2x00.h | 2 drivers/net/wireless/rt2x00/rt2x00config.c | 8 +- drivers/net/wireless/rt2x00/rt2x00dev.c | 8 +- drivers/net/wireless/rt2x00/rt2x00lib.h | 2 drivers/net/wireless/rt2x00/rt2x00mac.c | 18 ++--- drivers/net/wireless/rtl8180_dev.c | 10 +-- drivers/net/wireless/rtl8187_dev.c | 8 +- drivers/net/wireless/zd1211rw/zd_mac.c | 20 +++--- include/net/mac80211.h | 35 +---------- net/mac80211/cfg.c | 57 +++++++---------- net/mac80211/debugfs_netdev.c | 28 ++++---- net/mac80211/ht.c | 6 - net/mac80211/ieee80211_i.h | 6 - net/mac80211/iface.c | 40 ++++++------ net/mac80211/key.c | 6 - net/mac80211/main.c | 89 +++++++++++++--------------- net/mac80211/mlme.c | 40 ++++++------ net/mac80211/rx.c | 65 ++++++++++---------- net/mac80211/scan.c | 8 +- net/mac80211/sta_info.c | 4 - net/mac80211/tx.c | 28 ++++---- net/mac80211/util.c | 44 +++++++------ net/mac80211/wext.c | 84 +++++++++++++------------- 55 files changed, 519 insertions(+), 553 deletions(-)
include/net/mac80211.h +4 -31
@@ -478,33 +478,6 @@ struct ieee80211_conf { };/** -* enum ieee80211_if_types - types of 802.11 network interfaces -* -* @IEEE80211_IF_TYPE_INVALID: invalid interface type, not used -* by mac80211 itself -* @IEEE80211_IF_TYPE_AP: interface in AP mode. -* @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap -* daemon. Drivers should never see this type. -* @IEEE80211_IF_TYPE_STA: interface in STA (client) mode. -* @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode. -* @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode. -* @IEEE80211_IF_TYPE_WDS: interface in WDS mode. -* @IEEE80211_IF_TYPE_VLAN: VLAN interface bound to an AP, drivers -* will never see this type. -* @IEEE80211_IF_TYPE_MESH_POINT: 802.11s mesh point -*/ -enum ieee80211_if_types { -IEEE80211_IF_TYPE_INVALID , -IEEE80211_IF_TYPE_AP , -IEEE80211_IF_TYPE_STA , -IEEE80211_IF_TYPE_IBSS , -IEEE80211_IF_TYPE_MESH_POINT , -IEEE80211_IF_TYPE_MNTR , -IEEE80211_IF_TYPE_WDS , -IEEE80211_IF_TYPE_VLAN , -}; - -/** * struct ieee80211_vif - per-interface data * * Data in this structure is continually present for driver
@@ -515,7 +488,7 @@ enum ieee80211_if_types {* sizeof(void *). */ struct ieee80211_vif { -enum ieee80211_if_types type; +enum nl80211_iftype type;/* must be last */ u8 drv_priv[0 ] __attribute__((__aligned__ (sizeof (void *)))); };
@@ -523,7 +496,7 @@ struct ieee80211_vif {static inline bool ieee80211_vif_is_mesh (struct ieee80211_vif *vif) {#ifdef CONFIG_MAC80211_MESH -return vif->type ==IEEE80211_IF_TYPE_MESH_POINT ; +return vif->type ==NL80211_IFTYPE_MESH_POINT ;#endif return false; }
@@ -534,7 +507,7 @@ static inline bool ieee80211_vif_is_mesh* @vif: pointer to a driver-use per-interface structure. The pointer * itself is also used for various functions including * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). -* @type: one of &enum ieee80211_if_types constants. Determines the type of +* @type: one of &enum nl80211_iftype constants. Determines the type of * added/removed interface. * @mac_addr: pointer to MAC address of the interface. This pointer is valid * until the interface is removed (i.e. it cannot be used after
@@ -550,7 +523,7 @@ static inline bool ieee80211_vif_is_mesh* in pure monitor mode. */ struct ieee80211_if_init_conf { -enum ieee80211_if_types type; +enum nl80211_iftype type;struct ieee80211_vif *vif;void *mac_addr; };
net/mac80211/cfg.c +23 -34
175 lines not on this page · raw message
net/mac80211/debugfs_netdev.c +14 -14
@@ -345,26 +345,26 @@ static void add_files(struct ieee80211_sreturn ;switch (sdata->vif.type) { -case IEEE80211_IF_TYPE_MESH_POINT : +case NL80211_IFTYPE_MESH_POINT :#ifdef CONFIG_MAC80211_MESH add_mesh_stats (sdata);add_mesh_config (sdata);#endif break ; -case IEEE80211_IF_TYPE_STA : -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_STATION : +case NL80211_IFTYPE_ADHOC :add_sta_files (sdata);break ; -case IEEE80211_IF_TYPE_AP : +case NL80211_IFTYPE_AP :add_ap_files (sdata);break ; -case IEEE80211_IF_TYPE_WDS : +case NL80211_IFTYPE_WDS :add_wds_files (sdata);break ; -case IEEE80211_IF_TYPE_MNTR : +case NL80211_IFTYPE_MONITOR :add_monitor_files (sdata);break ; -case IEEE80211_IF_TYPE_VLAN : +case NL80211_IFTYPE_AP_VLAN :add_vlan_files (sdata);break ;default :
@@ -482,26 +482,26 @@ static void del_files(struct ieee80211_sreturn ;switch (sdata->vif.type) { -case IEEE80211_IF_TYPE_MESH_POINT : +case NL80211_IFTYPE_MESH_POINT :#ifdef CONFIG_MAC80211_MESH del_mesh_stats (sdata);del_mesh_config (sdata);#endif break ; -case IEEE80211_IF_TYPE_STA : -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_STATION : +case NL80211_IFTYPE_ADHOC :del_sta_files (sdata);break ; -case IEEE80211_IF_TYPE_AP : +case NL80211_IFTYPE_AP :del_ap_files (sdata);break ; -case IEEE80211_IF_TYPE_WDS : +case NL80211_IFTYPE_WDS :del_wds_files (sdata);break ; -case IEEE80211_IF_TYPE_MNTR : +case NL80211_IFTYPE_MONITOR :del_monitor_files (sdata);break ; -case IEEE80211_IF_TYPE_VLAN : +case NL80211_IFTYPE_AP_VLAN :del_vlan_files (sdata);break ;default :
net/mac80211/ht.c +3 -3
@@ -89,7 +89,7 @@ static void ieee80211_send_addba_requestmemset (mgmt,0 ,24 );memcpy (mgmt->da, da,ETH_ALEN );memcpy (mgmt->sa, sdata->dev->dev_addr,ETH_ALEN ); -if (sdata->vif.type ==IEEE80211_IF_TYPE_AP ) +if (sdata->vif.type ==NL80211_IFTYPE_AP )memcpy (mgmt->bssid, sdata->dev->dev_addr,ETH_ALEN );else memcpy (mgmt->bssid, ifsta->bssid,ETH_ALEN );
@@ -139,7 +139,7 @@ static void ieee80211_send_addba_resp(stmemset (mgmt,0 ,24 );memcpy (mgmt->da, da,ETH_ALEN );memcpy (mgmt->sa, sdata->dev->dev_addr,ETH_ALEN ); -if (sdata->vif.type ==IEEE80211_IF_TYPE_AP ) +if (sdata->vif.type ==NL80211_IFTYPE_AP )memcpy (mgmt->bssid, sdata->dev->dev_addr,ETH_ALEN );else memcpy (mgmt->bssid, ifsta->bssid,ETH_ALEN );
@@ -185,7 +185,7 @@ static void ieee80211_send_delba(structmemset (mgmt,0 ,24 );memcpy (mgmt->da, da,ETH_ALEN );memcpy (mgmt->sa, sdata->dev->dev_addr,ETH_ALEN ); -if (sdata->vif.type ==IEEE80211_IF_TYPE_AP ) +if (sdata->vif.type ==NL80211_IFTYPE_AP )memcpy (mgmt->bssid, sdata->dev->dev_addr,ETH_ALEN );else memcpy (mgmt->bssid, ifsta->bssid,ETH_ALEN );
net/mac80211/iface.c +21 -19
@@ -41,7 +41,7 @@ static void ieee80211_teardown_sdata(str sdata->fragment_next =0 ;switch (sdata->vif.type) { -case IEEE80211_IF_TYPE_AP : +case NL80211_IFTYPE_AP : beacon = sdata->u.ap.beacon;rcu_assign_pointer (sdata->u.ap.beacon,NULL );synchronize_rcu ();
@@ -53,22 +53,23 @@ static void ieee80211_teardown_sdata(str }break ; -case IEEE80211_IF_TYPE_MESH_POINT : +case NL80211_IFTYPE_MESH_POINT :if (ieee80211_vif_is_mesh (&sdata->vif))mesh_rmc_free (sdata);break ; -case IEEE80211_IF_TYPE_STA : -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_STATION : +case NL80211_IFTYPE_ADHOC :kfree (sdata->u.sta.extra_ie);kfree (sdata->u.sta.assocreq_ies);kfree (sdata->u.sta.assocresp_ies);kfree_skb (sdata->u.sta.probe_resp);break ; -case IEEE80211_IF_TYPE_WDS : -case IEEE80211_IF_TYPE_VLAN : -case IEEE80211_IF_TYPE_MNTR : +case NL80211_IFTYPE_WDS : +case NL80211_IFTYPE_AP_VLAN : +case NL80211_IFTYPE_MONITOR :break ; -case IEEE80211_IF_TYPE_INVALID : +case NL80211_IFTYPE_UNSPECIFIED : +case __NL80211_IFTYPE_AFTER_LAST:BUG ();break ; }
@@ -81,7 +82,7 @@ static void ieee80211_teardown_sdata(str* Helper function to initialise an interface to a specific type. */ static void ieee80211_setup_sdata (struct ieee80211_sub_if_data *sdata, -enum ieee80211_if_types type) +enum nl80211_iftype type) {/* clear type-dependent union */ memset (&sdata->u,0 ,sizeof (sdata->u));
@@ -93,28 +94,29 @@ static void ieee80211_setup_sdata(struct sdata->dev->type =ARPHRD_ETHER ;switch (type) { -case IEEE80211_IF_TYPE_AP : +case NL80211_IFTYPE_AP :skb_queue_head_init (&sdata->u.ap.ps_bc_buf);INIT_LIST_HEAD (&sdata->u.ap.vlans);break ; -case IEEE80211_IF_TYPE_STA : -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_STATION : +case NL80211_IFTYPE_ADHOC :ieee80211_sta_setup_sdata (sdata);break ; -case IEEE80211_IF_TYPE_MESH_POINT : +case NL80211_IFTYPE_MESH_POINT :if (ieee80211_vif_is_mesh (&sdata->vif))ieee80211_mesh_init_sdata (sdata);break ; -case IEEE80211_IF_TYPE_MNTR : +case NL80211_IFTYPE_MONITOR : sdata->dev->type =ARPHRD_IEEE80211_RADIOTAP ; sdata->dev->hard_start_xmit = ieee80211_monitor_start_xmit; sdata->u.mntr_flags =MONITOR_FLAG_CONTROL |MONITOR_FLAG_OTHER_BSS ;break ; -case IEEE80211_IF_TYPE_WDS : -case IEEE80211_IF_TYPE_VLAN : +case NL80211_IFTYPE_WDS : +case NL80211_IFTYPE_AP_VLAN :break ; -case IEEE80211_IF_TYPE_INVALID : +case NL80211_IFTYPE_UNSPECIFIED : +case __NL80211_IFTYPE_AFTER_LAST:BUG ();break ; }
@@ -123,7 +125,7 @@ static void ieee80211_setup_sdata(struct }int ieee80211_if_change_type (struct ieee80211_sub_if_data *sdata, -enum ieee80211_if_types type) +enum nl80211_iftype type) {ASSERT_RTNL ();
@@ -153,7 +155,7 @@ int ieee80211_if_change_type(struct ieee }int ieee80211_if_add (struct ieee80211_local *local,const char *name, -struct net_device **new_dev,enum ieee80211_if_types type, +struct net_device **new_dev,enum nl80211_iftype type,struct vif_params *params) {struct net_device *ndev;
net/mac80211/key.c +3 -3
@@ -118,8 +118,8 @@ static const u8 *get_mac_for_key(struct* address to indicate a transmit-only key. */ if (key->conf.alg !=ALG_WEP && - (key->sdata->vif.type ==IEEE80211_IF_TYPE_AP || - key->sdata->vif.type ==IEEE80211_IF_TYPE_VLAN )) + (key->sdata->vif.type ==NL80211_IFTYPE_AP || + key->sdata->vif.type ==NL80211_IFTYPE_AP_VLAN )) addr = zero_addr;if (key->sta)
@@ -331,7 +331,7 @@ void ieee80211_key_link(struct ieee80211*/ key->conf.flags |=IEEE80211_KEY_FLAG_PAIRWISE ; }else { -if (sdata->vif.type ==IEEE80211_IF_TYPE_STA ) { +if (sdata->vif.type ==NL80211_IFTYPE_STATION ) {struct sta_info *ap;/*
net/mac80211/main.c +44 -45
220 lines not on this page · raw message
net/mac80211/mlme.c +20 -20
@@ -709,7 +709,7 @@ static void ieee80211_set_associated(str ifsta->flags |=IEEE80211_STA_ASSOCIATED ; -if (sdata->vif.type !=IEEE80211_IF_TYPE_STA ) +if (sdata->vif.type !=NL80211_IFTYPE_STATION )return ; bss = ieee80211_rx_bss_get(local, ifsta->bssid,
@@ -1033,17 +1033,17 @@ static void ieee80211_rx_mgmt_auth(strucDECLARE_MAC_BUF (mac);if (ifsta->state !=IEEE80211_STA_MLME_AUTHENTICATE && - sdata->vif.type !=IEEE80211_IF_TYPE_IBSS ) + sdata->vif.type !=NL80211_IFTYPE_ADHOC )return ;if (len <24 +6 )return ; -if (sdata->vif.type !=IEEE80211_IF_TYPE_IBSS && +if (sdata->vif.type !=NL80211_IFTYPE_ADHOC &&memcmp (ifsta->bssid, mgmt->sa,ETH_ALEN ) !=0 )return ; -if (sdata->vif.type !=IEEE80211_IF_TYPE_IBSS && +if (sdata->vif.type !=NL80211_IFTYPE_ADHOC &&memcmp (ifsta->bssid, mgmt->bssid,ETH_ALEN ) !=0 )return ;
@@ -1051,7 +1051,7 @@ static void ieee80211_rx_mgmt_auth(struc auth_transaction =le16_to_cpu (mgmt->u.auth.auth_transaction); status_code =le16_to_cpu (mgmt->u.auth.status_code); -if (sdata->vif.type ==IEEE80211_IF_TYPE_IBSS ) { +if (sdata->vif.type ==NL80211_IFTYPE_ADHOC ) {/* * IEEE 802.11 standard does not require authentication in IBSS * networks and most implementations do not seem to use it.
@@ -1518,7 +1518,7 @@ static void ieee80211_rx_bss_info(structif (!channel || channel->flags &IEEE80211_CHAN_DISABLED )return ; -if (sdata->vif.type ==IEEE80211_IF_TYPE_IBSS && elems->supp_rates && +if (sdata->vif.type ==NL80211_IFTYPE_ADHOC && elems->supp_rates &&memcmp (mgmt->bssid, sdata->u.sta.bssid,ETH_ALEN ) ==0 ) { supp_rates =ieee80211_sta_get_rates (local, elems, band);
@@ -1563,14 +1563,14 @@ static void ieee80211_rx_bss_info(struct* In STA mode, the remaining parameters should not be overridden * by beacons because they're not necessarily accurate there. */ -if (sdata->vif.type !=IEEE80211_IF_TYPE_IBSS && +if (sdata->vif.type !=NL80211_IFTYPE_ADHOC && bss->last_probe_resp && beacon) {ieee80211_rx_bss_put (local, bss);return ; }/* check if we need to merge IBSS */ - if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && beacon && + if (sdata->vif.type == NL80211_IFTYPE_ADHOC && beacon && bss->capability & WLAN_CAPABILITY_IBSS && bss->freq == local->oper_channel->center_freq && elems->ssid_len == sdata->u.sta.ssid_len &&
@@ -1680,7 +1680,7 @@ static void ieee80211_rx_mgmt_beacon(strieee80211_rx_bss_info (sdata, mgmt, len, rx_status, &elems, true); -if (sdata->vif.type !=IEEE80211_IF_TYPE_STA ) +if (sdata->vif.type !=NL80211_IFTYPE_STATION )return ; ifsta = &sdata->u.sta;
@@ -1731,7 +1731,7 @@ static void ieee80211_rx_mgmt_probe_req(DECLARE_MAC_BUF (mac3);#endif -if (sdata->vif.type !=IEEE80211_IF_TYPE_IBSS || +if (sdata->vif.type !=NL80211_IFTYPE_ADHOC || ifsta->state !=IEEE80211_STA_MLME_IBSS_JOINED || len <24 +2 || !ifsta->probe_resp)return ;
@@ -2243,8 +2243,8 @@ static void ieee80211_sta_work(struct woif (local->sw_scanning || local->hw_scanning)return ; -if (WARN_ON (sdata->vif.type !=IEEE80211_IF_TYPE_STA && - sdata->vif.type !=IEEE80211_IF_TYPE_IBSS )) +if (WARN_ON (sdata->vif.type !=NL80211_IFTYPE_STATION && + sdata->vif.type !=NL80211_IFTYPE_ADHOC ))return ; ifsta = &sdata->u.sta;
@@ -2304,7 +2304,7 @@ static void ieee80211_sta_work(struct wostatic void ieee80211_restart_sta_timer (struct ieee80211_sub_if_data *sdata) { -if (sdata->vif.type ==IEEE80211_IF_TYPE_STA ) +if (sdata->vif.type ==NL80211_IFTYPE_STATION )queue_work (sdata->local->hw.workqueue, &sdata->u.sta.work); }
@@ -2386,7 +2386,7 @@ void ieee80211_sta_req_auth(struct ieee8 {struct ieee80211_local *local = sdata->local; -if (sdata->vif.type !=IEEE80211_IF_TYPE_STA ) +if (sdata->vif.type !=NL80211_IFTYPE_STATION )return ; if ((ifsta->flags & (IEEE80211_STA_BSSID_SET |
@@ -2438,7 +2438,7 @@ int ieee80211_sta_set_ssid(struct ieee80else ifsta->flags &= ~IEEE80211_STA_SSID_SET ; -if (sdata->vif.type ==IEEE80211_IF_TYPE_IBSS && +if (sdata->vif.type ==NL80211_IFTYPE_ADHOC && !(ifsta->flags &IEEE80211_STA_BSSID_SET )) { ifsta->ibss_join_req = jiffies; ifsta->state =IEEE80211_STA_MLME_IBSS_SEARCH ;
@@ -2513,8 +2513,8 @@ int ieee80211_sta_deauthenticate(structprintk (KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n" , sdata->dev->name, reason); -if (sdata->vif.type !=IEEE80211_IF_TYPE_STA && - sdata->vif.type !=IEEE80211_IF_TYPE_IBSS ) +if (sdata->vif.type !=NL80211_IFTYPE_STATION && + sdata->vif.type !=NL80211_IFTYPE_ADHOC )return -EINVAL ;ieee80211_set_disassoc (sdata, ifsta, true, true, reason);
@@ -2528,7 +2528,7 @@ int ieee80211_sta_disassociate(struct ieprintk (KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n" , sdata->dev->name, reason); -if (sdata->vif.type !=IEEE80211_IF_TYPE_STA ) +if (sdata->vif.type !=NL80211_IFTYPE_STATION )return -EINVAL ;if (!(ifsta->flags &IEEE80211_STA_ASSOCIATED ))
@@ -2544,7 +2544,7 @@ void ieee80211_mlme_notify_scan_completestruct ieee80211_sub_if_data *sdata = local->scan_sdata;struct ieee80211_if_sta *ifsta; -if (sdata && sdata->vif.type ==IEEE80211_IF_TYPE_IBSS ) { +if (sdata && sdata->vif.type ==NL80211_IFTYPE_ADHOC ) { ifsta = &sdata->u.sta; if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || (!(ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED) &&
@@ -2570,7 +2570,7 @@ void ieee80211_notify_mac(struct ieee802case IEEE80211_NOTIFY_RE_ASSOC :rcu_read_lock ();list_for_each_entry_rcu (sdata, &local->interfaces, list) { -if (sdata->vif.type !=IEEE80211_IF_TYPE_STA ) +if (sdata->vif.type !=NL80211_IFTYPE_STATION )continue ;ieee80211_sta_req_auth (sdata, &sdata->u.sta);
net/mac80211/rx.c +33 -32
190 lines not on this page · raw message
net/mac80211/scan.c +4 -4
@@ -475,7 +475,7 @@ void ieee80211_scan_completed(struct ieercu_read_lock ();list_for_each_entry_rcu (sdata, &local->interfaces, list) {/* Tell AP we're back */ -if (sdata->vif.type ==IEEE80211_IF_TYPE_STA ) { +if (sdata->vif.type ==NL80211_IFTYPE_STATION ) {if (sdata->u.sta.flags &IEEE80211_STA_ASSOCIATED ) {ieee80211_send_nullfunc (local, sdata,0 );netif_tx_wake_all_queues (sdata->dev);
@@ -539,7 +539,7 @@ void ieee80211_scan_work(struct work_str chan = &sband->channels[local->scan_channel_idx];if (chan->flags &IEEE80211_CHAN_DISABLED || - (sdata->vif.type ==IEEE80211_IF_TYPE_IBSS && + (sdata->vif.type ==NL80211_IFTYPE_ADHOC && chan->flags &IEEE80211_CHAN_NO_IBSS )) skip =1 ;
@@ -638,7 +638,7 @@ int ieee80211_start_scan(struct ieee8021rcu_read_lock ();list_for_each_entry_rcu (sdata, &local->interfaces, list) { -if (sdata->vif.type ==IEEE80211_IF_TYPE_STA ) { +if (sdata->vif.type ==NL80211_IFTYPE_STATION ) {if (sdata->u.sta.flags &IEEE80211_STA_ASSOCIATED ) {netif_tx_stop_all_queues (sdata->dev);ieee80211_send_nullfunc (local, sdata,1 );
@@ -681,7 +681,7 @@ int ieee80211_request_scan(struct ieee80struct ieee80211_local *local = sdata->local;struct ieee80211_if_sta *ifsta; -if (sdata->vif.type !=IEEE80211_IF_TYPE_STA ) +if (sdata->vif.type !=NL80211_IFTYPE_STATION )return ieee80211_start_scan (sdata, ssid, ssid_len);/*
net/mac80211/sta_info.c +2 -2
@@ -319,7 +319,7 @@ int sta_info_insert(struct sta_info *sta/* notify driver */ if (local->ops->sta_notify) { -if (sdata->vif.type ==IEEE80211_IF_TYPE_VLAN ) +if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) sdata =container_of (sdata->bss, struct ieee80211_sub_if_data, u.ap);
@@ -456,7 +456,7 @@ static void __sta_info_unlink(struct sta local->num_sta--;if (local->ops->sta_notify) { -if (sdata->vif.type ==IEEE80211_IF_TYPE_VLAN ) +if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) sdata =container_of (sdata->bss, struct ieee80211_sub_if_data, u.ap);
net/mac80211/tx.c +14 -14
@@ -226,7 +226,7 @@ ieee80211_tx_h_check_assoc(struct ieee80 !ieee80211_is_probe_req(hdr->frame_control))return TX_DROP ; -if (tx->sdata->vif.type ==IEEE80211_IF_TYPE_MESH_POINT ) +if (tx->sdata->vif.type ==NL80211_IFTYPE_MESH_POINT )return TX_CONTINUE ;if (tx->flags &IEEE80211_TX_PS_BUFFERED )
@@ -236,7 +236,7 @@ ieee80211_tx_h_check_assoc(struct ieee80if (likely (tx->flags &IEEE80211_TX_UNICAST )) {if (unlikely (!(sta_flags &WLAN_STA_ASSOC ) && - tx->sdata->vif.type !=IEEE80211_IF_TYPE_IBSS && + tx->sdata->vif.type !=NL80211_IFTYPE_ADHOC &&ieee80211_is_data (hdr->frame_control))) {#ifdef CONFIG_MAC80211_VERBOSE_DEBUG DECLARE_MAC_BUF (mac);
@@ -250,7 +250,7 @@ ieee80211_tx_h_check_assoc(struct ieee80 }else {if (unlikely (ieee80211_is_data (hdr->frame_control) && tx->local->num_sta ==0 && - tx->sdata->vif.type !=IEEE80211_IF_TYPE_IBSS )) { + tx->sdata->vif.type !=NL80211_IFTYPE_ADHOC )) {/* * No associated STAs - no need to send multicast * frames.
@@ -281,7 +281,7 @@ static void purge_old_ps_buffers(structlist_for_each_entry_rcu (sdata, &local->interfaces, list) {struct ieee80211_if_ap *ap; -if (sdata->vif.type !=IEEE80211_IF_TYPE_AP ) +if (sdata->vif.type !=NL80211_IFTYPE_AP )continue ; ap = &sdata->u.ap; skb =skb_dequeue (&ap->ps_bc_buf);
@@ -979,7 +979,7 @@ __ieee80211_tx_prepare(struct ieee80211_/* process and remove the injection radiotap header */ sdata =IEEE80211_DEV_TO_SUB_IF (dev); -if (unlikely (sdata->vif.type ==IEEE80211_IF_TYPE_MNTR )) { +if (unlikely (sdata->vif.type ==NL80211_IFTYPE_MONITOR )) {if (__ieee80211_parse_tx_radiotap (tx, skb) ==TX_DROP )return TX_DROP ;
@@ -1457,8 +1457,8 @@ int ieee80211_subif_start_xmit(struct sk fc =cpu_to_le16 (IEEE80211_FTYPE_DATA |IEEE80211_STYPE_DATA );switch (sdata->vif.type) { -case IEEE80211_IF_TYPE_AP : -case IEEE80211_IF_TYPE_VLAN : +case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_AP_VLAN : fc |=cpu_to_le16 (IEEE80211_FCTL_FROMDS );/* DA BSSID SA */ memcpy (hdr.addr1, skb->data,ETH_ALEN );
@@ -1466,7 +1466,7 @@ int ieee80211_subif_start_xmit(struct skmemcpy (hdr.addr3, skb->data +ETH_ALEN ,ETH_ALEN ); hdrlen =24 ;break ; -case IEEE80211_IF_TYPE_WDS : +case NL80211_IFTYPE_WDS : fc |=cpu_to_le16 (IEEE80211_FCTL_FROMDS |IEEE80211_FCTL_TODS );/* RA TA DA SA */ memcpy (hdr.addr1, sdata->u.wds.remote_addr,ETH_ALEN );
@@ -1476,7 +1476,7 @@ int ieee80211_subif_start_xmit(struct sk hdrlen =30 ;break ;#ifdef CONFIG_MAC80211_MESH -case IEEE80211_IF_TYPE_MESH_POINT : +case NL80211_IFTYPE_MESH_POINT : fc |=cpu_to_le16 (IEEE80211_FCTL_FROMDS |IEEE80211_FCTL_TODS );/* RA TA DA SA */ memset (hdr.addr1,0 ,ETH_ALEN );
@@ -1493,7 +1493,7 @@ int ieee80211_subif_start_xmit(struct sk hdrlen =30 ;break ;#endif -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION : fc |=cpu_to_le16 (IEEE80211_FCTL_TODS );/* BSSID SA DA */ memcpy (hdr.addr1, sdata->u.sta.bssid,ETH_ALEN );
@@ -1501,7 +1501,7 @@ int ieee80211_subif_start_xmit(struct skmemcpy (hdr.addr3, skb->data,ETH_ALEN ); hdrlen =24 ;break ; -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_ADHOC :/* DA SA BSSID */ memcpy (hdr.addr1, skb->data,ETH_ALEN );memcpy (hdr.addr2, skb->data +ETH_ALEN ,ETH_ALEN );
@@ -1814,7 +1814,7 @@ struct sk_buff *ieee80211_beacon_get(str sdata =vif_to_sdata (vif); bdev = sdata->dev; -if (sdata->vif.type ==IEEE80211_IF_TYPE_AP ) { +if (sdata->vif.type ==NL80211_IFTYPE_AP ) { ap = &sdata->u.ap; beacon =rcu_dereference (ap->beacon);if (ap && beacon) {
@@ -1856,7 +1856,7 @@ struct sk_buff *ieee80211_beacon_get(str num_beacons = &ap->num_beacons; }else goto out; - }else if (sdata->vif.type ==IEEE80211_IF_TYPE_IBSS ) { + }else if (sdata->vif.type ==NL80211_IFTYPE_ADHOC ) {struct ieee80211_hdr *hdr; ifsta = &sdata->u.sta;
@@ -1996,7 +1996,7 @@ ieee80211_get_buffered_bc(struct ieee802rcu_read_lock (); beacon =rcu_dereference (bss->beacon); -if (sdata->vif.type !=IEEE80211_IF_TYPE_AP || !beacon || !beacon->head) +if (sdata->vif.type !=NL80211_IFTYPE_AP || !beacon || !beacon->head) goto out;if (bss->dtim_count !=0 )
net/mac80211/util.c +23 -21
77 lines not on this page · raw message
net/mac80211/wext.c +42 -42
229 lines not on this page · raw message
net/mac80211/ieee80211_i.h +3 -3
@@ -954,10 +954,10 @@ void ieee80211_rx_bss_put(struct ieee802/* interface handling */ void ieee80211_if_setup (struct net_device *dev);int ieee80211_if_add (struct ieee80211_local *local,const char *name, -struct net_device **new_dev,enum ieee80211_if_types type, +struct net_device **new_dev,enum nl80211_iftype type,struct vif_params *params);int ieee80211_if_change_type (struct ieee80211_sub_if_data *sdata, -enum ieee80211_if_types type); +enum nl80211_iftype type);void ieee80211_if_remove (struct ieee80211_sub_if_data *sdata);void ieee80211_remove_interfaces (struct ieee80211_local *local);
@@ -1001,7 +1001,7 @@ extern void *mac80211_wiphy_privid; /* fextern const unsigned char rfc1042_header[6 ];extern const unsigned char bridge_tunnel_header[6 ];u8 *ieee80211_get_bssid (struct ieee80211_hdr *hdr,size_t len, -enum ieee80211_if_types type); +enum nl80211_iftype type);int ieee80211_frame_duration (struct ieee80211_local *local,size_t len,int rate,int erp,int short_preamble); void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
drivers/net/wireless/ath5k/ath5k.h +2 -2
@@ -1008,7 +1008,7 @@ struct ath5k_hw {enum ath5k_int ah_imr; -enum ieee80211_if_types ah_op_mode; +enum nl80211_iftype ah_op_mode;enum ath5k_power_mode ah_power_mode;struct ieee80211_channel ah_current_channel;bool ah_turbo;
@@ -1117,7 +1117,7 @@ extern void ath5k_hw_detach(struct ath5k/* Reset Functions */ extern int ath5k_hw_nic_wakeup (struct ath5k_hw *ah,int flags,bool initial); -extern int ath5k_hw_reset (struct ath5k_hw *ah,enum ieee80211_if_types op_mode,struct ieee80211_channel *channel,bool change_channel); +extern int ath5k_hw_reset (struct ath5k_hw *ah,enum nl80211_iftype op_mode,struct ieee80211_channel *channel,bool change_channel);/* Power management functions */ extern int ath5k_hw_set_power (struct ath5k_hw *ah,enum ath5k_power_mode mode,bool set_chip,u16 sleep_duration);
drivers/net/wireless/ath5k/base.h +1 -1
@@ -113,7 +113,7 @@ struct ath5k_softc {struct ieee80211_channel channels[ATH_CHAN_MAX ];struct ieee80211_rate rates[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ];u8 rate_idx[IEEE80211_NUM_BANDS ][AR5K_MAX_RATES ]; -enum ieee80211_if_types opmode; +enum nl80211_iftype opmode;struct ath5k_hw *ah;/* Atheros HW */ struct ieee80211_supported_band *curband;
drivers/net/wireless/ath5k/reset.c +1 -1
@@ -399,7 +399,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw/* * Main reset function */ -int ath5k_hw_reset (struct ath5k_hw *ah,enum ieee80211_if_types op_mode, +int ath5k_hw_reset (struct ath5k_hw *ah,enum nl80211_iftype op_mode,struct ieee80211_channel *channel,bool change_channel) {struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
drivers/net/wireless/ath9k/main.c +14 -14
@@ -140,7 +140,7 @@ static int ath_key_config(struct ath_sofstruct ath9k_keyval hk;const u8 *mac =NULL ;int ret =0 ; -enum ieee80211_if_types opmode; +enum nl80211_iftype opmode;memset (&hk,0 ,sizeof (hk));
@@ -179,14 +179,14 @@ static int ath_key_config(struct ath_sof*/ if (is_broadcast_ether_addr (addr)) {switch (opmode) { -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION :/* default key: could be group WPA key * or could be static WEP key */ mac =NULL ;break ; -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_ADHOC :break ; -case IEEE80211_IF_TYPE_AP : +case NL80211_IFTYPE_AP :break ;default :ASSERT (0 );
@@ -428,13 +428,13 @@ static int ath9k_add_interface(struct iereturn -ENOBUFS ;switch (conf->type) { -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION : ic_opmode =ATH9K_M_STA ;break ; -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_ADHOC : ic_opmode =ATH9K_M_IBSS ;break ; -case IEEE80211_IF_TYPE_AP : +case NL80211_IFTYPE_AP : ic_opmode =ATH9K_M_HOSTAP ;break ;default :
@@ -556,7 +556,7 @@ static int ath9k_config_interface(struct/* TODO: Need to decide which hw opmode to use for multi-interface * cases */ -if (vif->type ==IEEE80211_IF_TYPE_AP && +if (vif->type ==NL80211_IFTYPE_AP && ah->ah_opmode !=ATH9K_M_HOSTAP ) { ah->ah_opmode =ATH9K_M_HOSTAP ;ath9k_hw_setopmode (ah);
@@ -568,8 +568,8 @@ static int ath9k_config_interface(structif ((conf->changed &IEEE80211_IFCC_BSSID ) && !is_zero_ether_addr (conf->bssid)) {switch (vif->type) { -case IEEE80211_IF_TYPE_STA : -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_STATION : +case NL80211_IFTYPE_ADHOC :/* Update ratectrl about the new state */ ath_rate_newstate (sc, avp);
@@ -614,8 +614,8 @@ static int ath9k_config_interface(struct }if ((conf->changed &IEEE80211_IFCC_BEACON ) && - ((vif->type ==IEEE80211_IF_TYPE_IBSS ) || - (vif->type ==IEEE80211_IF_TYPE_AP ))) { + ((vif->type ==NL80211_IFTYPE_ADHOC ) || + (vif->type ==NL80211_IFTYPE_AP ))) {/* * Allocate and setup the beacon frame. *
@@ -634,7 +634,7 @@ static int ath9k_config_interface(struct }/* Check for WLAN_CAPABILITY_PRIVACY ? */ -if ((avp->av_opmode !=IEEE80211_IF_TYPE_STA )) { +if ((avp->av_opmode !=NL80211_IFTYPE_STATION )) {for (i =0 ; i <IEEE80211_WEP_NKID ; i++)if (ath9k_hw_keyisvalid (sc->sc_ah, (u16 )i)) ath9k_hw_keysetmac(sc->sc_ah,
@@ -643,7 +643,7 @@ static int ath9k_config_interface(struct }/* Only legacy IBSS for now */ -if (vif->type ==IEEE80211_IF_TYPE_IBSS ) +if (vif->type ==NL80211_IFTYPE_ADHOC )ath_update_chainmask (sc,0 );return 0 ;
drivers/net/wireless/iwlwifi/iwl-3945.h +1 -1
@@ -851,7 +851,7 @@ struct iwl3945_priv {/* eeprom */ struct iwl3945_eeprom eeprom; -enum ieee80211_if_types iw_mode; +enum nl80211_iftype iw_mode;struct sk_buff *ibss_beacon;
drivers/net/wireless/iwlwifi/iwl-dev.h +1 -1
@@ -954,7 +954,7 @@ struct iwl_priv {u8 *eeprom;struct iwl_eeprom_calib_info *calib_info; -enum ieee80211_if_types iw_mode; +enum nl80211_iftype iw_mode;struct sk_buff *ibss_beacon;
drivers/net/wireless/rt2x00/rt2x00.h +1 -1
@@ -483,7 +483,7 @@ struct rt2x00intf_conf {/* * Interface type */ -enum ieee80211_if_types type; +enum nl80211_iftype type;/* * TSF sync value, this is dependant on the operation type.
drivers/net/wireless/rt2x00/rt2x00config.c +4 -4
@@ -31,7 +31,7 @@void rt2x00lib_config_intf (struct rt2x00_dev *rt2x00dev,struct rt2x00_intf *intf, -enum ieee80211_if_types type, +enum nl80211_iftype type,u8 *mac,u8 *bssid) {struct rt2x00intf_conf conf;
@@ -40,11 +40,11 @@ void rt2x00lib_config_intf(struct rt2x00 conf.type = type;switch (type) { -case IEEE80211_IF_TYPE_IBSS : -case IEEE80211_IF_TYPE_AP : +case NL80211_IFTYPE_ADHOC : +case NL80211_IFTYPE_AP : conf.sync =TSF_SYNC_BEACON ;break ; -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION : conf.sync =TSF_SYNC_INFRA ;break ;default :
drivers/net/wireless/rt2x00/rt2x00lib.h +1 -1
@@ -88,7 +88,7 @@ void rt2x00lib_stop(struct rt2x00_dev *r*/ void rt2x00lib_config_intf (struct rt2x00_dev *rt2x00dev,struct rt2x00_intf *intf, -enum ieee80211_if_types type, +enum nl80211_iftype type,u8 *mac,u8 *bssid); void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf,
drivers/net/wireless/adm8211.c +11 -11
@@ -765,11 +765,11 @@ static void adm8211_update_mode(struct i priv->soft_rx_crc =0 ;switch (priv->mode) { -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION : priv->nar &= ~(ADM8211_NAR_PR |ADM8211_NAR_EA ); priv->nar |=ADM8211_NAR_ST |ADM8211_NAR_SR ;break ; -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_ADHOC : priv->nar &= ~ADM8211_NAR_PR ; priv->nar |=ADM8211_NAR_EA |ADM8211_NAR_ST |ADM8211_NAR_SR ;
@@ -777,7 +777,7 @@ static void adm8211_update_mode(struct iif (priv->pdev->revision >=ADM8211_REV_BA ) priv->soft_rx_crc =1 ;break ; -case IEEE80211_IF_TYPE_MNTR : +case NL80211_IFTYPE_MONITOR : priv->nar &= ~(ADM8211_NAR_EA |ADM8211_NAR_ST ); priv->nar |=ADM8211_NAR_PR |ADM8211_NAR_SR ;break ;
@@ -1410,11 +1410,11 @@ static int adm8211_add_interface(struct struct ieee80211_if_init_conf *conf) {struct adm8211_priv *priv = dev->priv; -if (priv->mode !=IEEE80211_IF_TYPE_MNTR ) +if (priv->mode !=NL80211_IFTYPE_MONITOR )return -EOPNOTSUPP ;switch (conf->type) { -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION : priv->mode = conf->type;break ;default :
@@ -1437,7 +1437,7 @@ static void adm8211_remove_interface(str struct ieee80211_if_init_conf *conf) {struct adm8211_priv *priv = dev->priv; - priv->mode =IEEE80211_IF_TYPE_MNTR ; + priv->mode =NL80211_IFTYPE_MONITOR ; }static int adm8211_init_rings (struct ieee80211_hw *dev)
@@ -1556,7 +1556,7 @@ static int adm8211_start(struct ieee8021ADM8211_CSR_WRITE (IER ,ADM8211_IER_NIE |ADM8211_IER_AIE |ADM8211_IER_RCIE |ADM8211_IER_TCIE |ADM8211_IER_TDUIE |ADM8211_IER_GPTIE ); - priv->mode =IEEE80211_IF_TYPE_MNTR ; + priv->mode =NL80211_IFTYPE_MONITOR ;adm8211_update_mode (dev);ADM8211_CSR_WRITE (RDR ,0 );
@@ -1571,7 +1571,7 @@ static void adm8211_stop(struct ieee8021 {struct adm8211_priv *priv = dev->priv; - priv->mode =IEEE80211_IF_TYPE_INVALID ; + priv->mode =NL80211_IFTYPE_UNSPECIFIED ; priv->nar =0 ;ADM8211_CSR_WRITE (NAR ,0 );ADM8211_CSR_WRITE (IER ,0 );
@@ -1896,7 +1896,7 @@ static int __devinit adm8211_probe(struc priv->tx_power =0x40 ; priv->lpf_cutoff =0xFF ; priv->lnags_threshold =0xFF ; - priv->mode =IEEE80211_IF_TYPE_INVALID ; + priv->mode =NL80211_IFTYPE_UNSPECIFIED ;/* Power-on issue. EEPROM won't read correctly without */ if (pdev->revision >=ADM8211_REV_BA ) {
@@ -1986,7 +1986,7 @@ static int adm8211_suspend(struct pci_destruct ieee80211_hw *dev =pci_get_drvdata (pdev);struct adm8211_priv *priv = dev->priv; -if (priv->mode !=IEEE80211_IF_TYPE_INVALID ) { +if (priv->mode !=NL80211_IFTYPE_UNSPECIFIED ) {ieee80211_stop_queues (dev);adm8211_stop (dev); }
@@ -2004,7 +2004,7 @@ static int adm8211_resume(struct pci_devpci_set_power_state (pdev,PCI_D0 );pci_restore_state (pdev); -if (priv->mode !=IEEE80211_IF_TYPE_INVALID ) { +if (priv->mode !=NL80211_IFTYPE_UNSPECIFIED ) {adm8211_start (dev);ieee80211_wake_queues (dev); }
drivers/net/wireless/at76_usb.c +1 -1
@@ -1928,7 +1928,7 @@ static int at76_add_interface(struct ieemutex_lock (&priv->mtx);switch (conf->type) { -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION : priv->iw_mode =IW_MODE_INFRA ;break ;default :
drivers/net/wireless/ath5k/attach.c +1 -1
@@ -124,7 +124,7 @@ struct ath5k_hw *ath5k_hw_attach(struct/* * HW information */ - ah->ah_op_mode =IEEE80211_IF_TYPE_STA ; + ah->ah_op_mode =NL80211_IFTYPE_STATION ; ah->ah_radar.r_enabled =AR5K_TUNE_RADAR_ALERT ; ah->ah_turbo = false; ah->ah_txpower.txp_tpc =AR5K_TUNE_TPC_TXPOWER ;
drivers/net/wireless/ath5k/base.c +25 -25
146 lines not on this page · raw message
drivers/net/wireless/ath5k/pcu.c +6 -6
@@ -52,26 +52,26 @@ int ath5k_hw_set_opmode(struct ath5k_hwATH5K_TRACE (ah->ah_sc);switch (ah->ah_op_mode) { -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_ADHOC : pcu_reg |=AR5K_STA_ID1_ADHOC |AR5K_STA_ID1_DESC_ANTENNA | (ah->ah_version ==AR5K_AR5210 ?AR5K_STA_ID1_NO_PSPOLL :0 ); beacon_reg |=AR5K_BCR_ADHOC ;break ; -case IEEE80211_IF_TYPE_AP : -case IEEE80211_IF_TYPE_MESH_POINT : +case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_MESH_POINT : pcu_reg |=AR5K_STA_ID1_AP |AR5K_STA_ID1_RTS_DEF_ANTENNA | (ah->ah_version ==AR5K_AR5210 ?AR5K_STA_ID1_NO_PSPOLL :0 ); beacon_reg |=AR5K_BCR_AP ;break ; -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION : pcu_reg |=AR5K_STA_ID1_DEFAULT_ANTENNA | (ah->ah_version ==AR5K_AR5210 ?AR5K_STA_ID1_PWR_SV :0 ); -case IEEE80211_IF_TYPE_MNTR : +case NL80211_IFTYPE_MONITOR : pcu_reg |=AR5K_STA_ID1_DEFAULT_ANTENNA | (ah->ah_version ==AR5K_AR5210 ?AR5K_STA_ID1_NO_PSPOLL :0 );
@@ -649,7 +649,7 @@ void ath5k_hw_init_beacon(struct ath5k_h* Set the additional timers by mode */ switch (ah->ah_op_mode) { -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION :if (ah->ah_version ==AR5K_AR5210 ) { timer1 =0xffffffff ; timer2 =0xffffffff ;
drivers/net/wireless/b43/main.c +19 -19
@@ -1244,13 +1244,13 @@ generate_new:static void handle_irq_tbtt_indication (struct b43_wldev *dev) { -if (b43_is_mode (dev->wl,IEEE80211_IF_TYPE_AP )) { +if (b43_is_mode (dev->wl,NL80211_IFTYPE_AP )) {///TODO: PS TBTT }else {if (1 /*FIXME: the last PSpoll frame was sent successfully */ )b43_power_saving_ctl_bits (dev,0 ); } -if (b43_is_mode (dev->wl,IEEE80211_IF_TYPE_IBSS )) +if (b43_is_mode (dev->wl,NL80211_IFTYPE_ADHOC )) dev->dfq_valid =1 ; }
@@ -1599,8 +1599,8 @@ static void handle_irq_beacon(struct b43struct b43_wl *wl = dev->wl;u32 cmd, beacon0_valid, beacon1_valid; -if (!b43_is_mode (wl,IEEE80211_IF_TYPE_AP ) && - !b43_is_mode (wl,IEEE80211_IF_TYPE_MESH_POINT )) +if (!b43_is_mode (wl,NL80211_IFTYPE_AP ) && + !b43_is_mode (wl,NL80211_IFTYPE_MESH_POINT ))return ;/* This is the bottom half of the asynchronous beacon update. */
@@ -2568,10 +2568,10 @@ static void b43_adjust_opmode(struct b43 ctl &= ~B43_MACCTL_BEACPROMISC ; ctl |=B43_MACCTL_INFRA ; -if (b43_is_mode (wl,IEEE80211_IF_TYPE_AP ) || -b43_is_mode (wl,IEEE80211_IF_TYPE_MESH_POINT )) +if (b43_is_mode (wl,NL80211_IFTYPE_AP ) || +b43_is_mode (wl,NL80211_IFTYPE_MESH_POINT )) ctl |=B43_MACCTL_AP ; -else if (b43_is_mode (wl,IEEE80211_IF_TYPE_IBSS )) +else if (b43_is_mode (wl,NL80211_IFTYPE_ADHOC )) ctl &= ~B43_MACCTL_INFRA ;if (wl->filter_flags &FIF_CONTROL )
@@ -3406,8 +3406,8 @@ static int b43_op_config(struct ieee8021 phy->ops->set_rx_antenna (dev, antenna);/* Update templates for AP/mesh mode. */ -if (b43_is_mode (wl,IEEE80211_IF_TYPE_AP ) || -b43_is_mode (wl,IEEE80211_IF_TYPE_MESH_POINT )) +if (b43_is_mode (wl,NL80211_IFTYPE_AP ) || +b43_is_mode (wl,NL80211_IFTYPE_MESH_POINT ))b43_set_beacon_int (dev, conf->beacon_int);if (!!conf->radio_enabled != phy->radio_on) {
@@ -3595,14 +3595,14 @@ static int b43_op_config_interface(strucelse memset (wl->bssid,0 ,ETH_ALEN );if (b43_status (dev) >=B43_STAT_INITIALIZED ) { -if (b43_is_mode (wl,IEEE80211_IF_TYPE_AP ) || -b43_is_mode (wl,IEEE80211_IF_TYPE_MESH_POINT )) { +if (b43_is_mode (wl,NL80211_IFTYPE_AP ) || +b43_is_mode (wl,NL80211_IFTYPE_MESH_POINT )) {B43_WARN_ON (vif->type != wl->if_type);if (conf->changed &IEEE80211_IFCC_SSID )b43_set_ssid (dev, conf->ssid, conf->ssid_len);if (conf->changed &IEEE80211_IFCC_BEACON )b43_update_templates (wl); - }else if (b43_is_mode (wl,IEEE80211_IF_TYPE_IBSS )) { + }else if (b43_is_mode (wl,NL80211_IFTYPE_ADHOC )) {if (conf->changed &IEEE80211_IFCC_BEACON )b43_update_templates (wl); }
@@ -3903,7 +3903,7 @@ static void b43_set_synth_pu_delay(struc pu_delay =3700 ; else pu_delay =1050 ; -if (b43_is_mode (dev->wl,IEEE80211_IF_TYPE_IBSS ) || idle) +if (b43_is_mode (dev->wl,NL80211_IFTYPE_ADHOC ) || idle) pu_delay =500 ;if ((dev->phy.radio_ver ==0x2050 ) && (dev->phy.radio_rev ==8 )) pu_delay =max (pu_delay, (u16 )2400 );
@@ -3917,7 +3917,7 @@ static void b43_set_pretbtt(struct b43_wu16 pretbtt;/* The time value is in microseconds. */ -if (b43_is_mode (dev->wl,IEEE80211_IF_TYPE_IBSS )) { +if (b43_is_mode (dev->wl,NL80211_IFTYPE_ADHOC )) { pretbtt =2 ; }else {if (dev->phy.type ==B43_PHYTYPE_A )
@@ -4084,11 +4084,11 @@ static int b43_op_add_interface(struct i/* TODO: allow WDS/AP devices to coexist */ -if (conf->type !=IEEE80211_IF_TYPE_AP && - conf->type !=IEEE80211_IF_TYPE_MESH_POINT && - conf->type !=IEEE80211_IF_TYPE_STA && - conf->type !=IEEE80211_IF_TYPE_WDS && - conf->type !=IEEE80211_IF_TYPE_IBSS ) +if (conf->type !=NL80211_IFTYPE_AP && + conf->type !=NL80211_IFTYPE_MESH_POINT && + conf->type !=NL80211_IFTYPE_STATION && + conf->type !=NL80211_IFTYPE_WDS && + conf->type !=NL80211_IFTYPE_ADHOC )return -EOPNOTSUPP ;mutex_lock (&wl->mutex);
drivers/net/wireless/b43/phy_common.c +2 -2
@@ -162,7 +162,7 @@ void b43_phy_lock(struct b43_wldev *dev)#endif B43_WARN_ON (dev->dev->id.revision <3 ); -if (!b43_is_mode (dev->wl,IEEE80211_IF_TYPE_AP )) +if (!b43_is_mode (dev->wl,NL80211_IFTYPE_AP ))b43_power_saving_ctl_bits (dev,B43_PS_AWAKE ); }
@@ -174,7 +174,7 @@ void b43_phy_unlock(struct b43_wldev *de#endif B43_WARN_ON (dev->dev->id.revision <3 ); -if (!b43_is_mode (dev->wl,IEEE80211_IF_TYPE_AP )) +if (!b43_is_mode (dev->wl,NL80211_IFTYPE_AP ))b43_power_saving_ctl_bits (dev,0 ); }
drivers/net/wireless/b43legacy/main.c +15 -15
@@ -888,13 +888,13 @@ generate_new:static void handle_irq_tbtt_indication (struct b43legacy_wldev *dev) { -if (b43legacy_is_mode (dev->wl,IEEE80211_IF_TYPE_AP )) { +if (b43legacy_is_mode (dev->wl,NL80211_IFTYPE_AP )) {/* TODO: PS TBTT */ }else {if (1 /*FIXME: the last PSpoll frame was sent successfully */ )b43legacy_power_saving_ctl_bits (dev,-1 ,-1 ); } -if (b43legacy_is_mode (dev->wl,IEEE80211_IF_TYPE_IBSS )) +if (b43legacy_is_mode (dev->wl,NL80211_IFTYPE_ADHOC )) dev->dfq_valid =1 ; }
@@ -1201,7 +1201,7 @@ static void handle_irq_beacon(struct b43struct b43legacy_wl *wl = dev->wl;u32 cmd; -if (!b43legacy_is_mode (wl,IEEE80211_IF_TYPE_AP )) +if (!b43legacy_is_mode (wl,NL80211_IFTYPE_AP ))return ;/* This is the bottom half of the asynchronous beacon update. */
@@ -1936,9 +1936,9 @@ static void b43legacy_adjust_opmode(stru ctl &= ~B43legacy_MACCTL_BEACPROMISC; ctl |= B43legacy_MACCTL_INFRA; -if (b43legacy_is_mode (wl,IEEE80211_IF_TYPE_AP )) +if (b43legacy_is_mode (wl,NL80211_IFTYPE_AP )) ctl |= B43legacy_MACCTL_AP; -else if (b43legacy_is_mode (wl,IEEE80211_IF_TYPE_IBSS )) +else if (b43legacy_is_mode (wl,NL80211_IFTYPE_ADHOC )) ctl &= ~B43legacy_MACCTL_INFRA;if (wl->filter_flags &FIF_CONTROL )
@@ -2646,7 +2646,7 @@ static int b43legacy_op_dev_config(strucb43legacy_mgmtframe_txantenna (dev, antenna_tx);/* Update templates for AP mode. */ -if (b43legacy_is_mode (wl,IEEE80211_IF_TYPE_AP )) +if (b43legacy_is_mode (wl,NL80211_IFTYPE_AP ))b43legacy_set_beacon_int (dev, conf->beacon_int);
@@ -2733,12 +2733,12 @@ static int b43legacy_op_config_interfaceelse memset (wl->bssid,0 ,ETH_ALEN );if (b43legacy_status (dev) >= B43legacy_STAT_INITIALIZED) { -if (b43legacy_is_mode (wl,IEEE80211_IF_TYPE_AP )) { -B43legacy_WARN_ON (vif->type !=IEEE80211_IF_TYPE_AP ); +if (b43legacy_is_mode (wl,NL80211_IFTYPE_AP )) { +B43legacy_WARN_ON (vif->type !=NL80211_IFTYPE_AP );b43legacy_set_ssid (dev, conf->ssid, conf->ssid_len);if (conf->changed &IEEE80211_IFCC_BEACON )b43legacy_update_templates (wl); - }else if (b43legacy_is_mode (wl,IEEE80211_IF_TYPE_IBSS )) { + }else if (b43legacy_is_mode (wl,NL80211_IFTYPE_ADHOC )) {if (conf->changed &IEEE80211_IFCC_BEACON )b43legacy_update_templates (wl); }
@@ -3020,7 +3020,7 @@ static void b43legacy_set_synth_pu_delay bool idle) {u16 pu_delay =1050 ; -if (b43legacy_is_mode (dev->wl,IEEE80211_IF_TYPE_IBSS ) || idle) +if (b43legacy_is_mode (dev->wl,NL80211_IFTYPE_ADHOC ) || idle) pu_delay =500 ;if ((dev->phy.radio_ver ==0x2050 ) && (dev->phy.radio_rev ==8 )) pu_delay =max (pu_delay, (u16 )2400 );
@@ -3035,7 +3035,7 @@ static void b43legacy_set_pretbtt(structu16 pretbtt;/* The time value is in microseconds. */ -if (b43legacy_is_mode (dev->wl,IEEE80211_IF_TYPE_IBSS )) +if (b43legacy_is_mode (dev->wl,NL80211_IFTYPE_ADHOC )) pretbtt =2 ;else pretbtt =250 ;
@@ -3259,10 +3259,10 @@ static int b43legacy_op_add_interface(st/* TODO: allow WDS/AP devices to coexist */ -if (conf->type !=IEEE80211_IF_TYPE_AP && - conf->type !=IEEE80211_IF_TYPE_STA && - conf->type !=IEEE80211_IF_TYPE_WDS && - conf->type !=IEEE80211_IF_TYPE_IBSS ) +if (conf->type !=NL80211_IFTYPE_AP && + conf->type !=NL80211_IFTYPE_STATION && + conf->type !=NL80211_IFTYPE_WDS && + conf->type !=NL80211_IFTYPE_ADHOC )return -EOPNOTSUPP ;mutex_lock (&wl->mutex);
drivers/net/wireless/b43legacy/phy.c +2 -2
@@ -103,7 +103,7 @@ void b43legacy_phy_lock(struct b43legacyif (dev->dev->id.revision <3 ) {b43legacy_mac_suspend (dev); }else { -if (!b43legacy_is_mode (dev->wl,IEEE80211_IF_TYPE_AP )) +if (!b43legacy_is_mode (dev->wl,NL80211_IFTYPE_AP ))b43legacy_power_saving_ctl_bits (dev,-1 ,1 ); } }
@@ -118,7 +118,7 @@ void b43legacy_phy_unlock(struct b43legaif (dev->dev->id.revision <3 ) {b43legacy_mac_enable (dev); }else { -if (!b43legacy_is_mode (dev->wl,IEEE80211_IF_TYPE_AP )) +if (!b43legacy_is_mode (dev->wl,NL80211_IFTYPE_AP ))b43legacy_power_saving_ctl_bits (dev,-1 ,-1 ); } }
drivers/net/wireless/ipw2100.c +1 -1
@@ -1,4 +1,4 @@ -/****************************************************************************** +,/******************************************************************************Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved.
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +1 -1
@@ -682,7 +682,7 @@ static void rs_get_rate(void *priv_rate, rs_sta = (void *)sta->rate_ctrl_priv; -if ((priv->iw_mode ==IEEE80211_IF_TYPE_IBSS ) && +if ((priv->iw_mode ==NL80211_IFTYPE_ADHOC ) && !rs_sta->ibss_sta_added) {u8 sta_id =iwl3945_hw_find_station (priv, hdr->addr1);
drivers/net/wireless/iwlwifi/iwl-3945.c +3 -3
@@ -520,10 +520,10 @@ static int iwl3945_is_network_packet(str/* Filter incoming packets to determine if they are targeted toward * this network, discarding packets coming from ourselves */ switch (priv->iw_mode) { -case IEEE80211_IF_TYPE_IBSS :/* Header: Dest. | Source | BSSID */ +case NL80211_IFTYPE_ADHOC :/* Header: Dest. | Source | BSSID */ /* packets to our IBSS update information */ return !compare_ether_addr (header->addr3, priv->bssid); -case IEEE80211_IF_TYPE_STA :/* Header: Dest. | AP{BSSID} | Source */ +case NL80211_IFTYPE_STATION :/* Header: Dest. | AP{BSSID} | Source */ /* packets to our IBSS update information */ return !compare_ether_addr (header->addr2, priv->bssid);default :
@@ -807,7 +807,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct priv->stations[sta_id].current_rate.rate_n_flags = rate; -if ((priv->iw_mode ==IEEE80211_IF_TYPE_IBSS ) && +if ((priv->iw_mode ==NL80211_IFTYPE_ADHOC ) && (sta_id != priv->hw_setting.bcast_sta_id) && (sta_id !=IWL_MULTICAST_ID )) priv->stations[IWL_STA_ID ].current_rate.rate_n_flags = rate;
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +4 -4
@@ -821,7 +821,7 @@ static void rs_tx_status(void *priv_rate lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; -if ((priv->iw_mode ==IEEE80211_IF_TYPE_IBSS ) && +if ((priv->iw_mode ==NL80211_IFTYPE_ADHOC ) && !lq_sta->ibss_sta_added) goto out;
@@ -2093,7 +2093,7 @@ static void rs_initialize_lq(struct iwl_ i = sta->last_txrate_idx;if ((lq_sta->lq.sta_id ==0xff ) && - (priv->iw_mode ==IEEE80211_IF_TYPE_IBSS )) + (priv->iw_mode ==NL80211_IFTYPE_ADHOC )) goto out; valid_tx_ant = priv->hw_params.valid_tx_ant;
@@ -2163,7 +2163,7 @@ static void rs_get_rate(void *priv_rate, lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; i = sta->last_txrate_idx; -if ((priv->iw_mode ==IEEE80211_IF_TYPE_IBSS ) && +if ((priv->iw_mode ==NL80211_IFTYPE_ADHOC ) && !lq_sta->ibss_sta_added) {u8 sta_id =iwl_find_station (priv, hdr->addr1);DECLARE_MAC_BUF (mac);
@@ -2243,7 +2243,7 @@ static void rs_rate_init(void *priv_rate* after assoc.. */ lq_sta->ibss_sta_added =0 ; -if (priv->iw_mode ==IEEE80211_IF_TYPE_AP ) { +if (priv->iw_mode ==NL80211_IFTYPE_AP ) {u8 sta_id =iwl_find_station (priv, sta->addr);DECLARE_MAC_BUF (mac);
drivers/net/wireless/iwlwifi/iwl-agn.c +32 -32
238 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-core.c +4 -4
@@ -306,14 +306,14 @@ void iwl_reset_qos(struct iwl_priv *privspin_lock_irqsave (&priv->lock, flags); priv->qos_data.qos_active =0 ; -if (priv->iw_mode ==IEEE80211_IF_TYPE_IBSS ) { +if (priv->iw_mode ==NL80211_IFTYPE_ADHOC ) {if (priv->qos_data.qos_enable) priv->qos_data.qos_active =1 ;if (!(priv->active_rate &0xfff0 )) { cw_min =31 ; is_legacy =1 ; } - }else if (priv->iw_mode ==IEEE80211_IF_TYPE_AP ) { + }else if (priv->iw_mode ==NL80211_IFTYPE_AP ) {if (priv->qos_data.qos_enable) priv->qos_data.qos_active =1 ; }else if (!(priv->staging_rxon.flags &RXON_FLG_SHORT_SLOT_MSK )) {
@@ -932,7 +932,7 @@ int iwl_init_drv(struct iwl_priv *priv) priv->ieee_rates =NULL ; priv->band =IEEE80211_BAND_2GHZ ; - priv->iw_mode =IEEE80211_IF_TYPE_STA ; + priv->iw_mode =NL80211_IFTYPE_STATION ; priv->use_ant_b_for_management_frame =1 ;/* start with ant B */ priv->current_ht_config.sm_ps =WLAN_HT_CAP_SM_PS_DISABLED ;
@@ -1396,7 +1396,7 @@ void iwl_radio_kill_sw_disable_radio(striwl_scan_cancel (priv);/* FIXME: This is a workaround for AP */ -if (priv->iw_mode !=IEEE80211_IF_TYPE_AP ) { +if (priv->iw_mode !=NL80211_IFTYPE_AP ) {spin_lock_irqsave (&priv->lock, flags);iwl_write32 (priv,CSR_UCODE_DRV_GP1_SET ,CSR_UCODE_SW_BIT_RFKILL );
drivers/net/wireless/iwlwifi/iwl-power.c +1 -1
@@ -290,7 +290,7 @@ int iwl_power_update_mode(struct iwl_pri final_mode = setting->critical_power_setting;/* driver only support CAM for non STA network */ -if (priv->iw_mode !=IEEE80211_IF_TYPE_STA ) +if (priv->iw_mode !=NL80211_IFTYPE_STATION ) final_mode =IWL_POWER_MODE_CAM ; if (!iwl_is_rfkill(priv) && !setting->power_disabled &&
drivers/net/wireless/iwlwifi/iwl-rx.c +4 -4
@@ -1026,10 +1026,10 @@ static int iwl_is_network_packet(struct/* Filter incoming packets to determine if they are targeted toward * this network, discarding packets coming from ourselves */ switch (priv->iw_mode) { -case IEEE80211_IF_TYPE_IBSS :/* Header: Dest. | Source | BSSID */ +case NL80211_IFTYPE_ADHOC :/* Header: Dest. | Source | BSSID */ /* packets to our IBSS update information */ return !compare_ether_addr (header->addr3, priv->bssid); -case IEEE80211_IF_TYPE_STA :/* Header: Dest. | AP{BSSID} | Source */ +case NL80211_IFTYPE_STATION :/* Header: Dest. | AP{BSSID} | Source */ /* packets to our IBSS update information */ return !compare_ether_addr (header->addr2, priv->bssid);default :
@@ -1169,7 +1169,7 @@ void iwl_rx_reply_rx(struct iwl_priv *pr rx_status.flag |=RX_FLAG_SHORTPRE ;/* Take shortcut when only in monitor mode */ -if (priv->iw_mode ==IEEE80211_IF_TYPE_MNTR ) { +if (priv->iw_mode ==NL80211_IFTYPE_MONITOR ) {iwl_pass_packet_to_mac80211 (priv, include_phy, rxb, &rx_status);return ;
@@ -1186,7 +1186,7 @@ void iwl_rx_reply_rx(struct iwl_priv *prswitch (fc &IEEE80211_FCTL_FTYPE ) {case IEEE80211_FTYPE_MGMT :case IEEE80211_FTYPE_DATA : -if (priv->iw_mode ==IEEE80211_IF_TYPE_AP ) +if (priv->iw_mode ==NL80211_IFTYPE_AP )iwl_update_ps_mode (priv, fc &IEEE80211_FCTL_PM , header->addr2);/* fall through */
drivers/net/wireless/iwlwifi/iwl-scan.c +2 -2
@@ -463,7 +463,7 @@ void iwl_init_scan_params(struct iwl_priint iwl_scan_initiate (struct iwl_priv *priv) { -if (priv->iw_mode ==IEEE80211_IF_TYPE_AP ) { +if (priv->iw_mode ==NL80211_IFTYPE_AP ) {IWL_ERROR ("APs don't scan.\n" );return 0 ; }
@@ -868,7 +868,7 @@ static void iwl_bg_request_scan(struct w scan->tx_cmd.len =cpu_to_le16 (cmd_len); -if (priv->iw_mode ==IEEE80211_IF_TYPE_MNTR ) +if (priv->iw_mode ==NL80211_IFTYPE_MONITOR ) scan->filter_flags =RXON_FILTER_PROMISC_MSK ; scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK |
drivers/net/wireless/iwlwifi/iwl-sta.c +10 -10
@@ -47,8 +47,8 @@ u8 iwl_find_station(struct iwl_priv *priunsigned long flags;DECLARE_MAC_BUF (mac); -if ((priv->iw_mode ==IEEE80211_IF_TYPE_IBSS ) || - (priv->iw_mode ==IEEE80211_IF_TYPE_AP )) +if ((priv->iw_mode ==NL80211_IFTYPE_ADHOC ) || + (priv->iw_mode ==NL80211_IFTYPE_AP )) start =IWL_STA_ID ;if (is_broadcast_ether_addr (addr))
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(iwl_find_station);int iwl_get_ra_sta_id (struct iwl_priv *priv,struct ieee80211_hdr *hdr) { -if (priv->iw_mode ==IEEE80211_IF_TYPE_STA ) { +if (priv->iw_mode ==NL80211_IFTYPE_STATION ) {return IWL_AP_ID ; }else {u8 *da =ieee80211_get_DA (hdr);
@@ -286,7 +286,7 @@ u8 iwl_add_station_flags(struct iwl_priv/* BCAST station and IBSS stations do not work in HT mode */ if (sta_id != priv->hw_params.bcast_sta_id && - priv->iw_mode !=IEEE80211_IF_TYPE_IBSS ) + priv->iw_mode !=NL80211_IFTYPE_ADHOC )iwl_set_ht_add_station (priv, sta_id, ht_info);spin_unlock_irqrestore (&priv->sta_lock, flags_spin);
@@ -817,7 +817,7 @@ int iwl_send_lq_cmd(struct iwl_priv *pri };if ((lq->sta_id ==0xFF ) && - (priv->iw_mode ==IEEE80211_IF_TYPE_IBSS )) + (priv->iw_mode ==NL80211_IFTYPE_ADHOC ))return -EINVAL ;if (lq->sta_id ==0xFF )
@@ -904,7 +904,7 @@ int iwl_rxon_add_station(struct iwl_privif ((is_ap) && (conf->flags &IEEE80211_CONF_SUPPORT_HT_MODE ) && - (priv->iw_mode ==IEEE80211_IF_TYPE_STA )) + (priv->iw_mode ==NL80211_IFTYPE_STATION )) sta_id =iwl_add_station_flags (priv, addr, is_ap,0 , cur_ht_config);else
@@ -938,11 +938,11 @@ int iwl_get_sta_id(struct iwl_priv *priv/* If we are a client station in a BSS network, use the special * AP station entry (that's the only station we communicate with) */ -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION :return IWL_AP_ID ;/* If we are an AP, then find the station, or use BCAST */ -case IEEE80211_IF_TYPE_AP : +case NL80211_IFTYPE_AP : sta_id =iwl_find_station (priv, hdr->addr1);if (sta_id !=IWL_INVALID_STATION )return sta_id;
@@ -950,7 +950,7 @@ int iwl_get_sta_id(struct iwl_priv *priv/* If this frame is going out to an IBSS network, find the station, * or create a new station table entry */ -case IEEE80211_IF_TYPE_IBSS : +case NL80211_IFTYPE_ADHOC : sta_id =iwl_find_station (priv, hdr->addr1);if (sta_id !=IWL_INVALID_STATION )return sta_id;
@@ -970,7 +970,7 @@ int iwl_get_sta_id(struct iwl_priv *priv/* If we are in monitor mode, use BCAST. This is required for * packet injection. */ -case IEEE80211_IF_TYPE_MNTR : +case NL80211_IFTYPE_MONITOR :return priv->hw_params.bcast_sta_id;default :
drivers/net/wireless/iwlwifi/iwl-tx.c +2 -2
@@ -814,10 +814,10 @@ int iwl_tx_skb(struct iwl_priv *priv, st/* drop all data frame if we are not associated */ if (ieee80211_is_data (fc) && - (priv->iw_mode !=IEEE80211_IF_TYPE_MNTR || + (priv->iw_mode !=NL80211_IFTYPE_MONITOR || !(info->flags &IEEE80211_TX_CTL_INJECTED )) &&/* packet injection */ (!iwl_is_associated (priv) || - ((priv->iw_mode ==IEEE80211_IF_TYPE_STA ) && !priv->assoc_id) || + ((priv->iw_mode ==NL80211_IFTYPE_STATION ) && !priv->assoc_id) || !priv->assoc_station_added)) {IWL_DEBUG_DROP ("Dropping - !iwl_is_associated\n" ); goto drop_unlock;
drivers/net/wireless/iwlwifi/iwl3945-base.c +42 -42
311 lines not on this page · raw message
drivers/net/wireless/libertas_tf/main.c +9 -9
@@ -219,7 +219,7 @@ static void lbtf_tx_work(struct work_strstruct sk_buff *skb =NULL ;int err; -if ((priv->vif->type ==IEEE80211_IF_TYPE_AP ) && +if ((priv->vif->type ==NL80211_IFTYPE_AP ) && (!skb_queue_empty (&priv->bc_ps_buf))) skb =skb_dequeue (&priv->bc_ps_buf);else if (priv->skb_to_tx) {
@@ -326,11 +326,11 @@ static int lbtf_op_add_interface(struct priv->vif = conf->vif;switch (conf->type) { -case IEEE80211_IF_TYPE_MESH_POINT : -case IEEE80211_IF_TYPE_AP : +case NL80211_IFTYPE_MESH_POINT : +case NL80211_IFTYPE_AP :lbtf_set_mode (priv,LBTF_AP_MODE );break ; -case IEEE80211_IF_TYPE_STA : +case NL80211_IFTYPE_STATION :lbtf_set_mode (priv,LBTF_STA_MODE );break ;default :
@@ -346,8 +346,8 @@ static void lbtf_op_remove_interface(str {struct lbtf_private *priv = hw->priv; -if (priv->vif->type ==IEEE80211_IF_TYPE_AP || - priv->vif->type ==IEEE80211_IF_TYPE_MESH_POINT ) +if (priv->vif->type ==NL80211_IFTYPE_AP || + priv->vif->type ==NL80211_IFTYPE_MESH_POINT )lbtf_beacon_ctrl (priv,0 ,0 );lbtf_set_mode (priv,LBTF_PASSIVE_MODE );lbtf_set_bssid (priv,0 ,NULL );
@@ -372,8 +372,8 @@ static int lbtf_op_config_interface(strustruct sk_buff *beacon;switch (priv->vif->type) { -case IEEE80211_IF_TYPE_AP : -case IEEE80211_IF_TYPE_MESH_POINT : +case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_MESH_POINT : beacon =ieee80211_beacon_get (hw, vif);if (beacon) {lbtf_beacon_set (priv, beacon);
@@ -614,7 +614,7 @@ void lbtf_bcn_sent(struct lbtf_private * {struct sk_buff *skb =NULL ; -if (priv->vif->type !=IEEE80211_IF_TYPE_AP ) +if (priv->vif->type !=NL80211_IFTYPE_AP )return ;if (skb_queue_empty (&priv->bc_ps_buf)) {
drivers/net/wireless/mac80211_hwsim.c +1 -1
@@ -267,7 +267,7 @@ static void mac80211_hwsim_beacon_tx(voistruct sk_buff *skb;struct ieee80211_tx_info *info; -if (vif->type !=IEEE80211_IF_TYPE_AP ) +if (vif->type !=NL80211_IFTYPE_AP )return ; skb =ieee80211_beacon_get (hw, vif);
drivers/net/wireless/p54/p54common.c +7 -7
@@ -1139,7 +1139,7 @@ static int p54_start(struct ieee80211_hw err = priv->open (dev);if (!err) - priv->mode =IEEE80211_IF_TYPE_MNTR ; + priv->mode =NL80211_IFTYPE_MONITOR ;p54_init_vdcf (dev);
@@ -1157,7 +1157,7 @@ static void p54_stop(struct ieee80211_hwkfree_skb (skb); priv->stop (dev);
Lines of this file are not shown. View the raw message.
drivers/net/wireless/p54/p54pci.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/net/wireless/rt2x00/rt2500usb.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/wireless/rt2x00/rt2x00dev.c +4 -4
Lines of this file are not shown. View the raw message.
drivers/net/wireless/rt2x00/rt2x00mac.c +9 -9
Lines of this file are not shown. View the raw message.
drivers/net/wireless/rtl8180_dev.c +5 -5
Lines of this file are not shown. View the raw message.
drivers/net/wireless/rtl8187_dev.c +4 -4
Lines of this file are not shown. View the raw message.
drivers/net/wireless/zd1211rw/zd_mac.c +10 -10
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Johannes Berg
maintainerPATCH 14/18 mac80211: move regular interface handling
In reply to Johannes BergMove the code to handle regular interfaces out of main.c and into iface.c, keep only the master interface stuff in main.c.
--- net/mac80211/ieee80211_i.h | 2 net/mac80211/iface.c | 534 ++++++++++++++++++++++++++++++++++++++++++ net/mac80211/main.c | 565 +-------------------------------------------- 3 files changed, 550 insertions(+), 551 deletions(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -891,6 +891,7 @@ u32 ieee80211_handle_ht(struct ieee80211 struct ieee80211_ht_bss_info *req_bss_cap);void ieee80211_bss_info_change_notify (struct ieee80211_sub_if_data *sdata,u32 changed); +void ieee80211_configure_filter (struct ieee80211_local *local);/* wireless extensions */ extern const struct iw_handler_def ieee80211_iw_handler_def;
@@ -952,7 +953,6 @@ void ieee80211_rx_bss_put(struct ieee802 struct ieee80211_bss *bss);/* interface handling */ -void ieee80211_if_setup (struct net_device *dev);int ieee80211_if_add (struct ieee80211_local *local,const char *name,struct net_device **new_dev,enum nl80211_iftype type,struct vif_params *params);
net/mac80211/iface.c +534 -0
545 lines not on this page · raw message
net/mac80211/main.c +15 -550
585 lines not on this page · raw message
Johannes Berg
maintainerPATCH 15/18 mac80211: warn on some invalid vlan operations
In reply to Johannes BergThese should never happen, but better warn about them than crashing a driver, the fact that they never happen is rather subtle throughout mac80211.
--- net/mac80211/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/mac80211/main.c +6 -0
@@ -156,6 +156,9 @@ int ieee80211_if_config(struct ieee80211if (WARN_ON (!netif_running (sdata->dev)))return 0 ; +if (WARN_ON (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN )) +return -EINVAL ; +if (!local->ops->config_interface)return 0 ;
@@ -321,6 +324,9 @@ void ieee80211_bss_info_change_notify(st {struct ieee80211_local *local = sdata->local; +if (WARN_ON (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN )) +return ; +if (!changed)return ;
Johannes Berg
maintainerPATCH 16/18 mac80211 hwsim: verify vif pointers
In reply to Johannes Bergmac80211-hwsim is a debugging tool for mac80211, and as such it can very well verify that mac80211 isn't passing junk to drivers, especially the vif pointer is prone to this because for vlan interfaces the AP interface pointer needs to be passed. This makes mac80211-hwsim add a magic cookie to the private vif area and verify it whenever an operation is called that gets a vif pointer.
--- drivers/net/wireless/mac80211_hwsim.c | 58 ++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
drivers/net/wireless/mac80211_hwsim.c +58 -0
@@ -28,6 +28,29 @@ static int radios = 2;module_param (radios, int,0444 );MODULE_PARM_DESC (radios,"Number of simulated radios" ); +struct hwsim_vif_priv { +u32 magic; +}; + +#define HWSIM_VIF_MAGIC 0x69537748 + +static inline void hwsim_check_magic (struct ieee80211_vif *vif) +{ +struct hwsim_vif_priv *vp = (void *)vif->drv_priv; +BUG_ON (vp->magic !=HWSIM_VIF_MAGIC ); +} + +static inline void hwsim_set_magic (struct ieee80211_vif *vif) +{ +struct hwsim_vif_priv *vp = (void *)vif->drv_priv; + vp->magic =HWSIM_VIF_MAGIC ; +} + +static inline void hwsim_clear_magic (struct ieee80211_vif *vif) +{ +struct hwsim_vif_priv *vp = (void *)vif->drv_priv; + vp->magic =0 ; +}static struct class *hwsim_class;
@@ -210,6 +233,9 @@ static int mac80211_hwsim_tx(struct ieee ack =mac80211_hwsim_tx_frame (hw, skb); txi =IEEE80211_SKB_CB (skb); + +hwsim_check_magic (txi->control.vif); +memset (&txi->status,0 ,sizeof (txi->status));if (!(txi->flags &IEEE80211_TX_CTL_NO_ACK )) {if (ack)
@@ -246,6 +272,7 @@ static int mac80211_hwsim_add_interface(printk (KERN_DEBUG "%s:%s (type=%d mac_addr=%s)\n" ,wiphy_name (hw->wiphy), __func__, conf->type,print_mac (mac, conf->mac_addr)); +hwsim_set_magic (conf->vif);return 0 ; }
@@ -257,6 +284,8 @@ static void mac80211_hwsim_remove_interfprintk (KERN_DEBUG "%s:%s (type=%d mac_addr=%s)\n" ,wiphy_name (hw->wiphy), __func__, conf->type,print_mac (mac, conf->mac_addr)); +hwsim_check_magic (conf->vif); +hwsim_clear_magic (conf->vif); }
@@ -267,6 +296,8 @@ static void mac80211_hwsim_beacon_tx(voistruct sk_buff *skb;struct ieee80211_tx_info *info; +hwsim_check_magic (vif); +if (vif->type !=NL80211_IFTYPE_AP )return ;
@@ -341,7 +372,28 @@ static void mac80211_hwsim_configure_fil *total_flags = data->rx_filter; } +static int mac80211_hwsim_config_interface (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_if_conf *conf) +{ +hwsim_check_magic (vif); +return 0 ; +} +static void mac80211_hwsim_bss_info_changed (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_bss_conf *info, +u32 changed) +{ +hwsim_check_magic (vif); +} + +static void mac80211_hwsim_sta_notify (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +enum sta_notify_cmd cmd,const u8 *addr) +{ +hwsim_check_magic (vif); +}static const struct ieee80211_ops mac80211_hwsim_ops = {
@@ -352,6 +404,9 @@ static const struct ieee80211_ops mac802 .remove_interface = mac80211_hwsim_remove_interface, .config = mac80211_hwsim_config, .configure_filter = mac80211_hwsim_configure_filter, + .config_interface = mac80211_hwsim_config_interface, + .bss_info_changed = mac80211_hwsim_bss_info_changed, + .sta_notify = mac80211_hwsim_sta_notify, };
@@ -452,6 +507,9 @@ static int __init init_mac80211_hwsim(voBIT (NL80211_IFTYPE_AP ); hw->ampdu_queues =1 ; +/* ask mac80211 to reserve space for magic */ + hw->vif_data_size =sizeof (struct hwsim_vif_priv ); +memcpy (data->channels, hwsim_channels,sizeof (hwsim_channels));memcpy (data->rates, hwsim_rates,sizeof (hwsim_rates)); data->band.channels = data->channels;
Re: [PATCH 16/18] mac80211 hwsim: verify vif pointers
Quoted 6 lines · Johannes Berg
drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:11.000000000 +0200 renamed from drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:05.000000000 +0200 +0
-0@@ -28,6 +28,29 @@ static int radios = 2; module_param(radios, int, 0444); MODULE_PARM_DESC(radios, "Number of simulated radios");
drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:11.000000000 +0200 static int radios = 2; · line 40
Quoted 10 lines
drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:11.000000000 +0200 renamed from drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:05.000000000 +0200 +10
-0+struct hwsim_vif_priv { + u32 magic; +}; + +#define HWSIM_VIF_MAGIC 0x69537748 + +static inline void hwsim_check_magic(struct ieee80211_vif *vif) +{ + struct hwsim_vif_priv *vp = (void *)vif->drv_priv; + BUG_ON(vp->magic != HWSIM_VIF_MAGIC);
If its a debugging tool then better WARN_ON instead no?
Luis
Johannes Berg
maintainerRe: [PATCH 16/18] mac80211 hwsim: verify vif pointers
Quoted 7 lines · Luis R. Rodriguez
Quoted 6 lines · Johannes Berg
drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:11.000000000 +0200 renamed from drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:05.000000000 +0200 +0
-0@@ -28,6 +28,29 @@ static int radios = 2; module_param(radios, int, 0444); MODULE_PARM_DESC(radios, "Number of simulated radios");
Quoted 12 lines
drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:11.000000000 +0200 static int radios = 2; · line 40
Quoted 10 lines
drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:11.000000000 +0200 renamed from drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:05.000000000 +0200 +10
-0+struct hwsim_vif_priv { + u32 magic; +}; + +#define HWSIM_VIF_MAGIC 0x69537748 + +static inline void hwsim_check_magic(struct ieee80211_vif *vif) +{ + struct hwsim_vif_priv *vp = (void *)vif->drv_priv; + BUG_ON(vp->magic != HWSIM_VIF_MAGIC);If its a debugging tool then better
WARN_ONinstead no?
I don't know, yeah, maybe. I can change it.
johannes
Re: [PATCH 16/18] mac80211 hwsim: verify vif pointers
Quoted 21 lines · Johannes Berg
Quoted 7 lines · Luis R. Rodriguez
Quoted 6 lines · Johannes Berg
drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:11.000000000 +0200 renamed from drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:05.000000000 +0200 +0
-0@@ -28,6 +28,29 @@ static int radios = 2; module_param(radios, int, 0444); MODULE_PARM_DESC(radios, "Number of simulated radios");Quoted 12 lines
drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:11.000000000 +0200 static int radios = 2; · line 40
Quoted 10 lines
drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:11.000000000 +0200 renamed from drivers/net/wireless/mac80211_hwsim.c 2008-09-10 23:58:05.000000000 +0200 +10
-0+struct hwsim_vif_priv { + u32 magic; +}; + +#define HWSIM_VIF_MAGIC 0x69537748 + +static inline void hwsim_check_magic(struct ieee80211_vif *vif) +{ + struct hwsim_vif_priv *vp = (void *)vif->drv_priv; + BUG_ON(vp->magic != HWSIM_VIF_MAGIC);If its a debugging tool then better
WARN_ONinstead no?
Quoted 1 line
I don't know, yeah, maybe. I can change it.
Leave it for now, it can be changed later.
Luis
Johannes Berg
maintainerPATCH v2 16/18 mac80211 hwsim: verify vif pointers
In reply to Johannes Bergmac80211-hwsim is a debugging tool for mac80211, and as such it can very well verify that mac80211 isn't passing junk to drivers, especially the vif pointer is prone to this because for vlan interfaces the AP interface pointer needs to be passed. This makes mac80211-hwsim add a magic cookie to the private vif area and verify it whenever an operation is called that gets a vif pointer.
--- drivers/net/wireless/mac80211_hwsim.c | 58 ++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
drivers/net/wireless/mac80211_hwsim.c +58 -0
@@ -28,6 +28,29 @@ static int radios = 2;module_param (radios, int,0444 );MODULE_PARM_DESC (radios,"Number of simulated radios" ); +struct hwsim_vif_priv { +u32 magic; +}; + +#define HWSIM_VIF_MAGIC 0x69537748 + +static inline void hwsim_check_magic (struct ieee80211_vif *vif) +{ +struct hwsim_vif_priv *vp = (void *)vif->drv_priv; +WARN_ON (vp->magic !=HWSIM_VIF_MAGIC ); +} + +static inline void hwsim_set_magic (struct ieee80211_vif *vif) +{ +struct hwsim_vif_priv *vp = (void *)vif->drv_priv; + vp->magic =HWSIM_VIF_MAGIC ; +} + +static inline void hwsim_clear_magic (struct ieee80211_vif *vif) +{ +struct hwsim_vif_priv *vp = (void *)vif->drv_priv; + vp->magic =0 ; +}static struct class *hwsim_class;
@@ -210,6 +233,9 @@ static int mac80211_hwsim_tx(struct ieee ack =mac80211_hwsim_tx_frame (hw, skb); txi =IEEE80211_SKB_CB (skb); + +hwsim_check_magic (txi->control.vif); +memset (&txi->status,0 ,sizeof (txi->status));if (!(txi->flags &IEEE80211_TX_CTL_NO_ACK )) {if (ack)
@@ -246,6 +272,7 @@ static int mac80211_hwsim_add_interface(printk (KERN_DEBUG "%s:%s (type=%d mac_addr=%s)\n" ,wiphy_name (hw->wiphy), __func__, conf->type,print_mac (mac, conf->mac_addr)); +hwsim_set_magic (conf->vif);return 0 ; }
@@ -257,6 +284,8 @@ static void mac80211_hwsim_remove_interfprintk (KERN_DEBUG "%s:%s (type=%d mac_addr=%s)\n" ,wiphy_name (hw->wiphy), __func__, conf->type,print_mac (mac, conf->mac_addr)); +hwsim_check_magic (conf->vif); +hwsim_clear_magic (conf->vif); }
@@ -267,6 +296,8 @@ static void mac80211_hwsim_beacon_tx(voistruct sk_buff *skb;struct ieee80211_tx_info *info; +hwsim_check_magic (vif); +if (vif->type !=NL80211_IFTYPE_AP )return ;
@@ -341,7 +372,28 @@ static void mac80211_hwsim_configure_fil *total_flags = data->rx_filter; } +static int mac80211_hwsim_config_interface (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_if_conf *conf) +{ +hwsim_check_magic (vif); +return 0 ; +} +static void mac80211_hwsim_bss_info_changed (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_bss_conf *info, +u32 changed) +{ +hwsim_check_magic (vif); +} + +static void mac80211_hwsim_sta_notify (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +enum sta_notify_cmd cmd,const u8 *addr) +{ +hwsim_check_magic (vif); +}static const struct ieee80211_ops mac80211_hwsim_ops = {
@@ -352,6 +404,9 @@ static const struct ieee80211_ops mac802 .remove_interface = mac80211_hwsim_remove_interface, .config = mac80211_hwsim_config, .configure_filter = mac80211_hwsim_configure_filter, + .config_interface = mac80211_hwsim_config_interface, + .bss_info_changed = mac80211_hwsim_bss_info_changed, + .sta_notify = mac80211_hwsim_sta_notify, };
@@ -452,6 +507,9 @@ static int __init init_mac80211_hwsim(voBIT (NL80211_IFTYPE_AP ); hw->ampdu_queues =1 ; +/* ask mac80211 to reserve space for magic */ + hw->vif_data_size =sizeof (struct hwsim_vif_priv ); +memcpy (data->channels, hwsim_channels,sizeof (hwsim_channels));memcpy (data->rates, hwsim_rates,sizeof (hwsim_rates)); data->band.channels = data->channels;
Johannes Berg
maintainerPATCH 17/18 mac80211: share STA information with driver
In reply to Johannes BergThis patch changes mac80211 to share some more data about stations with drivers. Should help iwlwifi and ath9k when
they get around to updating, and might also help with
implementing rate control algorithms without internals.
--- drivers/net/wireless/ath9k/main.c | 30 +++++++-------- drivers/net/wireless/b43/main.c | 5 +- drivers/net/wireless/b43legacy/main.c | 2 - drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 12 +++--- drivers/net/wireless/iwlwifi/iwl-agn.c | 12 +++--- drivers/net/wireless/mac80211_hwsim.c | 3 + include/net/mac80211.h | 53 ++++++++++++++++++++++++-- net/mac80211/cfg.c | 12 +++--- net/mac80211/debugfs_key.c | 3 + net/mac80211/debugfs_sta.c | 6 +-- net/mac80211/ht.c | 22 +++++------ net/mac80211/iface.c | 3 + net/mac80211/key.c | 2 - net/mac80211/mesh_hwmp.c | 8 ++-- net/mac80211/mesh_plink.c | 44 +++++++++++----------- net/mac80211/mlme.c | 2 - net/mac80211/rx.c | 12 +++--- net/mac80211/sta_info.c | 59 ++++++++++++++++++------------ net/mac80211/sta_info.h | 7 ++- net/mac80211/tkip.c | 2 - net/mac80211/tx.c | 10 ++--- net/mac80211/wme.c | 2 - net/mac80211/wpa.c | 2 - 23 files changed, 187 insertions(+), 126 deletions(-)
include/net/mac80211.h +48 -5
@@ -300,6 +300,9 @@ enum mac80211_tx_control_flags {* (2) driver internal use (if applicable) * (3) TX status information - driver tells mac80211 what happened * +* The TX control's sta pointer is only valid during the ->tx call, +* it may be NULL. +* * @flags: transmit info flags, defined above * @band: TBD * @tx_rate_idx: TBD
@@ -329,8 +332,8 @@ struct ieee80211_tx_info {struct {struct ieee80211_vif *vif;struct ieee80211_key_conf *hw_key; +struct ieee80211_sta *sta;unsigned long jiffies; -u16 aid;s8 rts_cts_rate_idx, alt_retry_rate_idx;u8 retry_limit;u8 icv_len;
@@ -652,6 +655,29 @@ enum set_key_cmd { };/** +* struct ieee80211_sta - station table entry +* +* A station table entry represents a station we are possibly +* communicating with. Since stations are RCU-managed in +* mac80211, any ieee80211_sta pointer you get access to must +* either be protected by rcu_read_lock() explicitly or implicitly, +* or you must take good care to not use such a pointer after a +* call to your sta_notify callback that removed it. +* +* @addr: MAC address +* @aid: AID we assigned to the station if we're an AP +* @drv_priv: data area for driver use, will always be aligned to +* sizeof(void *), size is determined in hw information. +*/ +struct ieee80211_sta { +u8 addr[ETH_ALEN ]; +u16 aid; + +/* must be last */ +u8 drv_priv[0 ] __attribute__((__aligned__ (sizeof (void *)))); +}; + +/** * enum sta_notify_cmd - sta notify command * * Used with the sta_notify() callback in &struct ieee80211_ops, this
@@ -795,6 +821,8 @@ enum ieee80211_hw_flags {* * @vif_data_size: size (in bytes) of the drv_priv data area * within &struct ieee80211_vif. +* @sta_data_size: size (in bytes) of the drv_priv data area +* within &struct ieee80211_sta. */ struct ieee80211_hw {struct ieee80211_conf conf;
@@ -806,6 +834,7 @@ struct ieee80211_hw {unsigned int extra_tx_headroom;int channel_change_time;int vif_data_size; +int sta_data_size;u16 queues;u16 ampdu_queues;u16 max_listen_interval;
@@ -1087,7 +1116,7 @@ enum ieee80211_ampdu_mlme_action {* This callback must be implemented and atomic. * * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit -* must be set or cleared for a given AID. Must be atomic. +* must be set or cleared for a given STA. Must be atomic. * * @set_key: See the section "Hardware crypto acceleration" * This callback can sleep, and is only called between add_interface
@@ -1173,7 +1202,8 @@ struct ieee80211_ops {unsigned int changed_flags, unsigned int *total_flags, int mc_count, struct dev_addr_list *mc_list); -int (*set_tim)(struct ieee80211_hw *hw,int aid,int set); +int (*set_tim)(struct ieee80211_hw *hw,struct ieee80211_sta *sta, +bool set);int (*set_key)(struct ieee80211_hw *hw,enum set_key_cmd cmd,const u8 *local_address,const u8 *address,struct ieee80211_key_conf *key);
@@ -1190,7 +1220,7 @@ struct ieee80211_ops {int (*set_retry_limit)(struct ieee80211_hw *hw,u32 short_retry,u32 long_retr);void (*sta_notify)(struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum sta_notify_cmd ,const u8 *addr); +enum sta_notify_cmd ,struct ieee80211_sta *sta);int (*conf_tx)(struct ieee80211_hw *hw,u16 queue,const struct ieee80211_tx_queue_params *params); int (*get_tx_stats)(struct ieee80211_hw *hw,
@@ -1200,7 +1230,7 @@ struct ieee80211_ops {int (*tx_last_beacon)(struct ieee80211_hw *hw);int (*ampdu_action)(struct ieee80211_hw *hw,enum ieee80211_ampdu_mlme_action action, -const u8 *addr,u16 tid,u16 *ssn); +struct ieee80211_sta *sta,u16 tid,u16 *ssn); };/**
@@ -1750,4 +1780,17 @@ void ieee80211_stop_tx_ba_cb_irqsafe(str*/ void ieee80211_notify_mac (struct ieee80211_hw *hw,enum ieee80211_notification_types notif_type); + +/** +* ieee80211_find_sta - find a station +* +* @hw: pointer as obtained from ieee80211_alloc_hw() +* @addr: station's address +* +* This function must be called under RCU lock and the +* resulting pointer is only valid under RCU lock as well. +*/ +struct ieee80211_sta *ieee80211_find_sta (struct ieee80211_hw *hw, +const u8 *addr); +#endif /* MAC80211_H */
net/mac80211/sta_info.h +5 -2
@@ -218,6 +218,7 @@ struct sta_ampdu_mlme {* @plink_timeout: TBD * @plink_timer: TBD * @debugfs: debug filesystem info +* @sta: station information we share with the driver */ struct sta_info {/* General information, mostly static */
@@ -232,8 +233,7 @@ struct sta_info {spinlock_t flaglock;struct ieee80211_ht_info ht_info;u64 supp_rates[IEEE80211_NUM_BANDS ]; -u8 addr[ETH_ALEN ]; -u16 aid; +u16 listen_interval;/*
@@ -327,6 +327,9 @@ struct sta_info { struct dentry *agg_status; } debugfs;#endif + +/* keep last! */ +struct ieee80211_sta sta; };static inline enum plink_state sta_plink_state (struct sta_info *sta)
net/mac80211/sta_info.c +36 -23
176 lines not on this page · raw message
net/mac80211/cfg.c +6 -6
@@ -357,7 +357,7 @@ static int ieee80211_dump_station(struct sta =sta_info_get_by_idx (local, idx, dev);if (sta) { ret =0 ; -memcpy (mac, sta->addr,ETH_ALEN ); +memcpy (mac, sta->sta.addr,ETH_ALEN );sta_set_sinfo (sta, sinfo); }
@@ -586,7 +586,7 @@ static void ieee80211_send_layer2_update* Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ memset (msg->da,0xff ,ETH_ALEN ); -memcpy (msg->sa, sta->addr,ETH_ALEN ); +memcpy (msg->sa, sta->sta.addr,ETH_ALEN ); msg->len =htons (6 ); msg->dsap =0 ; msg->ssap =0x01 ;/* NULL LSAP, CR Bit: Response */
@@ -641,9 +641,9 @@ static void sta_apply_parameters(struct*/ if (params->aid) { - sta->aid = params->aid; -if (sta->aid >IEEE80211_MAX_AID ) - sta->aid =0 ;/* XXX: should this be an error? */ + sta->sta.aid = params->aid; +if (sta->sta.aid >IEEE80211_MAX_AID ) + sta->sta.aid =0 ;/* XXX: should this be an error? */ }if (params->listen_interval >=0 )
@@ -912,7 +912,7 @@ static void mpath_set_pinfo(struct mesh_ struct mpath_info *pinfo) {if (mpath->next_hop) -memcpy (next_hop, mpath->next_hop->addr,ETH_ALEN ); +memcpy (next_hop, mpath->next_hop->sta.addr,ETH_ALEN );else memset (next_hop,0 ,ETH_ALEN );
net/mac80211/debugfs_key.c +2 -1
@@ -206,7 +206,8 @@ void ieee80211_debugfs_key_add(struct iercu_read_lock (); sta =rcu_dereference (key->sta);if (sta) -sprintf (buf,"../../stations/%s" ,print_mac (mac, sta->addr)); +sprintf (buf,"../../stations/%s" , +print_mac (mac, sta->sta.addr));rcu_read_unlock ();/* using sta as a boolean is fine outside RCU lock */
net/mac80211/debugfs_sta.c +3 -3
@@ -50,7 +50,7 @@ static const struct file_operations sta_ STA_READ_##format(name, field) \ STA_OPS(name) -STA_FILE (aid, aid,D ); +STA_FILE (aid, sta.aid,D );STA_FILE (dev, sdata->dev->name,S );STA_FILE (rx_packets, rx_packets,LU );STA_FILE (tx_packets, tx_packets,LU );
@@ -176,7 +176,7 @@ static ssize_t sta_agg_status_write(strustruct net_device *dev = sta->sdata->dev;struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);struct ieee80211_hw *hw = &local->hw; -u8 *da = sta->addr; +u8 *da = sta->sta.addr;static int tid_static_tx[16 ] = {0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 };static int tid_static_rx[16 ] = {1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,
@@ -253,7 +253,7 @@ void ieee80211_sta_debugfs_add(struct stif (!stations_dir)return ; - mac =print_mac (mbuf, sta->addr); + mac =print_mac (mbuf, sta->sta.addr); sta->debugfs.dir =debugfs_create_dir (mac, stations_dir);if (!sta->debugfs.dir)
net/mac80211/ht.c +11 -11
@@ -274,7 +274,7 @@ void ieee80211_sta_stop_rx_ba_session(st#endif /* CONFIG_MAC80211_HT_DEBUG */ ret = local->ops->ampdu_action (hw,IEEE80211_AMPDU_RX_STOP , - ra, tid,NULL ); + &sta->sta, tid,NULL );if (ret)printk (KERN_DEBUG "HW problem - can not stop rx " "aggregation for tid %d\n" , tid);
@@ -328,7 +328,7 @@ static void sta_addba_resp_timer_expiredrcu_read_lock (); - sta =sta_info_get (local, temp_sta->addr); + sta =sta_info_get (local, temp_sta->sta.addr);if (!sta) {rcu_read_unlock ();return ;
@@ -354,7 +354,7 @@ static void sta_addba_resp_timer_expired/* go through the state check in stop_BA_session */ *state =HT_AGG_STATE_OPERATIONAL ;spin_unlock_bh (&sta->lock); -ieee80211_stop_tx_ba_session (hw, temp_sta->addr, tid, +ieee80211_stop_tx_ba_session (hw, temp_sta->sta.addr, tid,WLAN_BACK_INITIATOR ); timer_expired_exit:
@@ -465,7 +465,7 @@ int ieee80211_start_tx_ba_session(structif (local->ops->ampdu_action) ret = local->ops->ampdu_action (hw,IEEE80211_AMPDU_TX_START , - ra, tid, &start_seq_num); + &sta->sta, tid, &start_seq_num);if (ret) {/* No need to requeue the packets in the agg queue, since we
@@ -557,7 +557,7 @@ int ieee80211_stop_tx_ba_session(structif (local->ops->ampdu_action) ret = local->ops->ampdu_action (hw,IEEE80211_AMPDU_TX_STOP , - ra, tid,NULL ); + &sta->sta, tid,NULL );/* case HW denied going back to legacy */ if (ret) {
@@ -767,7 +767,7 @@ static void sta_rx_agg_session_timer_exp#ifdef CONFIG_MAC80211_HT_DEBUG printk (KERN_DEBUG "rx session timer expired on tid %d\n" , (u16)*ptid);#endif -ieee80211_sta_stop_rx_ba_session (sta->sdata, sta->addr, +ieee80211_sta_stop_rx_ba_session (sta->sdata, sta->sta.addr, (u16)*ptid,WLAN_BACK_TIMER ,WLAN_REASON_QSTA_TIMEOUT ); }
@@ -874,7 +874,7 @@ void ieee80211_process_addba_request(strif (local->ops->ampdu_action) ret = local->ops->ampdu_action (hw,IEEE80211_AMPDU_RX_START , - sta->addr, tid, &start_seq_num); + &sta->sta, tid, &start_seq_num);#ifdef CONFIG_MAC80211_HT_DEBUG printk (KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n" , tid, ret);#endif /* CONFIG_MAC80211_HT_DEBUG */
@@ -899,7 +899,7 @@ end:spin_unlock_bh (&sta->lock); end_no_lock: -ieee80211_send_addba_resp (sta->sdata, sta->addr, tid, +ieee80211_send_addba_resp (sta->sdata, sta->sta.addr, tid, dialog_token, status,1 , buf_size, timeout); }
@@ -952,7 +952,7 @@ void ieee80211_process_addba_resp(struct/* this will allow the state check in stop_BA_session */ *state =HT_AGG_STATE_OPERATIONAL ;spin_unlock_bh (&sta->lock); -ieee80211_stop_tx_ba_session (hw, sta->addr, tid, +ieee80211_stop_tx_ba_session (hw, sta->sta.addr, tid,WLAN_BACK_INITIATOR ); } }
@@ -979,14 +979,14 @@ void ieee80211_process_delba(struct ieee#endif /* CONFIG_MAC80211_HT_DEBUG */ if (initiator ==WLAN_BACK_INITIATOR ) -ieee80211_sta_stop_rx_ba_session (sdata, sta->addr, tid, +ieee80211_sta_stop_rx_ba_session (sdata, sta->sta.addr, tid,WLAN_BACK_INITIATOR ,0 );else {/* WLAN_BACK_RECIPIENT */ spin_lock_bh (&sta->lock); sta->ampdu_mlme.tid_state_tx[tid] =HT_AGG_STATE_OPERATIONAL ;spin_unlock_bh (&sta->lock); -ieee80211_stop_tx_ba_session (&local->hw, sta->addr, tid, +ieee80211_stop_tx_ba_session (&local->hw, sta->sta.addr, tid,WLAN_BACK_RECIPIENT ); } }
net/mac80211/iface.c +2 -1
@@ -336,7 +336,8 @@ static int ieee80211_stop(struct net_devlist_for_each_entry_rcu (sta, &local->sta_list, list) {if (sta->sdata == sdata) -ieee80211_sta_tear_down_BA_sessions (sdata, sta->addr); +ieee80211_sta_tear_down_BA_sessions (sdata, + sta->sta.addr); }rcu_read_unlock ();
net/mac80211/key.c +1 -1
@@ -123,7 +123,7 @@ static const u8 *get_mac_for_key(struct addr = zero_addr;if (key->sta) - addr = key->sta->addr; + addr = key->sta->sta.addr;return addr; }
net/mac80211/mesh_hwmp.c +4 -4
@@ -517,7 +517,7 @@ static void hwmp_prep_frame_process(struspin_unlock_bh (&mpath->state_lock); goto fail; } -memcpy (next_hop, mpath->next_hop->addr,ETH_ALEN ); +memcpy (next_hop, mpath->next_hop->sta.addr,ETH_ALEN );spin_unlock_bh (&mpath->state_lock); --ttl; flags =PREP_IE_FLAGS (prep_elem);
@@ -529,7 +529,7 @@ static void hwmp_prep_frame_process(strumesh_path_sel_frame_tx (MPATH_PREP , flags, orig_addr,cpu_to_le32 (orig_dsn),0 , dst_addr, -cpu_to_le32 (dst_dsn), mpath->next_hop->addr, hopcount, ttl, +cpu_to_le32 (dst_dsn), mpath->next_hop->sta.addr, hopcount, ttl,cpu_to_le32 (lifetime),cpu_to_le32 (metric),0 , sdata);rcu_read_unlock ();
@@ -557,7 +557,7 @@ static void hwmp_perr_frame_process(struif (mpath) {spin_lock_bh (&mpath->state_lock);if (mpath->flags &MESH_PATH_ACTIVE && -memcmp (ta, mpath->next_hop->addr,ETH_ALEN ) ==0 && +memcmp (ta, mpath->next_hop->sta.addr,ETH_ALEN ) ==0 && (!(mpath->flags &MESH_PATH_DSN_VALID ) ||DSN_GT (dst_dsn, mpath->dsn))) { mpath->flags &= ~MESH_PATH_ACTIVE ;
@@ -799,7 +799,7 @@ int mesh_nexthop_lookup(struct sk_buff *mesh_queue_preq (mpath,PREQ_Q_F_START |PREQ_Q_F_REFRESH ); } -memcpy (hdr->addr1, mpath->next_hop->addr, +memcpy (hdr->addr1, mpath->next_hop->sta.addr,ETH_ALEN ); }else {if (!(mpath->flags &MESH_PATH_RESOLVING )) {
net/mac80211/mesh_plink.c +22 -22
153 lines not on this page · raw message
net/mac80211/mlme.c +1 -1
@@ -835,7 +835,7 @@ static void ieee80211_set_disassoc(strucnetif_tx_stop_all_queues (sdata->dev);netif_carrier_off (sdata->dev); -ieee80211_sta_tear_down_BA_sessions (sdata, sta->addr); +ieee80211_sta_tear_down_BA_sessions (sdata, sta->sta.addr);if (self_disconnected) {if (deauth)
net/mac80211/rx.c +6 -6
@@ -661,7 +661,7 @@ static void ap_sta_ps_start(struct net_dset_and_clear_sta_flags (sta,WLAN_STA_PS ,WLAN_STA_PSPOLL );#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG printk (KERN_DEBUG "%s: STA %s aid %d enters power save mode\n" , - dev->name,print_mac (mac, sta->addr), sta->aid); + dev->name,print_mac (mac, sta->sta.addr), sta->sta.aid);#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ }
@@ -685,7 +685,7 @@ static int ap_sta_ps_end(struct net_devi#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG printk (KERN_DEBUG "%s: STA %s aid %d exits power save mode\n" , - dev->name,print_mac (mac, sta->addr), sta->aid); + dev->name,print_mac (mac, sta->sta.addr), sta->sta.aid);#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ /* Send all buffered frames to the station */
@@ -702,7 +702,7 @@ static int ap_sta_ps_end(struct net_devi#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG printk (KERN_DEBUG "%s: STA %s aid %d send PS frame " "since STA not sleeping anymore\n" , dev->name, -print_mac (mac, sta->addr), sta->aid); +print_mac (mac, sta->sta.addr), sta->sta.aid);#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ info->flags |=IEEE80211_TX_CTL_REQUEUE ;dev_queue_xmit (skb);
@@ -1007,7 +1007,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG printk (KERN_DEBUG "STA %s aid %d: PS Poll (entries after %d)\n" , -print_mac (mac, rx->sta->addr), rx->sta->aid, +print_mac (mac, rx->sta->sta.addr), rx->sta->sta.aid,skb_queue_len (&rx->sta->ps_tx_buf));#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
@@ -1032,7 +1032,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_*/ printk (KERN_DEBUG "%s: STA %s sent PS Poll even " "though there are no buffered frames for it\n" , - rx->dev->name,print_mac (mac, rx->sta->addr)); + rx->dev->name,print_mac (mac, rx->sta->sta.addr));#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ }
@@ -2140,7 +2140,7 @@ static u8 ieee80211_rx_reorder_ampdu(str/* if this mpdu is fragmented - terminate rx aggregation session */ sc =le16_to_cpu (hdr->seq_ctrl);if (sc &IEEE80211_SCTL_FRAG ) { -ieee80211_sta_stop_rx_ba_session (sta->sdata, sta->addr, +ieee80211_sta_stop_rx_ba_session (sta->sdata, sta->sta.addr, tid,0 ,WLAN_REASON_QSTA_REQUIRE_SETUP ); ret =1 ; goto end_reorder;
net/mac80211/tkip.c +1 -1
@@ -304,7 +304,7 @@ int ieee80211_tkip_decrypt_data(struct c key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {u8 bcast[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff }; -u8 *sta_addr = key->sta->addr; +u8 *sta_addr = key->sta->sta.addr;if (is_multicast_ether_addr (ra)) sta_addr = bcast;
net/mac80211/tx.c +5 -5
@@ -381,7 +381,7 @@ ieee80211_tx_h_unicast_ps_buf(struct iee#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG printk (KERN_DEBUG "STA %s aid %d: PS buffer (entries " "before %d)\n" , -print_mac (mac, sta->addr), sta->aid, +print_mac (mac, sta->sta.addr), sta->sta.aid,skb_queue_len (&sta->ps_tx_buf));#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ if (tx->local->total_ps_buffered >=TOTAL_MAX_TX_BUFFER )
@@ -392,7 +392,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieeif (net_ratelimit ()) {printk (KERN_DEBUG "%s: STA %s TX " "buffer full - dropping oldest frame\n" , - tx->dev->name,print_mac (mac, sta->addr)); + tx->dev->name,print_mac (mac, sta->sta.addr)); }#endif dev_kfree_skb (old);
@@ -411,7 +411,7 @@ ieee80211_tx_h_unicast_ps_buf(struct iee else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) {printk (KERN_DEBUG "%s: STA %s in PS mode, but pspoll " "set -> send frame\n" , tx->dev->name, -print_mac (mac, sta->addr)); +print_mac (mac, sta->sta.addr)); }#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ clear_sta_flags (sta,WLAN_STA_PSPOLL );
@@ -528,7 +528,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_ sband = tx->local->hw.wiphy->bands[tx->channel->band];if (tx->sta) - info->control.aid = tx->sta->aid; + info->control.sta = &tx->sta->sta;if (!info->control.retry_limit) {if (!is_multicast_ether_addr (hdr->addr1)) {
@@ -608,7 +608,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_ }if (tx->sta) - info->control.aid = tx->sta->aid; + info->control.sta = &tx->sta->sta;return TX_CONTINUE ; }
net/mac80211/wme.c +1 -1
@@ -210,7 +210,7 @@ int ieee80211_ht_agg_queue_add(struct ieDECLARE_MAC_BUF (mac);printk (KERN_DEBUG "allocated aggregation queue" " %d tid %d addr %s pool=0x%lX\n" , - i, tid,print_mac (mac, sta->addr), + i, tid,print_mac (mac, sta->sta.addr), local->queue_pool[0]); }#endif /* CONFIG_MAC80211_HT_DEBUG */
net/mac80211/wpa.c +1 -1
@@ -256,7 +256,7 @@ ieee80211_crypto_tkip_decrypt(struct iee res =ieee80211_tkip_decrypt_data (rx->local->wep_rx_tfm, key, skb->data + hdrlen, - skb->len - hdrlen, rx->sta->addr, + skb->len - hdrlen, rx->sta->sta.addr, hdr->addr1, hwaccel, rx->queue, &rx->tkip_iv32, &rx->tkip_iv16);
drivers/net/wireless/b43/main.c +3 -2
@@ -4234,7 +4234,8 @@ out_unlock:return err; } -static int b43_op_beacon_set_tim (struct ieee80211_hw *hw,int aid,int set) +static int b43_op_beacon_set_tim (struct ieee80211_hw *hw, +struct ieee80211_sta *sta,bool set) {struct b43_wl *wl =hw_to_b43_wl (hw);unsigned long flags;
@@ -4249,7 +4250,7 @@ static int b43_op_beacon_set_tim(structstatic void b43_op_sta_notify (struct ieee80211_hw *hw,struct ieee80211_vif *vif,enum sta_notify_cmd notify_cmd, -const u8 *addr) +struct ieee80211_sta *sta) {struct b43_wl *wl =hw_to_b43_wl (hw);
drivers/net/wireless/b43legacy/main.c +1 -1
@@ -3403,7 +3403,7 @@ out_unlock: }static int b43legacy_op_beacon_set_tim (struct ieee80211_hw *hw, -int aid,int set) +struct ieee80211_sta *sta,bool set) {struct b43legacy_wl *wl =hw_to_b43legacy_wl (hw);unsigned long flags;
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +6 -6
@@ -366,8 +366,8 @@ static void rs_tl_turn_on_agg_for_tid(stif (state ==HT_AGG_STATE_IDLE &&rs_tl_get_load (lq_data, tid) >IWL_AGG_LOAD_THRESHOLD ) {IWL_DEBUG_HT ("Starting Tx agg: STA: %s tid: %d\n" , -print_mac (mac, sta->addr), tid); -ieee80211_start_tx_ba_session (priv->hw, sta->addr, tid); +print_mac (mac, sta->sta.addr), tid); +ieee80211_start_tx_ba_session (priv->hw, sta->sta.addr, tid); } }
@@ -2244,17 +2244,17 @@ static void rs_rate_init(void *priv_rate lq_sta->ibss_sta_added =0 ;if (priv->iw_mode ==NL80211_IFTYPE_AP ) { -u8 sta_id =iwl_find_station (priv, sta->addr); +u8 sta_id =iwl_find_station (priv, sta->sta.addr);DECLARE_MAC_BUF (mac);/* for IBSS the call are from tasklet */ IWL_DEBUG_RATE ("LQ: ADD station %s\n" , -print_mac (mac, sta->addr)); +print_mac (mac, sta->sta.addr));if (sta_id ==IWL_INVALID_STATION ) {IWL_DEBUG_RATE ("LQ: ADD station %s\n" , -print_mac (mac, sta->addr)); - sta_id =iwl_add_station_flags (priv, sta->addr, +print_mac (mac, sta->sta.addr)); + sta_id =iwl_add_station_flags (priv, sta->sta.addr,0 ,CMD_ASYNC ,NULL ); }if ((sta_id !=IWL_INVALID_STATION )) {
drivers/net/wireless/mac80211_hwsim.c +2 -1
@@ -390,7 +390,8 @@ static void mac80211_hwsim_bss_info_chanstatic void mac80211_hwsim_sta_notify (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum sta_notify_cmd cmd,const u8 *addr) +enum sta_notify_cmd cmd, +struct ieee80211_sta *sta) {hwsim_check_magic (vif); }
drivers/net/wireless/iwlwifi/iwl-agn.c +6 -6
@@ -3413,13 +3413,13 @@ static int iwl4965_mac_conf_tx(struct iestatic int iwl4965_mac_ampdu_action (struct ieee80211_hw *hw,enum ieee80211_ampdu_mlme_action action, -const u8 *addr,u16 tid,u16 *ssn) +struct ieee80211_sta *sta,u16 tid,u16 *ssn) {struct iwl_priv *priv = hw->priv;DECLARE_MAC_BUF (mac);IWL_DEBUG_HT ("A-MPDU action on addr %s tid %d\n" , -print_mac (mac, addr), tid); +print_mac (mac, sta->addr), tid);if (!(priv->cfg->sku &IWL_SKU_N ))return -EACCES ;
@@ -3427,16 +3427,16 @@ static int iwl4965_mac_ampdu_action(struswitch (action) {case IEEE80211_AMPDU_RX_START :IWL_DEBUG_HT ("start Rx\n" ); -return iwl_rx_agg_start (priv, addr, tid, *ssn); +return iwl_rx_agg_start (priv, sta->addr, tid, *ssn);case IEEE80211_AMPDU_RX_STOP :IWL_DEBUG_HT ("stop Rx\n" ); -return iwl_rx_agg_stop (priv, addr, tid); +return iwl_rx_agg_stop (priv, sta->addr, tid);case IEEE80211_AMPDU_TX_START :IWL_DEBUG_HT ("start Tx\n" ); -return iwl_tx_agg_start (priv, addr, tid, ssn); +return iwl_tx_agg_start (priv, sta->addr, tid, ssn);case IEEE80211_AMPDU_TX_STOP :IWL_DEBUG_HT ("stop Tx\n" ); -return iwl_tx_agg_stop (priv, addr, tid); +return iwl_tx_agg_stop (priv, sta->addr, tid);default :IWL_DEBUG_HT ("unknown\n" );return -EINVAL ;
drivers/net/wireless/ath9k/main.c +14 -16
@@ -686,7 +686,7 @@ static void ath9k_configure_filter(strucstatic void ath9k_sta_notify (struct ieee80211_hw *hw,struct ieee80211_vif *vif,enum sta_notify_cmd cmd, -const u8 *addr) +struct ieee80211_sta *sta) {struct ath_softc *sc = hw->priv;struct ath_node *an;
@@ -694,19 +694,18 @@ static void ath9k_sta_notify(struct ieeeDECLARE_MAC_BUF (mac);spin_lock_irqsave (&sc->node_lock, flags); - an =ath_node_find (sc, (u8 *) addr); + an =ath_node_find (sc, sta->addr);spin_unlock_irqrestore (&sc->node_lock, flags);switch (cmd) {case STA_NOTIFY_ADD :spin_lock_irqsave (&sc->node_lock, flags);if (!an) { -ath_node_attach (sc, (u8 *)addr,0 ); +ath_node_attach (sc, sta->addr,0 );DPRINTF (sc,ATH_DBG_CONFIG ,"%s: Attach a node: %s\n" , - __func__, -print_mac (mac, addr)); + __func__,print_mac (mac, sta->addr)); }else { -ath_node_get (sc, (u8 *)addr); +ath_node_get (sc, sta->addr); }spin_unlock_irqrestore (&sc->node_lock, flags);break ;
@@ -719,7 +718,7 @@ static void ath9k_sta_notify(struct ieeeath_node_put (sc, an,ATH9K_BH_STATUS_INTACT );DPRINTF (sc,ATH_DBG_CONFIG ,"%s: Put a node: %s\n" , __func__, -print_mac (mac, addr)); +print_mac (mac, sta->addr)); }break ;default :
@@ -973,45 +972,44 @@ static void ath9k_reset_tsf(struct ieee8static int ath9k_ampdu_action (struct ieee80211_hw *hw,enum ieee80211_ampdu_mlme_action action, -const u8 *addr, -u16 tid, -u16 *ssn) +struct ieee80211_sta *sta, +u16 tid,u16 *ssn) {struct ath_softc *sc = hw->priv;int ret =0 ;switch (action) {case IEEE80211_AMPDU_RX_START : - ret =ath_rx_aggr_start (sc, addr, tid, ssn); + ret =ath_rx_aggr_start (sc, sta->addr, tid, ssn);if (ret <0 )DPRINTF (sc,ATH_DBG_FATAL ,"%s: Unable to start RX aggregation\n" , __func__);break ;case IEEE80211_AMPDU_RX_STOP : - ret =ath_rx_aggr_stop (sc, addr, tid); + ret =ath_rx_aggr_stop (sc, sta->addr, tid);if (ret <0 )DPRINTF (sc,ATH_DBG_FATAL ,"%s: Unable to stop RX aggregation\n" , __func__);break ;case IEEE80211_AMPDU_TX_START : - ret =ath_tx_aggr_start (sc, addr, tid, ssn); + ret =ath_tx_aggr_start (sc, sta->addr, tid, ssn);if (ret <0 )DPRINTF (sc,ATH_DBG_FATAL ,"%s: Unable to start TX aggregation\n" , __func__);else -ieee80211_start_tx_ba_cb_irqsafe (hw, (u8 *)addr, tid); +ieee80211_start_tx_ba_cb_irqsafe (hw, sta->addr, tid);break ;case IEEE80211_AMPDU_TX_STOP : - ret =ath_tx_aggr_stop (sc, addr, tid); + ret =ath_tx_aggr_stop (sc, sta->addr, tid);if (ret <0 )DPRINTF (sc,ATH_DBG_FATAL ,"%s: Unable to stop TX aggregation\n" , __func__); -ieee80211_stop_tx_ba_cb_irqsafe (hw, (u8 *)addr, tid); +ieee80211_stop_tx_ba_cb_irqsafe (hw, sta->addr, tid);break ;default : DPRINTF(sc, ATH_DBG_FATAL,
Johannes Berg
maintainerPATCH 18/18 mac80211 hwsim: verify sta pointers
In reply to Johannes BergIn analogy with the previous patch to make mac80211-hwsim verify that the virtual interface pointers are correct, this makes it very that it knows about all station structs.
--- drivers/net/wireless/mac80211_hwsim.c | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/net/wireless/mac80211_hwsim.c +43 -0
@@ -52,6 +52,30 @@ static inline void hwsim_clear_magic(str vp->magic =0 ; } +struct hwsim_sta_priv { +u32 magic; +}; + +#define HWSIM_STA_MAGIC 0x6d537748 + +static inline void hwsim_check_sta_magic (struct ieee80211_sta *sta) +{ +struct hwsim_sta_priv *sp = (void *)sta->drv_priv; +BUG_ON (sp->magic !=HWSIM_VIF_MAGIC ); +} + +static inline void hwsim_set_sta_magic (struct ieee80211_sta *sta) +{ +struct hwsim_sta_priv *sp = (void *)sta->drv_priv; + sp->magic =HWSIM_VIF_MAGIC ; +} + +static inline void hwsim_clear_sta_magic (struct ieee80211_sta *sta) +{ +struct hwsim_sta_priv *sp = (void *)sta->drv_priv; + sp->magic =0 ; +} +static struct class *hwsim_class;static struct ieee80211_hw **hwsim_radios;
@@ -235,6 +259,8 @@ static int mac80211_hwsim_tx(struct ieee txi =IEEE80211_SKB_CB (skb);hwsim_check_magic (txi->control.vif); +if (txi->control.sta) +hwsim_check_sta_magic (txi->control.sta);memset (&txi->status,0 ,sizeof (txi->status));if (!(txi->flags &IEEE80211_TX_CTL_NO_ACK )) {
@@ -394,6 +420,22 @@ static void mac80211_hwsim_sta_notify(st struct ieee80211_sta *sta) {hwsim_check_magic (vif); +switch (cmd) { +case STA_NOTIFY_ADD : +hwsim_set_sta_magic (sta); +break ; +case STA_NOTIFY_REMOVE : +hwsim_clear_sta_magic (sta); +break ; + } +} + +static int mac80211_hwsim_set_tim (struct ieee80211_hw *hw, +struct ieee80211_sta *sta, +bool set) +{ +hwsim_check_sta_magic (sta); +return 0 ; } static const struct ieee80211_ops mac80211_hwsim_ops =
@@ -408,6 +450,7 @@ static const struct ieee80211_ops mac802 .config_interface = mac80211_hwsim_config_interface, .bss_info_changed = mac80211_hwsim_bss_info_changed, .sta_notify = mac80211_hwsim_sta_notify, + .set_tim = mac80211_hwsim_set_tim, };
Johannes Berg
maintainerPATCH v2 18/18 mac80211 hwsim: verify sta pointers
In analogy with the previous patch to make mac80211-hwsim verify that the virtual interface pointers are correct, this makes it very that it knows about all station structs.
--- drivers/net/wireless/mac80211_hwsim.c | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/net/wireless/mac80211_hwsim.c +43 -0
@@ -52,6 +52,30 @@ static inline void hwsim_clear_magic(str vp->magic =0 ; } +struct hwsim_sta_priv { +u32 magic; +}; + +#define HWSIM_STA_MAGIC 0x6d537748 + +static inline void hwsim_check_sta_magic (struct ieee80211_sta *sta) +{ +struct hwsim_sta_priv *sp = (void *)sta->drv_priv; +WARN_ON (sp->magic !=HWSIM_VIF_MAGIC ); +} + +static inline void hwsim_set_sta_magic (struct ieee80211_sta *sta) +{ +struct hwsim_sta_priv *sp = (void *)sta->drv_priv; + sp->magic =HWSIM_VIF_MAGIC ; +} + +static inline void hwsim_clear_sta_magic (struct ieee80211_sta *sta) +{ +struct hwsim_sta_priv *sp = (void *)sta->drv_priv; + sp->magic =0 ; +} +static struct class *hwsim_class;static struct ieee80211_hw **hwsim_radios;
@@ -235,6 +259,8 @@ static int mac80211_hwsim_tx(struct ieee txi =IEEE80211_SKB_CB (skb);hwsim_check_magic (txi->control.vif); +if (txi->control.sta) +hwsim_check_sta_magic (txi->control.sta);memset (&txi->status,0 ,sizeof (txi->status));if (!(txi->flags &IEEE80211_TX_CTL_NO_ACK )) {
@@ -394,6 +420,22 @@ static void mac80211_hwsim_sta_notify(st struct ieee80211_sta *sta) {hwsim_check_magic (vif); +switch (cmd) { +case STA_NOTIFY_ADD : +hwsim_set_sta_magic (sta); +break ; +case STA_NOTIFY_REMOVE : +hwsim_clear_sta_magic (sta); +break ; + } +} + +static int mac80211_hwsim_set_tim (struct ieee80211_hw *hw, +struct ieee80211_sta *sta, +bool set) +{ +hwsim_check_sta_magic (sta); +return 0 ; } static const struct ieee80211_ops mac80211_hwsim_ops =
@@ -408,6 +450,7 @@ static const struct ieee80211_ops mac802 .config_interface = mac80211_hwsim_config_interface, .bss_info_changed = mac80211_hwsim_bss_info_changed, .sta_notify = mac80211_hwsim_sta_notify, + .set_tim = mac80211_hwsim_set_tim, };
Johannes Berg
maintainerRe: [PATCH v2 18/18] mac80211 hwsim: verify sta pointers
Oh, I forgot the hunk below, I can resend after I reboot...
--- drivers/net/wireless/mac80211_hwsim.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mac80211_hwsim.c +1 -0
@@ -553,6 +553,7 @@ static int __init init_mac80211_hwsim(vo/* ask mac80211 to reserve space for magic */ hw->vif_data_size =sizeof (struct hwsim_vif_priv ); + hw->sta_data_size =sizeof (struct hwsim_sta_priv );memcpy (data->channels, hwsim_channels,sizeof (hwsim_channels));memcpy (data->rates, hwsim_rates,sizeof (hwsim_rates));
Johannes Berg
maintainer[PATCH 19/18] mac80211: small rate control changes
In reply to Johannes BergThis patch fixes mac80211 to not rely on the rate control algorithm to update sta->tx_retry_failed and sta->tx_retry_count (even if we don't currently use them), removes a number of completely unused values we don't even show in debugfs and changes the code in ieee80211_tx_status() to not look up the sta_info repeatedly.
The only behaviour change here would be not calling the rate control function rate_control_tx_status() when no sta_info is found, but all rate control algorithms ignore such calls anyway.
---
Now we can also change it to pass in the actual rate control information to the algorithm, saving all the lookups there and the cross-dir header inclusion! :)
net/mac80211/main.c | 50 ++++++++++++++++++++-------------------- net/mac80211/rc80211_pid_algo.c | 11 -------- net/mac80211/sta_info.h | 7 ----- 3 files changed, 25 insertions(+), 43 deletions(-)
net/mac80211/sta_info.h +0 -7
@@ -195,9 +195,6 @@ struct sta_ampdu_mlme {* @tx_filtered_count: TBD * @tx_retry_failed: TBD * @tx_retry_count: TBD -* @tx_num_consecutive_failures: TBD -* @tx_num_mpdu_ok: TBD -* @tx_num_mpdu_fail: TBD * @fail_avg: moving percentage of failed MSDUs * @tx_packets: number of RX/TX MSDUs * @tx_bytes: TBD
@@ -273,10 +270,6 @@ struct sta_info {/* Updated from TX status path only, no locking requirements */ unsigned long tx_filtered_count;unsigned long tx_retry_failed, tx_retry_count; -/* TODO: update in generic code not rate control? */ -u32 tx_num_consecutive_failures; -u32 tx_num_mpdu_ok; -u32 tx_num_mpdu_fail;/* moving percentage of failed MSDUs */ unsigned int fail_avg;
net/mac80211/rc80211_pid_algo.c +0 -11
@@ -282,17 +282,6 @@ static void rate_control_pid_tx_status(v spinfo->tx_num_xmit++; } -if (info->status.excessive_retries) { - sta->tx_retry_failed++; - sta->tx_num_consecutive_failures++; - sta->tx_num_mpdu_fail++; - }else { - sta->tx_num_consecutive_failures =0 ; - sta->tx_num_mpdu_ok++; - } - sta->tx_retry_count += info->status.retry_count; - sta->tx_num_mpdu_fail += info->status.retry_count; -/* Update PID controller state. */ period = (HZ * pinfo->sampling_period +500 ) /1000 ;if (!period)
net/mac80211/main.c +25 -25
71 lines not on this page · raw message
Johannes Berg
maintainer[PATCH 20/18] mac80211: move last_txrate_idx into RC algorithms
In reply to Johannes BergThis variable in sta_info is only used in a meaningful way by the Intel RC algorithms, so move it into those.
--- drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 20 ++++++++++++-------- drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 15 +++++++++------ net/mac80211/rc80211_pid_algo.c | 2 -- net/mac80211/sta_info.h | 2 -- 4 files changed, 21 insertions(+), 18 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +9 -6
@@ -163,6 +163,9 @@ struct iwl_lq_sta {u32 dbg_fixed_rate;#endif struct iwl_priv *drv; + +/* used to be in sta_info */ +int last_txrate_idx; }; static void rs_rate_scale_perform(struct iwl_priv *priv,
@@ -1746,7 +1749,7 @@ static void rs_rate_scale_perform(struct is_green = lq_sta->is_green;/* current tx rate */ - index = sta->last_txrate_idx; + index = lq_sta->last_txrate_idx;IWL_DEBUG_RATE ("Rate scale index %d for type %d\n" , index, tbl->lq_type);
@@ -2059,7 +2062,7 @@ lq_update: out: tbl->current_rate =rate_n_flags_from_tbl (tbl, index, is_green); i = index; - sta->last_txrate_idx = i; + lq_sta->last_txrate_idx = i;/* sta->txrate_idx is an index to A mode rates which start * at IWL_FIRST_OFDM_RATE
@@ -2090,7 +2093,7 @@ static void rs_initialize_lq(struct iwl_ goto out; lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; - i = sta->last_txrate_idx; + i = lq_sta->last_txrate_idx;if ((lq_sta->lq.sta_id ==0xff ) && (priv->iw_mode ==NL80211_IFTYPE_ADHOC ))
@@ -2161,7 +2164,7 @@ static void rs_get_rate(void *priv_rate, } lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; - i = sta->last_txrate_idx; + i = lq_sta->last_txrate_idx;if ((priv->iw_mode ==NL80211_IFTYPE_ADHOC ) && !lq_sta->ibss_sta_added) {
@@ -2270,10 +2273,10 @@ static void rs_rate_init(void *priv_rateif (sta->supp_rates[sband->band] &BIT (i)) sta->txrate_idx = i; - sta->last_txrate_idx = sta->txrate_idx; + lq_sta->last_txrate_idx = sta->txrate_idx;/* For MODE_IEEE80211A, skip over cck rates in global rate table */ if (local->hw.conf.channel->band ==IEEE80211_BAND_5GHZ ) - sta->last_txrate_idx +=IWL_FIRST_OFDM_RATE ; + lq_sta->last_txrate_idx +=IWL_FIRST_OFDM_RATE ; lq_sta->is_dup =0 ; lq_sta->is_green =rs_use_green (priv, conf);
net/mac80211/rc80211_pid_algo.c +0 -2
@@ -329,8 +329,6 @@ static void rate_control_pid_get_rate(voif (rateidx >= sband->n_bitrates) rateidx = sband->n_bitrates -1 ; - sta->last_txrate_idx = rateidx; -rcu_read_unlock (); sel->rate_idx = rateidx;
net/mac80211/sta_info.h +0 -2
@@ -200,7 +200,6 @@ struct sta_ampdu_mlme {* @tx_bytes: TBD * @tx_fragments: number of transmitted MPDUs * @txrate_idx: TBD -* @last_txrate_idx: TBD * @tid_seq: TBD * @wme_tx_queue: TBD * @ampdu_mlme: TBD
@@ -278,7 +277,6 @@ struct sta_info {unsigned long tx_bytes;unsigned long tx_fragments;int txrate_idx; -int last_txrate_idx;u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK +1 ];#ifdef CONFIG_MAC80211_DEBUG_COUNTERS unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES ];
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +12 -8
@@ -65,6 +65,9 @@ struct iwl3945_rs_sta {u8 ibss_sta_added;struct timer_list rate_scale_flush;struct iwl3945_rate_scale_data win[IWL_RATE_COUNT ]; + +/* used to be in sta_info */ +int last_txrate_idx; };static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT ] = {
@@ -319,6 +322,7 @@ static void iwl3945_collect_tx_data(strustatic void rs_rate_init (void *priv_rate,void *priv_sta,struct ieee80211_local *local,struct sta_info *sta) { +struct iwl3945_rs_sta *rs_sta = (void *)sta->rate_ctrl_priv;int i;IWL_DEBUG_RATE ("enter\n" );
@@ -335,11 +339,11 @@ static void rs_rate_init(void *priv_rate } } - sta->last_txrate_idx = sta->txrate_idx; + rs_sta->last_txrate_idx = sta->txrate_idx;/* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ if (local->hw.conf.channel->band ==IEEE80211_BAND_5GHZ ) - sta->last_txrate_idx +=IWL_FIRST_OFDM_RATE ; + rs_sta->last_txrate_idx +=IWL_FIRST_OFDM_RATE ;IWL_DEBUG_RATE ("leave\n" ); }
@@ -674,14 +678,14 @@ static void rs_get_rate(void *priv_rate,return ; } + rs_sta = (void *)sta->rate_ctrl_priv; + rate_mask = sta->supp_rates[sband->band]; - index =min (sta->last_txrate_idx &0xffff ,IWL_RATE_COUNT -1 ); + index =min (rs_sta->last_txrate_idx &0xffff ,IWL_RATE_COUNT -1 );if (sband->band ==IEEE80211_BAND_5GHZ ) rate_mask = rate_mask <<IWL_FIRST_OFDM_RATE ; - rs_sta = (void *)sta->rate_ctrl_priv; -if ((priv->iw_mode ==NL80211_IFTYPE_ADHOC ) && !rs_sta->ibss_sta_added) {u8 sta_id =iwl3945_hw_find_station (priv, hdr->addr1);
@@ -803,11 +807,11 @@ static void rs_get_rate(void *priv_rate, out: - sta->last_txrate_idx = index; + rs_sta->last_txrate_idx = index;if (sband->band ==IEEE80211_BAND_5GHZ ) - sta->txrate_idx = sta->last_txrate_idx -IWL_FIRST_OFDM_RATE ; + sta->txrate_idx = rs_sta->last_txrate_idx -IWL_FIRST_OFDM_RATE ;else - sta->txrate_idx = sta->last_txrate_idx; + sta->txrate_idx = rs_sta->last_txrate_idx;rcu_read_unlock ();
Johannes Berg
maintainer[PATCH 21/18] mac80211: share sta->supp_rates
In reply to Johannes BergAs more preparation for a saner rate control algorithm API, share the supported rates bitmap in the public API.
--- drivers/net/wireless/ath9k/rc.c | 2 +- drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 4 ++-- drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 6 +++--- include/net/mac80211.h | 2 ++ net/mac80211/cfg.c | 2 +- net/mac80211/mesh_plink.c | 4 ++-- net/mac80211/mlme.c | 8 ++++---- net/mac80211/rate.h | 2 +- net/mac80211/sta_info.h | 2 -- 9 files changed, 16 insertions(+), 16 deletions(-)
include/net/mac80211.h +2 -0
@@ -666,10 +666,12 @@ enum set_key_cmd {* * @addr: MAC address * @aid: AID we assigned to the station if we're an AP +* @supp_rates: Bitmap of supported rates (per band) * @drv_priv: data area for driver use, will always be aligned to * sizeof(void *), size is determined in hw information. */ struct ieee80211_sta { +u64 supp_rates[IEEE80211_NUM_BANDS ];u8 addr[ETH_ALEN ];u16 aid;
net/mac80211/cfg.c +1 -1
@@ -662,7 +662,7 @@ static void sta_apply_parameters(struct rates |=BIT (j); } } - sta->supp_rates[local->oper_channel->band] = rates; + sta->sta.supp_rates[local->oper_channel->band] = rates; }if (params->ht_capa) {
net/mac80211/mlme.c +4 -4
@@ -1332,7 +1332,7 @@ static void ieee80211_rx_mgmt_assoc_resp } } - sta->supp_rates[local->hw.conf.channel->band] = rates; + sta->sta.supp_rates[local->hw.conf.channel->band] = rates; sdata->bss_conf.basic_rates = basic_rates;/* cf. IEEE 802.11 9.2.12 */
@@ -1528,9 +1528,9 @@ static void ieee80211_rx_bss_info(structif (sta) {u64 prev_rates; - prev_rates = sta->supp_rates[band]; + prev_rates = sta->sta.supp_rates[band];/* make sure mandatory rates are always added */ - sta->supp_rates[band] = supp_rates | + sta->sta.supp_rates[band] = supp_rates |ieee80211_mandatory_rates (local, band);#ifdef CONFIG_MAC80211_IBSS_DEBUG
@@ -2369,7 +2369,7 @@ struct sta_info *ieee80211_ibss_add_sta(set_sta_flags (sta,WLAN_STA_AUTHORIZED );/* make sure mandatory rates are always added */ - sta->supp_rates[band] = supp_rates | + sta->sta.supp_rates[band] = supp_rates |ieee80211_mandatory_rates (local, band);rate_control_rate_init (sta, local);
net/mac80211/rate.h +1 -1
@@ -134,7 +134,7 @@ static inline int rate_supported(struct enum ieee80211_band band, int index) { -return (sta ==NULL || sta->supp_rates[band] &BIT (index)); +return (sta ==NULL || sta->sta.supp_rates[band] &BIT (index)); } static inline s8
net/mac80211/sta_info.h +0 -2
@@ -168,7 +168,6 @@ struct sta_ampdu_mlme {* in the header file. * @flaglock: spinlock for flags accesses * @ht_info: HT capabilities of this STA -* @supp_rates: Bitmap of supported rates (per band) * @addr: MAC address of this STA * @aid: STA's unique AID (1..2007, 0 = not assigned yet), * only used in AP (and IBSS?) mode
@@ -228,7 +227,6 @@ struct sta_info {spinlock_t lock;spinlock_t flaglock;struct ieee80211_ht_info ht_info; -u64 supp_rates[IEEE80211_NUM_BANDS ];u16 listen_interval;
net/mac80211/mesh_plink.c +2 -2
@@ -106,7 +106,7 @@ static struct sta_info *mesh_plink_allocreturn NULL ; sta->flags =WLAN_STA_AUTHORIZED ; - sta->supp_rates[local->hw.conf.channel->band] = rates; + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;return sta; }
@@ -243,7 +243,7 @@ void mesh_neighbour_update(u8 *hw_addr, } sta->last_rx = jiffies; - sta->supp_rates[local->hw.conf.channel->band] = rates; + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;if (peer_accepting_plinks && sta->plink_state ==PLINK_LISTEN && sdata->u.mesh.accepting_plinks && sdata->u.mesh.mshcfg.auto_open_plinks)
drivers/net/wireless/ath9k/rc.c +1 -1
@@ -1825,7 +1825,7 @@ static void ath_setup_rates(struct ieee8 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];for (i =0 ; i < sband->n_bitrates; i++) { -if (sta->supp_rates[local->hw.conf.channel->band] &BIT (i)) { +if (sta->sta.supp_rates[local->hw.conf.channel->band] &BIT (i)) { rc_priv->neg_rates.rs_rates[j] = (sband->bitrates[i].bitrate *2 ) /10 ; j++;
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +2 -2
@@ -333,7 +333,7 @@ static void rs_rate_init(void *priv_rate* after assoc.. */ for (i =IWL_RATE_COUNT -1 ; i >=0 ; i--) { -if (sta->supp_rates[local->hw.conf.channel->band] & (1 << i)) { +if (sta->sta.supp_rates[local->hw.conf.channel->band] & (1 << i)) { sta->txrate_idx = i;break ; }
@@ -680,7 +680,7 @@ static void rs_get_rate(void *priv_rate, rs_sta = (void *)sta->rate_ctrl_priv; - rate_mask = sta->supp_rates[sband->band]; + rate_mask = sta->sta.supp_rates[sband->band]; index =min (rs_sta->last_txrate_idx &0xffff ,IWL_RATE_COUNT -1 );if (sband->band ==IEEE80211_BAND_5GHZ )
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +3 -3
@@ -1731,7 +1731,7 @@ static void rs_rate_scale_perform(structreturn ; lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; - lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; + lq_sta->supp_rates = sta->sta.supp_rates[lq_sta->band]; tid =rs_tl_add_packet (lq_sta, hdr);
@@ -2233,7 +2233,7 @@ static void rs_rate_init(void *priv_rate sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; lq_sta->flush_timer =0 ; - lq_sta->supp_rates = sta->supp_rates[sband->band]; + lq_sta->supp_rates = sta->sta.supp_rates[sband->band]; sta->txrate_idx =3 ;for (j =0 ; j <LQ_SIZE ; j++)for (i =0 ; i <IWL_RATE_COUNT ; i++)
@@ -2270,7 +2270,7 @@ static void rs_rate_init(void *priv_rate/* Find highest tx rate supported by hardware and destination station */ for (i =0 ; i < sband->n_bitrates; i++) -if (sta->supp_rates[sband->band] &BIT (i)) +if (sta->sta.supp_rates[sband->band] &BIT (i)) sta->txrate_idx = i; lq_sta->last_txrate_idx = sta->txrate_idx;
Johannes Berg
maintainer[PATCH 22/18] mac80211: move txrate_idx into RC algorithms
In reply to Johannes BergThe sta_info->txrate_idx member isn't used by all RC algorithms in the way it was intended to be used, move it into those that require it (only PID) and keep track in the core code of which rate was last used for reporting to userspace and the mesh MLME.
--- drivers/net/wireless/ath9k/rc.c | 1 drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 10 ++------ drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 13 +---------- net/mac80211/mesh_hwmp.c | 2 - net/mac80211/rc80211_pid.h | 2 + net/mac80211/rc80211_pid_algo.c | 33 ++++++++++++++++------------- net/mac80211/sta_info.h | 2 - net/mac80211/tx.c | 2 + net/mac80211/wext.c | 4 +-- 9 files changed, 32 insertions(+), 37 deletions(-)
net/mac80211/mesh_hwmp.c +1 -1
@@ -223,7 +223,7 @@ static u32 airtime_link_metric_get(struc/* bitrate is in units of 100 Kbps, while we need rate in units of * 1Mbps. This will be corrected on tx_time computation. */ - rate = sband->bitrates[sta->txrate_idx].bitrate; + rate = sband->bitrates[sta->last_txrate_idx].bitrate; tx_time = (device_constant +10 * test_frame_len / rate); estimated_retx = ((1 << (2 *ARITH_SHIFT )) / (s_unit - err)); result = (tx_time * estimated_retx) >> (2 *ARITH_SHIFT ) ;
net/mac80211/sta_info.h +1 -1
@@ -274,7 +274,7 @@ struct sta_info {unsigned long tx_packets;unsigned long tx_bytes;unsigned long tx_fragments; -int txrate_idx; +unsigned int last_txrate_idx;u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK +1 ];#ifdef CONFIG_MAC80211_DEBUG_COUNTERS unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES ];
net/mac80211/wext.c +2 -2
@@ -636,8 +636,8 @@ static int ieee80211_ioctl_giwrate(struc sta =sta_info_get (local, sdata->u.sta.bssid); -if (sta && sta->txrate_idx < sband->n_bitrates) - rate->value = sband->bitrates[sta->txrate_idx].bitrate; +if (sta && sta->last_txrate_idx < sband->n_bitrates) + rate->value = sband->bitrates[sta->last_txrate_idx].bitrate;else rate->value =0 ;
net/mac80211/rc80211_pid.h +2 -0
@@ -180,6 +180,8 @@ struct rc_pid_sta_info {u32 tx_num_failed;u32 tx_num_xmit; +int txrate_idx; +/* Average failed frames percentage error (i.e. actual vs. target * percentage), scaled by RC_PID_SMOOTHING. This value is computed * using using an exponential weighted average technique:
net/mac80211/rc80211_pid_algo.c +19 -14
@@ -75,7 +75,8 @@ static void rate_control_pid_adjust_ratestruct ieee80211_sub_if_data *sdata;struct ieee80211_supported_band *sband;int cur_sorted, new_sorted, probe, tmp, n_bitrates, band; -int cur = sta->txrate_idx; +struct rc_pid_sta_info *spinfo = (void *)sta->rate_ctrl_priv; +int cur = spinfo->txrate_idx; sdata = sta->sdata; sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
@@ -111,7 +112,7 @@ static void rate_control_pid_adjust_rate/* Fit the rate found to the nearest supported rate. */ do { if (rate_supported(sta, band, rinfo[tmp].index)) { - sta->txrate_idx = rinfo[tmp].index; + spinfo->txrate_idx = rinfo[tmp].index; break; } if (adj < 0)
@@ -121,9 +122,9 @@ static void rate_control_pid_adjust_rate }while (tmp < n_bitrates && tmp >=0 );#ifdef CONFIG_MAC80211_DEBUGFS -rate_control_pid_event_rate_change ( - &((struct rc_pid_sta_info *)sta->rate_ctrl_priv)->events, - sta->txrate_idx, sband->bitrates[sta->txrate_idx].bitrate); +rate_control_pid_event_rate_change (&spinfo->events, + spinfo->txrate_idx, + sband->bitrates[spinfo->txrate_idx].bitrate);#endif }
@@ -190,16 +191,16 @@ static void rate_control_pid_sample(stru spinfo->tx_num_failed =0 ;/* If we just switched rate, update the rate behaviour info. */ -if (pinfo->oldrate != sta->txrate_idx) { +if (pinfo->oldrate != spinfo->txrate_idx) { i = rinfo[pinfo->oldrate].rev_index; - j = rinfo[sta->txrate_idx].rev_index; + j = rinfo[spinfo->txrate_idx].rev_index; tmp = (pf - spinfo->last_pf); tmp =RC_PID_DO_ARITH_RIGHT_SHIFT (tmp,RC_PID_ARITH_SHIFT ); rinfo[j].diff = rinfo[i].diff + tmp; - pinfo->oldrate = sta->txrate_idx; + pinfo->oldrate = spinfo->txrate_idx; }rate_control_pid_normalize (pinfo, sband->n_bitrates);
@@ -252,19 +253,20 @@ static void rate_control_pid_tx_status(vif (!sta) goto unlock; + spinfo = sta->rate_ctrl_priv; +/* Don't update the state if we're not controlling the rate. */ sdata = sta->sdata;if (sdata->force_unicast_rateidx >-1 ) { - sta->txrate_idx = sdata->max_ratectrl_rateidx; + spinfo->txrate_idx = sdata->max_ratectrl_rateidx; goto unlock; }/* Ignore all frames that were sent with a different rate than the rate * we currently advise mac80211 to use. */ -if (info->tx_rate_idx != sta->txrate_idx) +if (info->tx_rate_idx != spinfo->txrate_idx) goto unlock; - spinfo = sta->rate_ctrl_priv; spinfo->tx_num_xmit++;#ifdef CONFIG_MAC80211_DEBUGFS
@@ -301,6 +303,7 @@ static void rate_control_pid_get_rate(vostruct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr);struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;struct ieee80211_sub_if_data *sdata; +struct rc_pid_sta_info *spinfo;struct sta_info *sta;int rateidx;u16 fc;
@@ -321,10 +324,11 @@ static void rate_control_pid_get_rate(vo/* If a forced rate is in effect, select it. */ sdata =IEEE80211_DEV_TO_SUB_IF (dev); + spinfo = (struct rc_pid_sta_info *)sta->rate_ctrl_priv;if (sdata->force_unicast_rateidx >-1 ) - sta->txrate_idx = sdata->force_unicast_rateidx; + spinfo->txrate_idx = sdata->force_unicast_rateidx; - rateidx = sta->txrate_idx; + rateidx = spinfo->txrate_idx;if (rateidx >= sband->n_bitrates) rateidx = sband->n_bitrates -1 ;
@@ -349,9 +353,10 @@ static void rate_control_pid_rate_init(v* Until that method is implemented, we will use the lowest supported * rate as a workaround. */ struct ieee80211_supported_band *sband; +struct rc_pid_sta_info *spinfo = (void *)sta->rate_ctrl_priv; sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - sta->txrate_idx =rate_lowest_index (local, sband, sta); + spinfo->txrate_idx =rate_lowest_index (local, sband, sta); sta->fail_avg =0 ; }
drivers/net/wireless/ath9k/rc.c +0 -1
@@ -2039,7 +2039,6 @@ static void ath_rate_init(void *priv, voDPRINTF (sc,ATH_DBG_RATE ,"%s\n" , __func__); sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - sta->txrate_idx =rate_lowest_index (local, sband, sta);ath_setup_rates (local, sta);if (conf->flags &IEEE80211_CONF_SUPPORT_HT_MODE ) {
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +3 -7
@@ -334,13 +334,11 @@ static void rs_rate_init(void *priv_ratefor (i =IWL_RATE_COUNT -1 ; i >=0 ; i--) {if (sta->sta.supp_rates[local->hw.conf.channel->band] & (1 << i)) { - sta->txrate_idx = i; + rs_sta->last_txrate_idx = i;break ; } } - rs_sta->last_txrate_idx = sta->txrate_idx; -/* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ if (local->hw.conf.channel->band ==IEEE80211_BAND_5GHZ ) rs_sta->last_txrate_idx +=IWL_FIRST_OFDM_RATE ;
@@ -809,15 +807,13 @@ static void rs_get_rate(void *priv_rate, rs_sta->last_txrate_idx = index;if (sband->band ==IEEE80211_BAND_5GHZ ) - sta->txrate_idx = rs_sta->last_txrate_idx -IWL_FIRST_OFDM_RATE ; + sel->rate_idx = rs_sta->last_txrate_idx -IWL_FIRST_OFDM_RATE ;else - sta->txrate_idx = rs_sta->last_txrate_idx; + sel->rate_idx = rs_sta->last_txrate_idx;rcu_read_unlock ();IWL_DEBUG_RATE ("leave: %d\n" , index); - - sel->rate_idx = sta->txrate_idx; }static struct rate_control_ops rs_ops = {
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +2 -11
@@ -2064,14 +2064,6 @@ out: i = index; lq_sta->last_txrate_idx = i; -/* sta->txrate_idx is an index to A mode rates which start -* at IWL_FIRST_OFDM_RATE -*/ -if (lq_sta->band ==IEEE80211_BAND_5GHZ ) - sta->txrate_idx = i -IWL_FIRST_OFDM_RATE ; -else - sta->txrate_idx = i; -return ; }
@@ -2234,7 +2226,6 @@ static void rs_rate_init(void *priv_rate lq_sta->flush_timer =0 ; lq_sta->supp_rates = sta->sta.supp_rates[sband->band]; - sta->txrate_idx =3 ;for (j =0 ; j <LQ_SIZE ; j++)for (i =0 ; i <IWL_RATE_COUNT ; i++)rs_rate_scale_clear_window (&lq_sta->lq_info[j].win[i]);
@@ -2269,11 +2260,11 @@ static void rs_rate_init(void *priv_rate }/* Find highest tx rate supported by hardware and destination station */ + lq_sta->last_txrate_idx =3 ;for (i =0 ; i < sband->n_bitrates; i++)if (sta->sta.supp_rates[sband->band] &BIT (i)) - sta->txrate_idx = i; + lq_sta->last_txrate_idx = i; - lq_sta->last_txrate_idx = sta->txrate_idx;/* For MODE_IEEE80211A, skip over cck rates in global rate table */ if (local->hw.conf.channel->band ==IEEE80211_BAND_5GHZ ) lq_sta->last_txrate_idx +=IWL_FIRST_OFDM_RATE ;
net/mac80211/tx.c +2 -0
@@ -485,6 +485,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021if (likely (tx->rate_idx <0 )) {rate_control_get_rate (tx->dev, sband, tx->skb, &rsel); +if (tx->sta) + tx->sta->last_txrate_idx = rsel.rate_idx; tx->rate_idx = rsel.rate_idx;if (unlikely (rsel.probe_idx >=0 )) { info->flags |=IEEE80211_TX_CTL_RATE_CTRL_PROBE ;
Johannes Berg
maintainer[PATCH 23/18] mac80211: share sta_info->ht_info
In reply to Johannes BergRate control algorithms may need access to a station's HT capabilities, so share the ht_info struct in the public station API.
--- drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 6 +++--- include/net/mac80211.h | 2 ++ net/mac80211/cfg.c | 2 +- net/mac80211/mlme.c | 4 ++-- net/mac80211/sta_info.h | 2 -- 5 files changed, 8 insertions(+), 8 deletions(-)
include/net/mac80211.h +2 -0
@@ -667,6 +667,7 @@ enum set_key_cmd {* @addr: MAC address * @aid: AID we assigned to the station if we're an AP * @supp_rates: Bitmap of supported rates (per band) +* @ht_info: HT capabilities of this STA * @drv_priv: data area for driver use, will always be aligned to * sizeof(void *), size is determined in hw information. */
@@ -674,6 +675,7 @@ struct ieee80211_sta {u64 supp_rates[IEEE80211_NUM_BANDS ];u8 addr[ETH_ALEN ];u16 aid; +struct ieee80211_ht_info ht_info;/* must be last */ u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
net/mac80211/sta_info.h +0 -2
@@ -167,7 +167,6 @@ struct sta_ampdu_mlme {* @lock: used for locking all fields that require locking, see comments * in the header file. * @flaglock: spinlock for flags accesses -* @ht_info: HT capabilities of this STA * @addr: MAC address of this STA * @aid: STA's unique AID (1..2007, 0 = not assigned yet), * only used in AP (and IBSS?) mode
@@ -226,7 +225,6 @@ struct sta_info {void *rate_ctrl_priv;spinlock_t lock;spinlock_t flaglock; -struct ieee80211_ht_info ht_info;u16 listen_interval;
net/mac80211/cfg.c +1 -1
@@ -667,7 +667,7 @@ static void sta_apply_parameters(structif (params->ht_capa) {ieee80211_ht_cap_ie_to_ht_info (params->ht_capa, - &sta->ht_info); + &sta->sta.ht_info); }if (ieee80211_vif_is_mesh (&sdata->vif) && params->plink_action) {
net/mac80211/mlme.c +2 -2
@@ -1347,11 +1347,11 @@ static void ieee80211_rx_mgmt_assoc_respstruct ieee80211_ht_bss_info bss_info;ieee80211_ht_cap_ie_to_ht_info ( (struct ieee80211_ht_cap *) - elems.ht_cap_elem, &sta->ht_info); + elems.ht_cap_elem, &sta->sta.ht_info);ieee80211_ht_addt_info_ie_to_ht_bss_info ( (struct ieee80211_ht_addt_info *) elems.ht_info_elem, &bss_info); -ieee80211_handle_ht (local,1 , &sta->ht_info, &bss_info); +ieee80211_handle_ht (local,1 , &sta->sta.ht_info, &bss_info); }rate_control_rate_init (sta, local);
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +3 -3
@@ -1154,10 +1154,10 @@ static int rs_switch_to_mimo2(struct iwls8 is_green = lq_sta->is_green;if (!(conf->flags &IEEE80211_CONF_SUPPORT_HT_MODE ) || - !sta->ht_info.ht_supported) + !sta->sta.ht_info.ht_supported)return -1 ; -if (((sta->ht_info.cap &IEEE80211_HT_CAP_SM_PS ) >>2 ) +if (((sta->sta.ht_info.cap &IEEE80211_HT_CAP_SM_PS ) >>2 ) ==WLAN_HT_CAP_SM_PS_STATIC )return -1 ;
@@ -1222,7 +1222,7 @@ static int rs_switch_to_siso(struct iwl_s32 rate;if (!(conf->flags &IEEE80211_CONF_SUPPORT_HT_MODE ) || - !sta->ht_info.ht_supported) + !sta->sta.ht_info.ht_supported)return -1 ;IWL_DEBUG_RATE ("LQ: try to switch to SISO\n" );
Johannes Berg
maintainer[PATCH 24/18] iwlwifi: don't access mac80211's AMPDU state machine
In reply to Johannes BergThere really is no need, at worst ieee80211_start_tx_ba_session will log a message when debugging is enabled, and poking such internals of mac80211 definitely doesn't belong into an RC algorithm.
--- drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +1 -7
@@ -359,15 +359,9 @@ static void rs_tl_turn_on_agg_for_tid(st struct iwl_lq_sta *lq_data, u8 tid, struct sta_info *sta) { - unsigned long state;DECLARE_MAC_BUF (mac ); -spin_lock_bh (&sta->lock); - state = sta->ampdu_mlme.tid_state_tx[tid]; -spin_unlock_bh (&sta->lock); - -if (state ==HT_AGG_STATE_IDLE && -rs_tl_get_load (lq_data, tid) >IWL_AGG_LOAD_THRESHOLD ) { +if (rs_tl_get_load (lq_data, tid) >IWL_AGG_LOAD_THRESHOLD ) {IWL_DEBUG_HT ("Starting Tx agg: STA: %s tid: %d\n" ,print_mac (mac, sta->sta.addr), tid);ieee80211_start_tx_ba_session (priv->hw, sta->sta.addr, tid);
Johannes Berg
maintainer[PATCH 25/18] mac80211: pass AP vif pointer for VLANs
In reply to Johannes BergWe cannot pass a VLAN vif pointer to the driver since those are entirely virtual and we never tell the driver.
--- net/mac80211/tx.c | 4 ++++ 1 file changed, 4 insertions(+)
net/mac80211/tx.c +4 -0
@@ -1351,6 +1351,10 @@ int ieee80211_master_start_xmit(struct sreturn 0 ; } +if (osdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) + osdata =container_of (osdata->bss, + struct ieee80211_sub_if_data, + u.ap); info->control.vif = &osdata->vif; ret =ieee80211_tx (odev, skb);dev_put (odev);
cover mac80211 cleanups and fixes
In reply to Johannes BergQuoted 11 lines · Johannes Berg
Hi,
Here's another series to clean up a bit including a few things that I've been meaning to do for a long time:
* mac80211: move
ieee80211_set_freqto utils
* mac80211: makebridge_packetsa virtual interface option
* mac80211: clean up some comments
* mac80211: inform driver of basic rateset
* mac80211: use nl80211 interface types
Quoted 8 lines
I'd been talking with Sujith about this one:
* mac80211: share STA information with driver
and decided to just do it; as it stands it's not very useful but I expect it to be used soon, if not we can remove the
EXPORT_SYMBOLagain.
This would be very useful for ath9k. Making use of the private area for each STA can enable removal of the node list that is maintained currently.
Sujith
Johannes Berg
maintainerQuoted 4 lines · Sujith
Quoted 4 lines
I'd been talking with Sujith about this one:
* mac80211: share STA information with driver
Quoted 8 lines
Quoted 4 lines
and decided to just do it; as it stands it's not very useful but I expect it to be used soon, if not we can remove the
EXPORT_SYMBOLagain.This would be very useful for ath9k. Making use of the private area for each STA can enable removal of the node list that is maintained currently.
I had actually tried
(http://johannes.sipsolutions.net/patches/kernel/ath9k-sta-node.patch)
but you're using refcounting for the nodes while mac80211 RCU-protects them, so I didn't get very far. It needs a bit more effort to make sure you don't have node pointers stick around in some tx descriptor after mac80211 decides to remove a node (which may very well happen while frames are queued)
johannes
Quoted 11 lines · Johannes Berg
Quoted 9 lines · Sujith
Quoted 8 lines
I'd been talking with Sujith about this one:
* mac80211: share STA information with driver
and decided to just do it; as it stands it's not very useful but I expect it to be used soon, if not we can remove the
EXPORT_SYMBOLagain.
Quoted 8 lines
Quoted 3 lines
This would be very useful for ath9k. Making use of the private area for each STA can enable removal of the node list that is maintained currently.
I had actually tried
(http://johannes.sipsolutions.net/patches/kernel/ath9k-sta-node.patch)
but you're using refcounting for the nodes while mac80211 RCU-protects them, so I didn't get very far.
Good thing I read RCU docs yesterday.
We should be able to remove ref counts and simply use RCU and sychronize_rcu() before deletion.
Quoted 4 lines
It needs a bit more effort to make sure
you don't have node pointers stick around in some tx descriptor after mac80211 decides to remove a node (which may very well happen while frames are queued)
We can call_rcu() here no, and let the driver deal with what it needs to prior to deletion?
Luis
Johannes Berg
maintainerQuoted 6 lines · Luis R. Rodriguez
Quoted 4 lines
I had actually tried
(http://johannes.sipsolutions.net/patches/kernel/ath9k-sta-node.patch)
but you're using refcounting for the nodes while mac80211 RCU-protects them, so I didn't get very far.Good thing I read RCU docs yesterday.
Heh.
Quoted 2 lines
We should be able to remove ref counts and simply use RCU and
sychronize_rcu()before deletion.
Well you don't get to control deletion then, that's another thing.
Quoted 7 lines
Quoted 4 lines
It needs a bit more effort to make sure
you don't have node pointers stick around in some tx descriptor after mac80211 decides to remove a node (which may very well happen while frames are queued)We can
call_rcu()here no, and let the driver deal with what it needs to prior to deletion?
The driver already gets notified via sta_notify() that the sta is about to be deleted, it must make sure that no matter what sort of references it kept, the sta will not be accessed after that sta_notify call.
johannes
Quoted 7 lines · Johannes Berg
Quoted 5 lines · Luis R. Rodriguez
Quoted 4 lines
I had actually tried
(http://johannes.sipsolutions.net/patches/kernel/ath9k-sta-node.patch)
but you're using refcounting for the nodes while mac80211 RCU-protects them, so I didn't get very far.
Quoted 8 lines
Quoted 1 line
Good thing I read RCU docs yesterday.
Heh.
Quoted 2 lines
We should be able to remove ref counts and simply use RCU and
sychronize_rcu()before deletion.Well you don't get to control deletion then, that's another thing.
Does it matter? Our driver won't care as long as the entry still exists. Just as with stale routing tables, does it matter if we keep thinking we have a node for a few moments later?
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
It needs a bit more effort to make sure
you don't have node pointers stick around in some tx descriptor after mac80211 decides to remove a node (which may very well happen while frames are queued)We can
call_rcu()here no, and let the driver deal with what it needs to prior to deletion?The driver already gets notified via
sta_notify()that the sta is about to be deleted, it must make sure that no matter what sort of references it kept, the sta will not be accessed after thatsta_notifycall.
Ah good point. Then what is the issue?
Luis
Johannes Berg
maintainerQuoted 5 lines · Luis R. Rodriguez
Quoted 3 lines
The driver already gets notified via
sta_notify()that the sta is about to be deleted, it must make sure that no matter what sort of references it kept, the sta will not be accessed after thatsta_notifycall.Ah good point. Then what is the issue?
Well, mostly that ath9k right now assumes it controls the lifetime, and it won't do that afterwards, so since I didn't want to read all of the code I failed to change it that way because I didn't know where node pointers are kept. It's not a huge issue really, but the lifetime management change is somewhat involved, I think.
johannes
Quoted 6 lines · Johannes Berg
Quoted 4 lines · Luis R. Rodriguez
Quoted 3 lines
The driver already gets notified via
sta_notify()that the sta is about to be deleted, it must make sure that no matter what sort of references it kept, the sta will not be accessed after thatsta_notifycall.
Quoted 7 lines
Quoted 1 line
Ah good point. Then what is the issue?
Well, mostly that ath9k right now assumes it controls the lifetime, and it won't do that afterwards, so since I didn't want to read all of the code I failed to change it that way because I didn't know where node pointers are kept. It's not a huge issue really, but the lifetime management change is somewhat involved, I think.
Sure, it just needs a review.
Luis
Quoted 3 lines · Johannes Berg
Quoted 2 lines · Luis R. Rodriguez
Quoted 2 lines
I had actually tried
(http://johannes.sipsolutions.net/patches/kernel/ath9k-sta-node.patch)
Just a comment so far from the patch.
Review
Quoted 3 lines
(quoted diff) +3
-0+ rcu_read_unlock(); + + /* the "!an" here is fine even outside RCU lock */
Why is that? I fail to see that.
Luis
Johannes Berg
maintainerQuoted 5 lines · Luis R. Rodriguez
Quoted 3 lines · Johannes Berg
Quoted 2 lines · Luis R. Rodriguez
Quoted 2 lines
I had actually tried
(http://johannes.sipsolutions.net/patches/kernel/ath9k-sta-node.patch)
Quoted 7 lines
Just a comment so far from the patch.
Review
Quoted 3 lines
(quoted diff) +3
-0+ rcu_read_unlock(); + + /* the "!an" here is fine even outside RCU lock */Why is that? I fail to see that.
Well take the larger bit of code:
struct something *an = NULL;
...
rcu_read_lock(); sta = ieee80211_find_sta(hw, hdr->addr2); if (sta) an = (void *) sta->drv_priv;
if (an) {
ath_rx_input(sc, an,
hw->conf.ht_conf.ht_supported, skb, status, &st);
}
rcu_read_unlock(); /* the "!an" here is fine even outside RCU lock */
if (!an || (st != ATH_RX_CONSUMED))
__ieee80211_rx(hw, skb, &rx_status);
So at this point it's only checking whether above it had a pointer, it's not accessing it. Think of the "an" variable, after rcu_read_unlock(), as a bool indicating whether or not the code that just happened had access to the node or not.
johannes
Johannes Berg
maintainerQuoted 23 lines · Johannes Berg
Well take the larger bit of code:
struct something *an = NULL;...
rcu_read_lock(); sta = ieee80211_find_sta(hw, hdr->addr2); if (sta) an = (void *) sta->drv_priv;(quoted diff) +0
-0if (an) { ath_rx_input(sc, an, hw->conf.ht_conf.ht_supported, skb, status, &st); }rcu_read_unlock(); /* the "!an" here is fine even outside RCU lock */(quoted diff) +0
-0if (!an || (st != ATH_RX_CONSUMED)) __ieee80211_rx(hw, skb, &rx_status);
Quoted 4 lines
So at this point it's only checking whether above it had a pointer, it's not accessing it. Think of the "an" variable, after
rcu_read_unlock(), as a bool indicating whether or not the code that just happened had access to the node or not.
That said, here it's probably smarter to just initialise "st" to something other than _RX_CONSUMED and remove that !an condition entirely.
johannes
Johannes Berg
maintainerQuoted 25 lines · Johannes Berg
Quoted 23 lines · Johannes Berg
Well take the larger bit of code:
struct something *an = NULL;...
rcu_read_lock(); sta = ieee80211_find_sta(hw, hdr->addr2); if (sta) an = (void *) sta->drv_priv;(quoted diff) +0
-0if (an) { ath_rx_input(sc, an, hw->conf.ht_conf.ht_supported, skb, status, &st); }rcu_read_unlock(); /* the "!an" here is fine even outside RCU lock */(quoted diff) +0
-0if (!an || (st != ATH_RX_CONSUMED)) __ieee80211_rx(hw, skb, &rx_status);
Quoted 8 lines
Quoted 4 lines
So at this point it's only checking whether above it had a pointer, it's not accessing it. Think of the "an" variable, after
rcu_read_unlock(), as a bool indicating whether or not the code that just happened had access to the node or not.That said, here it's probably smarter to just initialise "st" to something other than
_RX_CONSUMEDand remove that !an condition entirely.
And why is that not the return value of ath_rx_input? Anyway, I'm getting off-topic here :)
johannes
Quoted 37 lines · Johannes Berg
Quoted 5 lines · Luis R. Rodriguez
Quoted 3 lines · Johannes Berg
Quoted 2 lines · Luis R. Rodriguez
Quoted 2 lines
I had actually tried
(http://johannes.sipsolutions.net/patches/kernel/ath9k-sta-node.patch)Quoted 7 lines
Just a comment so far from the patch.
Review
Quoted 3 lines
(quoted diff) +3
-0+ rcu_read_unlock(); + + /* the "!an" here is fine even outside RCU lock */Why is that? I fail to see that.
Well take the larger bit of code:
struct something *an = NULL;...
rcu_read_lock(); sta = ieee80211_find_sta(hw, hdr->addr2); if (sta) an = (void *) sta->drv_priv;(quoted diff) +0
-0if (an) { ath_rx_input(sc, an, hw->conf.ht_conf.ht_supported, skb, status, &st); }rcu_read_unlock(); /* the "!an" here is fine even outside RCU lock */(quoted diff) +0
-0if (!an || (st != ATH_RX_CONSUMED)) __ieee80211_rx(hw, skb, &rx_status);
Quoted 4 lines
So at this point it's only checking whether above it had a pointer, it's not accessing it. Think of the "an" variable, after
rcu_read_unlock(), as a bool indicating whether or not the code that just happened had access to the node or not.
I see now, thanks :)
Luis
Quoted 7 lines · Johannes Berg
I had actually tried
(http://johannes.sipsolutions.net/patches/kernel/ath9k-sta-node.patch)
but you're using refcounting for the nodes while mac80211 RCU-protects them, so I didn't get very far. It needs a bit more effort to make sure you don't have node pointers stick around in some tx descriptor after mac80211 decides to remove a node (which may very well happen while frames are queued)
Well, the node stuff is sprinkled throughout ath9k right now, I'll start cleaning up all that and revamp the aggregation logic in the process too. Do you mind if I build on this patch ?
Sujith
Johannes Berg
maintainerQuoted 9 lines · Sujith
Quoted 7 lines · Johannes Berg
I had actually tried
(http://johannes.sipsolutions.net/patches/kernel/ath9k-sta-node.patch)
but you're using refcounting for the nodes while mac80211 RCU-protects them, so I didn't get very far. It needs a bit more effort to make sure you don't have node pointers stick around in some tx descriptor after mac80211 decides to remove a node (which may very well happen while frames are queued)
Quoted 3 lines
Well, the node stuff is sprinkled throughout ath9k right now, I'll start cleaning up all that and revamp the aggregation logic in the process too. Do you mind if I build on this patch ?
Not at all, feel free to use it for whatever you want.
johannes