wifi: rtlwifi: rtl8192du fixes and additional support
v3 cover wifi: rtlwifi: rtl8192du fixes and additional support
Fixes
- BA sessions started for QoS null frames
- signal of A-MPDU frames without PHY status
Implements
- USB RX aggregation
Changes in v3:
- QoS null BA: explain the benefit and the impact
- usb.h: align RTL_RADIO_TAP_SIZE_RSV with RTL_RX_DESC_SIZE
- Add Acked-by from Ping-Ke to patches 2 and 4
Changes in v2:
- Drop "let the firmware use all rates"
- Drop the test results from the bug fixes
- Add "usb: move the radiotap headroom size to usb.h", used by RX aggregation instead of its own define
- RX aggregation: describe how the frames are split
- Add Acked-by from Ping-Ke to patches 3 and 5
Tested on RTL8192DU 2.4 GHz with iperf3.
Testing on 5 GHz did not show any changes.
before after
TX 7.0 6.4
RX 28.3 32.0
Ho Jie Feng (5):
wifi: rtlwifi: rc: start no BA session for QoS null frames
wifi: rtlwifi: rtl8192d: report no signal for frames without PHY
status
wifi: rtlwifi: usb: unify the RX code path
wifi: rtlwifi: usb: move the radiotap headroom size to usb.h
wifi: rtlwifi: rtl8192du: enable USB RX aggregation
drivers/net/wireless/realtek/rtlwifi/rc.c | 2 +- .../wireless/realtek/rtlwifi/rtl8192d/reg.h | 4 ++ .../realtek/rtlwifi/rtl8192d/trx_common.c | 2 + .../wireless/realtek/rtlwifi/rtl8192du/hw.c | 18 +++++- .../wireless/realtek/rtlwifi/rtl8192du/sw.c | 2 +- .../wireless/realtek/rtlwifi/rtl8192du/trx.c | 45 ++++++++++++++ .../wireless/realtek/rtlwifi/rtl8192du/trx.h | 4 ++ drivers/net/wireless/realtek/rtlwifi/usb.c | 60 ++----------------- drivers/net/wireless/realtek/rtlwifi/usb.h | 1 + 9 files changed, 80 insertions(+), 58 deletions(-)
base-commit: 0bdc579dbfc251a6b6838ee9459b6771b948c617
Signature · 1 line
2.53.0
PATCH v3 1/5 wifi: rtlwifi: rc: start no BA session for QoS null frames
rtl_tx_status() starts a TX BA session for any QoS null data frames, so these polls start a session even though they do not carry data. That costs an ADDBA exchange.
Check ieee80211_is_data_present() instead, so only frames that carry data start a BA session.
--- drivers/net/wireless/realtek/rtlwifi/rc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/rc.c +1 -1
@@ -216,7 +216,7 @@ static void rtl_tx_status(void *ppriv,__le16 fc =rtl_get_fc (skb);struct rtl_sta_info *sta_entry; -if (!priv_sta || !ieee80211_is_data (fc)) +if (!priv_sta || !ieee80211_is_data_present (fc))return ;if (rtl_is_special_data (mac->hw, skb, true, true))
Signature · 1 line
2.53.0
PATCH v3 2/5 wifi: rtlwifi: rtl8192d: report no signal for frames without PHY status
In reply to Ho Jie FengOnly the first frame of an A-MPDU comes with the PHY status. This makes mac80211 report the correct value when queried from iw.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192d/trx_common.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtlwifi/rtl8192d/trx_common.c +2 -0
@@ -425,6 +425,8 @@ bool rtl92d_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, stats->rx_bufshift);_rtl92d_translate_rx_signal_stuff (hw, skb, stats, pdesc, p_drvinfo); + }else { + rx_status->flag |=RX_FLAG_NO_SIGNAL_VAL ; }/*rx_status->qual = stats->signal; */ rx_status->signal = stats->recvsignalpower +10 ;
Signature · 1 line
2.53.0
PATCH v3 3/5 wifi: rtlwifi: usb: unify the RX code path
In reply to Ho Jie Feng_rtl_usb_rx_process_agg is a copy of _rtl_usb_rx_process_noagg except without the tail end. The noagg function can be used for aggregated frames, so drop it and rename _rtl_usb_rx_process_noagg to _rtl_usb_rx_process to unify the code path.
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 52 ++-------------------- 1 file changed, 3 insertions(+), 49 deletions(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +3 -49
@@ -366,50 +366,7 @@ static int _rtl_prep_rx_urb(struct ieee80211_hw *hw, struct rtl_usb *rtlusb,return 0 ; } -static void _rtl_usb_rx_process_agg (struct ieee80211_hw *hw, -struct sk_buff *skb) -{ -struct rtl_priv *rtlpriv =rtl_priv (hw); -u8 *rxdesc = skb->data; -struct ieee80211_hdr *hdr; -bool unicast = false; -__le16 fc; -struct ieee80211_rx_status rx_status = {0 }; -struct rtl_stats stats = { - .signal =0 , - .rate =0 , - }; - -skb_pull (skb,RTL_RX_DESC_SIZE ); - rtlpriv->cfg->ops->query_rx_desc (hw, &stats, &rx_status, rxdesc, skb); -skb_pull (skb, (stats.rx_drvinfo_size + stats.rx_bufshift)); - hdr =rtl_get_hdr (skb); - fc = hdr->frame_control; -if (!stats.crc) { -memcpy (IEEE80211_SKB_RXCB (skb), &rx_status,sizeof (rx_status)); - -if (is_broadcast_ether_addr (hdr->addr1)) { -/*TODO*/ ; - }else if (is_multicast_ether_addr (hdr->addr1)) { -/*TODO*/ - }else { - unicast = true; - rtlpriv->stats.rxbytesunicast += skb->len; - } - -if (ieee80211_is_data (fc)) { - rtlpriv->cfg->ops->led_control (hw,LED_CTL_RX ); - -if (unicast) - rtlpriv->link_info.num_rx_inperiod++; - } -/* static bcn for roaming */ -rtl_beacon_statistic (hw, skb); - } -} - -static void _rtl_usb_rx_process_noagg (struct ieee80211_hw *hw, -struct sk_buff *skb) +static void _rtl_usb_rx_process (struct ieee80211_hw *hw,struct sk_buff *skb) {struct rtl_priv *rtlpriv =rtl_priv (hw);u8 *rxdesc = skb->data;
@@ -470,8 +427,7 @@ static void _rtl_rx_pre_process(struct ieee80211_hw *hw, struct sk_buff *skb)WARN_ON (skb_queue_empty (&rx_queue));while (!skb_queue_empty (&rx_queue)) { _skb =skb_dequeue (&rx_queue); -_rtl_usb_rx_process_agg (hw, _skb); -ieee80211_rx (hw, _skb); +_rtl_usb_rx_process (hw, _skb); } }
@@ -490,11 +446,9 @@ static void _rtl_rx_work(struct tasklet_struct *t) }if (likely (!rtlusb->usb_rx_segregate_hdl)) { -_rtl_usb_rx_process_noagg (hw, skb); +_rtl_usb_rx_process (hw, skb); }else { -/* TO DO */ _rtl_rx_pre_process (hw, skb); -pr_err ("rx agg not supported\n" ); } } }
Signature · 1 line
2.53.0
PATCH v3 4/5 wifi: rtlwifi: usb: move the radiotap headroom size to usb.h
In reply to Ho Jie FengLet drivers use the same define to add headroom for the frames split out of aggregated transfers.
Move __RADIO_TAP_SIZE_RSV to usb.h as RTL_RADIO_TAP_SIZE_RSV so chip specific code can use it.
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 8 ++------ drivers/net/wireless/realtek/rtlwifi/usb.h | 1 + 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +2 -6
@@ -488,8 +488,6 @@ static unsigned int _rtl_rx_get_padding(struct ieee80211_hdr *hdr,#endif } -#define __RADIO_TAP_SIZE_RSV 32 -static void _rtl_rx_completed (struct urb *_urb) {struct rtl_usb *rtlusb = (struct rtl_usb *)_urb->context;
@@ -521,7 +519,7 @@ static void _rtl_rx_completed(struct urb *_urb) hdr = (void *)(_urb->transfer_buffer +RTL_RX_DESC_SIZE ); padding =_rtl_rx_get_padding (hdr, size -RTL_RX_DESC_SIZE ); - skb =dev_alloc_skb (size + __RADIO_TAP_SIZE_RSV + padding); + skb =dev_alloc_skb (size +RTL_RADIO_TAP_SIZE_RSV + padding);if (!skb) {pr_err ("Can't allocate skb for bulk IN!\n" ); goto resubmit;
@@ -533,7 +531,7 @@ static void _rtl_rx_completed(struct urb *_urb)skb_reserve (skb, padding);/* reserve some space for mac80211's radiotap */ -skb_reserve (skb, __RADIO_TAP_SIZE_RSV); +skb_reserve (skb,RTL_RADIO_TAP_SIZE_RSV );skb_put_data (skb, _urb->transfer_buffer, size);
@@ -570,8 +568,6 @@ static void _rtl_rx_completed(struct urb *_urb)usb_anchor_urb (_urb, &rtlusb->rx_cleanup_urbs); } -#undef __RADIO_TAP_SIZE_RSV -static void _rtl_usb_cleanup_rx (struct ieee80211_hw *hw) {struct rtl_priv *rtlpriv =rtl_priv (hw);
drivers/net/wireless/realtek/rtlwifi/usb.h +1 -0
@@ -7,6 +7,7 @@#include <linux/skbuff.h> #define RTL_RX_DESC_SIZE 24 +#define RTL_RADIO_TAP_SIZE_RSV 32#define RTL_USB_DEVICE (vend, prod, cfg) \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \
Signature · 1 line
2.53.0
PATCH v3 5/5 wifi: rtlwifi: rtl8192du: enable USB RX aggregation
In reply to Ho Jie FengAllow RX aggregation of up to 48 pages of 128 bytes or 24 with two MACs.
In an aggregated transfer, rtl92du_rx_segregate_hdl() copies each frame into a new skb with room for the radiotap header like in usb.c. The last frame reuses the original skb by pulling it to the frame's start and trimmed to its length.
Test results (2.4 GHz):
before after
TX 5.2 6.4
RX 27.1 32.0
--- .../wireless/realtek/rtlwifi/rtl8192d/reg.h | 4 ++ .../wireless/realtek/rtlwifi/rtl8192du/hw.c | 18 +++++++- .../wireless/realtek/rtlwifi/rtl8192du/sw.c | 2 +- .../wireless/realtek/rtlwifi/rtl8192du/trx.c | 45 +++++++++++++++++++ .../wireless/realtek/rtlwifi/rtl8192du/trx.h | 4 ++ 5 files changed, 71 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192d/reg.h +4 -0
@@ -329,6 +329,7 @@#define REG_USB_Queue_Select_MAC0 0xFE44#define REG_USB_Queue_Select_MAC1 0xFE47 +#define REG_USB_DMA_AGG_TO 0xFE5B/* ----------------------------------------------------- */ /* Redifine 8192C register definition for compatibility */
@@ -940,6 +941,9 @@#define ENSWBCN BIT(8)#define ENSEC BIT(9) +/* REG_TRXDMA_CTRL */ +#define RXDMA_AGG_EN BIT(2) +#define HQSEL_VOQ BIT(0)#define HQSEL_VIQ BIT(1)#define HQSEL_BEQ BIT(2)
drivers/net/wireless/realtek/rtlwifi/rtl8192du/hw.c +17 -1
@@ -489,6 +489,22 @@ static void _rtl92du_init_retry_function(struct ieee80211_hw *hw)rtl_write_byte (rtlpriv,REG_ACKTO ,0x40 ); } +static void _rtl92du_init_usb_aggregation (struct ieee80211_hw *hw) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +u8 page_count =48 ; + +if (rtlpriv->rtlhal.macphymode !=SINGLEMAC_SINGLEPHY ) + page_count =24 ; + +rtl_write_byte (rtlpriv,REG_TRXDMA_CTRL , +rtl_read_byte (rtlpriv,REG_TRXDMA_CTRL ) |RXDMA_AGG_EN ); +/* unit: 128 bytes */ +rtl_write_byte (rtlpriv,REG_RXDMA_AGG_PG_TH , page_count); +/* A larger value is a shorter timeout. */ +rtl_write_byte (rtlpriv,REG_USB_DMA_AGG_TO ,6 ); +} +static void _rtl92du_init_operation_mode (struct ieee80211_hw *hw) {struct rtl_priv *rtlpriv =rtl_priv (hw);
@@ -712,7 +728,7 @@ int rtl92du_hw_init(struct ieee80211_hw *hw)rtl_write_dword (rtlpriv,REG_RARFRC +4 ,0x08070605 );_rtl92du_init_retry_function (hw); -/* _InitUsbAggregationSetting(padapter); no aggregation for now */ +_rtl92du_init_usb_aggregation (hw);_rtl92du_init_operation_mode (hw);_rtl92du_init_beacon_parameters (hw);_rtl92du_init_ampdu_aggregation (hw);
drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c +1 -1
@@ -238,7 +238,7 @@ static const struct rtl_hal_usbint_cfg rtl92du_interface_cfg = { .rx_urb_num = 8, .rx_max_size = 15360, .usb_rx_hdl = NULL, - .usb_rx_segregate_hdl = NULL, + .usb_rx_segregate_hdl = rtl92du_rx_segregate_hdl,/* tx */ .usb_tx_cleanup = rtl92du_tx_cleanup, .usb_tx_post_hdl = rtl92du_tx_post_hdl,
drivers/net/wireless/realtek/rtlwifi/rtl8192du/trx.c +45 -0
51 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/rtl8192du/trx.h +4 -0
@@ -18,6 +18,8 @@#define WMM_NORMAL_TX_TOTAL_PAGE_NUMBER 0xF5 +#define RTL92DU_RX_AGG_ALIGN 128 +#define WMM_NORMAL_PAGE_NUM_PUBQ_92D 0x65#define WMM_NORMAL_PAGE_NUM_HPQ_92D 0x30#define WMM_NORMAL_PAGE_NUM_LPQ_92D 0x30
@@ -56,5 +58,7 @@ struct sk_buff *rtl92du_tx_aggregate_hdl(struct ieee80211_hw *hw,void rtl92du_tx_cleanup (struct ieee80211_hw *hw,struct sk_buff *skb);int rtl92du_tx_post_hdl (struct ieee80211_hw *hw,struct urb *urb,struct sk_buff *skb); +void rtl92du_rx_segregate_hdl (struct ieee80211_hw *hw,struct sk_buff *skb, +struct sk_buff_head *queue);#endif
Signature · 1 line
2.53.0
Ping-Ke Shih
maintainerRE: [PATCH rtw-next v3 1/5] wifi: rtlwifi: rc: start no BA session for QoS null frames
In reply to Ho Jie FengQuoted 3 lines · Ho Jie Feng
rtl_tx_status()starts a TX BA session for any QoS null data frames, so these polls start a session even though they do not carry data. That costs an ADDBA exchange.
Will ieee80211_is_data_qos() be more suitable?
Quoted 3 lines
Check
ieee80211_is_data_present()instead, so only frames that carry data start a BA session.
Re: [PATCH rtw-next v3 1/5] wifi: rtlwifi: rc: start no BA session for QoS null frames
Quoted 8 lines · Ping-Ke Shih
Quoted 3 lines · Ho Jie Feng
rtl_tx_status()starts a TX BA session for any QoS null data frames, so these polls start a session even though they do not carry data. That costs an ADDBA exchange.Will
ieee80211_is_data_qos()be more suitable?
ieee80211_is_data_qos() only tests the QoS bit (0x80), which is also set for QoS null (0xC0), so the BA session would still be started.
Quoted 5 lines
Quoted 3 lines
Check
ieee80211_is_data_present()instead, so only frames that carry data start a BA session.
Ping-Ke Shih
maintainerRE: [PATCH rtw-next v3 1/5] wifi: rtlwifi: rc: start no BA session for QoS null frames
Quoted 4 lines · Jie Feng
Quoted 3 lines · Ping-Ke Shih
Ho Jie Feng <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
rtl_tx_status()starts a TX BA session for any QoS null data frames, so these polls start a session even though they do not carry data. That costs an ADDBA exchange.Will
ieee80211_is_data_qos()be more suitable?
ieee80211_is_data_qos()only tests the QoS bit (0x80), which is also set for QoS null (0xC0), so the BA session would still be started.
How about ieee80211_is_data_qos() && ieee80211_is_data_present() ?
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Check
ieee80211_is_data_present()instead, so only frames that carry data start a BA session.