rt2x00 update
Subsystems (2)
cover rt2x00 update
Hi John,
The following 3 patches are intended on top of the patch series "mac80211 interface (config) cleanups" which were send to the list by Johannes.
The first one is a mac80211 bugfix for drivers that require the sequence counting to be done in software.
The second is a minor update for CTS protection support in rt2x00lib. There aren't any users for it at this time, but it is small, harmless and not really worth the effor for keepin it seperate. ;)
The last one cleans up beacon handling in rt2x00 which was possible because of Johannes' patch series.
Ivo
PATCH 1/3 mac80211: Include sequence number in IBSS and Mesh beacons
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
--- net/mac80211/tx.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
net/mac80211/tx.c +5 -0
@@ -1876,6 +1876,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, hdr->frame_control =IEEE80211_FC (IEEE80211_FTYPE_MGMT ,IEEE80211_STYPE_BEACON ); +ieee80211_include_sequence (sdata, hdr); + num_beacons = &ifsta->num_beacons; }else if (ieee80211_vif_is_mesh (&sdata->vif)) {/* headroom, head length, tail length and maximum TIM length */
@@ -1896,6 +1898,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,cpu_to_le16 (local->hw.conf.beacon_int); mgmt->u.beacon.capab_info =0x0 ;/* 0x0 for MPs */ +ieee80211_include_sequence (sdata, + (struct ieee80211_hdr *)skb->data); + pos =skb_put (skb,2 ); *pos++ =WLAN_EID_SSID ; *pos++ =0x0 ;
Signature · 1 line
1.5.6.1
PATCH 2/3 rt2x00: Add support for CTS protection in rt2x00lib
Inform drivers about the changed CTS protection settings.
--- drivers/net/wireless/rt2x00/rt2x00.h | 1 + drivers/net/wireless/rt2x00/rt2x00config.c | 2 ++ drivers/net/wireless/rt2x00/rt2x00mac.c | 2 +- 3 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +1 -0
@@ -434,6 +434,7 @@ struct rt2x00lib_conf {*/ struct rt2x00lib_erp {int short_preamble; +int cts_protection;int ack_timeout;int ack_consume_time;
drivers/net/wireless/rt2x00/rt2x00config.c +2 -0
@@ -84,6 +84,8 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,memset (&erp,0 ,sizeof (erp)); erp.short_preamble = bss_conf->use_short_preamble; + erp.cts_protection = bss_conf->use_cts_prot; + erp.ack_timeout =PLCP +get_duration (ACK_SIZE ,10 ); erp.ack_consume_time =SIFS +PLCP +get_duration (ACK_SIZE ,10 );
drivers/net/wireless/rt2x00/rt2x00mac.c +1 -1
@@ -511,7 +511,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,* When the erp information has changed, we should perform * additional configuration steps. For all other changes we are done. */ -if (changes &BSS_CHANGED_ERP_PREAMBLE ) { +if (changes & (BSS_CHANGED_ERP_PREAMBLE |BSS_CHANGED_ERP_CTS_PROT )) {if (!test_bit (DRIVER_REQUIRE_SCHEDULED , &rt2x00dev->flags))rt2x00lib_config_erp (rt2x00dev, intf, bss_conf);else
Signature · 1 line
1.5.6.1
PATCH 3/3 rt2x00: Reorganize beacon handling
With the new beacon handling from mac80211 we can reorganize the beacon handling in rt2x00 as well. This patch will move the function to the TX handlers, and move all duplicate code into rt2x00queue.c.
After this change the descriptor helper functions from rt2x00queue.c no longer need to be exported outside of rt2x00lib and can be declared static.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 89 +++++++---------- drivers/net/wireless/rt2x00/rt2500pci.c | 90 +++++++---------- drivers/net/wireless/rt2x00/rt2500usb.c | 154 +++++++++++------------------ drivers/net/wireless/rt2x00/rt2x00.h | 36 +------- drivers/net/wireless/rt2x00/rt2x00dev.c | 9 +-- drivers/net/wireless/rt2x00/rt2x00lib.h | 8 ++ drivers/net/wireless/rt2x00/rt2x00mac.c | 31 ++---- drivers/net/wireless/rt2x00/rt2x00queue.c | 64 +++++++++++- drivers/net/wireless/rt2x00/rt61pci.c | 103 +++++++------------- drivers/net/wireless/rt2x00/rt73usb.c | 115 ++++++++------------- 10 files changed, 289 insertions(+), 410 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +35 -54
@@ -1069,6 +1069,40 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,/* * TX data initialization */ +static void rt2400pci_write_beacon (struct queue_entry *entry) +{ +struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; +struct queue_entry_priv_pci *entry_priv = entry->priv_data; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb); +u32 word; +u32 reg; + +/* +* Disable beaconing while we are reloading the beacon data, +* otherwise we might be sending out invalid data. +*/ +rt2x00pci_register_read (rt2x00dev,CSR14 , ®); +rt2x00_set_field32 (®,CSR14_TSF_COUNT ,0 ); +rt2x00_set_field32 (®,CSR14_TBCN ,0 ); +rt2x00_set_field32 (®,CSR14_BEACON_GEN ,0 ); +rt2x00pci_register_write (rt2x00dev,CSR14 , reg); + +/* +* Replace rt2x00lib allocated descriptor with the +* pointer to the _real_ hardware descriptor. +* After that, map the beacon to DMA and update the +* descriptor. +*/ +memcpy (entry_priv->desc, skbdesc->desc, skbdesc->desc_len); + skbdesc->desc = entry_priv->desc; + +rt2x00queue_map_txskb (rt2x00dev, entry->skb); + +rt2x00_desc_read (entry_priv->desc,1 , &word); +rt2x00_set_field32 (&word,TXD_W1_BUFFER_ADDRESS , skbdesc->skb_dma); +rt2x00_desc_write (entry_priv->desc,1 , word); +} +static void rt2400pci_kick_tx_queue (struct rt2x00_dev *rt2x00dev,const enum data_queue_qid queue) {
@@ -1515,59 +1549,6 @@ static u64 rt2400pci_get_tsf(struct ieee80211_hw *hw)return tsf; } -static int rt2400pci_beacon_update (struct ieee80211_hw *hw,struct sk_buff *skb) -{ -struct rt2x00_dev *rt2x00dev = hw->priv; -struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb); -struct rt2x00_intf *intf =vif_to_intf (tx_info->control.vif); -struct queue_entry_priv_pci *entry_priv; -struct skb_frame_desc *skbdesc; -struct txentry_desc txdesc; -u32 reg; - -if (unlikely (!intf->beacon)) -return -ENOBUFS ; - entry_priv = intf->beacon->priv_data; - -/* -* Copy all TX descriptor information into txdesc, -* after that we are free to use the skb->cb array -* for our information. -*/ - intf->beacon->skb = skb; -rt2x00queue_create_tx_descriptor (intf->beacon, &txdesc); - -/* -* Fill in skb descriptor -*/ - skbdesc =get_skb_frame_desc (skb); -memset (skbdesc,0 ,sizeof (*skbdesc)); - skbdesc->desc = entry_priv->desc; - skbdesc->desc_len = intf->beacon->queue->desc_size; - skbdesc->entry = intf->beacon; - -/* -* Disable beaconing while we are reloading the beacon data, -* otherwise we might be sending out invalid data. -*/ -rt2x00pci_register_read (rt2x00dev,CSR14 , ®); -rt2x00_set_field32 (®,CSR14_TSF_COUNT ,0 ); -rt2x00_set_field32 (®,CSR14_TBCN ,0 ); -rt2x00_set_field32 (®,CSR14_BEACON_GEN ,0 ); -rt2x00pci_register_write (rt2x00dev,CSR14 , reg); - -/* -* Enable beacon generation. -* Write entire beacon with descriptor to register, -* and kick the beacon generator. -*/ -rt2x00queue_map_txskb (rt2x00dev, intf->beacon->skb); -rt2x00queue_write_tx_descriptor (intf->beacon, &txdesc); - rt2x00dev->ops->lib->kick_tx_queue (rt2x00dev,QID_BEACON ); - -return 0 ; -} -static int rt2400pci_tx_last_beacon (struct ieee80211_hw *hw) {struct rt2x00_dev *rt2x00dev = hw->priv;
@@ -1609,9 +1590,9 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { .link_tuner = rt2400pci_link_tuner, .write_tx_desc = rt2400pci_write_tx_desc, .write_tx_data = rt2x00pci_write_tx_data, + .write_beacon = rt2400pci_write_beacon, .kick_tx_queue = rt2400pci_kick_tx_queue, .fill_rxdone = rt2400pci_fill_rxdone, - .beacon_update = rt2400pci_beacon_update, .config_filter = rt2400pci_config_filter, .config_intf = rt2400pci_config_intf, .config_erp = rt2400pci_config_erp,
drivers/net/wireless/rt2x00/rt2500pci.c +35 -55
110 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2500usb.c +60 -94
181 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00.h +1 -35
@@ -521,6 +521,7 @@ struct rt2x00lib_ops {struct sk_buff *skb, struct txentry_desc *txdesc);int (*write_tx_data) (struct queue_entry *entry); +void (*write_beacon) (struct queue_entry *entry);int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb); void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
@@ -535,8 +536,6 @@ struct rt2x00lib_ops {/* * Configuration handlers. */ -int (*beacon_update) (struct ieee80211_hw *hw,struct sk_buff *bcn); -void (*config_filter) (struct rt2x00_dev *rt2x00dev,const unsigned int filter_flags); void (*config_intf) (struct rt2x00_dev *rt2x00dev,
@@ -913,39 +912,6 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate)void rt2x00queue_map_txskb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb);/** -* rt2x00queue_create_tx_descriptor - Create TX descriptor from mac80211 input -* @entry: The entry which will be used to transfer the TX frame. -* @txdesc: rt2x00 TX descriptor which will be initialized by this function. -* -* This function will initialize the &struct txentry_desc based on information -* from mac80211. This descriptor can then be used by rt2x00lib and the drivers -* to correctly initialize the hardware descriptor. -* Note that before calling this function the skb->cb array must be untouched -* by rt2x00lib. Only after this function completes will it be save to -* overwrite the skb->cb information. -* The reason for this is that mac80211 writes its own tx information into -* the skb->cb array, and this function will use that information to initialize -* the &struct txentry_desc structure. -*/ -void rt2x00queue_create_tx_descriptor (struct queue_entry *entry, -struct txentry_desc *txdesc); - -/** -* rt2x00queue_write_tx_descriptor - Write TX descriptor to hardware -* @entry: The entry which will be used to transfer the TX frame. -* @txdesc: TX descriptor which will be used to write hardware descriptor -* -* This function will write a TX descriptor initialized by -* &rt2x00queue_create_tx_descriptor to the hardware. After this call -* has completed the frame is now owned by the hardware, the hardware -* queue will have automatically be kicked unless this frame was generated -* by rt2x00lib, in which case the frame is "special" and must be kicked -* by the caller. -*/ -void rt2x00queue_write_tx_descriptor (struct queue_entry *entry, -struct txentry_desc *txdesc); - -/** * rt2x00queue_get_queue - Convert queue index to queue pointer * @rt2x00dev: Pointer to &struct rt2x00_dev. * @queue: rt2x00 queue index (see &enum data_queue_qid).
drivers/net/wireless/rt2x00/rt2x00dev.c +2 -7
@@ -434,13 +434,8 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,if (!test_bit (DEVICE_ENABLED_RADIO , &rt2x00dev->flags))return ; -if (delayed_flags &DELAYED_UPDATE_BEACON ) { -struct ieee80211_if_conf conf; - conf.bssid = conf.ssid =NULL ; - conf.ssid_len =0 ; - conf.changed =IEEE80211_IFCC_BEACON ; - rt2x00dev->ops->hw->config_interface (rt2x00dev->hw, vif, &conf); - } +if (delayed_flags &DELAYED_UPDATE_BEACON ) +rt2x00queue_update_beacon (rt2x00dev, vif);if (delayed_flags &DELAYED_CONFIG_ERP )rt2x00lib_config_erp (rt2x00dev, intf, &conf);
drivers/net/wireless/rt2x00/rt2x00lib.h +8 -0
@@ -139,6 +139,14 @@ void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);int rt2x00queue_write_tx_frame (struct data_queue *queue,struct sk_buff *skb);/** +* rt2x00queue_update_beacon - Send new beacon from mac80211 to hardware +* @rt2x00dev: Pointer to &struct rt2x00_dev. +* @vif: Interface for which the beacon should be updated. +*/ +int rt2x00queue_update_beacon (struct rt2x00_dev *rt2x00dev, +struct ieee80211_vif *vif); + +/** * rt2x00queue_index_inc - Index incrementation function * @queue: Queue (&struct data_queue) to perform the action on. * @index: Index type (&enum queue_index) to perform the action on.
drivers/net/wireless/rt2x00/rt2x00mac.c +10 -21
@@ -348,8 +348,8 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw, {struct rt2x00_dev *rt2x00dev = hw->priv;struct rt2x00_intf *intf =vif_to_intf (vif); -struct sk_buff *beacon; -int status; +int update_bssid =0 ; +int status =0 ;/* * Mac80211 might be calling this function while we are trying
@@ -361,15 +361,13 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw,spin_lock (&intf->lock);/* -* If the interface does not work in master mode, -* then the bssid value in the interface structure -* should now be set. -* * conf->bssid can be NULL if coming from the internal * beacon update routine. */ -if (conf->bssid && vif->type !=IEEE80211_IF_TYPE_AP ) +if (conf->changed &IEEE80211_IFCC_BSSID && conf->bssid) { + update_bssid =1 ;memcpy (&intf->bssid, conf->bssid,ETH_ALEN ); + }spin_unlock (&intf->lock);
@@ -379,23 +377,14 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw,* values as arguments we make keep access to rt2x00_intf thread safe * even without the lock. */ -rt2x00lib_config_intf (rt2x00dev, intf, vif->type,NULL , conf->bssid); +rt2x00lib_config_intf (rt2x00dev, intf, vif->type,NULL , + update_bssid ? conf->bssid :NULL );/* -* We only need to initialize the beacon when in master/ibss mode. +* Update the beacon. */ -if ((vif->type !=IEEE80211_IF_TYPE_AP && - vif->type !=IEEE80211_IF_TYPE_IBSS ) || - !(conf->changed &IEEE80211_IFCC_BEACON )) -return 0 ; - - beacon =ieee80211_beacon_get (rt2x00dev->hw, vif); -if (!beacon) -return -ENOMEM ; - - status = rt2x00dev->ops->lib->beacon_update (rt2x00dev->hw, beacon); -if (status) -dev_kfree_skb (beacon); +if (conf->changed &IEEE80211_IFCC_BEACON ) + status =rt2x00queue_update_beacon (rt2x00dev, vif);return status; }
drivers/net/wireless/rt2x00/rt2x00queue.c +58 -6
89 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt61pci.c +36 -67
123 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt73usb.c +44 -71
142 lines not on this page · raw message
Signature · 1 line
1.5.6.1
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
In reply to Ivo van DoornQuoted 5 lines · Ivo van Doorn
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Signed-off-by Ivo van Doorn <[email protected]>
Quoted 27 lines
--- net/mac80211/tx.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)net/mac80211/tx.c +5
-0@@ -1876,6 +1876,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, hdr->frame_control =IEEE80211_FC (IEEE80211_FTYPE_MGMT ,IEEE80211_STYPE_BEACON ); +ieee80211_include_sequence (sdata, hdr); + num_beacons = &ifsta->num_beacons; }else if (ieee80211_vif_is_mesh (&sdata->vif)) {/* headroom, head length, tail length and maximum TIM length */ @@ -1896,6 +1898,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,cpu_to_le16 (local->hw.conf.beacon_int); mgmt->u.beacon.capab_info =0x0 ;/* 0x0 for MPs */ +ieee80211_include_sequence (sdata, + (struct ieee80211_hdr *)skb->data); + pos =skb_put (skb,2 ); *pos++ =WLAN_EID_SSID ; *pos++ =0x0 ;
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
In reply to Ivo van DoornQuoted 3 lines · On Wednesday 09 July 2008 15:11:45 Ivo van Doorn wrote:
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Does software seq numbering even work at all?
What about packets that get sent between the driver requested the beacon and the driver does actually queue it?
Quoted 28 lines
Signed-off-by Ivo van Doorn <[email protected]>--- net/mac80211/tx.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)net/mac80211/tx.c +5
-0@@ -1876,6 +1876,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, hdr->frame_control =IEEE80211_FC (IEEE80211_FTYPE_MGMT ,IEEE80211_STYPE_BEACON ); +ieee80211_include_sequence (sdata, hdr); + num_beacons = &ifsta->num_beacons; }else if (ieee80211_vif_is_mesh (&sdata->vif)) {/* headroom, head length, tail length and maximum TIM length */ @@ -1896,6 +1898,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,cpu_to_le16 (local->hw.conf.beacon_int); mgmt->u.beacon.capab_info =0x0 ;/* 0x0 for MPs */ +ieee80211_include_sequence (sdata, + (struct ieee80211_hdr *)skb->data); + pos =skb_put (skb,2 ); *pos++ =WLAN_EID_SSID ; *pos++ =0x0 ;
Signature · 1 line
Greetings Michael.
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 8 lines · Michael Buesch
Quoted 3 lines · On Wednesday 09 July 2008 15:11:45 Ivo van Doorn wrote:
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Does software seq numbering even work at all?
What about packets that get sent between the driver requested the beacon and the driver does actually queue it?
Hmm. I guess we'd have to lock the master device while requesting a beacon... but also lock around the driver code queuing the beacon or something?
johannes
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
In reply to Michael BueschQuoted 8 lines · Michael Buesch
Quoted 3 lines · On Wednesday 09 July 2008 15:11:45 Ivo van Doorn wrote:
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Does software seq numbering even work at all?
What about packets that get sent between the driver requested the beacon and the driver does actually queue it?
For rt2x00 the beacon is requested and queued within interrupt context or during resume when it doesn't allow mac80211 to send any frames yet.
The problem would be when the config_interface() is called, if during that call mac80211 also sends out TX frames, then you get problems in the sequence counting.
Ivo
Quoted 31 lines
Quoted 28 lines
Signed-off-by Ivo van Doorn <[email protected]>--- net/mac80211/tx.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)net/mac80211/tx.c +5
-0@@ -1876,6 +1876,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, hdr->frame_control =IEEE80211_FC (IEEE80211_FTYPE_MGMT ,IEEE80211_STYPE_BEACON ); +ieee80211_include_sequence (sdata, hdr); + num_beacons = &ifsta->num_beacons; }else if (ieee80211_vif_is_mesh (&sdata->vif)) {/* headroom, head length, tail length and maximum TIM length */ @@ -1896,6 +1898,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,cpu_to_le16 (local->hw.conf.beacon_int); mgmt->u.beacon.capab_info =0x0 ;/* 0x0 for MPs */ +ieee80211_include_sequence (sdata, + (struct ieee80211_hdr *)skb->data); + pos =skb_put (skb,2 ); *pos++ =WLAN_EID_SSID ; *pos++ =0x0 ;
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 6 lines · Ivo van Doorn
Quoted 5 lines · Michael Buesch
Quoted 3 lines · On Wednesday 09 July 2008 15:11:45 Ivo van Doorn wrote:
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Quoted 6 lines
Quoted 3 lines
Does software seq numbering even work at all?
What about packets that get sent between the driver requested the beacon and the driver does actually queue it?For rt2x00 the beacon is requested and queued within interrupt context or during resume when it doesn't allow mac80211 to send any frames yet.
Ok, in interrupt context definitely works.
Quoted 3 lines
The problem would be when the
config_interface()is called, if during that call mac80211 also sends out TX frames, then you get problems in the sequence counting.
Well, if you care about the beacon in config_interface() you're implementing hwseq since otherwise you'd only request it when you need it, no?
johannes
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 16 lines · Johannes Berg
Quoted 6 lines · Ivo van Doorn
Quoted 5 lines · Michael Buesch
Quoted 3 lines · On Wednesday 09 July 2008 15:11:45 Ivo van Doorn wrote:
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Quoted 6 lines
Quoted 3 lines
Does software seq numbering even work at all?
What about packets that get sent between the driver requested the beacon and the driver does actually queue it?For rt2x00 the beacon is requested and queued within interrupt context or during resume when it doesn't allow mac80211 to send any frames yet.
Ok, in interrupt context definitely works.
Quoted 7 lines
Quoted 3 lines
The problem would be when the
config_interface()is called, if during that call mac80211 also sends out TX frames, then you get problems in the sequence counting.Well, if you care about the beacon in
config_interface()you're implementing hwseq since otherwise you'd only request it when you need it, no?
No not really, because from what moment can the driver start requesting beacons? I would think when mac80211 calls config_interface with the IEEE80211_IFCC_BEACON flag. ;)
At that moment the first beacon is loaded, and the device will trigger the interrupt to request a new beacon every x milliseconds.
Ivo
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 10 lines · Ivo van Doorn
Quoted 3 lines
Well, if you care about the beacon in
config_interface()you're implementing hwseq since otherwise you'd only request it when you need it, no?No not really, because from what moment can the driver start requesting beacons? I would think when mac80211 calls
config_interfacewith theIEEE80211_IFCC_BEACONflag. ;)At that moment the first beacon is loaded, and the device will trigger the interrupt to request a new beacon every x milliseconds.
Ok, I'd have thought you just set the "please send beacons now" flag and request one on the next round.
johannes
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
In reply to Ivo van DoornQuoted 11 lines · On Wednesday 09 July 2008 16:04:50 Ivo van Doorn wrote:
Quoted 8 lines · Michael Buesch
Quoted 3 lines · On Wednesday 09 July 2008 15:11:45 Ivo van Doorn wrote:
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Does software seq numbering even work at all?
What about packets that get sent between the driver requested the beacon and the driver does actually queue it?For rt2x00 the beacon is requested and queued within interrupt context
Well, another CPU could be in progress of walking down the mac80211 TX code and aquire a sequence number in the meantime before you requested the beacon. However that frame will be blocked by your driver locks, so the two seq numbers of the beacon and the other frame will be swapped, as the driver will queue the beacon first.
Signature · 1 line
Greetings Michael.
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 11 lines · Michael Buesch
Quoted 10 lines · On Wednesday 09 July 2008 16:04:50 Ivo van Doorn wrote:
Quoted 8 lines · Michael Buesch
Quoted 3 lines · On Wednesday 09 July 2008 15:11:45 Ivo van Doorn wrote:
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Does software seq numbering even work at all?
What about packets that get sent between the driver requested the beacon and the driver does actually queue it?
Quoted 7 lines
Quoted 1 line
For rt2x00 the beacon is requested and queued within interrupt context
Well, another CPU could be in progress of walking down the mac80211 TX code and aquire a sequence number in the meantime before you requested the beacon. However that frame will be blocked by your driver locks, so the two seq numbers of the beacon and the other frame will be swapped, as the driver will queue the beacon first.
Indeed, I was wrong.
I wonder if we should remove the hwseq support completely. It's much easier for the driver to do this, especially since we pass a vif pointer with driver-private data to all relevant functions and the driver could keep the current sequence number in there. Or, just like hwseq would, keep a global sequence number?
How does that affect multi-bss support btw? Do we have to use sw seqno for that?
johannes
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 12 lines · Johannes Berg
Quoted 11 lines · Michael Buesch
Quoted 10 lines · On Wednesday 09 July 2008 16:04:50 Ivo van Doorn wrote:
Quoted 8 lines · Michael Buesch
Quoted 3 lines · On Wednesday 09 July 2008 15:11:45 Ivo van Doorn wrote:
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Does software seq numbering even work at all?
What about packets that get sent between the driver requested the beacon and the driver does actually queue it?
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
For rt2x00 the beacon is requested and queued within interrupt context
Well, another CPU could be in progress of walking down the mac80211 TX code and aquire a sequence number in the meantime before you requested the beacon. However that frame will be blocked by your driver locks, so the two seq numbers of the beacon and the other frame will be swapped, as the driver will queue the beacon first.
If rt2x00 would use a global lock to block all TX and beacons, then yes. But rt2x00 uses per-queue locking. When a beacon is being updated rt2x00 will still allow regular frames to be queued.
But we can't halt the TX queues for the beacon update either, because ieee80211_stop_queues() should only be called from within the TX path.
Quoted 7 lines
Indeed, I was wrong.
I wonder if we should remove the hwseq support completely. It's much easier for the driver to do this, especially since we pass a vif pointer with driver-private data to all relevant functions and the driver could keep the current sequence number in there. Or, just like hwseq would, keep a global sequence number?
I think that would be moving the same problem to the driver side, and I am not really a big fan of the idea to put all queue handling under 1 big lock instead of the per-queue locking which is currently the case.
Quoted 2 lines
How does that affect multi-bss support btw? Do we have to use sw seqno for that?
As far as rt2x00 is concerned, all hardware that supports multi-bss also support HW sequence counters. rt2400pci and rt2500pci are the only ones requiring SW sequence counters, and they can't do multi-bss.
Ivo
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 4 lines
If rt2x00 would use a global lock to block all TX and beacons, then yes. But rt2x00 uses per-queue locking. When a beacon is being updated rt2x00 will still allow regular frames to be queued.
That just widens the window. And if you have multiple queues then you can't do sw sequence numbers anyway because the hardware might reorder the frames.
Quoted 3 lines
As far as rt2x00 is concerned, all hardware that supports multi-bss also support HW sequence counters. rt2400pci and rt2500pci are the only ones requiring SW sequence counters, and they can't do multi-bss.
Do they keep per-BSS counters?
johannes
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 8 lines · Johannes Berg
Quoted 4 lines
If rt2x00 would use a global lock to block all TX and beacons, then yes. But rt2x00 uses per-queue locking. When a beacon is being updated rt2x00 will still allow regular frames to be queued.
That just widens the window. And if you have multiple queues then you can't do sw sequence numbers anyway because the hardware might reorder the frames.
That doesn't seem to be a problem in the legacy drivers, so I guess the hardware does *something* to prevent problems.
Quoted 5 lines
Quoted 3 lines
As far as rt2x00 is concerned, all hardware that supports multi-bss also support HW sequence counters. rt2400pci and rt2500pci are the only ones requiring SW sequence counters, and they can't do multi-bss.
Do they keep per-BSS counters?
Not sure what you mean, but rt2400pci and rt2500pci don't support multi-bss, so they wouldn't have per-BSS counters.
rt61pci and rt73usb do support multi-bss and keep the sequence counting completely in firmware/hardware and I am not sure how they can be read by the driver. So I don't know how those are stored either.
Ivo
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 6 lines · On Wednesday 09 July 2008 17:08:04 Ivo van Doorn wrote:
Quoted 5 lines · Johannes Berg
Quoted 4 lines
If rt2x00 would use a global lock to block all TX and beacons, then yes. But rt2x00 uses per-queue locking. When a beacon is being updated rt2x00 will still allow regular frames to be queued.
Quoted 6 lines
Quoted 3 lines
That just widens the window. And if you have multiple queues then you can't do sw sequence numbers anyway because the hardware might reorder the frames.
That doesn't seem to be a problem in the legacy drivers, so I guess the hardware does *something* to prevent problems.
Well, legacy drivers don't use mac80211. Sequence counting can trivially be fixed by doing it _right_ before queueing the packet to the hardware in the driver, with the TX queue lock held, that must already be there.
Signature · 1 line
Greetings Michael.
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 11 lines · Michael Buesch
Quoted 10 lines · On Wednesday 09 July 2008 17:08:04 Ivo van Doorn wrote:
Quoted 8 lines · Johannes Berg
Quoted 4 lines
If rt2x00 would use a global lock to block all TX and beacons, then yes. But rt2x00 uses per-queue locking. When a beacon is being updated rt2x00 will still allow regular frames to be queued.
That just widens the window. And if you have multiple queues then you can't do sw sequence numbers anyway because the hardware might reorder the frames.
Quoted 6 lines
Quoted 2 lines
That doesn't seem to be a problem in the legacy drivers, so I guess the hardware does *something* to prevent problems.
Well, legacy drivers don't use mac80211. Sequence counting can trivially be fixed by doing it _right_ before queueing the packet to the hardware in the driver, with the TX queue lock held, that must already be there.
True, I have to double check it, but the legacy drivers use per-queue locking as well. And it would still be possible for the driver to send out frames with a higher sequence number before one with a lower number.
But I'll put out a request on the rt2400-devel list to see if anybody is interested in looking into this issue for rt2400pci and rt2500pci. In if there is nobody, I'll disable adhoc and master mode for those drivers to prevent problems.
Ivo
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 3 lines · Ivo van Doorn
True, I have to double check it, but the legacy drivers use per-queue locking as well. And it would still be possible for the driver to send out frames with a higher sequence number before one with a lower number.
The legacy drivers hopefully also implement proper sequence numbering per TID. I'll send another mail on the topic.
Quoted 3 lines
But I'll put out a request on the rt2400-devel list to see if anybody is interested in looking into this issue for rt2400pci and rt2500pci. In if there is nobody, I'll disable adhoc and master mode for those drivers to prevent problems.
Heh, that works. Just disable it and tell folks who want it to work to fix it :)
johannes
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 8 lines · Johannes Berg
Quoted 3 lines · Ivo van Doorn
True, I have to double check it, but the legacy drivers use per-queue locking as well. And it would still be possible for the driver to send out frames with a higher sequence number before one with a lower number.
The legacy drivers hopefully also implement proper sequence numbering per TID. I'll send another mail on the topic.
Heh, I seriously doubt that. As far as I know it is working using a single counter in the main interface structure. Just the same way it currently works in mac80211 (which isn't surprising, since I based the mac80211 patch on the legacy driver implementation).
Quoted 6 lines
Quoted 3 lines
But I'll put out a request on the rt2400-devel list to see if anybody is interested in looking into this issue for rt2400pci and rt2500pci. In if there is nobody, I'll disable adhoc and master mode for those drivers to prevent problems.
Heh, that works. Just disable it and tell folks who want it to work to fix it :)
Well I am putting out an in advance notice first. ;)
Ivo
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 7 lines · Ivo van Doorn
Quoted 6 lines · Johannes Berg
Quoted 3 lines · Ivo van Doorn
True, I have to double check it, but the legacy drivers use per-queue locking as well. And it would still be possible for the driver to send out frames with a higher sequence number before one with a lower number.
Quoted 7 lines
Quoted 2 lines
The legacy drivers hopefully also implement proper sequence numbering per TID. I'll send another mail on the topic.
Heh, I seriously doubt that. As far as I know it is working using a single counter in the main interface structure. Just the same way it currently works in mac80211 (which isn't surprising, since I based the mac80211 patch on the legacy driver implementation).
Ok so the thing is this: 802.11-2007 7.1.3.4.1 requires that we keep sequence counters per TID (and one for "not QoS"), which we only assign rather late in the wme code. Because even b43 hardware only keeps track of a single sequence counter, it requires not using that counter for QoS frames. I suspect no driver except the overly smart iwlwifi gets this right.
Do you have flags to turn off hwseq support for the other ralink devices?
johannes
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 6 lines · Johannes Berg
Ok so the thing is this: 802.11-2007 7.1.3.4.1 requires that we keep sequence counters per TID (and one for "not QoS"), which we only assign rather late in the wme code. Because even b43 hardware only keeps track of a single sequence counter, it requires not using that counter for QoS frames. I suspect no driver except the overly smart iwlwifi gets this right.
Even if we fix this, we still haven't solved the problem of the beacon sequence number. I'm currently favouring putting the burden on the driver since only rt2400pci and rt2500pci seem to require it and it's fairly simple to keep a race-free per-VIF counter for non-QoS frames in the driver (you can just do it under the queue lock), but doing it race-free in mac80211 will need a bunch of extra locking.
I'll put off the fix until after davem's TX MQ rework though.
johannes
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 3 lines · Johannes Berg
On Wed, 2008-07-09 at 17:49 +0200, Johannes Berg wrote:
=20Quoted 1 line
Ok so the thing is this: 802.11-2007 7.1.3.4.1 requires that we kee=
p
Quoted 1 line
Quoted 1 line
sequence counters per TID (and one for "not QoS"), which we only as=
sign
Quoted 1 line
Quoted 1 line
rather late in the wme code. Because even b43 hardware only keeps t=
rack
Quoted 1 line
Quoted 1 line
of a single sequence counter, it requires not using that counter fo=
r QoS
Quoted 1 line
Quoted 1 line
frames. =EF=BB=BFI suspect no driver except the overly smart iwlwif=
i gets this
Quoted 3 lines
Quoted 1 line
right.
=20
Even if we fix this, we still haven't solved the problem of the beaco=
n
Quoted 2 lines
sequence number. I'm currently favouring putting the burden on the driver since only =EF=BB=BFrt2400pci and rt2500pci seem to require it=
and it's
Quoted 1 line
fairly simple to keep a race-free per-VIF counter for non-QoS frames =
in
Quoted 4 lines
the driver (you can just do it under the queue lock), but doing it race-free in mac80211 will need a bunch of extra locking. =20
I'll put off the fix until after davem's TX MQ rework though.
Ok, that would allow some time for rt2x00 to come up with the implementation for the rt2400pci and rt2500pci drivers.
And this is extra motivation for a volunteer to look into this, because when mac80211 removes the seq counting, it is not just adhoc and master mode that are broken. ;)
Ivo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 1 line · Ivo van Doorn
Quoted 1 line
I'll put off the fix until after davem's TX MQ rework though.
Actually, I don't have to.
Quoted 6 lines
Ok, that would allow some time for rt2x00 to come up with the implementation for the rt2400pci and rt2500pci drivers.
And this is extra motivation for a volunteer to look into this, because when mac80211 removes the seq counting, it is not just adhoc and master mode that are broken. ;)
Here's a patch to try it out:
http://johannes.sipsolutions.net/patches/kernel/all/2008-07-09-17%3a38/022-mac80211-fix-hwseq.patch
johannes
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 9 lines · Johannes Berg
Quoted 1 line · Ivo van Doorn
Quoted 1 line
I'll put off the fix until after davem's TX MQ rework though.
Actually, I don't have to.
Quoted 3 lines
Ok, that would allow some time for rt2x00 to come up with the implementation for the rt2400pci and rt2500pci drivers.
Quoted 7 lines
Quoted 3 lines
And this is extra motivation for a volunteer to look into this, because when mac80211 removes the seq counting, it is not just adhoc and master mode that are broken. ;)
Here's a patch to try it out:
http://johannes.sipsolutions.net/patches/kernel/all/2008-07-09-17%3a38/022-mac80211-fix-hwseq.patch
Personally I have my doubts about the meaningfullness of the flag
IEEE80211_TX_CTL_QOS_FRAME since drivers will probably use ieee80211_is_data_qos() instead. Perhaps it is better to have the flag named something like: IEEE80211_TX_CTS_SW_SEQUENCE or IEEE80211_TX_CTS_HAS_SEQUENCE
That way it is a bit clearer what the intention of the flag is.
Ivo
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 11 lines · Ivo van Doorn
Quoted 1 line
http://johannes.sipsolutions.net/patches/kernel/all/2008-07-09-17%3a38/022-mac80211-fix-hwseq.patch
Personally I have my doubts about the meaningfullness of the flag
IEEE80211_TX_CTL_QOS_FRAME since drivers will probably use ieee80211_is_data_qos() instead. Perhaps it is better to have the flag named something like: IEEE80211_TX_CTS_SW_SEQUENCE or IEEE80211_TX_CTS_HAS_SEQUENCEThat way it is a bit clearer what the intention of the flag is.
Yeah, that's probably true, though I'd like people to be aware of the TID sequence stuff... Guess we need to write more docs.
johannes
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
In reply to Johannes BergQuoted 5 lines · Johannes Berg
Quoted 4 lines · Ivo van Doorn
Quoted 3 lines · Johannes Berg
On Wed, 2008-07-09 at 17:36 +0200, Ivo van Doorn wrote:
=20Quoted 1 line
True, I have to double check it, but the legacy drivers use per=
-queue locking as well.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
And it would still be possible for the driver to send out frame=
s with a higher
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
sequence number before one with a lower number.
=20
The legacy drivers hopefully also implement proper sequence numbe=
ring
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
per TID. I'll send another mail on the topic.
=20
Heh, I seriously doubt that. As far as I know it is working using a=
single
Quoted 1 line
Quoted 1 line
counter in the main interface structure. Just the same way it curre=
ntly
Quoted 1 line
Quoted 1 line
works in mac80211 (which isn't surprising, since I based the mac802=
11 patch
Quoted 4 lines
Quoted 1 line
on the legacy driver implementation).
=20
Ok so the thing is this: 802.11-2007 7.1.3.4.1 requires that we keep sequence counters per TID (and one for "not QoS"), which we only assi=
gn
Quoted 1 line
rather late in the wme code. Because even b43 hardware only keeps tra=
ck
Quoted 1 line
of a single sequence counter, it requires not using that counter for =
QoS
Quoted 1 line
frames. =EF=BB=BFI suspect no driver except the overly smart iwlwifi =
gets this
Quoted 4 lines
right.
=20
Do you have flags to turn off hwseq support for the other ralink devices?
rt2500usb: Not per-frame, it can only be disabled globally
rt61pci: Both per-frame as well as globally
rt73usb: Both per-frame as well as globally
rt2800pci: Not per-frame, not sure about globally
rt2800usb: Not per-frame, not sure about globally
Note that I don't know if these devices handle the TID and the not QOS = sequence
counting in the hardware. I'll have to consult the specsheets for that.
Ivo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
Quoted 5 lines · Ivo van Doorn
rt2500usb: Not per-frame, it can only be disabled globally
rt61pci: Both per-frame as well as globally
rt73usb: Both per-frame as well as globally
rt2800pci: Not per-frame, not sure about globally
rt2800usb: Not per-frame, not sure about globally
Interesting. The reason that broadcom firmware allows to disable per-frame is actually to implement the per-TID counters in software.
Quoted 2 lines
Note that I don't know if these devices handle the TID and the not QOS sequence counting in the hardware. I'll have to consult the specsheets for that.
Not much we can do about it either way unless you want to always disable globally.
johannes
Johannes Berg
maintainerRe: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
In reply to Ivo van DoornQuoted 6 lines · Ivo van Doorn
Quoted 3 lines
That just widens the window. And if you have multiple queues then you can't do sw sequence numbers anyway because the hardware might reorder the frames.
That doesn't seem to be a problem in the legacy drivers, so I guess the hardware does *something* to prevent problems.
Actually, looking at 7.1.3.4.1 (Sequence Number field) this all seems to be wrong anyway, we should be keeping a sequence number counter _per_TID_ and one for non-QoS data/mgmt frames.
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines
As far as rt2x00 is concerned, all hardware that supports multi-bss also support HW sequence counters. rt2400pci and rt2500pci are the only ones requiring SW sequence counters, and they can't do multi-bss.
Do they keep per-BSS counters?
Not sure what you mean, but rt2400pci and rt2500pci don't support multi-bss, so they wouldn't have per-BSS counters.
rt61pci and rt73usb do support multi-bss and keep the sequence counting completely infirmware/hardwareand I am not sure how they can be read by the driver. So I don't know how those are stored either.
Ok. Since the hw is capable of mBSS I'd guess it has sequence numbers for each BSS.
johannes
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
In reply to Ivo van DoornQuoted 21 lines · On Wednesday 09 July 2008 16:37:01 Ivo van Doorn wrote:
Quoted 12 lines · Johannes Berg
Quoted 11 lines · Michael Buesch
Quoted 10 lines · On Wednesday 09 July 2008 16:04:50 Ivo van Doorn wrote:
Quoted 8 lines · Michael Buesch
Quoted 3 lines · On Wednesday 09 July 2008 15:11:45 Ivo van Doorn wrote:
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Does software seq numbering even work at all?
What about packets that get sent between the driver requested the beacon and the driver does actually queue it?Quoted 7 lines
Quoted 7 lines
Quoted 1 line
For rt2x00 the beacon is requested and queued within interrupt context
Well, another CPU could be in progress of walking down the mac80211 TX code and aquire a sequence number in the meantime before you requested the beacon. However that frame will be blocked by your driver locks, so the two seq numbers of the beacon and the other frame will be swapped, as the driver will queue the beacon first.
Quoted 3 lines
If rt2x00 would use a global lock to block all TX and beacons, then yes. But rt2x00 uses per-queue locking. When a beacon is being updated rt2x00 will still allow regular frames to be queued.
It still leaves a race condition window. That's actually worse than consistently breaking ;)
Quoted 2 lines
But we can't halt the TX queues for the beacon update either, because
ieee80211_stop_queues()should only be called from within the TX path.
I think the problem can only be fixed by doing sequence numbering in the driver.
Signature · 1 line
Greetings Michael.
Re: [PATCH 1/3] mac80211: Include sequence number in IBSS and Mesh beacons
In reply to Ivo van DoornQuoted 5 lines · Ivo van Doorn
Currently only beacons generated in AP mode have the software sequence number inserted. This means IBSS and Mesh mode are broken for all hardware that require software sequence numbers.
Signed-off-by Ivo van Doorn <[email protected]>
As you are aware, Johannes posted a patch that removed ieee80211_include_sequence. I'm dropping this (i.e. Ivo's) patch.
John
Signature · 2 lines
John W. Linville [email protected]