d80211: Remove curr_rates and fix related concurrency issues
Subsystems (2)
PATCH 2/5 d80211: Do not require drivers to implement reset callback
In reply to Michael WuFrom: Michael Wu <[email protected]>
This prevents drivers from crashing if there is a TX timeout and the reset callback isn't implemented.
---
net/mac80211/ieee80211.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/mac80211/ieee80211.c +1 -1
@@ -2084,7 +2084,7 @@ static void ieee80211_tx_timeout(structprintk (KERN_WARNING "%s: resetting interface.\n" , dev->name); -if (local->ops->reset (local_to_hw (local))) +if (local->ops->reset && local->ops->reset (local_to_hw (local)))printk (KERN_ERR "%s: failed to reset interface.\n" , dev->name);else netif_wake_queue (dev);
PATCH 3/5 d80211: Set carrier status for STA interfaces
In reply to Michael WuFrom: Michael Wu <[email protected]>
This makes STA interfaces set the carrier status based on the current association status.
---
net/mac80211/ieee80211.c | 4 ++++ net/mac80211/ieee80211_sta.c | 3 +++ 2 files changed, 7 insertions(+), 0 deletions(-)
net/mac80211/ieee80211.c +4 -0
@@ -2377,6 +2377,10 @@ static int ieee80211_open(struct net_develse ieee80211_if_config (dev); +if (sdata->type ==IEEE80211_IF_TYPE_STA && + !local->user_space_mlme) +netif_carrier_off (dev); +netif_start_queue (dev);return 0 ; }
net/mac80211/ieee80211_sta.c +3 -0
@@ -375,11 +375,13 @@ static void ieee80211_set_associated(str sdata =IEEE80211_DEV_TO_SUB_IF (dev);if (sdata->type !=IEEE80211_IF_TYPE_STA )return ; +netif_carrier_on (dev); ifsta->prev_bssid_set =1 ;memcpy (ifsta->prev_bssid, sdata->u.sta.bssid,ETH_ALEN );memcpy (wrqu.ap_addr.sa_data, sdata->u.sta.bssid,ETH_ALEN );ieee80211_sta_send_associnfo (dev, ifsta); }else { +netif_carrier_off (dev);memset (wrqu.ap_addr.sa_data,0 ,ETH_ALEN ); } wrqu.ap_addr.sa_family =ARPHRD_ETHER ;
@@ -2007,6 +2009,7 @@ static void ieee80211_sta_reset_auth(str ifsta->auth_alg); ifsta->auth_transaction =-1 ; ifsta->associated = ifsta->auth_tries = ifsta->assoc_tries =0 ; +netif_carrier_off (dev); }
PATCH 1/5 d80211: Remove curr_rates and fix related concurrency issues
From: Michael Wu <[email protected]>
This switches the code from curr_rates and num_curr_rates to directly using the mode and converts portions of the code to use pointers to rates instead of indices to refer to rates. Two new fields are introduced in struct ieee80211_conf which may replace the channel/frequency/channel_val/phymode fields in the future. The rate control is now cleared only when the operating channel is changed.
---
include/net/mac80211.h | 7 ++- net/mac80211/ieee80211.c | 97 +++++++++++++++++------------------- net/mac80211/ieee80211_i.h | 7 +-- net/mac80211/ieee80211_ioctl.c | 40 ++++++++++----- net/mac80211/ieee80211_rate.h | 3 - net/mac80211/ieee80211_scan.c | 2 - net/mac80211/ieee80211_sta.c | 64 ++++++++++++++---------- net/mac80211/ieee80211_sysfs_sta.c | 5 +- net/mac80211/rc80211_simple.c | 57 ++++++++++++--------- net/mac80211/sta_info.c | 4 + 10 files changed, 156 insertions(+), 130 deletions(-)
include/net/mac80211.h +5 -2
@@ -209,8 +209,9 @@ struct ieee80211_tx_control {u8 sw_retry_attempt;/* number of times hw has tried to * transmit frame (not incl. hw retries) */ -int rateidx;/* internal 80211.o rateidx */ -int rts_rateidx;/* internal 80211.o rateidx for RTS/CTS */ +struct ieee80211_rate *rate;/* internal 80211.o rate */ +struct ieee80211_rate *rts_rate;/* internal 80211.o rate +* for RTS/CTS */ int alt_retry_rate;/* retry rate for the last retries, given as the * hw specific value for the rate (from * struct ieee80211_rate). To be used to limit
@@ -272,6 +273,8 @@ struct ieee80211_conf {int channel_val;/* hw specific value for the channel */ int phymode;/* MODE_IEEE80211A, .. */ +struct ieee80211_channel *chan; +struct ieee80211_hw_mode *mode;unsigned int regulatory_domain;int radio_enabled;
net/mac80211/ieee80211.c +47 -50
274 lines not on this page · raw message
net/mac80211/ieee80211_i.h +2 -5
@@ -123,12 +123,12 @@ struct ieee80211_txrx_data { unsigned int ps_buffered:1; unsigned int short_preamble:1; unsigned int probe_last_frag:1; +struct ieee80211_hw_mode *mode;struct ieee80211_rate *rate;/* use this rate (if set) for last fragment; rate can * be set to lower rate for the first fragments, e.g., * when using CTS protection with IEEE 802.11g. */ struct ieee80211_rate *last_frag_rate; -int last_frag_rateidx;int last_frag_hwrate;int mgmt_interface;
@@ -171,6 +171,7 @@ struct ieee80211_tx_stored_packet {struct sk_buff **extra_frag;int last_frag_rateidx;int last_frag_hwrate; +struct ieee80211_rate *last_frag_rate; unsigned int last_frag_rate_ctrl_probe:1; };
@@ -396,10 +397,6 @@ struct ieee80211_local {int iff_allmultis, iff_promiscs;/* number of interfaces with corresponding IFF_ flags */ -/* Current rate table. This is a pointer to hw->modes structure. */ -struct ieee80211_rate *curr_rates; -int num_curr_rates; -struct rate_control_ref *rate_ctrl;int next_mode;/* MODE_IEEE80211*
net/mac80211/ieee80211_ioctl.c +26 -14
@@ -269,6 +269,7 @@ static int ieee80211_ioctl_add_sta(strucu32 rates;int i, j;struct ieee80211_sub_if_data *sdata; +struct ieee80211_hw_mode *mode;int add_key_entry =1 ;/* Prevent a race with changing the rate control algorithm */
@@ -306,13 +307,14 @@ static int ieee80211_ioctl_add_sta(struc sta->listen_interval = param->u.add_sta.listen_interval; rates =0 ; + mode = local->oper_hw_mode;for (i =0 ; i <sizeof (param->u.add_sta.supp_rates); i++) {int rate = (param->u.add_sta.supp_rates[i] &0x7f ) *5 ; -if (local->hw.conf.phymode ==MODE_ATHEROS_TURBO || - local->hw.conf.phymode ==MODE_ATHEROS_TURBOG ) +if (mode->mode ==MODE_ATHEROS_TURBO || + mode->mode ==MODE_ATHEROS_TURBOG ) rate *=2 ; -for (j =0 ; j < local->num_curr_rates; j++) { -if (local->curr_rates[j].rate == rate) +for (j =0 ; j < mode->num_rates; j++) { +if (mode->rates[j].rate == rate) rates |=BIT (j); }
@@ -405,6 +407,7 @@ static int ieee80211_ioctl_get_info_sta( struct prism2_hostapd_param *param) {struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr); +struct ieee80211_hw_mode *mode;struct sta_info *sta; if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
@@ -417,7 +420,7 @@ static int ieee80211_ioctl_get_info_sta( param->u.get_info_sta.tx_bytes = stats->tx_bytes;/* go through all STAs and get STA with lowest max. rate */ param->u.get_info_sta.current_tx_rate = - local->curr_rates[sta_info_min_txrate_get (local)].rate; +sta_info_min_txrate_get (local);return 0 ; }
@@ -434,9 +437,10 @@ static int ieee80211_ioctl_get_info_sta( param->u.get_info_sta.tx_bytes = sta->tx_bytes; param->u.get_info_sta.channel_use = sta->channel_use; param->u.get_info_sta.flags = sta->flags; -if (sta->txrate >=0 && sta->txrate < local->num_curr_rates) + mode = local->oper_hw_mode; +if (sta->txrate >=0 && sta->txrate < mode->num_rates) param->u.get_info_sta.current_tx_rate = - local->curr_rates[sta->txrate].rate; + mode->rates[sta->txrate].rate; param->u.get_info_sta.num_ps_buf_frames =skb_queue_len (&sta->ps_tx_buf); param->u.get_info_sta.tx_retry_failed = sta->tx_retry_failed;
@@ -1805,6 +1809,7 @@ int ieee80211_set_channel(struct ieee802 {struct ieee80211_hw_mode *mode;int c, set =0 ; +int ret = -EINVAL ;list_for_each_entry (mode, &local->modes_list, list) {if (!(local->enabled_modes & (1 << mode->mode)))
@@ -1827,12 +1832,15 @@ int ieee80211_set_channel(struct ieee802if (set) {if (local->sta_scanning) -return 0 ; + ret =0 ;else -return ieee80211_hw_config (local); + ret =ieee80211_hw_config (local); + +rate_control_clear (local); +ieee80211_prepare_rates (local); } -return -EINVAL ; +return ret; } static int ieee80211_ioctl_siwfreq(struct net_device *dev,
@@ -2283,6 +2291,7 @@ ieee80211_ioctl_force_unicast_rate(struc int rate) {struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr); +struct ieee80211_hw_mode *mode;int i;if (sdata->type !=IEEE80211_IF_TYPE_AP )
@@ -2293,8 +2302,9 @@ ieee80211_ioctl_force_unicast_rate(strucreturn 0 ; } -for (i =0 ; i < local->num_curr_rates; i++) { -if (local->curr_rates[i].rate == rate) { + mode = local->oper_hw_mode; +for (i =0 ; i < mode->num_rates; i++) { +if (mode->rates[i].rate == rate) { sdata->u.ap.force_unicast_rateidx = i;return 0 ; }
@@ -2309,6 +2319,7 @@ ieee80211_ioctl_max_ratectrl_rate(struct int rate) {struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr); +struct ieee80211_hw_mode *mode;int i;if (sdata->type !=IEEE80211_IF_TYPE_AP )
@@ -2319,8 +2330,9 @@ ieee80211_ioctl_max_ratectrl_rate(structreturn 0 ; } -for (i =0 ; i < local->num_curr_rates; i++) { -if (local->curr_rates[i].rate == rate) { + mode = local->oper_hw_mode; +for (i =0 ; i < mode->num_rates; i++) { +if (mode->rates[i].rate == rate) { sdata->u.ap.max_ratectrl_rateidx = i;return 0 ; }
net/mac80211/ieee80211_rate.h +1 -2
@@ -26,11 +26,10 @@ struct rate_control_extra {/* values from rate_control_get_rate() to the caller: */ struct ieee80211_rate *probe;/* probe with this rate, or NULL for no * probing */ -int startidx, endidx, rateidx;struct ieee80211_rate *nonerp; -int nonerp_idx;/* parameters from the caller to rate_control_get_rate(): */ +struct ieee80211_hw_mode *mode;int mgmt_data;/* this is data frame that is used for management * (e.g., IEEE 802.1X EAPOL) */ u16 ethertype;
net/mac80211/ieee80211_scan.c +1 -1
@@ -326,7 +326,7 @@ void ieee80211_init_scan(struct ieee8021 local->scan.tx_control.key_idx =HW_KEY_IDX_INVALID ; local->scan.tx_control.flags |=IEEE80211_TXCTL_DO_NOT_ENCRYPT ;memset (&extra,0 ,sizeof (extra)); - extra.endidx = local->num_curr_rates; + extra.mode = local->hw.conf.mode; local->scan.tx_control.tx_rate =rate_control_get_rate (local, local->mdev, local->scan.skb, &extra)->val;
net/mac80211/ieee80211_sta.c +37 -27
172 lines not on this page · raw message
net/mac80211/ieee80211_sysfs_sta.c +3 -2
@@ -40,10 +40,11 @@ static ssize_t show_sta_##name(const str static ssize_t show_sta_##name(const struct sta_info *sta, char *buf) \ { \ struct ieee80211_local *local = wdev_priv(sta->dev->ieee80211_ptr);\ + struct ieee80211_hw_mode *mode = local->oper_hw_mode; \ return sprintf(buf, "%d\n", \ (sta->field >= 0 && \ - sta->field < local->num_curr_rates) ? \ - local->curr_rates[sta->field].rate : -1); \ + sta->field < mode->num_rates) ? \ + mode->rates[sta->field].rate : -1); \ }#define __STA_ATTR (name) \
net/mac80211/rc80211_simple.c +31 -26
156 lines not on this page · raw message
net/mac80211/sta_info.c +3 -1
@@ -80,10 +80,12 @@ EXPORT_SYMBOL(sta_info_get);int sta_info_min_txrate_get (struct ieee80211_local *local) {struct sta_info *sta; +struct ieee80211_hw_mode *mode;int min_txrate =9999999 ;int i;spin_lock_bh (&local->sta_lock); + mode = local->oper_hw_mode;for (i =0 ; i <STA_HASH_SIZE ; i++) { sta = local->sta_hash[i];while (sta) {
@@ -96,7 +98,7 @@ int sta_info_min_txrate_get(struct ieee8if (min_txrate ==9999999 ) min_txrate =0 ; -return min_txrate; +return mode->rates[min_txrate].rate; }
PATCH 4/5 d80211: Stop virtual interfaces during scan
From: Michael Wu <[email protected]>
This prevents data frames from being queued on the master device if it is in the midst of a scan. It also makes both master and virtual interfaces properly set trans_start when frames are sent so the network watchdog does not try to reset the interfaces. tx_queue_len is left as the default on virtual interfaces to allow frames to be queued while the device is scanning.
---
net/mac80211/ieee80211.c | 5 +++-- net/mac80211/ieee80211_sta.c | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-)
net/mac80211/ieee80211.c +3 -2
@@ -1148,6 +1148,7 @@ static int __ieee80211_tx(struct ieee802 ret = local->ops->tx (local_to_hw (local), skb, control);if (ret)return IEEE80211_TX_AGAIN ; + local->mdev->trans_start = jiffies;ieee80211_led_tx (local,1 ); }if (tx->u.tx.extra_frag) {
@@ -1178,6 +1179,7 @@ static int __ieee80211_tx(struct ieee802 control);if (ret)return IEEE80211_TX_FRAG_AGAIN ; + local->mdev->trans_start = jiffies;ieee80211_led_tx (local,1 ); tx->u.tx.extra_frag[i] =NULL ; }
@@ -1588,6 +1590,7 @@ static int ieee80211_subif_start_xmit(st skb->nh.raw = skb->data + nh_pos; skb->h.raw = skb->data + h_pos; + dev->trans_start = jiffies;dev_queue_xmit (skb);return 0 ;
@@ -4433,7 +4436,6 @@ void ieee80211_if_setup(struct net_devic dev->get_stats = ieee80211_get_stats; dev->open = ieee80211_open; dev->stop = ieee80211_stop; - dev->tx_queue_len =0 ; dev->uninit = ieee80211_if_reinit; dev->destructor = ieee80211_if_free; }
@@ -4448,7 +4450,6 @@ void ieee80211_if_mgmt_setup(struct net_ dev->stop = ieee80211_mgmt_stop; dev->type =ARPHRD_IEEE80211_PRISM ; dev->hard_header_parse = header_parse_80211; - dev->tx_queue_len =0 ; dev->uninit = ieee80211_if_reinit; dev->destructor = ieee80211_if_free; }
net/mac80211/ieee80211_sta.c +18 -5
@@ -2527,7 +2527,7 @@ void ieee80211_scan_completed(struct iee {struct ieee80211_local *local =hw_to_local (hw);struct net_device *dev = local->scan_dev; -struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_sub_if_data *sdata;union iwreq_data wrqu;printk (KERN_DEBUG "%s: scan completed\n" , dev->name);
@@ -2542,15 +2542,23 @@ void ieee80211_scan_completed(struct ieememset (&wrqu,0 ,sizeof (wrqu));wireless_send_event (dev,SIOCGIWSCAN , &wrqu,NULL ); +spin_lock_bh (&local->sub_if_lock); +list_for_each_entry (sdata, &local->sub_if_list, list) { +netif_wake_queue (sdata->dev); + +if (sdata->type ==IEEE80211_IF_TYPE_STA ) +ieee80211_sta_timer ((unsigned long )&sdata->u.sta); + } +spin_unlock_bh (&local->sub_if_lock); + + sdata =IEEE80211_DEV_TO_SUB_IF (dev);if (sdata->type ==IEEE80211_IF_TYPE_IBSS ) {struct ieee80211_if_sta *ifsta = &sdata->u.sta;if (!ifsta->bssid_set || (!ifsta->state ==IEEE80211_IBSS_JOINED && !ieee80211_sta_active_ibss (dev)))ieee80211_sta_find_ibss (dev, ifsta); -/* TODO: need to wake every sta interface */ - }else if (sdata->type ==IEEE80211_IF_TYPE_STA ) -ieee80211_sta_timer ((unsigned long )&sdata->u.sta); + } }EXPORT_SYMBOL (ieee80211_scan_completed);
@@ -2637,6 +2645,7 @@ static int ieee80211_sta_start_scan(stru u8 *ssid, size_t ssid_len) {struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr); +struct ieee80211_sub_if_data *sdata;if (ssid_len >IEEE80211_MAX_SSID_LEN )return -EINVAL ;
@@ -2680,7 +2689,11 @@ static int ieee80211_sta_start_scan(stru } local->sta_scanning =1 ; -/* TODO: stop TX queue? */ + +spin_lock_bh (&local->sub_if_lock); +list_for_each_entry (sdata, &local->sub_if_list, list) +netif_stop_queue (sdata->dev); +spin_unlock_bh (&local->sub_if_lock);if (ssid) { local->scan_ssid_len = ssid_len;
PATCH 5/5 d80211: switch STA interfaces to PS mode during scan
In reply to Michael WuFrom: Michael Wu <[email protected]>
This makes scans switch STA interfaces into PS mode so the AP queues frames destined for us while we are scanning. This is achieved by sending a nullfunc data frame with the PS mode bit set before scanning commences, and a PS poll frame after scanning is completed.
---
include/linux/ieee80211.h | 7 ++++ net/mac80211/ieee80211_sta.c | 77 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 76 insertions(+), 8 deletions(-)
include/linux/ieee80211.h +7 -0
@@ -203,6 +203,13 @@ struct ieee80211_cts {__u8 ra[6 ]; } __attribute__ ((packed)); +struct ieee80211_ps_poll { +__le16 frame_control; +__le16 aid; +__u8 bssid[6 ]; +__u8 ta[6 ]; +} __attribute__ ((packed)); +/* Authentication algorithms */ #define WLAN_AUTH_OPEN 0
net/mac80211/ieee80211_sta.c +69 -8
115 lines not on this page · raw message
Re: [PATCH 5/5] d80211: switch STA interfaces to PS mode during scan
Quoted 4 lines · Michael Wu
This makes scans switch STA interfaces into PS mode so the AP queues frames destined for us while we are scanning. This is achieved by sending a nullfunc data frame with the PS mode bit set before scanning commences, and a PS poll frame after scanning is completed.
Why bother with PS Poll in this case? Just send data::nullfunc with PS Poll flag cleared. That will make the AP deliver all buffered frames (if any).
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Re: [PATCH 5/5] d80211: switch STA interfaces to PS mode during scan
Quoted 3 lines · Jouni Malinen
Why bother with PS Poll in this case? Just send
data::nullfuncwith PS Poll flag cleared. That will make the AP deliver all buffered frames (if any).
Didn't think of it. :)
Here's a version that does that:
--
d80211: switch STA interfaces to PS mode during scan
From: Michael Wu <[email protected]>
This makes scans switch STA interfaces into PS mode so the AP queues frames destined for us while we are scanning. This is achieved by sending a nullfunc data frame with the PS mode bit set before scanning commences, and a PS poll frame after scanning is completed.
---
include/linux/ieee80211.h | 7 ++++++ net/mac80211/ieee80211_sta.c | 51 +++++++++++++++++++++++++++++++++++------- 2 files changed, 50 insertions(+), 8 deletions(-)
include/linux/ieee80211.h +7 -0
@@ -203,6 +203,13 @@ struct ieee80211_cts {__u8 ra[6 ]; } __attribute__ ((packed)); +struct ieee80211_ps_poll { +__le16 frame_control; +__le16 aid; +__u8 bssid[6 ]; +__u8 ta[6 ]; +} __attribute__ ((packed)); +/* Authentication algorithms */ #define WLAN_AUTH_OPEN 0
net/mac80211/ieee80211_sta.c +43 -8
83 lines not on this page · raw message
Re: [PATCH 5/5] d80211: switch STA interfaces to PS mode during scan
Quoted 5 lines · Michael Wu
This makes scans switch STA interfaces into PS mode so the AP queues frames destined for us while we are scanning. This is achieved by sending a nullfunc data frame with the PS mode bit set before scanning commences, and a PS poll frame after scanning is completed.
Er. I should update the description too..
--
d80211: switch STA interfaces to PS mode during scan
From: Michael Wu <[email protected]>
This makes scans switch STA interfaces into PS mode so the AP queues frames destined for us while we are scanning. This is achieved by sending a nullfunc data frame with the PS mode bit set before scanning commences, and a nullfunc data frame without the PS mode bit set after scanning is completed.
---
include/linux/ieee80211.h | 7 ++++++ net/mac80211/ieee80211_sta.c | 51 +++++++++++++++++++++++++++++++++++------- 2 files changed, 50 insertions(+), 8 deletions(-)
include/linux/ieee80211.h +7 -0
@@ -203,6 +203,13 @@ struct ieee80211_cts {__u8 ra[6 ]; } __attribute__ ((packed)); +struct ieee80211_ps_poll { +__le16 frame_control; +__le16 aid; +__u8 bssid[6 ]; +__u8 ta[6 ]; +} __attribute__ ((packed)); +/* Authentication algorithms */ #define WLAN_AUTH_OPEN 0
net/mac80211/ieee80211_sta.c +43 -8
83 lines not on this page · raw message
PATCH 1/1 d80211: Remove tx_timeout callback
In reply to Michael WuQuoted 3 lines · Michael Wu
This prevents drivers from crashing if there is a TX timeout and the reset callback isn't implemented.
Actually, I don't think we should bother setting the TX timeout callback at all.
--
d80211: Remove tx_timeout callback
From: Michael Wu <[email protected]>
This never worked in the first place and we can't use the network watchdog anyway since that checks if the queue is stopped, but wireless devices can have many queues. TX timeouts on virtual interfaces don't really make sense either since they can't stall.
---
net/mac80211/ieee80211.c | 15 --------------- 1 files changed, 0 insertions(+), 15 deletions(-)
net/mac80211/ieee80211.c +0 -15
@@ -2078,19 +2078,6 @@ static int ieee80211_change_mtu_apdev(st } -static void ieee80211_tx_timeout (struct net_device *dev) -{ -struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr); - -printk (KERN_WARNING "%s: resetting interface.\n" , dev->name); - -if (local->ops->reset (local_to_hw (local))) -printk (KERN_ERR "%s: failed to reset interface.\n" , dev->name); -else -netif_wake_queue (dev); -} - -static int ieee80211_set_mac_address (struct net_device *dev,void *addr) {struct sockaddr *a = addr;
@@ -4425,7 +4412,6 @@ void ieee80211_if_setup(struct net_devic dev->set_mac_address = ieee80211_set_mac_address; dev->set_multicast_list = ieee80211_set_multicast_list; dev->change_mtu = ieee80211_change_mtu; - dev->tx_timeout = ieee80211_tx_timeout; dev->get_stats = ieee80211_get_stats; dev->open = ieee80211_open; dev->stop = ieee80211_stop;
@@ -4593,7 +4579,6 @@ struct ieee80211_hw *ieee80211_alloc_hw( mdev->wireless_handlers = &ieee80211_iw_master_handler_def; mdev->do_ioctl = ieee80211_ioctl; mdev->change_mtu = ieee80211_change_mtu; - mdev->tx_timeout = ieee80211_tx_timeout; mdev->get_stats = ieee80211_get_stats; mdev->open = ieee80211_master_open; mdev->stop = ieee80211_master_stop;
Re: [PATCH 4/5] d80211: Stop virtual interfaces during scan
In reply to Michael WuQuoted 9 lines · Michael Wu
From: Michael Wu <[email protected]>
This prevents data frames from being queued on the master device if it is in the midst of a scan. It also makes both master and virtual interfaces properly set
trans_startwhen frames are sent so the network watchdog does not try to reset the interfaces.tx_queue_lenis left as the default on virtual interfaces to allow frames to be queued while the device is scanning.
And now that all STA interfaces are woken up after a scan, we also can remove the scan_dev check.
--
d80211: Stop virtual interfaces during scan
From: Michael Wu <[email protected]>
This prevents data frames from being queued on the master device if it is in the midst of a scan. It also makes both master and virtual interfaces properly set trans_start when frames are sent. tx_queue_len is left as the default on virtual interfaces to allow frames to be queued while the device is scanning.
---
net/mac80211/ieee80211.c | 5 +++-- net/mac80211/ieee80211_sta.c | 28 +++++++++++++++++++--------- 2 files changed, 22 insertions(+), 11 deletions(-)
net/mac80211/ieee80211.c +3 -2
@@ -1148,6 +1148,7 @@ static int __ieee80211_tx(struct ieee802 ret = local->ops->tx (local_to_hw (local), skb, control);if (ret)return IEEE80211_TX_AGAIN ; + local->mdev->trans_start = jiffies;ieee80211_led_tx (local,1 ); }if (tx->u.tx.extra_frag) {
@@ -1178,6 +1179,7 @@ static int __ieee80211_tx(struct ieee802 control);if (ret)return IEEE80211_TX_FRAG_AGAIN ; + local->mdev->trans_start = jiffies;ieee80211_led_tx (local,1 ); tx->u.tx.extra_frag[i] =NULL ; }
@@ -1588,6 +1590,7 @@ static int ieee80211_subif_start_xmit(st skb->nh.raw = skb->data + nh_pos; skb->h.raw = skb->data + h_pos; + dev->trans_start = jiffies;dev_queue_xmit (skb);return 0 ;
@@ -4419,7 +4422,6 @@ void ieee80211_if_setup(struct net_devic dev->get_stats = ieee80211_get_stats; dev->open = ieee80211_open; dev->stop = ieee80211_stop; - dev->tx_queue_len =0 ; dev->uninit = ieee80211_if_reinit; dev->destructor = ieee80211_if_free; }
@@ -4434,7 +4436,6 @@ void ieee80211_if_mgmt_setup(struct net_ dev->stop = ieee80211_mgmt_stop; dev->type =ARPHRD_IEEE80211_PRISM ; dev->hard_header_parse = header_parse_80211; - dev->tx_queue_len =0 ; dev->uninit = ieee80211_if_reinit; dev->destructor = ieee80211_if_free; }
net/mac80211/ieee80211_sta.c +19 -9
@@ -1918,10 +1918,7 @@ void ieee80211_sta_work(struct work_struif (!netif_running (dev))return ; -/* TODO: scan_dev check should be removed once scan_completed wakes -* every STA interface */ -if (local->sta_scanning && - local->scan_dev == dev) +if (local->sta_scanning)return ; sdata =IEEE80211_DEV_TO_SUB_IF (dev);
@@ -2527,7 +2524,7 @@ void ieee80211_scan_completed(struct iee {struct ieee80211_local *local =hw_to_local (hw);struct net_device *dev = local->scan_dev; -struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_sub_if_data *sdata;union iwreq_data wrqu;printk (KERN_DEBUG "%s: scan completed\n" , dev->name);
@@ -2542,15 +2539,23 @@ void ieee80211_scan_completed(struct ieememset (&wrqu,0 ,sizeof (wrqu));wireless_send_event (dev,SIOCGIWSCAN , &wrqu,NULL ); +spin_lock_bh (&local->sub_if_lock); +list_for_each_entry (sdata, &local->sub_if_list, list) { +netif_wake_queue (sdata->dev); + +if (sdata->type ==IEEE80211_IF_TYPE_STA ) +ieee80211_sta_timer ((unsigned long )&sdata->u.sta); + } +spin_unlock_bh (&local->sub_if_lock); + + sdata =IEEE80211_DEV_TO_SUB_IF (dev);if (sdata->type ==IEEE80211_IF_TYPE_IBSS ) {struct ieee80211_if_sta *ifsta = &sdata->u.sta;if (!ifsta->bssid_set || (!ifsta->state ==IEEE80211_IBSS_JOINED && !ieee80211_sta_active_ibss (dev)))ieee80211_sta_find_ibss (dev, ifsta); -/* TODO: need to wake every sta interface */ - }else if (sdata->type ==IEEE80211_IF_TYPE_STA ) -ieee80211_sta_timer ((unsigned long )&sdata->u.sta); + } }EXPORT_SYMBOL (ieee80211_scan_completed);
@@ -2637,6 +2642,7 @@ static int ieee80211_sta_start_scan(stru u8 *ssid, size_t ssid_len) {struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr); +struct ieee80211_sub_if_data *sdata;if (ssid_len >IEEE80211_MAX_SSID_LEN )return -EINVAL ;
@@ -2680,7 +2686,11 @@ static int ieee80211_sta_start_scan(stru } local->sta_scanning =1 ; -/* TODO: stop TX queue? */ + +spin_lock_bh (&local->sub_if_lock); +list_for_each_entry (sdata, &local->sub_if_list, list) +netif_stop_queue (sdata->dev); +spin_unlock_bh (&local->sub_if_lock);if (ssid) { local->scan_ssid_len = ssid_len;
Re: [PATCH 5/5] d80211: switch STA interfaces to PS mode during scan
In reply to Michael WuQuoted 8 lines · Michael Wu
Quoted 4 lines · Michael Wu
This makes scans switch STA interfaces into PS mode so the AP queues frames destined for us while we are scanning. This is achieved by sending a nullfunc data frame with the PS mode bit set before scanning commences, and a PS poll frame after scanning is completed.
Er. I should update the description too..
And drop the ps_poll part since we don't use the ps poll frame now..
--
d80211: switch STA interfaces to PS mode during scan
From: Michael Wu <[email protected]>
This makes scans switch STA interfaces into PS mode so the AP queues frames destined for us while we are scanning. This is achieved by sending a nullfunc data frame with the PS mode bit set before scanning commences, and a nullfunc data frame without the PS mode bit set after scanning is completed.
---
net/mac80211/ieee80211_sta.c | 51 +++++++++++++++++++++++++++++++++++------- 1 files changed, 43 insertions(+), 8 deletions(-)
net/mac80211/ieee80211_sta.c +43 -8
@@ -2520,6 +2520,37 @@ int ieee80211_sta_set_bssid(struct net_d } +static void ieee80211_send_nullfunc (struct ieee80211_local *local, +struct ieee80211_sub_if_data *sdata, +int powersave) +{ +struct sk_buff *skb; +struct ieee80211_hdr *nullfunc; +u16 fc; + + skb =dev_alloc_skb (local->hw.extra_tx_headroom +24 ); +if (!skb) { +printk (KERN_DEBUG "%s: failed to allocate buffer for nullfunc " +"frame\n" , sdata->dev->name); +return ; + } +skb_reserve (skb, local->hw.extra_tx_headroom); + + nullfunc = (struct ieee80211_hdr *)skb_put (skb,24 ); +memset (nullfunc,0 ,24 ); + fc =IEEE80211_FTYPE_DATA |IEEE80211_STYPE_NULLFUNC | +IEEE80211_FCTL_TODS ; +if (powersave) + fc |=IEEE80211_FCTL_PM ; + nullfunc->frame_control =cpu_to_le16 (fc); +memcpy (nullfunc->addr1, sdata->u.sta.bssid,ETH_ALEN ); +memcpy (nullfunc->addr2, sdata->dev->dev_addr,ETH_ALEN ); +memcpy (nullfunc->addr3, sdata->u.sta.bssid,ETH_ALEN ); + +ieee80211_sta_tx (sdata->dev, skb,0 ); +} + +void ieee80211_scan_completed (struct ieee80211_hw *hw) {struct ieee80211_local *local =hw_to_local (hw);
@@ -2541,10 +2572,12 @@ void ieee80211_scan_completed(struct ieespin_lock_bh (&local->sub_if_lock);list_for_each_entry (sdata, &local->sub_if_list, list) { -netif_wake_queue (sdata->dev); - -if (sdata->type ==IEEE80211_IF_TYPE_STA ) +if (sdata->type ==IEEE80211_IF_TYPE_STA ) { +if (sdata->u.sta.associated) +ieee80211_send_nullfunc (local, sdata,0 );ieee80211_sta_timer ((unsigned long )&sdata->u.sta); + } +netif_wake_queue (sdata->dev); }spin_unlock_bh (&local->sub_if_lock);
@@ -2664,9 +2697,6 @@ static int ieee80211_sta_start_scan(stru* ResultCode: SUCCESS, INVALID_PARAMETERS */ -/* TODO: if assoc, move to power save mode for the duration of the -* scan */ -if (local->sta_scanning) {if (local->scan_dev == dev)return 0 ;
@@ -2688,8 +2718,12 @@ static int ieee80211_sta_start_scan(stru local->sta_scanning =1 ;spin_lock_bh (&local->sub_if_lock); -list_for_each_entry (sdata, &local->sub_if_list, list) +list_for_each_entry (sdata, &local->sub_if_list, list) {netif_stop_queue (sdata->dev); +if (sdata->type ==IEEE80211_IF_TYPE_STA && + sdata->u.sta.associated) +ieee80211_send_nullfunc (local, sdata,1 ); + }spin_unlock_bh (&local->sub_if_lock);if (ssid) {
@@ -2703,7 +2737,8 @@ static int ieee80211_sta_start_scan(stru list); local->scan_channel_idx =0 ; local->scan_dev = dev; -schedule_delayed_work (&local->scan_work,0 ); +/* TODO: start scan as soon as all nullfunc frames are ACKed */ +schedule_delayed_work (&local->scan_work,IEEE80211_CHANNEL_TIME );return 0 ; }
net/mac80211/ieee80211.c static int rate_list_match(const int *ra · line 140
Quoted 10 lines · Michael Wu
net/mac80211/ieee80211.c +1
-0@@ -136,16 +136,16 @@ static int rate_list_match(const int *ravoid ieee80211_prepare_rates (struct ieee80211_local *local) {int i; +struct ieee80211_hw_mode *mode = local->oper_hw_mode;
Ehh, this isn't quite right and may break things on ABG devices.
--
d80211: Remove curr_rates and fix related concurrency issues
From: Michael Wu <[email protected]>
This switches the code from curr_rates and num_curr_rates to directly using the mode and converts portions of the code to use pointers to rates instead of indices to refer to rates. Two new fields are introduced in struct ieee80211_conf which may replace the channel/frequency/channel_val/phymode fields in the future. The rate control is now cleared only when the operating channel is changed.
---
include/net/mac80211.h | 7 ++ net/mac80211/ieee80211.c | 101 +++++++++++++++++------------------- net/mac80211/ieee80211_i.h | 10 +--- net/mac80211/ieee80211_ioctl.c | 52 +++++++++++-------- net/mac80211/ieee80211_rate.h | 3 - net/mac80211/ieee80211_scan.c | 2 - net/mac80211/ieee80211_sta.c | 64 +++++++++++++---------- net/mac80211/ieee80211_sysfs_sta.c | 5 +- net/mac80211/rc80211_simple.c | 57 +++++++++++--------- net/mac80211/sta_info.c | 4 + 10 files changed, 166 insertions(+), 139 deletions(-)
include/net/mac80211.h +5 -2
@@ -209,8 +209,9 @@ struct ieee80211_tx_control {u8 sw_retry_attempt;/* number of times hw has tried to * transmit frame (not incl. hw retries) */ -int rateidx;/* internal 80211.o rateidx */ -int rts_rateidx;/* internal 80211.o rateidx for RTS/CTS */ +struct ieee80211_rate *rate;/* internal 80211.o rate */ +struct ieee80211_rate *rts_rate;/* internal 80211.o rate +* for RTS/CTS */ int alt_retry_rate;/* retry rate for the last retries, given as the * hw specific value for the rate (from * struct ieee80211_rate). To be used to limit
@@ -272,6 +273,8 @@ struct ieee80211_conf {int channel_val;/* hw specific value for the channel */ int phymode;/* MODE_IEEE80211A, .. */ +struct ieee80211_channel *chan; +struct ieee80211_hw_mode *mode;unsigned int regulatory_domain;int radio_enabled;
net/mac80211/ieee80211.c +49 -52
281 lines not on this page · raw message
net/mac80211/ieee80211_i.h +4 -6
@@ -123,12 +123,12 @@ struct ieee80211_txrx_data { unsigned int ps_buffered:1; unsigned int short_preamble:1; unsigned int probe_last_frag:1; +struct ieee80211_hw_mode *mode;struct ieee80211_rate *rate;/* use this rate (if set) for last fragment; rate can * be set to lower rate for the first fragments, e.g., * when using CTS protection with IEEE 802.11g. */ struct ieee80211_rate *last_frag_rate; -int last_frag_rateidx;int last_frag_hwrate;int mgmt_interface;
@@ -171,6 +171,7 @@ struct ieee80211_tx_stored_packet {struct sk_buff **extra_frag;int last_frag_rateidx;int last_frag_hwrate; +struct ieee80211_rate *last_frag_rate; unsigned int last_frag_rate_ctrl_probe:1; };
@@ -396,10 +397,6 @@ struct ieee80211_local {int iff_allmultis, iff_promiscs;/* number of interfaces with corresponding IFF_ flags */ -/* Current rate table. This is a pointer to hw->modes structure. */ -struct ieee80211_rate *curr_rates; -int num_curr_rates; -struct rate_control_ref *rate_ctrl;int next_mode;/* MODE_IEEE80211*
@@ -614,7 +611,8 @@ void ieee80211_key_free(struct ieee80211void ieee80211_key_release (struct kobject *kobj);void ieee80211_rx_mgmt (struct ieee80211_local *local,struct sk_buff *skb,struct ieee80211_rx_status *status,u32 msg_type); -void ieee80211_prepare_rates (struct ieee80211_local *local); +void ieee80211_prepare_rates (struct ieee80211_local *local, +struct ieee80211_hw_mode *mode);void ieee80211_tx_set_iswep (struct ieee80211_txrx_data *tx);int ieee80211_if_update_wds (struct net_device *dev,u8 *remote_addr);void ieee80211_if_setup (struct net_device *dev);
net/mac80211/ieee80211_ioctl.c +32 -20
137 lines not on this page · raw message
net/mac80211/ieee80211_rate.h +1 -2
@@ -26,11 +26,10 @@ struct rate_control_extra {/* values from rate_control_get_rate() to the caller: */ struct ieee80211_rate *probe;/* probe with this rate, or NULL for no * probing */ -int startidx, endidx, rateidx;struct ieee80211_rate *nonerp; -int nonerp_idx;/* parameters from the caller to rate_control_get_rate(): */ +struct ieee80211_hw_mode *mode;int mgmt_data;/* this is data frame that is used for management * (e.g., IEEE 802.1X EAPOL) */ u16 ethertype;
net/mac80211/ieee80211_scan.c +1 -1
@@ -326,7 +326,7 @@ void ieee80211_init_scan(struct ieee8021 local->scan.tx_control.key_idx =HW_KEY_IDX_INVALID ; local->scan.tx_control.flags |=IEEE80211_TXCTL_DO_NOT_ENCRYPT ;memset (&extra,0 ,sizeof (extra)); - extra.endidx = local->num_curr_rates; + extra.mode = local->hw.conf.mode; local->scan.tx_control.tx_rate =rate_control_get_rate (local, local->mdev, local->scan.skb, &extra)->val;
net/mac80211/ieee80211_sta.c +37 -27
172 lines not on this page · raw message
net/mac80211/ieee80211_sysfs_sta.c +3 -2
@@ -40,10 +40,11 @@ static ssize_t show_sta_##name(const str static ssize_t show_sta_##name(const struct sta_info *sta, char *buf) \ { \ struct ieee80211_local *local = wdev_priv(sta->dev->ieee80211_ptr);\ + struct ieee80211_hw_mode *mode = local->oper_hw_mode; \ return sprintf(buf, "%d\n", \ (sta->field >= 0 && \ - sta->field < local->num_curr_rates) ? \ - local->curr_rates[sta->field].rate : -1); \ + sta->field < mode->num_rates) ? \ + mode->rates[sta->field].rate : -1); \ }#define __STA_ATTR (name) \
net/mac80211/rc80211_simple.c +31 -26
156 lines not on this page · raw message
net/mac80211/sta_info.c +3 -1
@@ -80,10 +80,12 @@ EXPORT_SYMBOL(sta_info_get);int sta_info_min_txrate_get (struct ieee80211_local *local) {struct sta_info *sta; +struct ieee80211_hw_mode *mode;int min_txrate =9999999 ;int i;spin_lock_bh (&local->sta_lock); + mode = local->oper_hw_mode;for (i =0 ; i <STA_HASH_SIZE ; i++) { sta = local->sta_hash[i];while (sta) {
@@ -96,7 +98,7 @@ int sta_info_min_txrate_get(struct ieee8if (min_txrate ==9999999 ) min_txrate =0 ; -return min_txrate; +return mode->rates[min_txrate].rate; }
Quoted 6 lines · Michael Wu
This switches the code from
curr_ratesandnum_curr_ratesto directly using the mode and converts portions of the code to use pointers to rates instead of indices to refer to rates. Two new fields are introduced in structieee80211_confwhich may replace the channel/frequency/channel_val/phymode fields in the future. The rate control is now cleared only when the operating channel is changed.
Looks correct to me. I'll apply it to my tree (if John isn't faster :-)).
Thanks,
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Re: [PATCH 3/5] d80211: Set carrier status for STA interfaces
In reply to Michael WuQuoted 2 lines · Michael Wu
This makes STA interfaces set the carrier status based on the current association status.
Does this really work? Last time I checked, when the carrier is off, no frames are sent to hard_start_xmit.
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Re: [PATCH] d80211: Remove tx_timeout callback
In reply to Michael WuQuoted 4 lines · Michael Wu
This never worked in the first place and we can't use the network watchdog anyway since that checks if the queue is stopped, but wireless devices can have many queues. TX timeouts on virtual interfaces don't really make sense either since they can't stall.
Okay. Let's reintroduce this when multiqueue support is implemented in the kernel.
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Re: [PATCH 3/5] d80211: Set carrier status for STA interfaces
In reply to Jiri BencQuoted 7 lines · Jiri Benc
Quoted 2 lines · Michael Wu
This makes STA interfaces set the carrier status based on the current association status.
Does this really work? Last time I checked, when the carrier is off, no frames are sent to
hard_start_xmit.
This applies only to STA interfaces, whose frames to the master dev are dropped anyways if there is no association.
-Michael Wu
Re: [PATCH 3/5] d80211: Set carrier status for STA interfaces
Quoted 6 lines · Michael Wu
Quoted 3 lines · Jiri Benc
Does this really work? Last time I checked, when the carrier is off, no frames are sent to
hard_start_xmit.This applies only to STA interfaces, whose frames to the master dev are dropped anyways if there is no association.
True, you're right.
Thanks,
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Re: [PATCH 4/5] d80211: Stop virtual interfaces during scan
In reply to Michael WuQuoted 10 lines · Michael Wu
Quoted 9 lines · Michael Wu
From: Michael Wu <[email protected]>
This prevents data frames from being queued on the master device if it is in the midst of a scan. It also makes both master and virtual interfaces properly set
trans_startwhen frames are sent so the network watchdog does not try to reset the interfaces.tx_queue_lenis left as the default on virtual interfaces to allow frames to be queued while the device is scanning.
Quoted 2 lines
And now that all STA interfaces are woken up after a scan, we also can remove the
scan_devcheck.
Looks good, thanks!
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Re: [PATCH 5/5] d80211: switch STA interfaces to PS mode during scan
In reply to Michael WuQuoted 15 lines · Michael Wu
Quoted 8 lines · Michael Wu
Quoted 4 lines · Michael Wu
This makes scans switch STA interfaces into PS mode so the AP queues frames destined for us while we are scanning. This is achieved by sending a nullfunc data frame with the PS mode bit set before scanning commences, and a PS poll frame after scanning is completed.
Er. I should update the description too..
And drop the
ps_pollpart since we don't use the ps poll frame now..[...]
net/mac80211/ieee80211_sta.c +0
-0@@ -2541,10 +2572,12 @@ void ieee80211_scan_completed(struct ieespin_lock_bh (&local->sub_if_lock);
net/mac80211/ieee80211_sta.c void ieee80211_scan_completed(struct iee · line 2580
Quoted 10 lines
net/mac80211/ieee80211_sta.c +5
-3list_for_each_entry (sdata, &local->sub_if_list, list) { -netif_wake_queue (sdata->dev); - -if (sdata->type ==IEEE80211_IF_TYPE_STA ) +if (sdata->type ==IEEE80211_IF_TYPE_STA ) { +if (sdata->u.sta.associated) +ieee80211_send_nullfunc (local, sdata,0 );ieee80211_sta_timer ((unsigned long )&sdata->u.sta); + } +netif_wake_queue (sdata->dev);
Shouldn't the queue be woken before calling ieee80211_sta_timer?
Thanks,
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Re: [PATCH 5/5] d80211: switch STA interfaces to PS mode during scan
Quoted 16 lines · Jiri Benc
net/mac80211/ieee80211_sta.c void ieee80211_scan_completed(struct iee · line 2580
Quoted 13 lines
net/mac80211/ieee80211_sta.c +5
-3@@ -2541,10 +2572,12 @@ void ieee80211_scan_completed(struct ieespin_lock_bh (&local->sub_if_lock);list_for_each_entry (sdata, &local->sub_if_list, list) { -netif_wake_queue (sdata->dev); - -if (sdata->type ==IEEE80211_IF_TYPE_STA ) +if (sdata->type ==IEEE80211_IF_TYPE_STA ) { +if (sdata->u.sta.associated) +ieee80211_send_nullfunc (local, sdata,0 );ieee80211_sta_timer ((unsigned long )&sdata->u.sta); + } +netif_wake_queue (sdata->dev);Shouldn't the queue be woken before calling
ieee80211_sta_timer?
ieee80211_sta_timer just schedules the workqueue to run. I'm not sure if the workqueue can run immediately after that, but even if it did, the sta code doesn't depend on the queue of a virtual interface so these lines don't need to run in any particular order.
-Michael Wu
Re: [PATCH 5/5] d80211: switch STA interfaces to PS mode during scan
Quoted 4 lines · Michael Wu
ieee80211_sta_timerjust schedules the workqueue to run. I'm not sure if the workqueue can run immediately after that, but even if it did, the sta code doesn't depend on the queue of a virtual interface so these lines don't need to run in any particular order.
Okay, you're right. Applied, thanks!
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs