d80211: pull request
Subsystems (2)
cover d80211: pull request
Please pull fromgit://git.kernel.org/pub/scm/linux/kernel/git/jbenc/dscape.git up to obtain following patches:
David Kimdon:
d80211: Fix overflow when creating AVS header
d80211: allow wireless vlan interface to have same MAC an AP interface
d80211: use FCS_LEN instead of hardcoded number.
d80211: silence sparse warning: bad constant expression
d80211: remove unused Super AG definitions, purge comment
Elliot Schwartz:
d80211: remove unused xr structure members, interface, etc.
d80211: remove rate limit code
Jiri Benc:
d80211: fix is_ieee80211_device
d80211: add missing rtnl_unlock()
d80211: del sta timer on interface close
d80211: rename rate_control.h to ieee80211_rate.h
d80211: proper rate_control loading
d80211: rename rate_control.c to rc80211_simple.c
d80211: proper rate control structures freeing
d80211: allow changing of the rate control algorithm
d80211: rate_control: do not use atomic allocations when not necessary
Jouni Malinen:
d80211: retain PS frames for at least STA listen interval
Modestas Vainius:
d80211: Fix TX/RX rates
include/net/d80211.h | 23 ---- include/net/d80211_mgmt.h | 4 - include/net/d80211_shared.h | 6 - net/d80211/Makefile | 3 net/d80211/hostapd_ioctl.h | 10 -- net/d80211/ieee80211.c | 245 +++++++++++++++++--------------------- net/d80211/ieee80211_i.h | 11 +- net/d80211/ieee80211_iface.c | 12 -- net/d80211/ieee80211_ioctl.c | 38 +----- net/d80211/ieee80211_rate.c | 140 ++++++++++++++++++++++ net/d80211/ieee80211_rate.h | 161 +++++++++++++++++++++++++ net/d80211/ieee80211_scan.c | 4 - net/d80211/ieee80211_sta.c | 19 ++- net/d80211/ieee80211_sysfs.c | 27 +++- net/d80211/ieee80211_sysfs_sta.c | 5 - net/d80211/rate_control.h | 154 ------------------------ net/d80211/rate_control.c | 26 ++-- net/d80211/sta_info.c | 46 ++++--- net/d80211/sta_info.h | 9 + 19 files changed, 513 insertions(+), 430 deletions(-)
Signature · 2 lines
Jiri Benc SUSE Labs
PATCH 1/18 d80211: fix is_ieee80211_device
The is_ieee80211_device function must ensure that the passed net_device belongs to the hardware device we are working with.
---
net/d80211/ieee80211.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
54bac502265add95b8ca098ccf62c1d506daeb86
net/d80211/ieee80211.c +5 -4
@@ -1123,9 +1123,10 @@ __ieee80211_tx_prepare(struct ieee80211_ } -static int inline is_ieee80211_device (struct net_device *dev) +static int inline is_ieee80211_device (struct net_device *dev, +struct net_device *master) { -return (dev->ieee80211_ptr !=NULL ); +return (dev->ieee80211_ptr == master->ieee80211_ptr); }/* Device in tx->dev has a reference added; use dev_put(tx->dev) when
@@ -1140,7 +1141,7 @@ static void inline ieee80211_tx_prepare( pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; dev =dev_get_by_index (pkt_data->ifindex); -if (unlikely (dev && !is_ieee80211_device (dev))) { +if (unlikely (dev && !is_ieee80211_device (dev, mdev))) {dev_put (dev); dev =NULL ; }
@@ -1395,7 +1396,7 @@ static int ieee80211_master_start_xmit(sif (pkt_data->ifindex) odev =dev_get_by_index (pkt_data->ifindex); -if (unlikely (odev && !is_ieee80211_device (odev))) { +if (unlikely (odev && !is_ieee80211_device (odev, dev))) {dev_put (odev); odev =NULL ; }
Signature · 1 line
1.3.0
PATCH 2/18 d80211: add missing rtnl_unlock()
In reply to Jiri BencAdd forgotten rtnl_unlock() in the error path of ieee80211_register_hw.
---
net/d80211/ieee80211.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
693ca0e679ae17dd34f5392886f99ba36f68940c
net/d80211/ieee80211.c +3 -1
@@ -4449,8 +4449,10 @@ int ieee80211_register_hw(struct net_dev result =sysfs_create_link (&local->class_dev.kobj, &dev->class_dev.kobj,"master" ); -if (result <0 ) +if (result <0 ) { +rtnl_unlock (); goto fail_masterlink; + } result =ieee80211_sysfs_add_netdevice (dev);rtnl_unlock ();if (result <0 )
Signature · 1 line
1.3.0
PATCH 3/18 d80211: del sta timer on interface close
In reply to Jiri BencDelete sta timer when the corresponding network interface is brought down.
---
net/d80211/ieee80211.c | 24 ++++++++++++++++++++++++ net/d80211/ieee80211_i.h | 1 + net/d80211/ieee80211_iface.c | 12 +++--------- net/d80211/ieee80211_sta.c | 3 +++ 4 files changed, 31 insertions(+), 9 deletions(-)
606451a64310c8084e9a3de07bafb8360989d004
net/d80211/ieee80211.c +24 -0
@@ -2106,6 +2106,29 @@ static struct net_device_stats *ieee8021return &(sdata->stats); } +void ieee80211_if_shutdown (struct net_device *dev) +{ +struct ieee80211_local *local = dev->ieee80211_ptr; +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); + +ASSERT_RTNL (); +switch (sdata->type) { +case IEEE80211_IF_TYPE_STA : +case IEEE80211_IF_TYPE_IBSS : + sdata->u.sta.state =IEEE80211_DISABLED ; +del_timer_sync (&sdata->u.sta.timer); +if (local->scan_work.data == sdata->dev) { + local->sta_scanning =0 ; +cancel_delayed_work (&local->scan_work); +flush_scheduled_work (); +/* see comment in ieee80211_unregister_hw to +* understand why this works */ + local->scan_work.data =NULL ; + } +break ; + } +} +static inline int identical_mac_addr_allowed (int type1,int type2) { return (type1 == IEEE80211_IF_TYPE_MNTR ||
@@ -2306,6 +2329,7 @@ static int ieee80211_stop(struct net_dev conf.mac_addr = dev->dev_addr; local->hw->remove_interface (sdata->master, &conf); } +ieee80211_if_shutdown (dev);ieee80211_start_hard_monitor (local);
net/d80211/ieee80211_i.h +1 -0
@@ -583,6 +583,7 @@ void ieee80211_tx_set_iswep(struct ieee8int ieee80211_if_update_wds (struct net_device *dev,u8 *remote_addr);void ieee80211_if_setup (struct net_device *dev);void ieee80211_if_mgmt_setup (struct net_device *dev); +void ieee80211_if_shutdown (struct net_device *dev);/* ieee80211_ioctl.c */ int ieee80211_ioctl (struct net_device *dev,struct ifreq *rq,int cmd);
net/d80211/ieee80211_iface.c +3 -9
@@ -242,6 +242,9 @@ #endifieee80211_key_free (sdata->keys[i]); } +/* Shouldn't be necessary but won't hurt */ +ieee80211_if_shutdown (dev); +switch (sdata->type) {case IEEE80211_IF_TYPE_AP : {/* Remove all virtual interfaces that use this BSS
@@ -286,15 +289,6 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */break ;case IEEE80211_IF_TYPE_STA :case IEEE80211_IF_TYPE_IBSS : -del_timer_sync (&sdata->u.sta.timer); -if (local->scan_work.data == sdata->dev) { - local->sta_scanning =0 ; -cancel_delayed_work (&local->scan_work); -flush_scheduled_work (); -/* see comment in ieee80211_unregister_hw to -* understand why this works */ - local->scan_work.data =NULL ; - }kfree (sdata->u.sta.extra_ie); sdata->u.sta.extra_ie =NULL ;kfree (sdata->u.sta.assocreq_ies);
net/d80211/ieee80211_sta.c +3 -0
@@ -1848,6 +1848,9 @@ void ieee80211_sta_timer(unsigned long pstruct ieee80211_if_sta *ifsta; dev = (struct net_device *) ptr; +if (!netif_running (dev)) +return ; + sdata =IEEE80211_DEV_TO_SUB_IF (dev);if (sdata->type !=IEEE80211_IF_TYPE_STA && sdata->type !=IEEE80211_IF_TYPE_IBSS ) {
Signature · 1 line
1.3.0
PATCH 4/18 d80211: rename rate_control.h to ieee80211_rate.h
In reply to Jiri Bencrate_control.h is not a header for rate_control.c as the name suggests. Furthermore, we want to introduce ieee80211_rate.c which implements some things defined in rate_control.h.
This patch renames rate_control.h to ieee80211_rate.h.
---
net/d80211/ieee80211.c | 2 - net/d80211/ieee80211_ioctl.c | 2 - net/d80211/ieee80211_rate.h | 154 ++++++++++++++++++++++++++++++++++++++++++ net/d80211/ieee80211_scan.c | 2 - net/d80211/ieee80211_sta.c | 2 - net/d80211/ieee80211_sysfs.c | 2 - net/d80211/rate_control.c | 2 - net/d80211/rate_control.h | 154 ------------------------------------------ net/d80211/sta_info.c | 2 - 9 files changed, 161 insertions(+), 161 deletions(-) create mode 100644 net/d80211/ieee80211_rate.h delete mode 100644 net/d80211/rate_control.h
3e72d14a5a66f204c66ea88e89aa8d45f3f7c2c0
net/d80211/ieee80211.c +1 -1
@@ -25,7 +25,7 @@ #include <net/d80211.h>#include <net/d80211_common.h> #include <net/d80211_mgmt.h> #include "ieee80211_i.h" -#include "rate_control.h" +#include "ieee80211_rate.h" #include "wep.h" #include "wpa.h" #include "tkip.h"
net/d80211/ieee80211_ioctl.c +1 -1
@@ -23,7 +23,7 @@ #include <net/d80211.h>#include <net/d80211_mgmt.h> #include "ieee80211_i.h" #include "hostapd_ioctl.h" -#include "rate_control.h" +#include "ieee80211_rate.h" #include "wpa.h" #include "aes_ccm.h"
net/d80211/ieee80211_rate.h new file +154 -0
154 lines not on this page · raw message
net/d80211/ieee80211_scan.c +1 -1
@@ -14,7 +14,7 @@ #include <linux/skbuff.h>#include <net/d80211.h> #include "ieee80211_i.h" -#include "rate_control.h" +#include "ieee80211_rate.h" /* Maximum number of seconds to wait for the traffic load to get below
net/d80211/ieee80211_sta.c +1 -1
@@ -28,7 +28,7 @@ #include <asm/delay.h>#include <net/d80211.h> #include <net/d80211_mgmt.h> #include "ieee80211_i.h" -#include "rate_control.h" +#include "ieee80211_rate.h" #include "hostapd_ioctl.h" #define IEEE80211_AUTH_TIMEOUT (HZ / 5)
net/d80211/ieee80211_sysfs.c +1 -1
@@ -14,7 +14,7 @@ #include <linux/netdevice.h>#include <linux/rtnetlink.h> #include <net/d80211.h> #include "ieee80211_i.h" -#include "rate_control.h" +#include "ieee80211_rate.h" #define to_ieee80211_local (class) container_of(class, struct ieee80211_local, class_dev)#define to_net_dev (class) container_of(class, struct net_device, class_dev)
net/d80211/rate_control.c +1 -1
@@ -17,7 +17,7 @@ #include <linux/compiler.h>#include <net/d80211.h> #include "ieee80211_i.h" -#include "rate_control.h" +#include "ieee80211_rate.h" /* This is a minimal implementation of TX rate controlling that can be used
net/d80211/rate_control.h deleted +0 -154
154 lines not on this page · raw message
net/d80211/sta_info.c +1 -1
@@ -17,7 +17,7 @@ #include <linux/if_arp.h>#include <net/d80211.h> #include "ieee80211_i.h" -#include "rate_control.h" +#include "ieee80211_rate.h" #include "sta_info.h"
Signature · 1 line
1.3.0
PATCH 5/18 d80211: proper rate_control loading
In reply to Jiri BencFix locking issues with loading of rate_control modules. This still doesn't allow changing of the modules on the fly.
---
net/d80211/Makefile | 1 net/d80211/ieee80211.c | 108 ++++++++++++++----------------------------- net/d80211/ieee80211_rate.c | 92 +++++++++++++++++++++++++++++++++++++ net/d80211/ieee80211_rate.h | 8 ++- net/d80211/rate_control.c | 3 + 5 files changed, 136 insertions(+), 76 deletions(-) create mode 100644 net/d80211/ieee80211_rate.c
1e55cd13b3f20ac9560270a5455d58f0cbd2acd9
net/d80211/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_D80211) += 80211.o rate_con ieee80211_sta.o \ ieee80211_dev.o \ ieee80211_iface.o \ + ieee80211_rate.o \ ieee80211_sysfs.o \ ieee80211_sysfs_sta.o \ michael.o \
net/d80211/ieee80211.c +35 -73
138 lines not on this page · raw message
net/d80211/ieee80211_rate.c new file +92 -0
92 lines not on this page · raw message
net/d80211/ieee80211_rate.h +6 -2
@@ -37,6 +37,7 @@ struct rate_control_extra {struct rate_control_ops { +struct module *module;const char *name;void (*tx_status)(struct net_device *dev,struct sk_buff *skb,struct ieee80211_tx_status *status);
@@ -61,6 +62,8 @@ struct rate_control_ops {int ieee80211_rate_control_register (struct rate_control_ops *ops);void ieee80211_rate_control_unregister (struct rate_control_ops *ops); +struct rate_control_ops *ieee80211_rate_control_ops_get (char *name); +void ieee80211_rate_control_ops_put (struct rate_control_ops *ops); static inline void rate_control_tx_status(struct net_device *dev, struct sk_buff *skb,
@@ -93,9 +96,10 @@ static inline void rate_control_clear(st } -static inline void *rate_control_alloc (struct ieee80211_local *local) +static inline void *rate_control_alloc (struct rate_control_ops *ops, +struct ieee80211_local *local) { -return local->rate_ctrl->alloc (local); +return ops->alloc (local); }
net/d80211/rate_control.c +2 -1
@@ -28,7 +28,7 @@ #define RATE_CONTROL_EMERG_DEC 2#define RATE_CONTROL_INTERVAL (HZ / 20)#define RATE_CONTROL_MIN_TX 10 -MODULE_ALIAS ("ieee80211_rate_control" ); +MODULE_ALIAS ("rc80211_default" );static void rate_control_rate_inc (struct ieee80211_local *local,struct sta_info *sta)
@@ -361,6 +361,7 @@ static void rate_control_simple_remove_s }static struct rate_control_ops rate_control_simple = { + .module =THIS_MODULE , .name ="simple" , .tx_status = rate_control_simple_tx_status, .get_rate = rate_control_simple_get_rate,
Signature · 1 line
1.3.0
PATCH 6/18 d80211: rename rate_control.c to rc80211_simple.c
In reply to Jiri BencTo support changing of the rate control modules on the fly we need well-defined names of the modules.
Let it be rc80211_*. Rename the only one rate control module (rate_control.c) into rc80211_simple.c. The module alias for the default module is changed to rc80211_default.
---
net/d80211/Makefile | 2 net/d80211/rate_control.c | 395 ------------------------------------------- net/d80211/rc80211_simple.c | 395 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 396 insertions(+), 396 deletions(-) delete mode 100644 net/d80211/rate_control.c create mode 100644 net/d80211/rc80211_simple.c
4bef5903c5a0b05778d31f605668b6d8576b40d8
net/d80211/Makefile +1 -1
@@ -1,4 +1,4 @@ -obj-$(CONFIG_D80211) += 80211.o rate_control.o +obj-$(CONFIG_D80211) += 80211.o rc80211_simple.o 80211-objs-$(CONFIG_D80211_LEDS) += ieee80211_led.o
net/d80211/rate_control.c deleted +0 -395
395 lines not on this page · raw message
net/d80211/rc80211_simple.c new file +395 -0
395 lines not on this page · raw message
Signature · 1 line
1.3.0
PATCH 7/18 d80211: proper rate control structures freeing
In reply to Jiri BencAdd a reference counting to the rate control algorithm structure. This prevents unloading of the rate control module when there still exists a sta entry which uses that module.
To achieve this some other things need to be done in this patch as well:
- The new rate_control_ref structure is introduced. It replaces the rate_ctrl and rate_ctrl_priv fields in the ieee80211_local.
- Parameters for most rate control callbacks are changed.
---
net/d80211/ieee80211.c | 37 +++++-------- net/d80211/ieee80211_i.h | 3 - net/d80211/ieee80211_ioctl.c | 2 - net/d80211/ieee80211_rate.c | 54 +++++++++++++++++- net/d80211/ieee80211_rate.h | 124 +++++++++++++++++++++--------------------- net/d80211/ieee80211_scan.c | 2 - net/d80211/ieee80211_sta.c | 6 +- net/d80211/ieee80211_sysfs.c | 5 +- net/d80211/rc80211_simple.c | 19 ++++-- net/d80211/sta_info.c | 14 +++-- net/d80211/sta_info.h | 1 11 files changed, 158 insertions(+), 109 deletions(-)
a020fc0696485e6cf460060c7fc03c1066897ba0
net/d80211/ieee80211.c +15 -22
@@ -351,7 +351,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 extra.startidx =0 ; extra.endidx = tx->local->num_curr_rates; - tx->u.tx.rate =rate_control_get_rate (tx->dev, tx->skb, &extra); + tx->u.tx.rate =rate_control_get_rate (tx->local, tx->dev, tx->skb, + &extra);if (unlikely (extra.probe !=NULL )) { tx->u.tx.control->rate_ctrl_probe =1 ; tx->u.tx.probe_last_frag =1 ;
@@ -1781,7 +1782,7 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */memset (&extra,0 ,sizeof (extra)); extra.endidx = local->num_curr_rates; - rate =rate_control_get_rate (dev, skb, &extra); + rate =rate_control_get_rate (local, dev, skb, &extra);if (!rate) {if (net_ratelimit ()) { printk(KERN_DEBUG "%s: ieee80211_beacon_get: no rate "
@@ -4102,7 +4103,7 @@ void ieee80211_tx_status(struct net_devireturn ; } }else { -rate_control_tx_status (dev, skb, status); +rate_control_tx_status (local, dev, skb, status); }ieee80211_led_tx (local,0 );
@@ -4304,36 +4305,30 @@ static void ieee80211_precalc_modes(strustatic int rate_control_initialize (struct ieee80211_local *local) { -struct rate_control_ops *ops; +struct rate_control_ref *ref; - ops =ieee80211_rate_control_ops_get (NULL ); -if (!ops) { + ref =rate_control_alloc (NULL , local); +if (!ref) {printk (KERN_WARNING "%s: Failed to select rate control " "algorithm\n" , local->mdev->name);return -1 ; } - local->rate_ctrl_priv =rate_control_alloc (ops, local); -if (!local->rate_ctrl_priv) { -ieee80211_rate_control_ops_put (ops); -return -1 ; - } - local->rate_ctrl = ops; + local->rate_ctrl = ref;printk (KERN_DEBUG "%s: Selected rate control " "algorithm '%s'\n" , local->mdev->name, - local->rate_ctrl->name); + ref->ops->name);return 0 ; }static void rate_control_deinitialize (struct ieee80211_local *local) { -struct rate_control_ops *ops; +struct rate_control_ref *ref; -rate_control_free (local); - ops = local->rate_ctrl; + ref = local->rate_ctrl; local->rate_ctrl =NULL ; -ieee80211_rate_control_ops_put (ops); +rate_control_put (ref); } struct net_device *ieee80211_alloc_hw(size_t priv_data_len,
@@ -4511,8 +4506,7 @@ int ieee80211_register_hw(struct net_dev "algorithm\n", dev->name); goto fail_rate; } - result =rate_control_add_attrs (local, local->rate_ctrl_priv, - &local->class_dev.kobj); + result =rate_control_add_attrs (local->ref, &local->class_dev.kobj);if (result <0 ) {printk (KERN_DEBUG "%s: Failed to register sysfs attributes " "for rate control\n" , dev->name);
@@ -4630,8 +4624,8 @@ void ieee80211_unregister_hw(struct net_ieee80211_rx_bss_list_deinit (dev);ieee80211_clear_tx_pending (local);sta_info_stop (local); -rate_control_remove_attrs (local, local->rate_ctrl_priv, - &local->class_dev.kobj); +rate_control_remove_attrs (local->ref, &local->class_dev.kobj); +rate_control_deinitialize (local);ieee80211_dev_sysfs_del (local);for (i =0 ; i <NUM_IEEE80211_MODES ; i++) {
@@ -4662,7 +4656,6 @@ EXPORT_SYMBOL(ieee80211_free_hw);void ieee80211_release_hw (struct ieee80211_local *local) { -rate_control_deinitialize (local);kfree (local); }
net/d80211/ieee80211_i.h +1 -2
@@ -382,8 +382,7 @@ #define IEEE80211_IRQSAFE_QUEUE_LIMIT 12struct ieee80211_rate *curr_rates;int num_curr_rates; -void *rate_ctrl_priv; -struct rate_control_ops *rate_ctrl; +struct rate_control_ref *rate_ctrl;int next_mode;/* MODE_IEEE80211* * The mode preference for next channel change. This is
net/d80211/ieee80211_ioctl.c +1 -1
@@ -311,7 +311,7 @@ static int ieee80211_ioctl_add_sta(struc } sta->supp_rates = rates; -rate_control_rate_init (local, sta); +rate_control_rate_init (sta, local);if (param->u.add_sta.wds_flags &0x01 ) sta->flags |=WLAN_STA_WDS ;
net/d80211/ieee80211_rate.c +51 -3
72 lines not on this page · raw message
net/d80211/ieee80211_rate.h +63 -61
189 lines not on this page · raw message
net/d80211/ieee80211_scan.c +1 -1
@@ -333,7 +333,7 @@ void ieee80211_init_scan(struct net_devimemset (&extra,0 ,sizeof (extra)); extra.endidx = local->num_curr_rates; local->scan.tx_control.tx_rate = -rate_control_get_rate (dev, local->scan.skb, &extra)->val; +rate_control_get_rate (local, dev, local->scan.skb, &extra)->val; local->scan.tx_control.no_ack =1 ; }
net/d80211/ieee80211_sta.c +3 -3
@@ -1189,7 +1189,7 @@ static void ieee80211_rx_mgmt_assoc_resp } sta->supp_rates = rates; -rate_control_rate_init (local, sta); +rate_control_rate_init (sta, local);if (elems.wmm_param && ifsta->wmm_enabled) { sta->flags |=WLAN_STA_WME ;
@@ -2054,7 +2054,7 @@ static int ieee80211_sta_join_ibss(struc control.pkt_type =PKT_PROBE_RESP ;memset (&extra,0 ,sizeof (extra)); extra.endidx = local->num_curr_rates; - rate =rate_control_get_rate (dev, skb, &extra); + rate =rate_control_get_rate (local, dev, skb, &extra);if (!rate) {printk (KERN_DEBUG "%s: Failed to determine TX rate " "for IBSS beacon\n" , dev->name);
@@ -2839,7 +2839,7 @@ struct sta_info * ieee80211_ibss_add_sta sta->dev = sta_dev; sta->supp_rates = sdata->u.sta.supp_rates_bits; -rate_control_rate_init (local, sta); +rate_control_rate_init (sta, local);return sta;/* caller will call sta_info_put() */ }
net/d80211/ieee80211_sysfs.c +3 -2
@@ -188,8 +188,9 @@ __IEEE80211_LOCAL_SHOW(modes);static ssize_t ieee80211_local_fmt_rate_ctrl_alg (struct ieee80211_local *local,char *buf) { -if (local->rate_ctrl && local->rate_ctrl_priv) -return sprintf (buf,"%s\n" , local->rate_ctrl->name); +struct rate_control_ref *ref = local->rate_ctrl; +if (ref) +return sprintf (buf,"%s\n" , ref->ops->name);return 0 ; }__IEEE80211_LOCAL_SHOW (rate_ctrl_alg);
net/d80211/rc80211_simple.c +11 -8
@@ -120,7 +120,7 @@ struct sta_rate_control { }; -static void rate_control_simple_tx_status (struct net_device *dev, +static void rate_control_simple_tx_status (void *priv,struct net_device *dev,struct sk_buff *skb,struct ieee80211_tx_status *status) {
@@ -212,7 +212,8 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */static struct ieee80211_rate * -rate_control_simple_get_rate (struct net_device *dev,struct sk_buff *skb, +rate_control_simple_get_rate (void *priv,struct net_device *dev, +struct sk_buff *skb,struct rate_control_extra *extra) {struct ieee80211_local *local = dev->ieee80211_ptr;
@@ -264,7 +265,8 @@ rate_control_simple_get_rate(struct net_ } -static void rate_control_simple_rate_init (struct ieee80211_local *local, +static void rate_control_simple_rate_init (void *priv,void *priv_sta, +struct ieee80211_local *local,struct sta_info *sta) {int i;
@@ -303,7 +305,7 @@ static void rate_control_simple_clear(vo } -static void *rate_control_simple_alloc_sta (void ) +static void *rate_control_simple_alloc_sta (void *priv) {struct sta_rate_control *rctrl;
@@ -313,9 +315,9 @@ static void * rate_control_simple_alloc_ } -static void rate_control_simple_free_sta (void *priv) +static void rate_control_simple_free_sta (void *priv,void *priv_sta) { -struct sta_rate_control *rctrl = priv; +struct sta_rate_control *rctrl = priv_sta;kfree (rctrl); }
@@ -349,12 +351,13 @@ static struct attribute_group rate_contr .attrs = rate_control_simple_sta_attrs, }; -static int rate_control_simple_add_sta_attrs (void *priv,struct kobject *kobj) +static int rate_control_simple_add_sta_attrs (void *priv,void *priv_sta, +struct kobject *kobj) {return sysfs_create_group (kobj, &rate_control_simple_sta_group); } -static void rate_control_simple_remove_sta_attrs (void *priv, +static void rate_control_simple_remove_sta_attrs (void *priv,void *priv_sta,struct kobject *kobj) {sysfs_remove_group (kobj, &rate_control_simple_sta_group);
net/d80211/sta_info.c +8 -6
@@ -123,7 +123,8 @@ void sta_info_release(struct kobject *kowhile ((skb =skb_dequeue (&sta->tx_filtered)) !=NULL ) {dev_kfree_skb_any (skb); } -rate_control_free_sta (local, sta->rate_ctrl_priv); +rate_control_free_sta (sta->rate_ctrl, sta->rate_ctrl_priv); +rate_control_put (sta->rate_ctrl);kfree (sta); }
@@ -146,8 +147,10 @@ struct sta_info * sta_info_add(struct ie sta->kobj.kset = &local->sta_kset;kobject_init (&sta->kobj); - sta->rate_ctrl_priv =rate_control_alloc_sta (local); + sta->rate_ctrl =rate_control_get (local->rate_ctrl); + sta->rate_ctrl_priv =rate_control_alloc_sta (sta->rate_ctrl);if (!sta->rate_ctrl_priv) { +rate_control_put (sta->rate_ctrl);kobject_put (&sta->kobj);kfree (sta);return NULL ;
@@ -177,8 +180,7 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */if (!in_interrupt ()) { sta->sysfs_registered =1 ;ieee80211_sta_sysfs_add (sta); -rate_control_add_sta_attrs (local, sta->rate_ctrl_priv, - &sta->kobj); +rate_control_add_sta_attrs (sta, &sta->kobj); }else {/* procfs entry adding might sleep, so schedule process context * task for adding proc entry for STAs that do not yet have
@@ -203,7 +205,7 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */ sta->key =NULL ; } -rate_control_remove_sta_attrs (local, sta->rate_ctrl_priv, &sta->kobj); +rate_control_remove_sta_attrs (sta, &sta->kobj);ieee80211_sta_sysfs_remove (sta);sta_info_put (sta);
@@ -370,7 +372,7 @@ static void sta_info_proc_add_task(void sta->sysfs_registered =1 ;ieee80211_sta_sysfs_add (sta); -rate_control_add_sta_attrs (local, sta->rate_ctrl_priv, &sta->kobj); +rate_control_add_sta_attrs (sta, &sta->kobj);sta_info_put (sta); } }
net/d80211/sta_info.h +1 -0
@@ -71,6 +71,7 @@ struct sta_info {u32 tx_num_mpdu_ok;u32 tx_num_mpdu_fail; +struct rate_control_ref *rate_ctrl;void *rate_ctrl_priv;/* last received seq/frag number from this STA (per RX queue) */
Signature · 1 line
1.3.0
PATCH 8/18 d80211: allow changing of the rate control algorithm
In reply to Jiri BencAllow changing of the rate control algorithm.
This has some limitations:
- The rate control algorithm can be set per-wiphy only.
- All of network interfaces of the wiphy have to be down to change the algorithm.
- All sta entries are flushed when the algorithm is succesfully changed.
- The add_sta ioctl can be called only at a running interface from now.
Changing of the algorithm is possible by writing a new algorithm name into /sys/class/ieee80211/phyX/rate_ctrl_alg. This will be most likely changed in the future.
---
net/d80211/ieee80211.c | 50 +++++++++++++++++++++++++++++------------- net/d80211/ieee80211_i.h | 2 ++ net/d80211/ieee80211_ioctl.c | 4 +++ net/d80211/ieee80211_sysfs.c | 18 ++++++++++++++- 4 files changed, 57 insertions(+), 17 deletions(-)
61a4837fa8e08fc3200b8fa026a84b4afcb674ff
net/d80211/ieee80211.c +34 -16
@@ -4303,22 +4303,44 @@ static void ieee80211_precalc_modes(stru } } -static int rate_control_initialize (struct ieee80211_local *local) +int ieee80211_init_rate_ctrl_alg (struct ieee80211_local *local, +const char *name) { -struct rate_control_ref *ref; +struct rate_control_ref *ref, *old; +int res; + +ASSERT_RTNL (); +if (local->open_count ||netif_running (local->mdev) || + (local->apdev &&netif_running (local->apdev))) +return -EBUSY ; - ref =rate_control_alloc (NULL , local); + ref =rate_control_alloc (name, local);if (!ref) {printk (KERN_WARNING "%s: Failed to select rate control " "algorithm\n" , local->mdev->name); -return -1 ; +return -ENOENT ; + } + res =rate_control_add_attrs (ref, &local->class_dev.kobj); +if (res <0 ) { +printk (KERN_DEBUG "%s: Failed to register sysfs attributes " +"for rate control\n" , local->mdev->name); +rate_control_put (ref); +return res; } + + old = local->rate_ctrl; local->rate_ctrl = ref; +if (old) { +rate_control_remove_attrs (ref, &local->class_dev.kobj); +rate_control_put (old); +sta_info_flush (local,NULL ); + }printk (KERN_DEBUG "%s: Selected rate control " "algorithm '%s'\n" , local->mdev->name, ref->ops->name); +return 0 ; }
@@ -4328,6 +4350,7 @@ static void rate_control_deinitialize(st ref = local->rate_ctrl; local->rate_ctrl =NULL ; +rate_control_remove_attrs (ref, &local->class_dev.kobj);rate_control_put (ref); }
@@ -4496,28 +4519,24 @@ int ieee80211_register_hw(struct net_dev goto fail_masterlink; } result =ieee80211_sysfs_add_netdevice (dev); -rtnl_unlock (); -if (result <0 ) +if (result <0 ) { +rtnl_unlock (); goto fail_if_sysfs; + } - result =rate_control_initialize (local); + result =ieee80211_init_rate_ctrl_alg (local,NULL ); +rtnl_unlock ();if (result <0 ) {printk (KERN_DEBUG "%s: Failed to initialize rate control " "algorithm\n" , dev->name); goto fail_rate; } - result =rate_control_add_attrs (local->ref, &local->class_dev.kobj); -if (result <0 ) { -printk (KERN_DEBUG "%s: Failed to register sysfs attributes " -"for rate control\n" , dev->name); - goto fail_rate_attrs; - } result =ieee80211_wep_init (local);if (result <0 ) {printk (KERN_DEBUG "%s: Failed to initialize wep\n" , dev->name); - goto fail_rate_attrs; + goto fail_wep; }/* TODO: add rtnl locking around device creation and qdisc install */
@@ -4536,7 +4555,7 @@ int ieee80211_register_hw(struct net_devreturn 0 ; -fail_rate_attrs: +fail_wep:rate_control_deinitialize (local); fail_rate:ieee80211_sysfs_remove_netdevice (dev);
@@ -4624,7 +4643,6 @@ void ieee80211_unregister_hw(struct net_ieee80211_rx_bss_list_deinit (dev);ieee80211_clear_tx_pending (local);sta_info_stop (local); -rate_control_remove_attrs (local->ref, &local->class_dev.kobj);rate_control_deinitialize (local);ieee80211_dev_sysfs_del (local);
net/d80211/ieee80211_i.h +2 -0
@@ -583,6 +583,8 @@ int ieee80211_if_update_wds(struct net_dvoid ieee80211_if_setup (struct net_device *dev);void ieee80211_if_mgmt_setup (struct net_device *dev);void ieee80211_if_shutdown (struct net_device *dev); +int ieee80211_init_rate_ctrl_alg (struct ieee80211_local *local, +const char *name);/* ieee80211_ioctl.c */ int ieee80211_ioctl (struct net_device *dev,struct ifreq *rq,int cmd);
net/d80211/ieee80211_ioctl.c +4 -0
@@ -270,6 +270,10 @@ static int ieee80211_ioctl_add_sta(strucstruct ieee80211_sub_if_data *sdata;int add_key_entry =1 ; +/* Prevent a race with changing the rate control algorithm */ +if (!netif_running (dev)) +return -ENETDOWN ; + sta =sta_info_get (local, param->sta_addr);if (!sta) {
net/d80211/ieee80211_sysfs.c +17 -1
@@ -102,6 +102,22 @@ static ssize_t store_remove_iface(structreturn res <0 ? res : len; } +static ssize_t store_rate_ctrl_alg (struct class_device *dev, +const char *buf,size_t len) +{ +struct ieee80211_local *local =to_ieee80211_local (dev); +int res; + +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; + res =rtnl_lock_local (local); +if (res) +return res; + res =ieee80211_init_rate_ctrl_alg (local, buf); +rtnl_unlock (); +return res <0 ? res : len; +} +static ssize_t ieee80211_local_show (struct class_device *dev,char *buf,ssize_t (*format)(struct ieee80211_local *,char *)) {
@@ -214,7 +230,7 @@ static struct class_device_attribute iee__ATTR (wep_iv,S_IRUGO , ieee80211_local_show_wep_iv,NULL ),__ATTR (tx_power_reduction,S_IRUGO , ieee80211_local_show_tx_power_reduction,NULL ),__ATTR (modes,S_IRUGO , ieee80211_local_show_modes,NULL ), - __ATTR(rate_ctrl_alg, S_IRUGO, ieee80211_local_show_rate_ctrl_alg, NULL), + __ATTR(rate_ctrl_alg, S_IRUGO | S_IWUGO, ieee80211_local_show_rate_ctrl_alg, store_rate_ctrl_alg), {} };
Signature · 1 line
1.3.0
PATCH 9/18 d80211: rate_control: do not use atomic allocations when not necessary
In reply to Jiri BencAllow GFP_KERNEL to be used for allocations of sta entries triggered from the user space.
---
net/d80211/ieee80211_ioctl.c | 2 +- net/d80211/ieee80211_rate.h | 7 ++++--- net/d80211/ieee80211_sta.c | 4 ++-- net/d80211/rc80211_simple.c | 4 ++-- net/d80211/sta_info.c | 8 +++----- net/d80211/sta_info.h | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-)
034b87e99c85b243b94c6955bbdce94825dd6b1f
net/d80211/ieee80211_ioctl.c +1 -1
@@ -277,7 +277,7 @@ static int ieee80211_ioctl_add_sta(struc sta =sta_info_get (local, param->sta_addr);if (!sta) { - sta =sta_info_add (local, dev, param->sta_addr); + sta =sta_info_add (local, dev, param->sta_addr,GFP_KERNEL );if (!sta)return -ENOMEM ; }
net/d80211/ieee80211_rate.h +4 -3
@@ -52,7 +52,7 @@ struct rate_control_ops {void *(*alloc)(struct ieee80211_local *local);void (*free)(void *priv); -void *(*alloc_sta)(void *priv); +void *(*alloc_sta)(void *priv,gfp_t gfp);void (*free_sta)(void *priv,void *priv_sta);int (*add_attrs)(void *priv,struct kobject *kobj);
@@ -112,9 +112,10 @@ static inline void rate_control_clear(st ref->ops->clear (ref->priv); } -static inline void *rate_control_alloc_sta (struct rate_control_ref *ref) +static inline void *rate_control_alloc_sta (struct rate_control_ref *ref, +gfp_t gfp) { -return ref->ops->alloc_sta (ref->priv); +return ref->ops->alloc_sta (ref->priv, gfp); } static inline void rate_control_free_sta(struct rate_control_ref *ref,
net/d80211/ieee80211_sta.c +2 -2
@@ -1158,7 +1158,7 @@ static void ieee80211_rx_mgmt_assoc_resp/* Add STA entry for the AP */ sta =sta_info_get (local, ifsta->bssid);if (!sta) { - sta =sta_info_add (local, dev, ifsta->bssid); + sta =sta_info_add (local, dev, ifsta->bssid,GFP_ATOMIC );if (!sta) {printk (KERN_DEBUG "%s: failed to add STA entry for the" " AP\n" , dev->name);
@@ -2832,7 +2832,7 @@ struct sta_info * ieee80211_ibss_add_staprintk (KERN_DEBUG "%s: Adding new IBSS station " MAC_FMT " (dev=%s)\n" , dev->name,MAC_ARG (addr), sta_dev->name); - sta =sta_info_add (local, dev, addr); + sta =sta_info_add (local, dev, addr,GFP_ATOMIC );if (!sta)return NULL ;
net/d80211/rc80211_simple.c +2 -2
@@ -305,11 +305,11 @@ static void rate_control_simple_clear(vo } -static void *rate_control_simple_alloc_sta (void *priv) +static void *rate_control_simple_alloc_sta (void *priv,gfp_t gfp) {struct sta_rate_control *rctrl; - rctrl =kzalloc (sizeof (*rctrl),GFP_ATOMIC ); + rctrl =kzalloc (sizeof (*rctrl), gfp);return rctrl; }
net/d80211/sta_info.c +3 -5
@@ -130,16 +130,14 @@ void sta_info_release(struct kobject *kostruct sta_info *sta_info_add (struct ieee80211_local *local, -struct net_device *dev,u8 *addr) +struct net_device *dev,u8 *addr,gfp_t gfp) {struct sta_info *sta; - sta =kmalloc (sizeof (*sta),GFP_ATOMIC ); + sta =kzalloc (sizeof (*sta), gfp);if (!sta)return NULL ; -memset (sta,0 ,sizeof (*sta)); -if (kobject_set_name (&sta->kobj,MAC_FMT ,MAC_ARG (addr))) {kfree (sta);return NULL ;
@@ -148,7 +146,7 @@ struct sta_info * sta_info_add(struct iekobject_init (&sta->kobj); sta->rate_ctrl =rate_control_get (local->rate_ctrl); - sta->rate_ctrl_priv =rate_control_alloc_sta (sta->rate_ctrl); + sta->rate_ctrl_priv =rate_control_alloc_sta (sta->rate_ctrl, gfp);if (!sta->rate_ctrl_priv) {rate_control_put (sta->rate_ctrl);kobject_put (&sta->kobj);
net/d80211/sta_info.h +1 -1
@@ -133,7 +133,7 @@ struct sta_info * sta_info_get(struct ieint sta_info_min_txrate_get (struct ieee80211_local *local);void sta_info_put (struct sta_info *sta);struct sta_info *sta_info_add (struct ieee80211_local *local, -struct net_device *dev,u8 *addr); +struct net_device *dev,u8 *addr,gfp_t gfp);void sta_info_free (struct sta_info *sta,int locked);void sta_info_release (struct kobject *kobj);void sta_info_init (struct ieee80211_local *local);
Signature · 1 line
1.3.0
PATCH 10/18 d80211: Fix overflow when creating AVS header
In reply to Jiri BencFrom: David Kimdon <[email protected]>
Fix overflow when converting timespec to microseconds. Without this patch you can get an overflow during the multiplication which can result in a negative number. hostime is define here:
4.4 hosttime
The hosttime field is set to the current value of the host maintained clock variable when the frame is received.
(from http://www.locustworld.com/tracker/getfile/prism2drivers/doc/capturefrm.txt)
it is a u64.
---
net/d80211/ieee80211.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
4fdbfdf950c3260f16bad12bb1a5ebeac97bee37
net/d80211/ieee80211.c +1 -1
@@ -2579,7 +2579,7 @@ ieee80211_rx_mgmt(struct net_device *devstruct ieee80211_rate *rate;jiffies_to_timespec (status->hosttime, &ts); - fi->hosttime =cpu_to_be64 (ts.tv_sec *1000000 + + fi->hosttime =cpu_to_be64 ((u64 ) ts.tv_sec *1000000 + ts.tv_nsec /1000 ); fi->mactime =cpu_to_be64 (status->mactime);switch (status->phymode) {
Signature · 1 line
1.3.0
PATCH 11/18 d80211: remove unused xr structure members, interface, etc.
In reply to Jiri BencFrom: Elliot Schwartz <[email protected]>
This is all unused.
---
include/net/d80211.h | 9 --------- include/net/d80211_mgmt.h | 4 ---- include/net/d80211_shared.h | 4 +--- net/d80211/hostapd_ioctl.h | 1 - net/d80211/ieee80211_sysfs_sta.c | 5 ++--- net/d80211/sta_info.h | 1 - 6 files changed, 3 insertions(+), 21 deletions(-)
6e353ac70959573dceff64137badeb170cec0709
include/net/d80211.h +0 -9
@@ -82,7 +82,6 @@ struct ieee80211_hw_modes {struct ieee80211_channel *channels;int num_rates;struct ieee80211_rate *rates; -int xr_end;/* only used with Atheros XR */ };struct ieee80211_tx_queue_params {
@@ -166,8 +165,6 @@ struct ieee80211_tx_control {* transmission */ unsigned int fast_frame:1; - unsigned int atheros_xr:1; /* only used with Atheros XR */ - unsigned int power_level:8; /* per-packet transmit power level, in dBm*/ unsigned int antenna_sel:4; /* 0 = default/diversity,
@@ -193,7 +190,6 @@ struct ieee80211_tx_control {#define RX_FLAG_MMIC_ERROR 0x1#define RX_FLAG_DECRYPTED 0x2 -#define RX_FLAG_XR_DOUBLE_CHIRP 0x4/* Receive status. The low-level driver should provide this information * (the subset supported by hardware) to the 802.11 code with each received
@@ -276,8 +272,6 @@ struct ieee80211_conf {int atheros_super_ag_turbo_g;int atheros_super_ag_turbo_prime; -int atheros_xr; -/* Following five fields are used for IEEE 802.11H */ unsigned int radar_detect;unsigned int spect_mgmt;
@@ -679,9 +673,6 @@ struct ieee80211_hw {* needed only for IBSS mode and the result of this function is used to * determine whether to reply to Probe Requests. */ int (*tx_last_beacon)(struct net_device *dev); - -/* Optional handler for XR-in-use notification. */ -int (*atheros_xr_in_use)(struct net_device *dev,int in_use); };/* Allocate a new hardware device. This must be called once for each
include/net/d80211_mgmt.h +0 -4
@@ -220,8 +220,4 @@ enum ieee80211_eid {WLAN_EID_QOS_PARAMETER =222 }; - - -#define ATHEROS_INFO_USEXR BIT(3) -#endif /* D802_11_MGMT_H */
include/net/d80211_shared.h +1 -3
@@ -21,8 +21,7 @@ enum {MODE_ATHEROS_TURBOG =4 /* Atheros Turbo mode (2x.11g at 2.4 GHz) */ ,MODE_ATHEROS_PRIME =5 /* Atheros Dynamic Turbo mode */ ,MODE_ATHEROS_PRIMEG =6 /* Atheros Dynamic Turbo mode G */ , -MODE_ATHEROS_XR =7 /* Atheros XR mode */ , - NUM_IEEE80211_MODES = 8 + NUM_IEEE80211_MODES = 7 };#define IEEE80211_CHAN_W_SCAN 0x00000001
@@ -40,7 +39,6 @@ #define IEEE80211_RATE_OFDM 0x00000020#define IEEE80211_RATE_CCK 0x00000040#define IEEE80211_RATE_TURBO 0x00000080#define IEEE80211_RATE_MANDATORY 0x00000100 -#define IEEE80211_RATE_XR 0x00000200#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)#define IEEE80211_RATE_MODULATION (f) \
net/d80211/hostapd_ioctl.h +0 -1
@@ -186,7 +186,6 @@ struct prism2_hostapd_param {* IEEE80211_ATHEROS_SUPER_AG */ u8 atheros_super_ag; -u8 atheros_xr_mode;u8 wds_flags;#define IEEE80211_STA_DYNAMIC_ENC BIT(0)u8 enc_flags;
net/d80211/ieee80211_sysfs_sta.c +2 -3
@@ -77,7 +77,7 @@ STA_ATTR(wep_weak_iv_count, wep_weak_iv_static ssize_t show_sta_flags (const struct sta_info *sta,char *buf) { - return sprintf(buf, "%s%s%s%s%s%s%s%s%s%s", + return sprintf(buf, "%s%s%s%s%s%s%s%s%s", sta->flags & WLAN_STA_AUTH ? "AUTH\n" : "", sta->flags & WLAN_STA_ASSOC ? "ASSOC\n" : "", sta->flags & WLAN_STA_PS ? "PS\n" : "",
@@ -87,8 +87,7 @@ static ssize_t show_sta_flags(const stru sta->flags &WLAN_STA_SHORT_PREAMBLE ?"SHORT PREAMBLE\n" :"" , sta->flags &WLAN_STA_WME ?"WME\n" :"" , - sta->flags &WLAN_STA_WDS ?"WDS\n" :"" , - sta->flags & WLAN_STA_XR ? "XR\n" : ""); + sta->flags & WLAN_STA_WDS ? "WDS\n" : ""); }__STA_ATTR (flags);
net/d80211/sta_info.h +0 -1
@@ -26,7 +26,6 @@ #define WLAN_STA_AUTHORIZED BIT(5) /* If*/ #define WLAN_STA_SHORT_PREAMBLE BIT(7)#define WLAN_STA_WME BIT(9) -#define WLAN_STA_XR BIT(26)#define WLAN_STA_WDS BIT(27)
Signature · 1 line
1.3.0
PATCH 12/18 d80211: remove rate limit code
In reply to Jiri BencFrom: Elliot Schwartz <[email protected]>
Remove unused and more or less pointless rate limiting code. This would have just dropped multicast frames arbitrarily when the limit is reached which is quite useless and does not really belong to 802.11 code.
---
net/d80211/hostapd_ioctl.h | 4 ++-- net/d80211/ieee80211.c | 38 -------------------------------------- net/d80211/ieee80211_i.h | 5 ----- net/d80211/ieee80211_ioctl.c | 27 --------------------------- net/d80211/ieee80211_sysfs.c | 2 -- 5 files changed, 2 insertions(+), 74 deletions(-)
e57d91e2de0ac577bce30aa6c752627ad735bd4f
net/d80211/hostapd_ioctl.h +2 -2
@@ -58,8 +58,8 @@ enum {PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES =1001 ,PRISM2_PARAM_DROP_UNENCRYPTED =1002 ,PRISM2_PARAM_PREAMBLE =1003 , -PRISM2_PARAM_RATE_LIMIT =1004 , -PRISM2_PARAM_RATE_LIMIT_BURST =1005 , +PRISM2_PARAM_RATE_LIMIT =1004 ,/* no longer used */ +PRISM2_PARAM_RATE_LIMIT_BURST =1005 ,/* no longer used */ PRISM2_PARAM_SHORT_SLOT_TIME =1006 ,PRISM2_PARAM_TEST_MODE =1007 , PRISM2_PARAM_NEXT_MODE = 1008,
net/d80211/ieee80211.c +0 -38
@@ -834,38 +834,6 @@ ieee80211_tx_h_misc(struct ieee80211_txr } -static void ieee80211_rate_limit (unsigned long data) -{ -struct ieee80211_local *local = (struct ieee80211_local *) data; - -if (local->rate_limit) { - local->rate_limit_bucket += local->rate_limit; -if (local->rate_limit_bucket > local->rate_limit_burst) - local->rate_limit_bucket = local->rate_limit_burst; - local->rate_limit_timer.expires = jiffies +HZ ; -add_timer (&local->rate_limit_timer); - } -} - - -static ieee80211_txrx_result -ieee80211_tx_h_rate_limit (struct ieee80211_txrx_data *tx) -{ - -if (likely (!tx->local->rate_limit || tx->u.tx.unicast)) -return TXRX_CONTINUE ; - -/* rate limit */ -if (tx->local->rate_limit_bucket) { - tx->local->rate_limit_bucket--; -return TXRX_CONTINUE ; - } - -I802_DEBUG_INC (tx->local->tx_handlers_drop_rate_limit); -return TXRX_DROP ; -} - -static ieee80211_txrx_result ieee80211_tx_h_check_assoc (struct ieee80211_txrx_data *tx) {
@@ -4203,7 +4171,6 @@ static ieee80211_rx_handler ieee80211_rxstatic ieee80211_tx_handler ieee80211_tx_handlers[] = { - ieee80211_tx_h_rate_limit, ieee80211_tx_h_check_assoc, ieee80211_tx_h_ps_buf, ieee80211_tx_h_select_key,
@@ -4416,9 +4383,6 @@ struct net_device *ieee80211_alloc_hw(siinit_timer (&local->scan.timer);/* clear it out */ spin_lock_init (&local->generic_lock); -init_timer (&local->rate_limit_timer); - local->rate_limit_timer.function = ieee80211_rate_limit; - local->rate_limit_timer.data = (unsigned long ) local;init_timer (&local->stat_timer); local->stat_timer.function = ieee80211_stat_refresh; local->stat_timer.data = (unsigned long ) local;
@@ -4626,8 +4590,6 @@ void ieee80211_unregister_hw(struct net_rtnl_unlock (); -if (local->rate_limit) -del_timer_sync (&local->rate_limit_timer);if (local->stat_time)del_timer_sync (&local->stat_timer);if (local->scan_work.data) {
net/d80211/ieee80211_i.h +0 -5
@@ -469,10 +469,6 @@ #endifu32 stat_time;struct timer_list stat_timer; -struct timer_list rate_limit_timer; -u32 rate_limit; -u32 rate_limit_burst; -u32 rate_limit_bucket;struct proc_dir_entry *proc, *proc_sta, *proc_iface;struct work_struct sta_proc_add;
@@ -492,7 +488,6 @@ #ifdef CONFIG_D80211_DEBUG_COUNTERSunsigned int tx_handlers_drop_unencrypted;unsigned int tx_handlers_drop_fragment;unsigned int tx_handlers_drop_wep; -unsigned int tx_handlers_drop_rate_limit;unsigned int tx_handlers_drop_not_assoc;unsigned int tx_handlers_drop_unauth_port;unsigned int rx_handlers_drop;
net/d80211/ieee80211_ioctl.c +0 -27
@@ -2409,25 +2409,6 @@ static int ieee80211_ioctl_prism2_param( local->short_preamble = value;break ; -case PRISM2_PARAM_RATE_LIMIT_BURST : - local->rate_limit_burst = value; - local->rate_limit_bucket = value; -break ; - -case PRISM2_PARAM_RATE_LIMIT : -/* number of packets (tokens) allowed per second */ -if (!local->rate_limit && value) { -if (!local->rate_limit_burst) local->rate_limit_burst = - value; - local->rate_limit_bucket = local->rate_limit_burst; - local->rate_limit_timer.expires = jiffies +HZ ; -add_timer (&local->rate_limit_timer); - }else if (local->rate_limit && !value) { -del_timer_sync (&local->rate_limit_timer); - } - local->rate_limit = value; -break ; -case PRISM2_PARAM_STAT_TIME :if (!local->stat_time && value) { local->stat_timer.expires = jiffies +HZ * value /100 ;
@@ -2660,14 +2641,6 @@ static int ieee80211_ioctl_get_prism2_pa *param = local->short_preamble;break ; -case PRISM2_PARAM_RATE_LIMIT_BURST : - *param = local->rate_limit_burst; -break ; - -case PRISM2_PARAM_RATE_LIMIT : - *param = local->rate_limit; -break ; -case PRISM2_PARAM_STAT_TIME : *param = local->stat_time;break ;
net/d80211/ieee80211_sysfs.c +0 -2
@@ -258,7 +258,6 @@ IEEE80211_LOCAL_ATTR(tx_handlers_queued,IEEE80211_LOCAL_ATTR (tx_handlers_drop_unencrypted, tx_handlers_drop_unencrypted,"%u" );IEEE80211_LOCAL_ATTR (tx_handlers_drop_fragment, tx_handlers_drop_fragment,"%u" );IEEE80211_LOCAL_ATTR (tx_handlers_drop_wep, tx_handlers_drop_wep,"%u" ); -IEEE80211_LOCAL_ATTR (tx_handlers_drop_rate_limit, tx_handlers_drop_rate_limit,"%u" );IEEE80211_LOCAL_ATTR (tx_handlers_drop_not_assoc, tx_handlers_drop_not_assoc,"%u" );IEEE80211_LOCAL_ATTR (tx_handlers_drop_unauth_port, tx_handlers_drop_unauth_port,"%u" );IEEE80211_LOCAL_ATTR (rx_handlers_drop, rx_handlers_drop,"%u" );
@@ -369,7 +368,6 @@ #ifdef CONFIG_D80211_DEBUG_COUNTERS &class_device_attr_tx_handlers_drop_unencrypted.attr, &class_device_attr_tx_handlers_drop_fragment.attr, &class_device_attr_tx_handlers_drop_wep.attr, - &class_device_attr_tx_handlers_drop_rate_limit.attr, &class_device_attr_tx_handlers_drop_not_assoc.attr, &class_device_attr_tx_handlers_drop_unauth_port.attr, &class_device_attr_rx_handlers_drop.attr,
Signature · 1 line
1.3.0
PATCH 13/18 d80211: retain PS frames for at least STA listen interval
In reply to Jiri BencFrom: Jouni Malinen <[email protected]>
Start using 2 * listen_int * beacon_int as a timeout for PS buffered unicast frames if that is longer than 10 seconds. Previously, we used fixed 10 second limit regardless of the listen interval.
This fixes power saving for STAs that request very long listen interval (over 10 seconds).
This was reported by UNH IOL 802.11 AP Base MAC Test Suite v2.4 Test #1.3.2 Part e.
While we are at it, remove the station from the TIM when the PS buffer is empty.
---
net/d80211/hostapd_ioctl.h | 1 + net/d80211/ieee80211_ioctl.c | 1 + net/d80211/sta_info.c | 24 ++++++++++++++++-------- net/d80211/sta_info.h | 5 ++++- 4 files changed, 22 insertions(+), 9 deletions(-)
a1db08ff39daef9a57d50d737bdbb91f8a5e0592
net/d80211/hostapd_ioctl.h +1 -0
@@ -189,6 +189,7 @@ struct prism2_hostapd_param {u8 wds_flags;#define IEEE80211_STA_DYNAMIC_ENC BIT(0)u8 enc_flags; +u16 listen_interval; } add_sta;struct {u32 inactive_msec;
net/d80211/ieee80211_ioctl.c +1 -0
@@ -300,6 +300,7 @@ static int ieee80211_ioctl_add_sta(struc sta->aid = param->u.add_sta.aid;if (sta->aid >IEEE80211_MAX_AID ) sta->aid =0 ; + sta->listen_interval = param->u.add_sta.listen_interval; rates =0 ;for (i =0 ; i <sizeof (param->u.add_sta.supp_rates); i++) {
net/d80211/sta_info.c +16 -8
@@ -269,18 +269,24 @@ void sta_info_free(struct sta_info *sta, } -static inline int sta_info_buffer_expired (struct sk_buff *skb) +static inline int sta_info_buffer_expired (struct ieee80211_local *local, +struct sta_info *sta, +struct sk_buff *skb) {struct ieee80211_tx_packet_data *pkt_data; +int timeout; +if (!skb)return 0 ; -/* TODO: this could be improved by passing STA listen interval into -* the kernel driver and expiring frames after 2 x listen_interval x -* beacon interval */ - pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; -return time_after (jiffies, pkt_data->jiffies +STA_TX_BUFFER_EXPIRE ); + +/* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */ + timeout = (sta->listen_interval * local->conf.beacon_int *32 / +15625 ) *HZ ; +if (timeout <STA_TX_BUFFER_EXPIRE ) + timeout =STA_TX_BUFFER_EXPIRE ; +return time_after (jiffies, pkt_data->jiffies + timeout); }
@@ -296,9 +302,11 @@ static void sta_info_cleanup_expire_bufffor (;;) {spin_lock_irqsave (&sta->ps_tx_buf.lock, flags); skb =skb_peek (&sta->ps_tx_buf); -if (sta_info_buffer_expired (skb)) +if (sta_info_buffer_expired (local, sta, skb)) { skb =__skb_dequeue (&sta->ps_tx_buf); -else +if (skb_queue_empty (&sta->ps_tx_buf)) + sta->flags &= ~WLAN_STA_TIM ; + }else skb =NULL ;spin_unlock_irqrestore (&sta->ps_tx_buf.lock, flags);
net/d80211/sta_info.h +4 -1
@@ -108,6 +108,8 @@ #ifdef CONFIG_D80211_DEBUG_COUNTERS#endif /* CONFIG_D80211_DEBUG_COUNTERS */ int vlan_id; + +u16 listen_interval; };
@@ -121,7 +123,8 @@ #define STA_HASH(sta) (sta[5])/* Maximum number of frames to buffer per power saving station */ #define STA_MAX_TX_BUFFER 128 -/* Buffered frame expiry time */ +/* Minimum buffered frame expiry time. If STA uses listen interval that is +* smaller than this value, the minimum value here is used instead. */ #define STA_TX_BUFFER_EXPIRE (10 * HZ)/* How often station data is cleaned up (e.g., expiration of buffered frames)
Signature · 1 line
1.3.0
PATCH 14/18 d80211: allow wireless vlan interface to have same MAC an AP interface
In reply to Jiri BencFrom: David Kimdon <[email protected]>
Wireless vlan interfaces need to have the same mac address as AP interfaces. The STA must not see the change when it is bound to a specific vlan, so the address of the vlan interface must be the same as the address of the AP interface the station associated with.
---
net/d80211/ieee80211.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
afff04d301dabfe05bb9bc5e4bb378c1b9223d45
net/d80211/ieee80211.c +6 -1
@@ -2096,7 +2096,12 @@ static inline int identical_mac_addr_all type2 == IEEE80211_IF_TYPE_WDS) || (type1 ==IEEE80211_IF_TYPE_WDS && (type2 ==IEEE80211_IF_TYPE_WDS || - type2 == IEEE80211_IF_TYPE_AP))); + type2 ==IEEE80211_IF_TYPE_AP )) || + (type1 ==IEEE80211_IF_TYPE_AP && + type2 ==IEEE80211_IF_TYPE_VLAN ) || + (type1 ==IEEE80211_IF_TYPE_VLAN && + (type2 ==IEEE80211_IF_TYPE_AP || + type2 == IEEE80211_IF_TYPE_VLAN))); }static int ieee80211_master_open (struct net_device *dev)
Signature · 1 line
1.3.0
PATCH 15/18 d80211: use FCS_LEN instead of hardcoded number.
In reply to Jiri BencFrom: David Kimdon <[email protected]>
---
net/d80211/ieee80211.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
22acdd71c90cc4123d3df59a07919d432847e3e7
net/d80211/ieee80211.c +2 -2
@@ -442,7 +442,7 @@ ieee80211_tx_h_fragment(struct ieee80211 hdrlen =ieee80211_get_hdrlen (tx->fc); payload_len = first->len - hdrlen; - per_fragm = frag_threshold - hdrlen -4 /* FCS */ ; + per_fragm = frag_threshold - hdrlen -FCS_LEN ; num_fragm = (payload_len + per_fragm -1 ) / per_fragm; frags =kzalloc (num_fragm *sizeof (struct sk_buff *),GFP_ATOMIC );
@@ -1062,7 +1062,7 @@ __ieee80211_tx_prepare(struct ieee80211_ control->no_ack =is_multicast_ether_addr (hdr->addr1); tx->fragmented = local->fragmentation_threshold <IEEE80211_MAX_FRAG_THRESHOLD && tx->u.tx.unicast && - skb->len +4 /* FCS */ > local->fragmentation_threshold && + skb->len +FCS_LEN > local->fragmentation_threshold && (!local->hw->set_frag_threshold);if (!tx->sta) control->clear_dst_mask =1 ;
Signature · 1 line
1.3.0
PATCH 16/18 d80211: silence sparse warning: bad constant expression
In reply to Jiri BencFrom: David Kimdon <[email protected]>
Sparse does not figure out that algs[] isn't really a variable length array. The message is:
net/d80211/ieee80211_sta.c:934:12: error: bad constant expression
This switches algs[] to be obviously a constant array, and derives the value of num_algs algs[]. The code is correct and equivalent with or without this change.
---
net/d80211/ieee80211_sta.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
59e8ad6835a88cf25f958e9224b0d9b17ccd2d89
net/d80211/ieee80211_sta.c +2 -2
@@ -930,8 +930,8 @@ static void ieee80211_rx_mgmt_auth(strucprintk (KERN_DEBUG "%s: AP denied authentication (auth_alg=%d " "code=%d)\n" , dev->name, ifsta->auth_alg, status_code);if (status_code ==WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG ) { -const int num_algs =3 ; -u8 algs[num_algs]; +u8 algs[3 ]; +const int num_algs =ARRAY_SIZE (algs);int i, pos; algs[0 ] = algs[1 ] = algs[2 ] =0xff ;if (ifsta->auth_algs &IEEE80211_AUTH_ALG_OPEN )
Signature · 1 line
1.3.0
PATCH 17/18 d80211: Fix TX/RX rates
In reply to Jiri BencFrom: Modestas Vainius <[email protected]>
This patch correctly initializes the force_unicast_rateidx and max_ratectrl_rateidx. This was not done previously and caused a bug in rf80211_simple where when rate_control_simple_get_rate() was called, the incorrect rate was selected from the list.
---
net/d80211/ieee80211.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
0fbc8104060588dab4db93f37e3cdfb86ffed062
net/d80211/ieee80211.c +2 -0
@@ -4414,6 +4414,8 @@ struct net_device *ieee80211_alloc_hw(si sdata->dev = mdev; sdata->master = mdev; sdata->local = local; + sdata->u.ap.force_unicast_rateidx =-1 ; + sdata->u.ap.max_ratectrl_rateidx =-1 ;ieee80211_if_sdata_init (sdata);list_add_tail (&sdata->list, &local->sub_if_list);
Signature · 1 line
1.3.0
PATCH 18/18 d80211: remove unused Super AG definitions, purge comment
In reply to Jiri BencFrom: David Kimdon <[email protected]>
Remove unused Super AG structure members, enums.
In struct ieee80211_tx_status the queue_length and queue_number could be useful outside the context of Super AG, so remove the comment and leave the members.
---
include/net/d80211.h | 14 -------------- include/net/d80211_shared.h | 4 +--- net/d80211/hostapd_ioctl.h | 4 ---- 3 files changed, 1 insertions(+), 21 deletions(-)
a3cdcec1a299bcb883a7bcc73588163f245b64ae
include/net/d80211.h +0 -14
@@ -159,12 +159,6 @@ struct ieee80211_tx_control { unsigned int requeue:1; unsigned int first_fragment:1; /* This is a first fragment of the* frame */ -/* following three flags are only used with Atheros Super A/G */ - unsigned int compress:1; - unsigned int turbo_prime_notify:1; /* notify HostAPd after frame -* transmission */ - unsigned int fast_frame:1; - unsigned int power_level:8; /* per-packet transmit power level, in dBm*/ unsigned int antenna_sel:4; /* 0 = default/diversity,
@@ -219,7 +213,6 @@ struct ieee80211_tx_status {int excessive_retries;int retry_count; -/* following two fields are only used with Atheros Super A/G */ int queue_length;/* information about TX queue */ int queue_number; };
@@ -265,13 +258,6 @@ struct ieee80211_conf {int antenna_def;int antenna_mode; -int atheros_super_ag_compression; -int atheros_super_ag_fast_frame; -int atheros_super_ag_burst; -int atheros_super_ag_wme_ele; -int atheros_super_ag_turbo_g; -int atheros_super_ag_turbo_prime; -/* Following five fields are used for IEEE 802.11H */ unsigned int radar_detect;unsigned int spect_mgmt;
include/net/d80211_shared.h +1 -3
@@ -19,9 +19,7 @@ enum {MODE_ATHEROS_TURBO =2 /* Atheros Turbo mode (2x.11a at 5 GHz) */ ,MODE_IEEE80211G =3 /* IEEE 802.11g (and 802.11b compatibility) */ ,MODE_ATHEROS_TURBOG =4 /* Atheros Turbo mode (2x.11g at 2.4 GHz) */ , -MODE_ATHEROS_PRIME =5 /* Atheros Dynamic Turbo mode */ , -MODE_ATHEROS_PRIMEG =6 /* Atheros Dynamic Turbo mode G */ , - NUM_IEEE80211_MODES = 7 + NUM_IEEE80211_MODES = 5 };#define IEEE80211_CHAN_W_SCAN 0x00000001
net/d80211/hostapd_ioctl.h +0 -4
@@ -182,10 +182,6 @@ struct prism2_hostapd_param {u16 aid;u16 capability;u8 supp_rates[32 ]; -/* atheros_super_ag and enc_flags are only used with -* IEEE80211_ATHEROS_SUPER_AG -*/ -u8 atheros_super_ag;u8 wds_flags;#define IEEE80211_STA_DYNAMIC_ENC BIT(0)u8 enc_flags;
Signature · 1 line
1.3.0