rt2x00 patches 14.02.2017
v2 cover rt2x00 patches 14.02.2017
Patches for rt2x00. Most important is txdone functions rework to use ieee80211_tx_status_noskb() if can not match sent skb with status from TX_STAT_FIFO. Currently used only for rt2800usb.
v1 -> v2:
Fix skbdesc->sta and TXDONE_ACK_REQ issues pointed by Felix. Add changelog to patch 6, pointed by Kalle.
Gabor Juhos (1):
rt2x00: rt2800lib: move rt2800_drv_data declaration into rt2800lib.h
Stanislaw Gruszka (9):
rt2800: identify station based on status WCID
rt2x00: separte filling tx status from rt2x00lib_txdone
rt2x00: separte clearing entry from rt2x00lib_txdone
rt2x00: add txdone nomatch function
rt2x00: fixup fill_tx_status for nomatch case
rt2x00: use txdone_nomatch on rt2800usb
rt2800: status based rate flags for nomatch case
rt2800: use TXOP_BACKOFF for probe frames
rt2x00: fix rt2x00debug_dump_frame comment
drivers/net/wireless/ralink/rt2x00/rt2800.h | 27 +-- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 67 ++++++- drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 27 ++- drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt2800usb.c | 18 +- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 4 +- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 232 +++++++++++++++-------- drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 7 +- drivers/net/wireless/ralink/rt2x00/rt2x00queue.h | 4 +- 9 files changed, 260 insertions(+), 128 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/10 rt2x00: rt2800lib: move rt2800_drv_data declaration into rt2800lib.h
From: Gabor Juhos <[email protected]>
The rt2800_drv_data structure contains driver specific information. Move the declaration into the rt2800lib.h header which is a more logical place for it. Also fix the comment style to avoid checkpatch warning.
The patch contains no functional changes, it is in preparation for the next patch.
--- drivers/net/wireless/ralink/rt2x00/rt2800.h | 25 ------------------------- drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 25 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2800.h +0 -25
@@ -2987,29 +2987,4 @@ enum rt2800_eeprom_word {*/ #define BCN_TBTT_OFFSET 64 -/* -* Hardware has 255 WCID table entries. First 32 entries are reserved for -* shared keys. Since parts of the pairwise key table might be shared with -* the beacon frame buffers 6 & 7 we could only use the first 222 entries. -*/ -#define WCID_START 33 -#define WCID_END 222 -#define STA_IDS_SIZE (WCID_END - WCID_START + 2) - -/* -* RT2800 driver data structure -*/ -struct rt2800_drv_data { -u8 calibration_bw20; -u8 calibration_bw40; -u8 bbp25; -u8 bbp26; -u8 txmixer_gain_24g; -u8 txmixer_gain_5g; -u8 max_psdu; -unsigned int tbtt_tick; -unsigned int ampdu_factor_cnt[4 ]; - DECLARE_BITMAP(sta_ids, STA_IDS_SIZE); -}; -#endif /* RT2800_H */
drivers/net/wireless/ralink/rt2x00/rt2800lib.h +23 -0
@@ -20,6 +20,29 @@ #ifndef RT2800LIB_H #define RT2800LIB_H +/* + * Hardware has 255 WCID table entries. First 32 entries are reserved for + * shared keys. Since parts of the pairwise key table might be shared with + * the beacon frame buffers 6 & 7 we could only use the first 222 entries. + */ +#define WCID_START 33 +#define WCID_END 222 +#define STA_IDS_SIZE (WCID_END - WCID_START + 2) + +/* RT2800 driver data structure */ +struct rt2800_drv_data { + u8 calibration_bw20; + u8 calibration_bw40; + u8 bbp25; + u8 bbp26; + u8 txmixer_gain_24g; + u8 txmixer_gain_5g; + u8 max_psdu; + unsigned int tbtt_tick; + unsigned int ampdu_factor_cnt[4]; + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE); +}; + struct rt2800_ops { void (*register_read)(struct rt2x00_dev *rt2x00dev, const unsigned int offset, u32 *value);
Signature · 1 line
1.8.3.1
PATCH v2 2/10 rt2800: identify station based on status WCID
In reply to Stanislaw GruszkaAdd framework to identify sta based on tx status WCID. This is currently not used, will start be utilized in the future patch.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 +++++ drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 1 + drivers/net/wireless/ralink/rt2x00/rt2x00queue.h | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +5 -0
@@ -855,11 +855,13 @@ void rt2800_process_rxwi(struct queue_entry *entry,void rt2800_txdone_entry (struct queue_entry *entry,u32 status,__le32 *txwi) {struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; +struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb);struct txdone_entry_desc txdesc;u32 word;u16 mcs, real_mcs;int aggr, ampdu; +int wcid;/* * Obtain the status about this packet.
@@ -872,6 +874,7 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi) real_mcs =rt2x00_get_field32 (status,TX_STA_FIFO_MCS ); aggr =rt2x00_get_field32 (status,TX_STA_FIFO_TX_AGGRE ); + wcid =rt2x00_get_field32 (status,TX_STA_FIFO_WCID );/* * If a frame was meant to be sent as a single non-aggregated MPDU
@@ -1468,6 +1471,7 @@ int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif,return 0 ;__set_bit (wcid -WCID_START , drv_data->sta_ids); + drv_data->wcid_to_sta[wcid -WCID_START ] = sta;/* * Clean up WCID attributes and write STA address to the device.
@@ -1498,6 +1502,7 @@ int rt2800_sta_remove(struct rt2x00_dev *rt2x00dev, struct ieee80211_sta *sta)* get renewed when the WCID is reused. */ rt2800_config_wcid (rt2x00dev,NULL , wcid); + drv_data->wcid_to_sta[wcid -WCID_START ] =NULL ;__clear_bit (wcid -WCID_START , drv_data->sta_ids);return 0 ;
drivers/net/wireless/ralink/rt2x00/rt2800lib.h +1 -0
@@ -41,6 +41,7 @@ struct rt2800_drv_data {unsigned int tbtt_tick;unsigned int ampdu_factor_cnt[4 ];DECLARE_BITMAP (sta_ids,STA_IDS_SIZE ); +struct ieee80211_sta *wcid_to_sta[STA_IDS_SIZE ]; };struct rt2800_ops {
drivers/net/wireless/ralink/rt2x00/rt2x00queue.h +2 -1
@@ -102,7 +102,7 @@ enum skb_frame_desc_flags {* of the scope of the skb->data pointer. * @iv: IV/EIV data used during encryption/decryption. * @skb_dma: (PCI-only) the DMA address associated with the sk buffer. -* @entry: The entry to which this sk buffer belongs. +* @sta: The station where sk buffer was sent. */ struct skb_frame_desc {u8 flags;
@@ -116,6 +116,7 @@ struct skb_frame_desc {__le32 iv[2 ];dma_addr_t skb_dma; +struct ieee80211_sta *sta; };/**
Signature · 1 line
1.8.3.1
PATCH v2 3/10 rt2x00: separte filling tx status from rt2x00lib_txdone
In reply to Stanislaw GruszkaThis makes rt2x00lib_txdone a bit simpler and will allow to reuse code in different variant of txdone which I'm preparing.
--- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 141 +++++++++++++------------ 1 file changed, 76 insertions(+), 65 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +76 -65
@@ -313,73 +313,14 @@ static inline int rt2x00lib_txdone_bar_status(struct queue_entry *entry)return ret; } -void rt2x00lib_txdone (struct queue_entry *entry, -struct txdone_entry_desc *txdesc) +static void rt2x00lib_fill_tx_status (struct rt2x00_dev *rt2x00dev, +struct ieee80211_tx_info *tx_info, +struct skb_frame_desc *skbdesc, +struct txdone_entry_desc *txdesc, +bool success) { -struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; -struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (entry->skb); -struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb); -unsigned int header_length, i;u8 rate_idx, rate_flags, retry_rates; -u8 skbdesc_flags = skbdesc->flags; -bool success; - -/* -* Unmap the skb. -*/ -rt2x00queue_unmap_skb (entry); - -/* -* Remove the extra tx headroom from the skb. -*/ -skb_pull (entry->skb, rt2x00dev->extra_tx_headroom); - -/* -* Signal that the TX descriptor is no longer in the skb. -*/ - skbdesc->flags &= ~SKBDESC_DESC_IN_SKB ; - -/* -* Determine the length of 802.11 header. -*/ - header_length =ieee80211_get_hdrlen_from_skb (entry->skb); - -/* -* Remove L2 padding which was added during -*/ -if (rt2x00_has_cap_flag (rt2x00dev,REQUIRE_L2PAD )) -rt2x00queue_remove_l2pad (entry->skb, header_length); - -/* -* If the IV/EIV data was stripped from the frame before it was -* passed to the hardware, we should now reinsert it again because -* mac80211 will expect the same data to be present it the -* frame as it was passed to us. -*/ -if (rt2x00_has_cap_hw_crypto (rt2x00dev)) -rt2x00crypto_tx_insert_iv (entry->skb, header_length); - -/* -* Send frame to debugfs immediately, after this call is completed -* we are going to overwrite the skb->cb array. -*/ -rt2x00debug_dump_frame (rt2x00dev,DUMP_FRAME_TXDONE , entry); - -/* -* Determine if the frame has been successfully transmitted and -* remove BARs from our check list while checking for their -* TX status. -*/ - success = -rt2x00lib_txdone_bar_status (entry) || -test_bit (TXDONE_SUCCESS , &txdesc->flags) || -test_bit (TXDONE_UNKNOWN , &txdesc->flags); - -/* -* Update TX statistics. -*/ - rt2x00dev->link.qual.tx_success += success; - rt2x00dev->link.qual.tx_failed += !success; +int i; rate_idx = skbdesc->tx_rate_idx; rate_flags = skbdesc->tx_rate_flags;
@@ -448,6 +389,76 @@ void rt2x00lib_txdone(struct queue_entry *entry,else rt2x00dev->low_level_stats.dot11RTSFailureCount++; } +} + +void rt2x00lib_txdone (struct queue_entry *entry, +struct txdone_entry_desc *txdesc) +{ +struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; +struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (entry->skb); +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb); +u8 skbdesc_flags = skbdesc->flags; +unsigned int header_length; +bool success; + +/* +* Unmap the skb. +*/ +rt2x00queue_unmap_skb (entry); + +/* +* Remove the extra tx headroom from the skb. +*/ +skb_pull (entry->skb, rt2x00dev->extra_tx_headroom); + +/* +* Signal that the TX descriptor is no longer in the skb. +*/ + skbdesc->flags &= ~SKBDESC_DESC_IN_SKB ; + +/* +* Determine the length of 802.11 header. +*/ + header_length =ieee80211_get_hdrlen_from_skb (entry->skb); + +/* +* Remove L2 padding which was added during +*/ +if (rt2x00_has_cap_flag (rt2x00dev,REQUIRE_L2PAD )) +rt2x00queue_remove_l2pad (entry->skb, header_length); + +/* +* If the IV/EIV data was stripped from the frame before it was +* passed to the hardware, we should now reinsert it again because +* mac80211 will expect the same data to be present it the +* frame as it was passed to us. +*/ +if (rt2x00_has_cap_hw_crypto (rt2x00dev)) +rt2x00crypto_tx_insert_iv (entry->skb, header_length); + +/* +* Send frame to debugfs immediately, after this call is completed +* we are going to overwrite the skb->cb array. +*/ +rt2x00debug_dump_frame (rt2x00dev,DUMP_FRAME_TXDONE , entry); + +/* +* Determine if the frame has been successfully transmitted and +* remove BARs from our check list while checking for their +* TX status. +*/ + success = +rt2x00lib_txdone_bar_status (entry) || +test_bit (TXDONE_SUCCESS , &txdesc->flags) || +test_bit (TXDONE_UNKNOWN , &txdesc->flags); + +/* +* Update TX statistics. +*/ + rt2x00dev->link.qual.tx_success += success; + rt2x00dev->link.qual.tx_failed += !success; + +rt2x00lib_fill_tx_status (rt2x00dev, tx_info, skbdesc, txdesc, success);/* * Only send the status report to mac80211 when it's a frame
Signature · 1 line
1.8.3.1
PATCH v2 4/10 rt2x00: separte clearing entry from rt2x00lib_txdone
In reply to Stanislaw GruszkaThis makes rt2x00lib_txdone a bit simpler and will allow to reuse code in different variant of txdone which I'm preparing.
--- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 51 +++++++++++++++----------- 1 file changed, 29 insertions(+), 22 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +29 -22
@@ -391,6 +391,32 @@ static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev, } } +static void rt2x00lib_clear_entry (struct rt2x00_dev *rt2x00dev, +struct queue_entry *entry) +{ +/* +* Make this entry available for reuse. +*/ + entry->skb =NULL ; + entry->flags =0 ; + + rt2x00dev->ops->lib->clear_entry (entry); + +rt2x00queue_index_inc (entry,Q_INDEX_DONE ); + +/* +* If the data queue was below the threshold before the txdone +* handler we must make sure the packet queue in the mac80211 stack +* is reenabled when the txdone handler has finished. This has to be +* serialized with rt2x00mac_tx(), otherwise we can wake up queue +* before it was stopped. +*/ +spin_lock_bh (&entry->queue->tx_lock); +if (!rt2x00queue_threshold (entry->queue)) +rt2x00queue_unpause_queue (entry->queue); +spin_unlock_bh (&entry->queue->tx_lock); +} +void rt2x00lib_txdone (struct queue_entry *entry,struct txdone_entry_desc *txdesc) {
@@ -471,30 +497,11 @@ void rt2x00lib_txdone(struct queue_entry *entry,ieee80211_tx_status (rt2x00dev->hw, entry->skb); else ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb); - }else + }else {dev_kfree_skb_any (entry->skb); + } -/* -* Make this entry available for reuse. -*/ - entry->skb =NULL ; - entry->flags =0 ; - - rt2x00dev->ops->lib->clear_entry (entry); - -rt2x00queue_index_inc (entry,Q_INDEX_DONE ); - -/* -* If the data queue was below the threshold before the txdone -* handler we must make sure the packet queue in the mac80211 stack -* is reenabled when the txdone handler has finished. This has to be -* serialized with rt2x00mac_tx(), otherwise we can wake up queue -* before it was stopped. -*/ -spin_lock_bh (&entry->queue->tx_lock); -if (!rt2x00queue_threshold (entry->queue)) -rt2x00queue_unpause_queue (entry->queue); -spin_unlock_bh (&entry->queue->tx_lock); +rt2x00lib_clear_entry (rt2x00dev, entry); }EXPORT_SYMBOL_GPL (rt2x00lib_txdone);
Signature · 1 line
1.8.3.1
PATCH v2 5/10 rt2x00: add txdone nomatch function
In reply to Stanislaw GruszkaThis txdone nomatch function will be used when we get status from the HW, but we could not match it with any sent skb.
--- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 2 ++ drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 50 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+)
drivers/net/wireless/ralink/rt2x00/rt2x00.h +2 -0
@@ -1425,6 +1425,8 @@ u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,void rt2x00lib_dmadone (struct queue_entry *entry);void rt2x00lib_txdone (struct queue_entry *entry,struct txdone_entry_desc *txdesc); +void rt2x00lib_txdone_nomatch (struct queue_entry *entry, +struct txdone_entry_desc *txdesc);void rt2x00lib_txdone_noinfo (struct queue_entry *entry,u32 status);void rt2x00lib_rxdone (struct queue_entry *entry,gfp_t gfp);
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +50 -0
56 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 6/10 rt2x00: fixup fill_tx_status for nomatch case
In reply to Stanislaw GruszkaAdd bits rt2x00lib_fill_tx_status() when filling status in nomatch case and hopefully do not break the function for existing cases.
--- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 6 +++++- drivers/net/wireless/ralink/rt2x00/rt2x00queue.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +5 -1
@@ -357,6 +357,9 @@ static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,if (i < (IEEE80211_TX_MAX_RATES -1 )) tx_info->status.rates[i].idx =-1 ;/* terminate */ +if (test_bit (TXDONE_NO_ACK_REQ , &txdesc->flags)) + tx_info->flags |=IEEE80211_TX_CTL_NO_ACK ; +if (!(tx_info->flags &IEEE80211_TX_CTL_NO_ACK )) {if (success) tx_info->flags |=IEEE80211_TX_STAT_ACK ;
@@ -375,7 +378,8 @@ static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,*/ if (test_bit (TXDONE_AMPDU , &txdesc->flags) || tx_info->flags &IEEE80211_TX_CTL_AMPDU ) { - tx_info->flags |=IEEE80211_TX_STAT_AMPDU ; + tx_info->flags |=IEEE80211_TX_STAT_AMPDU | +IEEE80211_TX_CTL_AMPDU ; tx_info->status.ampdu_len =1 ; tx_info->status.ampdu_ack_len = success ?1 :0 ;
drivers/net/wireless/ralink/rt2x00/rt2x00queue.h +1 -0
@@ -215,6 +215,7 @@ enum txdone_entry_desc_flags {TXDONE_FAILURE ,TXDONE_EXCESSIVE_RETRY ,TXDONE_AMPDU , + TXDONE_NO_ACK_REQ, };/**
Signature · 1 line
1.8.3.1
PATCH v2 7/10 rt2x00: use txdone_nomatch on rt2800usb
In reply to Stanislaw GruszkaIf we do not match skb entry, provide tx status via nomatch procedure.
Currently in that case we do rt2x00lib_txdone_noinfo(TXDONE_NOINFO), which actually assume that entry->skb was posted without retries and provide rate saved in skb desc as successful. Patch changed that to rate read from TX_STAT_FIFO, however still do not provide correct number of retries.
On SoC/PCI devices we keep providing status via standard txdone procedure, no change in those devices, though we should thing about it.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 31 ++++++++++++++++++++----- drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 3 ++- drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 2 +- drivers/net/wireless/ralink/rt2x00/rt2800usb.c | 18 ++++++-------- 4 files changed, 35 insertions(+), 19 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +25 -6
@@ -852,7 +852,8 @@ void rt2800_process_rxwi(struct queue_entry *entry, }EXPORT_SYMBOL_GPL (rt2800_process_rxwi); -void rt2800_txdone_entry (struct queue_entry *entry,u32 status,__le32 *txwi) +void rt2800_txdone_entry (struct queue_entry *entry,u32 status,__le32 *txwi, +bool match) {struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
@@ -860,8 +861,7 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi)struct txdone_entry_desc txdesc;u32 word;u16 mcs, real_mcs; -int aggr, ampdu; -int wcid; +int aggr, ampdu, wcid, ack_req;/* * Obtain the status about this packet.
@@ -875,6 +875,7 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi) real_mcs =rt2x00_get_field32 (status,TX_STA_FIFO_MCS ); aggr =rt2x00_get_field32 (status,TX_STA_FIFO_TX_AGGRE ); wcid =rt2x00_get_field32 (status,TX_STA_FIFO_WCID ); + ack_req =rt2x00_get_field32 (status,TX_STA_FIFO_TX_ACK_REQUIRED );/* * If a frame was meant to be sent as a single non-aggregated MPDU
@@ -891,8 +892,12 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi)* Hence, replace the requested rate with the real tx rate to not * confuse the rate control algortihm by providing clearly wrong * data. -*/ -if (unlikely (aggr ==1 && ampdu ==0 && real_mcs != mcs)) { +* +* FIXME: if we do not find matching entry, we tell that frame was +* posted without any retries. We need to find a way to fix that +* and provide retry count. +*/ +if (unlikely ((aggr ==1 && ampdu ==0 && real_mcs != mcs)) || !match) { skbdesc->tx_rate_idx = real_mcs; mcs = real_mcs; }
@@ -900,6 +905,9 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi)if (aggr ==1 || ampdu ==1 )__set_bit (TXDONE_AMPDU , &txdesc.flags); +if (!ack_req) +__set_bit (TXDONE_NO_ACK_REQ , &txdesc.flags); +/* * Ralink has a retry mechanism using a global fallback * table. We setup this fallback table to try the immediate
@@ -931,7 +939,18 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi)if (txdesc.retry)__set_bit (TXDONE_FALLBACK , &txdesc.flags); -rt2x00lib_txdone (entry, &txdesc); +if (!match) { +/* RCU assures non-null sta will not be freed by mac80211. */ +rcu_read_lock (); +if (likely (wcid >=WCID_START && wcid <=WCID_END )) + skbdesc->sta = drv_data->wcid_to_sta[wcid -WCID_START ]; +else + skbdesc->sta =NULL ; +rt2x00lib_txdone_nomatch (entry, &txdesc); +rcu_read_unlock (); + }else { +rt2x00lib_txdone (entry, &txdesc); + } }EXPORT_SYMBOL_GPL (rt2800_txdone_entry);
drivers/net/wireless/ralink/rt2x00/rt2800lib.h +2 -1
@@ -191,7 +191,8 @@ void rt2800_write_tx_data(struct queue_entry *entry, struct txentry_desc *txdesc);void rt2800_process_rxwi (struct queue_entry *entry,struct rxdone_entry_desc *txdesc); -void rt2800_txdone_entry (struct queue_entry *entry,u32 status,__le32 * txwi); +void rt2800_txdone_entry (struct queue_entry *entry,u32 status,__le32 *txwi, +bool match);void rt2800_write_beacon (struct queue_entry *entry,struct txentry_desc *txdesc);void rt2800_clear_beacon (struct queue_entry *entry);
drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +1 -1
@@ -239,7 +239,7 @@ static bool rt2800mmio_txdone_release_entries(struct queue_entry *entry, {if (test_bit (ENTRY_DATA_STATUS_SET , &entry->flags)) {rt2800_txdone_entry (entry, entry->status, -rt2800mmio_get_txwi (entry)); +rt2800mmio_get_txwi (entry), true);return false; }
drivers/net/wireless/ralink/rt2x00/rt2800usb.c +7 -11
@@ -501,8 +501,7 @@ static int rt2800usb_get_tx_data_len(struct queue_entry *entry)/* * TX control handlers */ -static enum txdone_entry_desc_flags -rt2800usb_txdone_entry_check (struct queue_entry *entry,u32 reg) +static bool rt2800usb_txdone_entry_check (struct queue_entry *entry,u32 reg) {__le32 *txwi;u32 word;
@@ -515,7 +514,7 @@ static int rt2800usb_get_tx_data_len(struct queue_entry *entry)* frame. */ if (test_bit (ENTRY_DATA_IO_FAILED , &entry->flags)) -return TXDONE_FAILURE ; +return false; wcid =rt2x00_get_field32 (reg,TX_STA_FIFO_WCID ); ack =rt2x00_get_field32 (reg,TX_STA_FIFO_TX_ACK_REQUIRED );
@@ -537,10 +536,10 @@ static int rt2800usb_get_tx_data_len(struct queue_entry *entry)rt2x00_dbg (entry->queue->rt2x00dev,"TX status report missed for queue %d entry %d\n" , entry->queue->qid, entry->entry_idx); -return TXDONE_UNKNOWN ; +return false; } -return TXDONE_SUCCESS ; +return true; }static void rt2800usb_txdone (struct rt2x00_dev *rt2x00dev)
@@ -549,7 +548,7 @@ static void rt2800usb_txdone(struct rt2x00_dev *rt2x00dev)struct queue_entry *entry;u32 reg;u8 qid; -enum txdone_entry_desc_flags done_status; +bool match;while (kfifo_get (&rt2x00dev->txstatus_fifo, ®)) {/*
@@ -574,11 +573,8 @@ static void rt2800usb_txdone(struct rt2x00_dev *rt2x00dev)break ; } - done_status =rt2800usb_txdone_entry_check (entry, reg); -if (likely (done_status ==TXDONE_SUCCESS )) -rt2800_txdone_entry (entry, reg,rt2800usb_get_txwi (entry)); -else -rt2x00lib_txdone_noinfo (entry, done_status); + match =rt2800usb_txdone_entry_check (entry, reg); +rt2800_txdone_entry (entry, reg,rt2800usb_get_txwi (entry), match); } }
Signature · 1 line
1.8.3.1
PATCH v2 8/10 rt2800: status based rate flags for nomatch case
In reply to Stanislaw GruszkaWe use skb_desc->tx_rate_flags from entry as rate[].flags even if skb does not match status. Patch corrects flags and also fixes mcs for legacy rates.
rt2800_rate_from_status() is based on Felix's mt76 mt76x2_mac_process_tx_rate() function.
--- drivers/net/wireless/ralink/rt2x00/rt2800.h | 2 ++ drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 35 +++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800.h +2 -0
@@ -1760,6 +1760,8 @@#define TX_STA_FIFO_WCID FIELD32(0x0000ff00)#define TX_STA_FIFO_SUCCESS_RATE FIELD32(0xffff0000)#define TX_STA_FIFO_MCS FIELD32(0x007f0000) +#define TX_STA_FIFO_BW FIELD32(0x00800000) +#define TX_STA_FIFO_SGI FIELD32(0x01000000)#define TX_STA_FIFO_PHYMODE FIELD32(0xc0000000)/*
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +34 -1
@@ -852,6 +852,39 @@ void rt2800_process_rxwi(struct queue_entry *entry, }EXPORT_SYMBOL_GPL (rt2800_process_rxwi); +static void rt2800_rate_from_status (struct skb_frame_desc *skbdesc, +u32 status,enum nl80211_band band) +{ +u8 flags =0 ; +u8 idx =rt2x00_get_field32 (status,TX_STA_FIFO_MCS ); + +switch (rt2x00_get_field32 (status,TX_STA_FIFO_PHYMODE )) { +case RATE_MODE_HT_GREENFIELD : + flags |=IEEE80211_TX_RC_GREEN_FIELD ; +/* fall through */ +case RATE_MODE_HT_MIX : + flags |=IEEE80211_TX_RC_MCS ; +break ; +case RATE_MODE_OFDM : +if (band ==NL80211_BAND_2GHZ ) + idx +=4 ; +break ; +case RATE_MODE_CCK : +if (idx >=8 ) + idx -=8 ; +break ; + } + +if (rt2x00_get_field32 (status,TX_STA_FIFO_BW )) + flags |=IEEE80211_TX_RC_40_MHZ_WIDTH ; + +if (rt2x00_get_field32 (status,TX_STA_FIFO_SGI )) + flags |=IEEE80211_TX_RC_SHORT_GI ; + + skbdesc->tx_rate_idx = idx; + skbdesc->tx_rate_flags = flags; +} +void rt2800_txdone_entry (struct queue_entry *entry,u32 status,__le32 *txwi,bool match) {
@@ -898,7 +931,7 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi,* and provide retry count. */ if (unlikely ((aggr ==1 && ampdu ==0 && real_mcs != mcs)) || !match) { - skbdesc->tx_rate_idx = real_mcs; +rt2800_rate_from_status (skbdesc, status, rt2x00dev->curr_band); mcs = real_mcs; }
Signature · 1 line
1.8.3.1
PATCH v2 9/10 rt2800: use TXOP_BACKOFF for probe frames
In reply to Stanislaw GruszkaEven if we do not set AMPDU bit in TXWI, device still can aggregate frame and send it with rate not corresponding to requested. That mean we can do not sent probe frames with requested rate. To prevent that use TXOP_BACKOFF for probe frames.
--- drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +4 -3
@@ -372,15 +372,16 @@ static void rt2x00queue_create_tx_descriptor_ht(struct rt2x00_dev *rt2x00dev,/* * Determine IFS values -* - Use TXOP_BACKOFF for management frames except beacons +* - Use TXOP_BACKOFF for probe and management frames except beacons * - Use TXOP_SIFS for fragment bursts * - Use TXOP_HTTXOP for everything else * * Note: rt2800 devices won't use CTS protection (if used) * for frames not transmitted with TXOP_HTTXOP */ -if (ieee80211_is_mgmt (hdr->frame_control) && - !ieee80211_is_beacon (hdr->frame_control)) +if ((ieee80211_is_mgmt (hdr->frame_control) && + !ieee80211_is_beacon (hdr->frame_control)) || + (tx_info->flags &IEEE80211_TX_CTL_RATE_CTRL_PROBE )) txdesc->u.ht.txop =TXOP_BACKOFF ;else if (!(tx_info->flags &IEEE80211_TX_CTL_FIRST_FRAGMENT )) txdesc->u.ht.txop =TXOP_SIFS ;
Signature · 1 line
1.8.3.1
PATCH v2 10/10 rt2x00: fix rt2x00debug_dump_frame comment
In reply to Stanislaw Gruszka--- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2x00.h +1 -1
@@ -1396,7 +1396,7 @@ struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue,* rt2x00debug_dump_frame - Dump a frame to userspace through debugfs. * @rt2x00dev: Pointer to &struct rt2x00_dev. * @type: The type of frame that is being dumped. -* @skb: The skb containing the frame to be dumped. +* @entry: The queue entry containing the frame to be dumped. */ #ifdef CONFIG_RT2X00_LIB_DEBUGFS void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
Signature · 1 line
1.8.3.1
Re: [v2, 01/10] rt2x00: rt2800lib: move rt2800_drv_data declaration into rt2800lib.h
In reply to Stanislaw GruszkaQuoted 7 lines · Stanislaw Gruszka
From: Gabor Juhos <[email protected]>
The
rt2800_drv_datastructure contains driver specific information. Move the declaration into thert2800lib.hheader which is a more logical place for it. Also fix the comment style to avoid checkpatch warning.
Quoted 6 lines
The patch contains no functional changes, it is in preparation for the next patch.
Signed-off-by Gabor Juhos <[email protected]>Signed-off-by Daniel Golle <[email protected]>Signed-off-by Stanislaw Gruszka <[email protected]>
10 patches applied to wireless-drivers-next.git, thanks.
96609f366c6f rt2x00: rt2800lib: move rt2800_drv_data declaration into rt2800lib.h a13d985f26f6 rt2800: identify station based on status WCID 5edb05afebba rt2x00: separte filling tx status from rt2x00lib_txdone 56646adf9cd6 rt2x00: separte clearing entry from rt2x00lib_txdone a09305d05216 rt2x00: add txdone nomatch functionec80ad70d778 rt2x00: fixup fill_tx_status for nomatch case 293dff78ee05 rt2x00: use txdone_nomatch on rt2800usb9d7a7a4d2b02 rt2800: status based rate flags for nomatch case fb47ada8dc3c rt2800: use TXOP_BACKOFF for probe framesdd35cc0896fa rt2x00: fix rt2x00debug_dump_frame comment
Signature · 6 lines
https://patchwork.kernel.org/patch/9573627/ Documentation about submitting wireless patches and checking status from patchwork: https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches