[ath9k-devel] Fwd: Missing WMI_BSSINFO_EVENTID from AR6004
Hi, I connecting AR6004 through SDIO using compat-drivers-3.8-1-u driver and it is getting detected and proper firmware is getting loaded to the chip. But it is not showing txpower, bitrate, frequency. It shows like below: wlan0 IEEE 802.11abg ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm Retry long limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:on Another observation is that "WMI_BSSINFO_EVENTID" events are not coming to driver. Any idea of such behavior. Thanks, Manohar. ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Re: [ath9k-devel] [PATCH 1/2] mac80211: Add STBC RX flag to radiotap
On Mon, 2013-04-29 at 11:04 +0200, Wojciech Dubowik wrote: > Add rx flag to radiotap header which tells whether Same here, you can't just randomly add something to radiotap. Go standardise it first. johannes ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Re: [ath9k-devel] [PATCH 2/4] mac80211: add STBC flag for radiotap
On Mon, 2013-04-29 at 11:33 +0200, Oleksij Rempel wrote: > --- a/include/net/ieee80211_radiotap.h > +++ b/include/net/ieee80211_radiotap.h > @@ -269,6 +269,7 @@ enum ieee80211_radiotap_type { > #define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04 > #define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08 > #define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10 > +#define IEEE80211_RADIOTAP_MCS_HAVE_STBC 0x20 Umm, need to do radiotap standardisation process, so NACK until then. johannes ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Re: [ath9k-devel] [PATCH 1/2] mac80211: Add STBC RX flag to radiotap
Am 29.04.2013 11:04, schrieb Wojciech Dubowik: > Add rx flag to radiotap header which tells whether > Space-Time Block Code was used. At the moment only > 1 stream STBC is supported. > > TODO: Pass information from the driver on how many STBC > streams have been received. Hi, do i understand it correctly, on 2x2 or 2x1 system we will get one stream STBC. On 4x4 or 4x2 we will get one or two stream STBC, is it correct? Is it possible that we will get some thing like this any time soon? -- Regards, Oleksij ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
[ath9k-devel] [PATCH 4/4] ath9k: check for Rx-STBC flag and pass it to ieee80211
Signed-off-by: Oleksij Rempel --- drivers/net/wireless/ath/ath9k/mac.c | 3 +++ drivers/net/wireless/ath/ath9k/mac.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index a52081d..b924024 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c @@ -593,6 +593,9 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, (ads.ds_rxstatus3 & AR_GI) ? RX_FLAG_SHORT_GI : 0; rs->flag |= (ads.ds_rxstatus3 & AR_2040) ? RX_FLAG_40MHZ : 0; + if (AR_SREV_9280_20_OR_LATER(ah)) + rs->flag |= + (ads.ds_rxstatus3 & AR_STBC) ? RX_FLAG_STBC : 0; if (ads.ds_rxstatus8 & AR_PreDelimCRCErr) rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE; diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index 3f1e775..b02dfce 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h @@ -534,7 +534,8 @@ struct ar5416_desc { #define AR_2040 0x0002 #define AR_Parallel40 0x0004 #define AR_Parallel40_S 2 -#define AR_RxStatusRsvd30 0x00f8 +#define AR_STBC 0x0008 /* on ar9280 and later */ +#define AR_RxStatusRsvd30 0x00f0 #define AR_RxAntenna 0xff00 #define AR_RxAntenna_S 8 -- 1.8.1.2 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
[ath9k-devel] [PATCH 3/4] ath9k: remove useless flag conversation.
some flags used only outside of ath9k - In this case we can use "enum mac80211_rx_flags" and pass it upstream without extra conversation. Signed-off-by: Oleksij Rempel --- drivers/net/wireless/ath/ath9k/ar9003_mac.c | 5 +++-- drivers/net/wireless/ath/ath9k/mac.c| 11 +++ drivers/net/wireless/ath/ath9k/mac.h| 1 + drivers/net/wireless/ath/ath9k/recv.c | 5 + 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c index 301bf72..5163abd 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c @@ -469,6 +469,7 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs, rxs->rs_status = 0; rxs->rs_flags = 0; + rxs->flag = 0; rxs->rs_datalen = rxsp->status2 & AR_DataLen; rxs->rs_tstamp = rxsp->status3; @@ -493,8 +494,8 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs, rxs->rs_isaggr = (rxsp->status11 & AR_RxAggr) ? 1 : 0; rxs->rs_moreaggr = (rxsp->status11 & AR_RxMoreAggr) ? 1 : 0; rxs->rs_antenna = (MS(rxsp->status4, AR_RxAntenna) & 0x7); - rxs->rs_flags = (rxsp->status4 & AR_GI) ? ATH9K_RX_GI : 0; - rxs->rs_flags |= (rxsp->status4 & AR_2040) ? ATH9K_RX_2040 : 0; + rxs->flag |= (rxsp->status4 & AR_GI) ? RX_FLAG_SHORT_GI : 0; + rxs->flag |= (rxsp->status4 & AR_2040) ? RX_FLAG_40MHZ : 0; rxs->evm0 = rxsp->status6; rxs->evm1 = rxsp->status7; diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 498fee0..a52081d 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c @@ -547,6 +547,7 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, rs->rs_status = 0; rs->rs_flags = 0; + rs->flag = 0; rs->rs_datalen = ads.ds_rxstatus1 & AR_DataLen; rs->rs_tstamp = ads.AR_RcvTimestamp; @@ -586,10 +587,12 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, rs->rs_moreaggr = (ads.ds_rxstatus8 & AR_RxMoreAggr) ? 1 : 0; rs->rs_antenna = MS(ads.ds_rxstatus3, AR_RxAntenna); - rs->rs_flags = - (ads.ds_rxstatus3 & AR_GI) ? ATH9K_RX_GI : 0; - rs->rs_flags |= - (ads.ds_rxstatus3 & AR_2040) ? ATH9K_RX_2040 : 0; + + /* directly mapped flags for ieee80211_rx_status */ + rs->flag |= + (ads.ds_rxstatus3 & AR_GI) ? RX_FLAG_SHORT_GI : 0; + rs->flag |= + (ads.ds_rxstatus3 & AR_2040) ? RX_FLAG_40MHZ : 0; if (ads.ds_rxstatus8 & AR_PreDelimCRCErr) rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE; diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index 5865f92..3f1e775 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h @@ -149,6 +149,7 @@ struct ath_rx_status { u32 evm2; u32 evm3; u32 evm4; + u32 flag; /* see enum mac80211_rx_flags */ }; struct ath_htc_rx_status { diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 8be2b5d..b4b758d 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c @@ -868,10 +868,7 @@ static int ath9k_process_rate(struct ath_common *common, if (rx_stats->rs_rate & 0x80) { /* HT rate */ rxs->flag |= RX_FLAG_HT; - if (rx_stats->rs_flags & ATH9K_RX_2040) - rxs->flag |= RX_FLAG_40MHZ; - if (rx_stats->rs_flags & ATH9K_RX_GI) - rxs->flag |= RX_FLAG_SHORT_GI; + rxs->flag |= rx_stats->flag; rxs->rate_idx = rx_stats->rs_rate & 0x7f; return 0; } -- 1.8.1.2 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
[ath9k-devel] [PATCH 2/4] mac80211: add STBC flag for radiotap
Signed-off-by: Oleksij Rempel --- include/net/ieee80211_radiotap.h | 2 ++ include/net/mac80211.h | 2 ++ net/mac80211/main.c | 3 ++- net/mac80211/rx.c| 2 ++ net/mac80211/status.c| 3 ++- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h index c399963..8d3455b 100644 --- a/include/net/ieee80211_radiotap.h +++ b/include/net/ieee80211_radiotap.h @@ -269,6 +269,7 @@ enum ieee80211_radiotap_type { #define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04 #define IEEE80211_RADIOTAP_MCS_HAVE_FMT0x08 #define IEEE80211_RADIOTAP_MCS_HAVE_FEC0x10 +#define IEEE80211_RADIOTAP_MCS_HAVE_STBC 0x20 #define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03 #defineIEEE80211_RADIOTAP_MCS_BW_200 @@ -278,6 +279,7 @@ enum ieee80211_radiotap_type { #define IEEE80211_RADIOTAP_MCS_SGI 0x04 #define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 #define IEEE80211_RADIOTAP_MCS_FEC_LDPC0x10 +#define IEEE80211_RADIOTAP_MCS_STBC0x20 /* For IEEE80211_RADIOTAP_AMPDU_STATUS */ #define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN0x0001 diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 04c2d46..76e7977 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -805,6 +805,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) * on this subframe * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC * is stored in the @ampdu_delimiter_crc field) + * @RX_FLAG_STBC: STBC was used */ enum mac80211_rx_flags { RX_FLAG_MMIC_ERROR = BIT(0), @@ -832,6 +833,7 @@ enum mac80211_rx_flags { RX_FLAG_80MHZ = BIT(23), RX_FLAG_80P80MHZ= BIT(24), RX_FLAG_160MHZ = BIT(25), + RX_FLAG_STBC= BIT(26), }; /** diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 8a7bfc4..44191a3 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -589,7 +589,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, local->hw.conf.short_frame_max_tx_count = wiphy->retry_short; local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS | IEEE80211_RADIOTAP_MCS_HAVE_GI | -IEEE80211_RADIOTAP_MCS_HAVE_BW; +IEEE80211_RADIOTAP_MCS_HAVE_BW | +IEEE80211_RADIOTAP_MCS_HAVE_STBC; local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES; diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index c8447af..fada697 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -267,6 +267,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, *pos |= IEEE80211_RADIOTAP_MCS_BW_40; if (status->flag & RX_FLAG_HT_GF) *pos |= IEEE80211_RADIOTAP_MCS_FMT_GF; + if (status->flag & RX_FLAG_STBC) + *pos |= IEEE80211_RADIOTAP_MCS_STBC; pos++; *pos++ = status->rate_idx; } diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 4343920..41143f8 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -312,7 +312,8 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS); pos[0] = IEEE80211_RADIOTAP_MCS_HAVE_MCS | IEEE80211_RADIOTAP_MCS_HAVE_GI | -IEEE80211_RADIOTAP_MCS_HAVE_BW; +IEEE80211_RADIOTAP_MCS_HAVE_BW | +IEEE80211_RADIOTAP_MCS_HAVE_STBC; if (info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI) pos[1] |= IEEE80211_RADIOTAP_MCS_SGI; if (info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) -- 1.8.1.2 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
[ath9k-devel] [PATCH 1/4] ath9k_htc: add STBC TX support
current firmware will enable STBC_TX, only if other peer support it. This patch provide ht_peer_caps to firmware. FW versions 1.3, 1.4 should be able to work with it. Tested on ar7010+ar9280 and ar7010+ar9287. Signed-off-by: Oleksij Rempel --- drivers/net/wireless/ath/ath9k/htc.h | 2 ++ drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 +++ drivers/net/wireless/ath/ath9k/htc_drv_main.c | 4 3 files changed, 9 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index d3b099d..db4a793 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h @@ -142,6 +142,8 @@ struct ath9k_htc_target_aggr { #define WLAN_RC_40_FLAG 0x02 #define WLAN_RC_SGI_FLAG 0x04 #define WLAN_RC_HT_FLAG 0x08 +#define WLAN_RC_TX_STBC_FLAG 0x20 /* TX STBC */ +#define WLAN_RC_RX_STBC_FLAG 0xC0 /* RX STBC ,2 bits */ struct ath9k_htc_rateset { u8 rs_nrates; diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index a47f5e0..c79c5ac 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -517,6 +517,9 @@ static void setup_ht_cap(struct ath9k_htc_priv *priv, ath_dbg(common, CONFIG, "TX streams %d, RX streams: %d\n", tx_streams, rx_streams); + if (tx_streams >= 2) + ht_info->cap |= IEEE80211_HT_CAP_TX_STBC; + if (tx_streams != rx_streams) { ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; ht_info->mcs.tx_params |= ((tx_streams - 1) << diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 0743a47..af08b4a 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c @@ -623,6 +623,10 @@ static void ath9k_htc_setup_rate(struct ath9k_htc_priv *priv, trate->rates.ht_rates.rs_nrates = j; caps = WLAN_RC_HT_FLAG; + if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC) + caps |= WLAN_RC_RX_STBC_FLAG; + if (sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC) + caps |= WLAN_RC_TX_STBC_FLAG; if (sta->ht_cap.mcs.rx_mask[1]) caps |= WLAN_RC_DS_FLAG; if ((sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) && -- 1.8.1.2 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
[ath9k-devel] [PATCH 0/4 RFC] STBC work for ath9k*
This serie of patches is about support for STBC on ath9k chips. It will add STBC Tx to ath9k-htc and allow tracing Rx packets. Radiotap part of this patch set based on Wojciech Dubowik work. Currently this values seems to be not compatible with STBC draft for radiotap: http://www.radiotap.org/suggested-fields/MCS%20extension%20for%20STBC%20and%20Ness but compatible with wireshark (thx Wojciech): http://code.wireshark.org/git/?p=wireshark;a=blob;f=epan/dissectors/packet-ieee80211-radiotap-defs.h;h=e0b9a6a0098b3b8ada30cacb75e6ff5009284d3a;hb=HEAD#l280 Oleksij Rempel (4): ath9k_htc: add STBC TX support mac80211: add STBC RX flag for radiotap ath9k: remove useless flag conversation. ath9k: check for Rx-STBC flag and pass it to ieee80211 drivers/net/wireless/ath/ath9k/ar9003_mac.c | 5 +++-- drivers/net/wireless/ath/ath9k/htc.h | 2 ++ drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 +++ drivers/net/wireless/ath/ath9k/htc_drv_main.c | 4 drivers/net/wireless/ath/ath9k/mac.c | 14 ++ drivers/net/wireless/ath/ath9k/mac.h | 4 +++- drivers/net/wireless/ath/ath9k/recv.c | 5 + include/net/ieee80211_radiotap.h | 2 ++ include/net/mac80211.h| 2 ++ net/mac80211/main.c | 3 ++- net/mac80211/rx.c | 2 ++ net/mac80211/status.c | 3 ++- 12 files changed, 36 insertions(+), 13 deletions(-) -- 1.8.1.2 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
[ath9k-devel] [PATCH 1/2] mac80211: Add STBC RX flag to radiotap
Add rx flag to radiotap header which tells whether Space-Time Block Code was used. At the moment only 1 stream STBC is supported. TODO: Pass information from the driver on how many STBC streams have been received. Signed-off-by: Wojciech Dubowik --- include/net/ieee80211_radiotap.h |6 ++ include/net/mac80211.h |2 ++ net/mac80211/main.c |3 ++- net/mac80211/rx.c|2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h index e07d7d7..0254cbd 100644 --- a/include/net/ieee80211_radiotap.h +++ b/include/net/ieee80211_radiotap.h @@ -271,6 +271,7 @@ enum ieee80211_radiotap_type { #define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04 #define IEEE80211_RADIOTAP_MCS_HAVE_FMT0x08 #define IEEE80211_RADIOTAP_MCS_HAVE_FEC0x10 +#define IEEE80211_RADIOTAP_MCS_HAVE_STBC 0x20 #define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03 #defineIEEE80211_RADIOTAP_MCS_BW_200 @@ -280,6 +281,11 @@ enum ieee80211_radiotap_type { #define IEEE80211_RADIOTAP_MCS_SGI 0x04 #define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 #define IEEE80211_RADIOTAP_MCS_FEC_LDPC0x10 +#define IEEE80211_RADIOTAP_MCS_STBC_MASK 0x60 +#defineIEEE80211_RADIOTAP_MCS_STBC_0 0 +#defineIEEE80211_RADIOTAP_MCS_STBC_1 1 +#defineIEEE80211_RADIOTAP_MCS_STBC_2 2 +#defineIEEE80211_RADIOTAP_MCS_STBC_3 3 /* For IEEE80211_RADIOTAP_AMPDU_STATUS */ #define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN0x0001 diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 1fe1844..efa9fb1 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -808,6 +808,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) * on this subframe * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC * is stored in the @ampdu_delimiter_crc field) + * @RX_FLAG_STBC: Space-Time Block Code was used */ enum mac80211_rx_flags { RX_FLAG_MMIC_ERROR = BIT(0), @@ -835,6 +836,7 @@ enum mac80211_rx_flags { RX_FLAG_80MHZ = BIT(23), RX_FLAG_80P80MHZ= BIT(24), RX_FLAG_160MHZ = BIT(25), + RX_FLAG_STBC= BIT(26), }; /** diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 8a7bfc4..44191a3 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -589,7 +589,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, local->hw.conf.short_frame_max_tx_count = wiphy->retry_short; local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS | IEEE80211_RADIOTAP_MCS_HAVE_GI | -IEEE80211_RADIOTAP_MCS_HAVE_BW; +IEEE80211_RADIOTAP_MCS_HAVE_BW | +IEEE80211_RADIOTAP_MCS_HAVE_STBC; local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES; diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index c8447af..955a70f 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -267,6 +267,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, *pos |= IEEE80211_RADIOTAP_MCS_BW_40; if (status->flag & RX_FLAG_HT_GF) *pos |= IEEE80211_RADIOTAP_MCS_FMT_GF; + if (status->flag & RX_FLAG_STBC) + *pos |= IEEE80211_RADIOTAP_MCS_STBC_1; pos++; *pos++ = status->rate_idx; } -- 1.7.10.4 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
[ath9k-devel] [PATCH 2/2] ath9k: Add STBC flag to rx status
Pass RX flag to mac80211 layer when STBC stream has been received. Signed-off-by: Wojciech Dubowik --- drivers/net/wireless/ath/ath9k/ar9003_mac.c |1 + drivers/net/wireless/ath/ath9k/mac.c|2 ++ drivers/net/wireless/ath/ath9k/mac.h|1 + drivers/net/wireless/ath/ath9k/recv.c |2 ++ 4 files changed, 6 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c index 2570ccc..3318a5f 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c @@ -592,6 +592,7 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs, rxs->rs_antenna = (MS(rxsp->status4, AR_RxAntenna) & 0x7); rxs->rs_flags = (rxsp->status4 & AR_GI) ? ATH9K_RX_GI : 0; rxs->rs_flags |= (rxsp->status4 & AR_2040) ? ATH9K_RX_2040 : 0; + rxs->rs_flags |= (rxsp->status4 & AR_RxStbc) ? ATH9K_RX_STBC : 0; rxs->rs_hw_upload_data = (rxsp->status2 & AR_HwUploadData) ? 1 : 0; rxs->rs_not_sounding = (rxsp->status4 & AR_RxNotSounding) ? 1 : 0; diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 498fee0..288361d 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c @@ -590,6 +590,8 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, (ads.ds_rxstatus3 & AR_GI) ? ATH9K_RX_GI : 0; rs->rs_flags |= (ads.ds_rxstatus3 & AR_2040) ? ATH9K_RX_2040 : 0; + rs->rs_flags |= + (ads.ds_rxstatus3 & AR_RxStbc) ? ATH9K_RX_STBC : 0; if (ads.ds_rxstatus8 & AR_PreDelimCRCErr) rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE; diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index da5ab6e..a2d17f4 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h @@ -199,6 +199,7 @@ struct ath_htc_rx_status { #define ATH9K_RX_DELIM_CRC_PRE0x10 #define ATH9K_RX_DELIM_CRC_POST 0x20 #define ATH9K_RX_DECRYPT_BUSY 0x40 +#define ATH9K_RX_STBC 0x80 #define ATH9K_RXKEYIX_INVALID ((u8)-1) #define ATH9K_TXKEYIX_INVALID ((u8)-1) diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 8be2b5d..f442c1e 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c @@ -872,6 +872,8 @@ static int ath9k_process_rate(struct ath_common *common, rxs->flag |= RX_FLAG_40MHZ; if (rx_stats->rs_flags & ATH9K_RX_GI) rxs->flag |= RX_FLAG_SHORT_GI; + if (rx_stats->rs_flags & ATH9K_RX_STBC) + rxs->flag |= RX_FLAG_STBC; rxs->rate_idx = rx_stats->rs_rate & 0x7f; return 0; } -- 1.7.10.4 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
[ath9k-devel] [PATCH 0/2] Add STBC rx flag for radiotap using ath9k driver
These patches add STBC rx flag for radiotap. They are based on proposed field structure from radiotap.org. Only one STBC stream is supported. TODO: Implement mechanism for passing the number of STBC streams being used. We could use mac80211_rx_flags to point number of streams which would require 3 precious bits or use a separate structure. Wojciech Dubowik (2): mac80211: Add STBC RX flag to radiotap ath9k: Add STBC flag to rx status drivers/net/wireless/ath/ath9k/ar9003_mac.c |1 + drivers/net/wireless/ath/ath9k/mac.c|2 ++ drivers/net/wireless/ath/ath9k/mac.h|1 + drivers/net/wireless/ath/ath9k/recv.c |2 ++ include/net/ieee80211_radiotap.h|6 ++ include/net/mac80211.h |2 ++ net/mac80211/main.c |3 ++- net/mac80211/rx.c |2 ++ 8 files changed, 18 insertions(+), 1 deletion(-) -- 1.7.10.4 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Re: [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
Michal Kazior wrote: > > An updated patch: > > > > [PATCH] ath10k: Remove unneeded locks during HTT RX attach > > > > Fix two issues: > > > > * Bail out properly when RX buffer allocation fails at init time. > > * Do not acquire the rx ring lock during attach() since we > >don't rearm the replenish timer. > > > > Signed-off-by: Sujith Manoharan > > --- > > Looks good to me now. Alright. Thanks for the review ! Sujith ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Re: [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
On 29/04/13 10:14, Sujith Manoharan wrote: > Michal Kazior wrote: >> I'm not even sure if we should abort right away. We replenish htt rx >> buffers using GFP_ATOMIC allocation. This can fail under memory pressure >> more often (then, say, GFP_KERNEL). I wouldn't really consider this as >> fatal error. Although we could probably have a ath10k_warn/info if the >> initial allocation doesn't fill everything up. Perhaps we could fail >> only if the fill_cnt is still 0, or below a defined threshold? >> >> We could also try and split the replenishing functions and use >> GFP_KERNEL allocation during htt rx attach. > > We do a bunch of allocations using GFP_ATOMIC after htt_attach(). > Proceeding with initialization at this point seems wrong and programming > the FW with RX ring configuration via HTT_H2T_MSG_TYPE_RX_RING_CFG even though > host setup failed is probably incorrect ? You're right. > An updated patch: > > [PATCH] ath10k: Remove unneeded locks during HTT RX attach > > Fix two issues: > > * Bail out properly when RX buffer allocation fails at init time. > * Do not acquire the rx ring lock during attach() since we >don't rearm the replenish timer. > > Signed-off-by: Sujith Manoharan > --- Looks good to me now. -- Pozdrawiam / Best regards, Michal Kazior. ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Re: [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
Michal Kazior wrote: > Won't this still fail the lockdep assertion? > > We're also leaking memory upon failure. We need to free up the skbuffs > we successfully allocated & mapped. > > If you want to check if the ath10k_htt_rx_ring_fill_n() failed you could > simply compare fill_level and fill_cnt while (still) holding the spinlock: > > spin_lock_bh(&htt->rx_ring.lock); > htt->rx_ring.fill_cnt = 0; > ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level); > if (htt->rx_ring.fill_cnt != htt->rx_ring.fill_level) { > // handle failure > } > spin_unlock_bh(&htt->rx_ring.lock); > > I'm not even sure if we should abort right away. We replenish htt rx > buffers using GFP_ATOMIC allocation. This can fail under memory pressure > more often (then, say, GFP_KERNEL). I wouldn't really consider this as > fatal error. Although we could probably have a ath10k_warn/info if the > initial allocation doesn't fill everything up. Perhaps we could fail > only if the fill_cnt is still 0, or below a defined threshold? > > We could also try and split the replenishing functions and use > GFP_KERNEL allocation during htt rx attach. We do a bunch of allocations using GFP_ATOMIC after htt_attach(). Proceeding with initialization at this point seems wrong and programming the FW with RX ring configuration via HTT_H2T_MSG_TYPE_RX_RING_CFG even though host setup failed is probably incorrect ? IMHO, the simplest fix is to just die happily when the system is hosed at load-time. An updated patch: [PATCH] ath10k: Remove unneeded locks during HTT RX attach Fix two issues: * Bail out properly when RX buffer allocation fails at init time. * Do not acquire the rx ring lock during attach() since we don't rearm the replenish timer. Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath10k/htt_rx.c | 81 ++-- 1 file changed, 57 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 7986601..6b1ca2b 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -273,27 +273,36 @@ static int ath10k_htt_rx_ring_fill_level(struct ath10k_htt *htt) return size; } -static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) +static void ath10k_htt_rx_ring_free(struct ath10k_htt *htt) +{ + struct sk_buff *skb; + struct ath10k_skb_cb *cb; + int i; + + for (i = 0; i < htt->rx_ring.fill_cnt; i++) { + skb = htt->rx_ring.netbufs_ring[i]; + cb = ATH10K_SKB_CB(skb); + dma_unmap_single(htt->ar->dev, cb->paddr, +skb->len + skb_tailroom(skb), +DMA_FROM_DEVICE); + dev_kfree_skb_any(skb); + } + + htt->rx_ring.fill_cnt = 0; +} + +static int __ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) { struct htt_rx_desc *rx_desc; struct sk_buff *skb; dma_addr_t paddr; - int idx; - - lockdep_assert_held(&htt->rx_ring.lock); + int ret = 0, idx; idx = __le32_to_cpu(*(htt->rx_ring.alloc_idx.vaddr)); while (num > 0) { skb = dev_alloc_skb(HTT_RX_BUF_SIZE + HTT_RX_DESC_ALIGN); if (!skb) { - /* -* Failed to fill it to the desired level - -* we'll start a timer and try again next time. -* As long as enough buffers are left in the ring for -* another A-MPDU rx, no special recovery is needed. -*/ - mod_timer(&htt->rx_ring.refill_retry_timer, jiffies + - msecs_to_jiffies(HTT_RX_RING_REFILL_RETRY_MS)); + ret = -ENOMEM; goto fail; } @@ -312,6 +321,7 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) if (unlikely(dma_mapping_error(htt->ar->dev, paddr))) { dev_kfree_skb_any(skb); + ret = -ENOMEM; goto fail; } @@ -327,16 +337,32 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) fail: *(htt->rx_ring.alloc_idx.vaddr) = __cpu_to_le32(idx); - return; + return ret; +} + +static int ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) +{ + lockdep_assert_held(&htt->rx_ring.lock); + return __ath10k_htt_rx_ring_fill_n(htt, num); } static void ath10k_htt_rx_msdu_buff_replenish(struct ath10k_htt *htt) { - int num_to_fill; + int ret, num_to_fill; spin_lock_bh(&htt->rx_ring.lock); num_to_fill = htt->rx_ring.fill_level - htt->rx_ring.fill_cnt; - ath10k_htt_rx_ring_fill_n(htt, num_to_fill); + ret = ath10k_h
[ath9k-devel] [PATCH 2/2] ath10k: WMI wmi_bcn_info update
Sync with FW ver .614 - wmi_bcn_info structure. Signed-off-by: Janusz Dziedzic --- drivers/net/wireless/ath/ath10k/wmi.h |9 - 1 file changed, 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 986f0c1..d32ba23 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -2408,14 +2408,6 @@ struct wmi_tim_info { __le32 tim_num_ps_pending; } __packed; -struct wmi_quiet_info { - __le32 is_enabled; - __le32 tbttcount; - __le32 period; - __le32 duration; - __le32 offset; -} __packed; - /* Maximum number of NOA Descriptors supported */ #define WMI_P2P_MAX_NOA_DESCRIPTORS 4 #define WMI_P2P_OPPPS_ENABLE_BIT BIT(0) @@ -2439,7 +2431,6 @@ struct wmi_p2p_noa_info { struct wmi_bcn_info { struct wmi_tim_info tim_info; - struct wmi_quiet_info quiet_info; struct wmi_p2p_noa_info p2p_noa_info; } __packed; -- 1.7.9.5 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
[ath9k-devel] [PATCH 1/2] ath10k: use ieee80211 NoA definitions
Remove internal types definition and use ieee80211/cfg80211 notice of absence definitions. Signed-off-by: Janusz Dziedzic --- drivers/net/wireless/ath/ath10k/wmi.c | 10 +- drivers/net/wireless/ath/ath10k/wmi.h | 18 -- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 8d542e5..2d4c7d9 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -538,7 +538,7 @@ static void ath10k_wmi_update_tim(struct ath10k *ar, struct ath10k_vif *arvif, static void ath10k_p2p_fill_noa_ie(u8 *data, u32 len, struct wmi_p2p_noa_info *noa) { - struct ath10k_p2p_noa_attr *noa_attr; + struct ieee80211_p2p_noa_attr *noa_attr; u8 ctwindow_oppps = noa->ctwindow_oppps; u8 ctwindow = ctwindow_oppps >> WMI_P2P_OPPPS_CTWINDOW_OFFSET; bool oppps = !!(ctwindow_oppps & WMI_P2P_OPPPS_ENABLE_BIT); @@ -558,12 +558,12 @@ static void ath10k_p2p_fill_noa_ie(u8 *data, u32 len, /* NOA ATTR */ data[6] = IEEE80211_P2P_ATTR_ABSENCE_NOTICE; noa_attr_len = (__le16 *) &data[7]; /* 2 bytes */ - noa_attr = (struct ath10k_p2p_noa_attr *) &data[9]; + noa_attr = (struct ieee80211_p2p_noa_attr *) &data[9]; noa_attr->index = noa->index; noa_attr->oppps_ctwindow = ctwindow; if (oppps) - noa_attr->oppps_ctwindow |= ATH10K_P2P_OPPPS_ENABLE_BIT; + noa_attr->oppps_ctwindow |= IEEE80211_P2P_OPPPS_ENABLE_BIT; for (i = 0; i < noa_descriptors; i++) { noa_attr->desc[i].count = @@ -575,7 +575,7 @@ static void ath10k_p2p_fill_noa_ie(u8 *data, u32 len, } attr_len = 2; /* index + oppps_ctwindow */ - attr_len += noa_descriptors * sizeof(struct ath10k_p2p_noa_desc); + attr_len += noa_descriptors * sizeof(struct ieee80211_p2p_noa_desc); *noa_attr_len = __cpu_to_le16(attr_len); } @@ -593,7 +593,7 @@ static u32 ath10k_p2p_calc_noa_ie_len(struct wmi_p2p_noa_info *noa) len += 1 + 1 + 4; /* EID + len + OUI */ len += 1 + 2; /* noa attr + attr len */ len += 1 + 1; /* index + oppps_ctwindow */ - len += noa_descriptors * sizeof(struct ath10k_p2p_noa_desc); + len += noa_descriptors * sizeof(struct ieee80211_p2p_noa_desc); return len; } diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 9946a51..986f0c1 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -2766,24 +2766,6 @@ struct wmi_add_bcn_filter_cmd { /* By default disable power save for IBSS */ #define ATH10K_DEFAULT_ATIM 0 - -/* TODO to be removed when cfg80211 changes will be merged: - cfg80211: add P2P Notice of Absence attribute */ -struct ath10k_p2p_noa_desc { - u8 count; - __le32 duration; - __le32 interval; - __le32 start_time; -} __packed; - -struct ath10k_p2p_noa_attr { - u8 index; - u8 oppps_ctwindow; - struct ath10k_p2p_noa_desc desc[4]; -} __packed; - -#define ATH10K_P2P_OPPPS_ENABLE_BITBIT(7) - struct ath10k; struct ath10k_vif; -- 1.7.9.5 ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Re: [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
On 29/04/13 09:08, Sujith Manoharan wrote: > Sujith Manoharan wrote: >> ...and it doesn't seem correct to proceed with init after htt_rx_attach() has >> failed due to memory allocation, since subsequent allocations would probably >> fail >> too. > > How about something like this ? > > [PATCH] ath10k: Remove unneeded locks during HTT RX attach > > If buffer allocation fails during attach(), bail out properly > so the replenish timer doesn't get fired. > > Signed-off-by: Sujith Manoharan > --- > (...) > @@ -641,23 +645,29 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt) > setup_timer(timer, ath10k_htt_rx_ring_refill_retry, (unsigned long)htt); > > spin_lock_init(&htt->rx_ring.lock); > - spin_lock_bh(&htt->rx_ring.lock); > + > htt->rx_ring.fill_cnt = 0; > - ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level); > - spin_unlock_bh(&htt->rx_ring.lock); > + if (ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level)) > + goto err_fill_ring; Won't this still fail the lockdep assertion? We're also leaking memory upon failure. We need to free up the skbuffs we successfully allocated & mapped. If you want to check if the ath10k_htt_rx_ring_fill_n() failed you could simply compare fill_level and fill_cnt while (still) holding the spinlock: spin_lock_bh(&htt->rx_ring.lock); htt->rx_ring.fill_cnt = 0; ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level); if (htt->rx_ring.fill_cnt != htt->rx_ring.fill_level) { // handle failure } spin_unlock_bh(&htt->rx_ring.lock); I'm not even sure if we should abort right away. We replenish htt rx buffers using GFP_ATOMIC allocation. This can fail under memory pressure more often (then, say, GFP_KERNEL). I wouldn't really consider this as fatal error. Although we could probably have a ath10k_warn/info if the initial allocation doesn't fill everything up. Perhaps we could fail only if the fill_cnt is still 0, or below a defined threshold? We could also try and split the replenishing functions and use GFP_KERNEL allocation during htt rx attach. -- Pozdrawiam / Best regards, Michal Kazior. ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets
Am 29.04.2013 08:45, schrieb Wojciech Dubowik: > On 04/28/2013 05:03 PM, Oleksij Rempel wrote: >> Am 28.04.2013 16:13, schrieb Oleksij Rempel: >>> Am 28.04.2013 14:51, schrieb Felix Fietkau: On 2013-04-27 5:25 PM, Oleksij Rempel wrote: > Collect statistics about recived duplicate and STBC packets. > This information should help see if STBC is actually working. > > Tested on ar9285; > > Signed-off-by: Oleksij Rempel I thought about this patch some more, and I'm wondering what's the point in doing this? These statistics are going to be completely useless for most people and they'll waste some memory/cpu cycles, especially on small-cache devices. I think it's much more useful to simply pass the information to mac80211 via rx flags and get them added to the radiotap header. >>> >>> Sure. >>> >> >> I see Wojciech Dubowik sanded some patches, for at least one year, to >> make exactly what Felix suggested. Are there any reason why this >> patches was not accepted? >> Wojciech if you alive and have some time, can you update them? > Sure. I will try to update them based on suggested radiotap field > structure for STBC and Ness. > > On the other hand as Felix already mentioned it's yet another line of > code one needs once in a lifetime. > If one is checking whether stbc is working the easiest way is to create > own debugging namespace > in radiotap and dump all descriptor registers there. It probably doesn't > go mainline but you could apply > the patches when you need and they mostly rebase cleanly. At least > that's what I do. Felix, will this patches go upstream if i make it raditap compatible? If yes, and performance and cache usage is an issue, it think we should remove this double flags mapping in ath9k. Currently we convert device specific flags to driver flags, and then convert them to mac80211 flags. There is lots of useless checks and conversations for each packet. Should i change it? -- Regards, Oleksij ___ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Re: [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
Sujith Manoharan wrote: > ...and it doesn't seem correct to proceed with init after htt_rx_attach() has > failed due to memory allocation, since subsequent allocations would probably > fail > too. How about something like this ? [PATCH] ath10k: Remove unneeded locks during HTT RX attach If buffer allocation fails during attach(), bail out properly so the replenish timer doesn't get fired. Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath10k/htt_rx.c | 54 +++- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 7986601..2c65a21 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -273,12 +273,12 @@ static int ath10k_htt_rx_ring_fill_level(struct ath10k_htt *htt) return size; } -static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) +static int ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) { struct htt_rx_desc *rx_desc; struct sk_buff *skb; dma_addr_t paddr; - int idx; + int ret = 0, idx; lockdep_assert_held(&htt->rx_ring.lock); @@ -286,14 +286,7 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) while (num > 0) { skb = dev_alloc_skb(HTT_RX_BUF_SIZE + HTT_RX_DESC_ALIGN); if (!skb) { - /* -* Failed to fill it to the desired level - -* we'll start a timer and try again next time. -* As long as enough buffers are left in the ring for -* another A-MPDU rx, no special recovery is needed. -*/ - mod_timer(&htt->rx_ring.refill_retry_timer, jiffies + - msecs_to_jiffies(HTT_RX_RING_REFILL_RETRY_MS)); + ret = -ENOMEM; goto fail; } @@ -312,6 +305,7 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) if (unlikely(dma_mapping_error(htt->ar->dev, paddr))) { dev_kfree_skb_any(skb); + ret = -ENOMEM; goto fail; } @@ -327,16 +321,26 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) fail: *(htt->rx_ring.alloc_idx.vaddr) = __cpu_to_le32(idx); - return; + return ret; } static void ath10k_htt_rx_msdu_buff_replenish(struct ath10k_htt *htt) { - int num_to_fill; + int ret, num_to_fill; spin_lock_bh(&htt->rx_ring.lock); num_to_fill = htt->rx_ring.fill_level - htt->rx_ring.fill_cnt; - ath10k_htt_rx_ring_fill_n(htt, num_to_fill); + ret = ath10k_htt_rx_ring_fill_n(htt, num_to_fill); + if (ret == -ENOMEM) { + /* +* Failed to fill it to the desired level - +* we'll start a timer and try again next time. +* As long as enough buffers are left in the ring for +* another A-MPDU rx, no special recovery is needed. +*/ + mod_timer(&htt->rx_ring.refill_retry_timer, jiffies + + msecs_to_jiffies(HTT_RX_RING_REFILL_RETRY_MS)); + } spin_unlock_bh(&htt->rx_ring.lock); } @@ -615,13 +619,13 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt) kmalloc(htt->rx_ring.size * sizeof(struct sk_buff *), GFP_KERNEL); if (!htt->rx_ring.netbufs_ring) - goto fail1; + goto err_netbuf; vaddr = dma_alloc_coherent(htt->ar->dev, (htt->rx_ring.size * sizeof(htt->rx_ring.paddrs_ring)), &paddr, GFP_DMA); if (!vaddr) - goto fail2; + goto err_dma_ring; htt->rx_ring.paddrs_ring = vaddr; htt->rx_ring.base_paddr = paddr; @@ -630,7 +634,7 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt) sizeof(*htt->rx_ring.alloc_idx.vaddr), &paddr, GFP_DMA); if (!vaddr) - goto fail3; + goto err_dma_idx; htt->rx_ring.alloc_idx.vaddr = vaddr; htt->rx_ring.alloc_idx.paddr = paddr; @@ -641,23 +645,29 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt) setup_timer(timer, ath10k_htt_rx_ring_refill_retry, (unsigned long)htt); spin_lock_init(&htt->rx_ring.lock); - spin_lock_bh(&htt->rx_ring.lock); + htt->rx_ring.fill_cnt = 0; - ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level); - spin_unlock_bh(&htt->rx_ring.lock); + if (ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level)) + goto err_fill_ring; ath10k_dbg(ATH10K_DBG_HTT, "HTT RX ring size: %d,