rtlwifi: Various updates
cover rtlwifi: Various updates
Realtek has finished an extensive review and rewrite of the rtlwifi drivers. Much of that work resulted in major changes to btcoexist. Those changes are not included here, but will be submitted later.
These 14 changes fix a number of deficiencies. None of them are serious enough to be pushed to stable; however they help in the stability of the drivers, and in the robustness of authentication/ association.
This material should be sent to the 4.11 stream.
Vincent Fann (1)
rtlwifi: Correct power save capability while init mac80211
Ping-Ke Shih (13)
rtlwifi: Fix programing CAM content sequence.
rtlwifi: Set retry limit depends on vif type.
rtlwifi: extend debug_comp to u64
rtlwifi: Add TX report and disable key will wait until report acked.
rtlwifi: rtl8723be: btcoexist: Add single_ant_path
rtlwifi: move btcoex's ant_num declaration
rtlwifi: rtl8723be: btcoex: add package_type function to btcoex
rtlwifi: ibtcoex: move bt_type declaration
rtlwifi: Add BTC_TRACE_STRING to new btcoex
rtlwifi: Add a new enumeration value to btc_set_type
rtlwifi: btcoexist: Add vendor definition for new btcoexist
rtlwifi: rtl8723be: fix ant_sel code
rtlwifi: Add work queue for c2h cmd.
drivers/net/wireless/realtek/rtlwifi/base.c | 211 +++++++++++++++++++-- drivers/net/wireless/realtek/rtlwifi/base.h | 10 + .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 32 ++++ .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 31 +++ .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 16 -- .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h | 5 +- drivers/net/wireless/realtek/rtlwifi/cam.c | 6 +- drivers/net/wireless/realtek/rtlwifi/core.c | 26 ++- drivers/net/wireless/realtek/rtlwifi/debug.c | 4 +- drivers/net/wireless/realtek/rtlwifi/debug.h | 19 +- drivers/net/wireless/realtek/rtlwifi/efuse.c | 5 +- drivers/net/wireless/realtek/rtlwifi/efuse.h | 1 + drivers/net/wireless/realtek/rtlwifi/pci.c | 7 + drivers/net/wireless/realtek/rtlwifi/ps.c | 3 + .../net/wireless/realtek/rtlwifi/rtl8192ee/fw.c | 16 +- .../net/wireless/realtek/rtlwifi/rtl8192ee/fw.h | 3 +- .../net/wireless/realtek/rtlwifi/rtl8192ee/sw.c | 1 + .../net/wireless/realtek/rtlwifi/rtl8192ee/trx.c | 8 + .../net/wireless/realtek/rtlwifi/rtl8723be/fw.c | 19 +- .../net/wireless/realtek/rtlwifi/rtl8723be/fw.h | 3 +- .../net/wireless/realtek/rtlwifi/rtl8723be/hw.c | 42 +++- .../net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 1 + .../net/wireless/realtek/rtlwifi/rtl8723be/trx.c | 8 + .../net/wireless/realtek/rtlwifi/rtl8723be/trx.h | 12 ++ .../net/wireless/realtek/rtlwifi/rtl8821ae/fw.c | 21 +- .../net/wireless/realtek/rtlwifi/rtl8821ae/fw.h | 3 + .../net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 1 + .../net/wireless/realtek/rtlwifi/rtl8821ae/trx.c | 8 + .../net/wireless/realtek/rtlwifi/rtl8821ae/trx.h | 13 ++ drivers/net/wireless/realtek/rtlwifi/wifi.h | 34 ++++ 30 files changed, 512 insertions(+), 57 deletions(-)
Signature · 1 line
2.10.2
PATCH 1/14 rtlwifi: Correct power save capability while init mac80211
Set IEEE80211_HW_SUPPORTS_PS when driver is fwlps
Because mac80211 control SW-LPS only, we add constraints to avoid errors.
--- drivers/net/wireless/realtek/rtlwifi/base.c | 2 ++ drivers/net/wireless/realtek/rtlwifi/core.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/base.c +2 -0
@@ -406,6 +406,8 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)ieee80211_hw_set (hw,SUPPORTS_PS );ieee80211_hw_set (hw,PS_NULLFUNC_STACK ); } +if (rtlpriv->psc.fwctrl_lps) +ieee80211_hw_set (hw,SUPPORTS_PS ); hw->wiphy->interface_modes =BIT (NL80211_IFTYPE_AP ) | BIT(NL80211_IFTYPE_STATION) |
drivers/net/wireless/realtek/rtlwifi/core.c +2 -1
@@ -620,7 +620,8 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed) }/*For LPS */ -if (changed &IEEE80211_CONF_CHANGE_PS ) { +if ((changed &IEEE80211_CONF_CHANGE_PS ) && + rtlpriv->psc.swctrl_lps && !rtlpriv->psc.fwctrl_lps) {cancel_delayed_work (&rtlpriv->works.ps_work);cancel_delayed_work (&rtlpriv->works.ps_rfon_wq);if (conf->flags &IEEE80211_CONF_PS ) {
Signature · 1 line
2.10.2
PATCH 2/14 rtlwifi: Fix programing CAM content sequence.
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
There is a potential race condition when the control byte of a CAM entry is written first. Write in reverse order to correct the condition.
--- drivers/net/wireless/realtek/rtlwifi/cam.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtlwifi/cam.c +3 -3
@@ -45,12 +45,13 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,u32 target_command;u32 target_content =0 ; -u8 entry_i; +s8 entry_i;RT_PRINT_DATA (rtlpriv,COMP_SEC ,DBG_DMESG ,"Key content :" , key_cont_128,16 ); -for (entry_i =0 ; entry_i <CAM_CONTENT_COUNT ; entry_i++) { +/* 0-1 config + mac, 2-5 fill 128key,6-7 are reserved */ +for (entry_i =CAM_CONTENT_COUNT -1 ; entry_i >=0 ; entry_i--) { target_command = entry_i +CAM_CONTENT_COUNT * entry_no; target_command = target_command |BIT (31 ) |BIT (16 );
@@ -102,7 +103,6 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no, target_content);rtl_write_dword (rtlpriv, rtlpriv->cfg->maps[RWCAM ], target_command); -udelay (100 );RT_TRACE (rtlpriv,COMP_SEC ,DBG_LOUD ,"WRITE A4: %x\n" , target_content);
Signature · 1 line
2.10.2
PATCH 3/14 rtlwifi: Set retry limit depends on vif type.
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
We assign different retry limit according to vif type, because it can boost performance in field.
--- drivers/net/wireless/realtek/rtlwifi/core.c | 21 ++++++++++++++++++--- drivers/net/wireless/realtek/rtlwifi/pci.c | 7 +++++++ drivers/net/wireless/realtek/rtlwifi/ps.c | 3 +++ 3 files changed, 28 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtlwifi/core.c +18 -3
@@ -234,6 +234,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_mac *mac =rtl_mac (rtl_priv (hw));int err =0 ; +u8 retry_limit =0x30 ;if (mac->vif) { RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
@@ -272,6 +273,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw, rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_BASIC_RATE , (u8 *)(&mac->basic_rates)); + retry_limit =0x07 ;break ;case NL80211_IFTYPE_P2P_GO : mac->p2p =P2P_ROLE_GO ;
@@ -288,6 +290,8 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw, mac->basic_rates =0xff0 ; rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_BASIC_RATE , (u8 *)(&mac->basic_rates)); + + retry_limit =0x07 ;break ;case NL80211_IFTYPE_MESH_POINT : RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
@@ -301,6 +305,8 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw, mac->basic_rates =0xff0 ; rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_BASIC_RATE , (u8 *)(&mac->basic_rates)); + + retry_limit =0x07 ;break ;default : RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
@@ -322,6 +328,10 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,memcpy (mac->mac_addr, vif->addr,ETH_ALEN ); rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_ETHER_ADDR , mac->mac_addr); + mac->retry_long = retry_limit; + mac->retry_short = retry_limit; + rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_RETRY_LIMIT , + (u8 *)(&retry_limit)); out:mutex_unlock (&rtlpriv->locks.conf_mutex);return err;
@@ -647,10 +657,15 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)RT_TRACE (rtlpriv,COMP_MAC80211 ,DBG_LOUD ,"IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n" , hw->conf.long_frame_max_tx_count); - mac->retry_long = hw->conf.long_frame_max_tx_count; - mac->retry_short = hw->conf.long_frame_max_tx_count; - rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_RETRY_LIMIT , +/* brought up everything changes (changed == ~0) indicates first +* open, so use our default value instead of that of wiphy. +*/ +if (changed != ~0 ) { + mac->retry_long = hw->conf.long_frame_max_tx_count; + mac->retry_short = hw->conf.long_frame_max_tx_count; + rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_RETRY_LIMIT , (u8 *)(&hw->conf.long_frame_max_tx_count)); + } } if (changed & IEEE80211_CONF_CHANGE_CHANNEL &&
drivers/net/wireless/realtek/rtlwifi/pci.c +7 -0
@@ -1214,6 +1214,10 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw, mac->current_ampdu_density =7 ; mac->current_ampdu_factor =3 ; +/*Retry Limit*/ + mac->retry_short =7 ; + mac->retry_long =7 ; +/*QOS*/ rtlpci->acm_method =EACMWAY2_SW ;
@@ -1820,6 +1824,7 @@ static int rtl_pci_start(struct ieee80211_hw *hw)struct rtl_hal *rtlhal =rtl_hal (rtl_priv (hw));struct rtl_pci *rtlpci =rtl_pcidev (rtl_pcipriv (hw));struct rtl_ps_ctl *ppsc =rtl_psc (rtl_priv (hw)); +struct rtl_mac *rtlmac =rtl_mac (rtl_priv (hw));int err;
@@ -1837,6 +1842,8 @@ static int rtl_pci_start(struct ieee80211_hw *hw) "Failed to config hardware!\n");return err; } + rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_RETRY_LIMIT , + &rtlmac->retry_long); rtlpriv->cfg->ops->enable_interrupt (hw);RT_TRACE (rtlpriv,COMP_INIT ,DBG_LOUD ,"enable_interrupt OK\n" );
drivers/net/wireless/realtek/rtlwifi/ps.c +3 -0
@@ -34,6 +34,7 @@ bool rtl_ps_enable_nic(struct ieee80211_hw *hw)struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_ps_ctl *ppsc =rtl_psc (rtl_priv (hw));struct rtl_hal *rtlhal =rtl_hal (rtl_priv (hw)); +struct rtl_mac *rtlmac =rtl_mac (rtl_priv (hw));/*<1> reset trx ring */ if (rtlhal->interface ==INTF_PCI )
@@ -46,6 +47,8 @@ bool rtl_ps_enable_nic(struct ieee80211_hw *hw)/*<2> Enable Adapter */ if (rtlpriv->cfg->ops->hw_init (hw))return false; + rtlpriv->cfg->ops->set_hw_reg (hw,HW_VAR_RETRY_LIMIT , + &rtlmac->retry_long);RT_CLEAR_PS_LEVEL (ppsc,RT_RF_OFF_LEVL_HALT_NIC );/*<3> Enable Interrupt */
Signature · 1 line
2.10.2
PATCH 3/14 rtlwifi: extend debug_comp to u64
In reply to Larry FingerThe number of debugging conditions will exceed the capabilities of a 32-bit word.
--- drivers/net/wireless/realtek/rtlwifi/debug.c | 2 +- drivers/net/wireless/realtek/rtlwifi/debug.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtlwifi/debug.c +1 -1
@@ -50,7 +50,7 @@ void rtl_dbgp_flag_init(struct ieee80211_hw *hw)EXPORT_SYMBOL_GPL (rtl_dbgp_flag_init);#ifdef CONFIG_RTLWIFI_DEBUG -void _rtl_dbg_trace (struct rtl_priv *rtlpriv,int comp,int level, +void _rtl_dbg_trace (struct rtl_priv *rtlpriv,u64 comp,int level,const char *modname,const char *fmt, ...) { if (unlikely((comp & rtlpriv->dbg.global_debugcomponents) &&
drivers/net/wireless/realtek/rtlwifi/debug.h +3 -3
@@ -178,7 +178,7 @@ do { \struct rtl_priv ; __printf(5, 6) -void _rtl_dbg_trace (struct rtl_priv *rtlpriv,int comp,int level, +void _rtl_dbg_trace (struct rtl_priv *rtlpriv,u64 comp,int level,const char *modname,const char *fmt, ...);#define RT_TRACE (rtlpriv, comp, level, fmt, ...) \
@@ -217,7 +217,7 @@ static inline void RT_ASSERT(int exp, const char *fmt, ...) __printf(4, 5)static inline void RT_TRACE (struct rtl_priv *rtlpriv, -int comp,int level, +u64 comp,int level,const char *fmt, ...) { }
@@ -230,7 +230,7 @@ static inline void RTPRINT(struct rtl_priv *rtlpriv, }static inline void RT_PRINT_DATA (struct rtl_priv *rtlpriv, -int comp,int level, +u64 comp,int level,const char *titlestring,const void *hexdata,size_t hexdatalen) {
Signature · 1 line
2.10.2
PATCH 5/14 rtlwifi: Add TX report and disable key will wait until report acked.
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
When using EAPOL to do a PTK rekey, there is a possible race condition. When msg 3/4 is received, the supplicant will send msg 4/4 and install the new key immediately; however, the driver must make sure that msg 4/4 is sent before installing the new key. We use TX report to ensure it is sent.
--- drivers/net/wireless/realtek/rtlwifi/base.c | 117 ++++++++++++++++++--- drivers/net/wireless/realtek/rtlwifi/base.h | 7 ++ drivers/net/wireless/realtek/rtlwifi/core.c | 2 + drivers/net/wireless/realtek/rtlwifi/debug.c | 2 +- drivers/net/wireless/realtek/rtlwifi/debug.h | 1 + .../net/wireless/realtek/rtlwifi/rtl8192ee/fw.c | 1 + .../net/wireless/realtek/rtlwifi/rtl8192ee/trx.c | 8 ++ .../net/wireless/realtek/rtlwifi/rtl8723be/fw.c | 1 + .../net/wireless/realtek/rtlwifi/rtl8723be/trx.c | 8 ++ .../net/wireless/realtek/rtlwifi/rtl8723be/trx.h | 12 +++ .../net/wireless/realtek/rtlwifi/rtl8821ae/fw.c | 3 + .../net/wireless/realtek/rtlwifi/rtl8821ae/trx.c | 8 ++ .../net/wireless/realtek/rtlwifi/rtl8821ae/trx.h | 13 +++ drivers/net/wireless/realtek/rtlwifi/wifi.h | 10 ++ 14 files changed, 180 insertions(+), 13 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.c +105 -12
@@ -1107,6 +1107,9 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,if (txrate) tcb_desc->hw_rate = txrate->hw_value; +if (rtl_is_tx_report_skb (hw, skb)) + tcb_desc->use_spe_rpt =1 ; +if (ieee80211_is_data (fc)) {/* *we set data rate INX 0
@@ -1315,21 +1318,13 @@ static void setup_arp_tx(struct rtl_priv *rtlpriv, struct rtl_ps_ctl *ppsc) ppsc->last_delaylps_stamp_jiffies = jiffies; } -/*should call before software enc*/ -u8 rtl_is_special_data (struct ieee80211_hw *hw,struct sk_buff *skb,u8 is_tx, -bool is_enc) +static const u8 *rtl_skb_ether_type_ptr (struct ieee80211_hw *hw, +struct sk_buff *skb,bool is_enc) {struct rtl_priv *rtlpriv =rtl_priv (hw); -struct rtl_ps_ctl *ppsc =rtl_psc (rtl_priv (hw)); -__le16 fc =rtl_get_fc (skb); -u16 ether_type;u8 mac_hdr_len =ieee80211_get_hdrlen_from_skb (skb);u8 encrypt_header_len =0 ;u8 offset; -const struct iphdr *ip; - -if (!ieee80211_is_data (fc)) - goto end;switch (rtlpriv->sec.pairwise_enc_algorithm) {case WEP40_ENCRYPTION :
@@ -1349,10 +1344,29 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx, offset = mac_hdr_len +SNAP_SIZE ;if (is_enc) offset += encrypt_header_len; - ether_type =be16_to_cpup ((__be16 *)(skb->data + offset)); + +return skb->data + offset; +} + +/*should call before software enc*/ +u8 rtl_is_special_data (struct ieee80211_hw *hw,struct sk_buff *skb,u8 is_tx, +bool is_enc) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +struct rtl_ps_ctl *ppsc =rtl_psc (rtl_priv (hw)); +__le16 fc =rtl_get_fc (skb); +u16 ether_type; +const u8 *ether_type_ptr; +const struct iphdr *ip; + +if (!ieee80211_is_data (fc)) + goto end; + + ether_type_ptr =rtl_skb_ether_type_ptr (hw, skb, is_enc); + ether_type =be16_to_cpup ((__be16 *)ether_type_ptr);if (ETH_P_IP == ether_type) { - ip = (struct iphdr *)((u8 *)skb->data + offset + + ip = (struct iphdr *)((u8 *)ether_type_ptr +PROTOC_TYPE_SIZE );if (IPPROTO_UDP == ip->protocol) { struct udphdr *udp = (struct udphdr *)((u8 *)ip +
@@ -1402,6 +1416,85 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx, }EXPORT_SYMBOL_GPL (rtl_is_special_data); +bool rtl_is_tx_report_skb (struct ieee80211_hw *hw,struct sk_buff *skb) +{ +u16 ether_type; +const u8 *ether_type_ptr; + + ether_type_ptr =rtl_skb_ether_type_ptr (hw, skb, true); + ether_type =be16_to_cpup ((__be16 *)ether_type_ptr); + +/* EAPOL */ +if (ether_type ==ETH_P_PAE ) +return true; + +return false; +} + +u16 rtl_get_tx_report_sn (struct ieee80211_hw *hw) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +struct rtl_tx_report *tx_report = &rtlpriv->tx_report; +u16 sn; + + sn =atomic_inc_return (&tx_report->sn) &0x0FFF ; + + tx_report->last_sent_sn = sn; + tx_report->last_sent_time = jiffies; + +RT_TRACE (rtlpriv,COMP_TX_REPORT ,DBG_DMESG , +"Send TX-Report sn=0x%X\n" , sn); + +return sn; +} +EXPORT_SYMBOL_GPL (rtl_get_tx_report_sn); + +void rtl_tx_report_handler (struct ieee80211_hw *hw,u8 *tmp_buf,u8 c2h_cmd_len) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +struct rtl_tx_report *tx_report = &rtlpriv->tx_report; +u16 sn; + + sn = ((tmp_buf[7 ] &0x0F ) <<8 ) | tmp_buf[6 ]; + + tx_report->last_recv_sn = sn; + +RT_TRACE (rtlpriv,COMP_TX_REPORT ,DBG_DMESG , +"Recv TX-Report st=0x%02X sn=0x%X retry=0x%X\n" , + tmp_buf[0 ], sn, tmp_buf[2 ]); +} +EXPORT_SYMBOL_GPL (rtl_tx_report_handler); + +bool rtl_check_tx_report_acked (struct ieee80211_hw *hw) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +struct rtl_tx_report *tx_report = &rtlpriv->tx_report; + +if (tx_report->last_sent_sn == tx_report->last_recv_sn) +return true; + +if (time_before (tx_report->last_sent_time +3 *HZ , jiffies)) { +RT_TRACE (rtlpriv,COMP_TX_REPORT ,DBG_WARNING , +"Check TX-Report timeout!!\n" ); +return true;/* 3 sec. (timeout) seen as acked */ + } + +return false; +} + +void rtl_wait_tx_report_acked (struct ieee80211_hw *hw,u32 wait_ms) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +int i; + +for (i =0 ; i < wait_ms; i++) { +if (rtl_check_tx_report_acked (hw)) +break ; +usleep_range (1000 ,2000 ); +RT_TRACE (rtlpriv,COMP_SEC ,DBG_DMESG , +"Wait 1ms (%d/%d) to disable key.\n" , i, wait_ms); + } +}/********************************************************* * * functions called by core.c
drivers/net/wireless/realtek/rtlwifi/base.h +7 -0
@@ -123,6 +123,13 @@ bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);u8 rtl_is_special_data (struct ieee80211_hw *hw,struct sk_buff *skb,u8 is_tx,bool is_enc); +bool rtl_is_tx_report_skb (struct ieee80211_hw *hw,struct sk_buff *skb); +u16 rtl_get_tx_report_sn (struct ieee80211_hw *hw); +void rtl_tx_report_handler (struct ieee80211_hw *hw,u8 *tmp_buf, +u8 c2h_cmd_len); +bool rtl_check_tx_report_acked (struct ieee80211_hw *hw); +void rtl_wait_tx_report_acked (struct ieee80211_hw *hw,u32 wait_ms); +void rtl_beacon_statistic (struct ieee80211_hw *hw,struct sk_buff *skb);int rtl_tx_agg_start (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta,u16 tid,u16 *ssn);
drivers/net/wireless/realtek/rtlwifi/core.c +2 -0
@@ -1675,6 +1675,8 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,*so don't use rtl_cam_reset_all_entry *or clear all entry here. */ +rtl_wait_tx_report_acked (hw,500 );/* wait 500ms for TX ack */ +rtl_cam_delete_one_entry (hw, mac_addr, key_idx);break ;default :
drivers/net/wireless/realtek/rtlwifi/debug.c +1 -1
@@ -39,7 +39,7 @@ void rtl_dbgp_flag_init(struct ieee80211_hw *hw)COMP_RF |COMP_TURBO |COMP_RATR |COMP_CMD |COMP_EFUSE |COMP_QOS |COMP_MAC80211 |COMP_REGD |COMP_CHAN |COMP_EASY_CONCURRENT |COMP_EFUSE |COMP_QOS |COMP_MAC80211 | -COMP_REGD |COMP_CHAN |COMP_BT_COEXIST ; +COMP_REGD |COMP_CHAN |COMP_BT_COEXIST |COMP_TX_REPORT ;for (i =0 ; i <DBGP_TYPE_MAX ; i++)
drivers/net/wireless/realtek/rtlwifi/debug.h +1 -0
@@ -105,6 +105,7 @@#define COMP_EASY_CONCURRENT COMP_USB/* reuse of this bit is OK */ #define COMP_BT_COEXIST BIT(30)#define COMP_IQK BIT(31) +#define COMP_TX_REPORT BIT_ULL(32)/*-------------------------------------------------------------- Define the rt_print components
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c +1 -0
@@ -859,6 +859,7 @@ static void _rtl92ee_c2h_content_parsing(struct ieee80211_hw *hw, u8 c2h_cmd_id,case C2H_8192E_TX_REPORT :RT_TRACE (rtlpriv,COMP_FW ,DBG_TRACE ,"[C2H], C2H_8723BE_TX_REPORT!\n" ); +rtl_tx_report_handler (hw, tmp_buf, c2h_cmd_len);break ;case C2H_8192E_BT_INFO : RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c +8 -0
@@ -731,6 +731,14 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw,SET_TX_DESC_OFFSET (pdesc,USB_HWDESC_HEADER_LEN ); } +/* tx report */ +if (ptcb_desc->use_spe_rpt) { +u16 sn =rtl_get_tx_report_sn (hw); + +SET_TX_DESC_SPE_RPT (pdesc,1 ); +SET_TX_DESC_SW_DEFINE (pdesc, sn); + } +SET_TX_DESC_TX_RATE (pdesc, ptcb_desc->hw_rate);if (ieee80211_is_mgmt (fc)) {
drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c +1 -0
@@ -600,6 +600,7 @@ static void _rtl8723be_c2h_content_parsing(struct ieee80211_hw *hw,case C2H_8723B_TX_REPORT :RT_TRACE (rtlpriv,COMP_FW ,DBG_TRACE ,"[C2H], C2H_8723BE_TX_REPORT!\n" ); +rtl_tx_report_handler (hw, tmp_buf, c2h_cmd_len);break ;case C2H_8723B_BT_INFO : RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c +8 -0
@@ -488,6 +488,14 @@ void rtl8723be_tx_fill_desc(struct ieee80211_hw *hw,SET_TX_DESC_OFFSET (pdesc,USB_HWDESC_HEADER_LEN ); } +/* tx report */ +if (ptcb_desc->use_spe_rpt) { +u16 sn =rtl_get_tx_report_sn (hw); + +SET_TX_DESC_SPE_RPT (pdesc,1 ); +SET_TX_DESC_SW_DEFINE (pdesc, sn); + } +/* ptcb_desc->use_driver_rate = true; */ SET_TX_DESC_TX_RATE (pdesc, ptcb_desc->hw_rate);if (ptcb_desc->hw_rate >DESC92C_RATEMCS0 )
drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h +12 -0
@@ -187,6 +187,18 @@#define SET_TX_DESC_RTS_SC (__pdesc, __val) \ SET_BITS_TO_LE_4BYTE(__pdesc+20, 13, 4, __val) +#define SET_TX_DESC_SW_DEFINE (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 0, 12, __val) +#define SET_TX_DESC_MBSSID (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 12, 4, __val) +#define SET_TX_DESC_ANTSEL_A (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 16, 3, __val) +#define SET_TX_DESC_ANTSEL_B (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 19, 3, __val) +#define SET_TX_DESC_ANTSEL_C (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 22, 3, __val) +#define SET_TX_DESC_ANTSEL_D (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 25, 3, __val)#define SET_TX_DESC_TX_BUFFER_SIZE (__pdesc, __val) \ SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 16, __val)
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c +3 -0
@@ -1819,6 +1819,9 @@ static void _rtl8821ae_c2h_content_parsing(struct ieee80211_hw *hw,case C2H_8812_DBG :RT_TRACE (rtlpriv,COMP_FW ,DBG_LOUD ,"[C2H], C2H_8812_DBG!!\n" );break ; +case C2H_8812_TX_REPORT : +rtl_tx_report_handler (hw, tmp_buf, c2h_cmd_len); +break ;case C2H_8812_RA_RPT :rtl8821ae_c2h_ra_report_handler (hw, tmp_buf, c2h_cmd_len);break ;
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c +8 -0
@@ -740,6 +740,14 @@ void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw,SET_TX_DESC_OFFSET (pdesc,USB_HWDESC_HEADER_LEN ); } +/* tx report */ +if (ptcb_desc->use_spe_rpt) { +u16 sn =rtl_get_tx_report_sn (hw); + +SET_TX_DESC_SPE_RPT (pdesc,1 ); +SET_TX_DESC_SW_DEFINE (pdesc, sn); + } +/* ptcb_desc->use_driver_rate = true; */ SET_TX_DESC_TX_RATE (pdesc, ptcb_desc->hw_rate);if (ptcb_desc->hw_rate >DESC_RATEMCS0 )
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h +13 -0
@@ -185,6 +185,19 @@#define SET_TX_DESC_RTS_SC (__pdesc, __val) \ SET_BITS_TO_LE_4BYTE(__pdesc+20, 13, 4, __val) +#define SET_TX_DESC_SW_DEFINE (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 0, 12, __val) +#define SET_TX_DESC_ANTSEL_A (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 16, 3, __val) +#define SET_TX_DESC_ANTSEL_B (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 19, 3, __val) +#define SET_TX_DESC_ANTSEL_C (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 22, 3, __val) +#define SET_TX_DESC_ANTSEL_D (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 25, 3, __val) +#define SET_TX_DESC_MBSSID (__pdesc, __val) \ + SET_BITS_TO_LE_4BYTE(__pdesc + 24, 12, 4, __val) +#define SET_TX_DESC_TX_BUFFER_SIZE (__pdesc, __val) \ SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 16, __val)
drivers/net/wireless/realtek/rtlwifi/wifi.h +10 -0
@@ -1873,6 +1873,13 @@ struct rtl_efuse {u8 channel_plan; }; +struct rtl_tx_report { +atomic_t sn; +u16 last_sent_sn; +unsigned long last_sent_time; +u16 last_recv_sn; +}; +struct rtl_ps_ctl {bool pwrdomain_protect;bool in_powersavemode;
@@ -2062,6 +2069,8 @@ struct rtl_tcb_desc { u8 use_driver_rate:1; u8 disable_ratefallback:1; + u8 use_spe_rpt:1; +u8 ratr_index;u8 mac_id;u8 hw_rate;
@@ -2570,6 +2579,7 @@ struct rtl_priv {struct rtl_dm dm;struct rtl_security sec;struct rtl_efuse efuse; +struct rtl_tx_report tx_report;struct rtl_ps_ctl psc;struct rate_adaptive ra;
Signature · 1 line
2.10.2
PATCH 6/14 rtlwifi: rtl8723be: btcoexist: Add single_ant_path
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
Some devices with RTL8732BE wifi/Bluetooth adapters are shipped with only a single antenna. On a subset of these, the EEPROM is incorectly coded to indicate the wrong connection. The resulting problems have been fixed for wifi. This change handles them for BT.
--- drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 5 +++++ drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h | 1 + drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c | 1 + drivers/net/wireless/realtek/rtlwifi/wifi.h | 1 + 4 files changed, 8 insertions(+)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +5 -0
@@ -146,6 +146,11 @@ static u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist)return chnl; } +u8 rtl_get_hwpg_single_ant_path (struct rtl_priv *rtlpriv) +{ +return rtlpriv->btcoexist.btc_info.single_ant_path; +} +static void halbtc_leave_lps (struct btc_coexist *btcoexist) {struct rtl_priv *rtlpriv;
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h +1 -0
@@ -49,6 +49,7 @@ struct rtl_btc_ops *rtl_btc_get_ops_pointer(void);u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv);u8 rtl_get_hwpg_bt_exist (struct rtl_priv *rtlpriv);u8 rtl_get_hwpg_bt_type (struct rtl_priv *rtlpriv); +u8 rtl_get_hwpg_single_ant_path (struct rtl_priv *rtlpriv);enum rt_media_status mgnt_link_status_query (struct ieee80211_hw *hw);#endif
drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +1 -0
@@ -2661,6 +2661,7 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, rtlpriv->btcoexist.btc_info.btcoexist =0 ; rtlpriv->btcoexist.btc_info.bt_type =BT_RTL8723B ; rtlpriv->btcoexist.btc_info.ant_num =ANT_X2 ; + rtlpriv->btcoexist.btc_info.single_ant_path =0 ; }/* override ant_num / ant_path */
drivers/net/wireless/realtek/rtlwifi/wifi.h +1 -0
@@ -2471,6 +2471,7 @@ struct rtl_btc_info {u8 bt_type;u8 btcoexist;u8 ant_num; +u8 single_ant_path; };struct bt_coexist_info {
Signature · 1 line
2.10.2
PATCH 7/14 rtlwifi: move btcoex's ant_num declaration
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
File halbtcoutsrc.c is a better place for routine rtl_get_hwpg_ant_num() than file rtl_btc.c.
--- .../net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 12 ++++++++++++ drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 11 ----------- drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h | 2 +- drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c | 2 ++ 4 files changed, 15 insertions(+), 12 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +12 -0
@@ -151,6 +151,18 @@ u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv)return rtlpriv->btcoexist.btc_info.single_ant_path; } +u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv) +{ +u8 num; + +if (rtlpriv->btcoexist.btc_info.ant_num ==ANT_X2 ) + num =2 ; +else + num =1 ; + +return num; +} +static void halbtc_leave_lps (struct btc_coexist *btcoexist) {struct rtl_priv *rtlpriv;
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c +0 -11
@@ -178,17 +178,6 @@ struct rtl_btc_ops *rtl_btc_get_ops_pointer(void) }EXPORT_SYMBOL (rtl_btc_get_ops_pointer); -u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv) -{ -u8 num; - -if (rtlpriv->btcoexist.btc_info.ant_num ==ANT_X2 ) - num =2 ; -else - num =1 ; - -return num; -}enum rt_media_status mgnt_link_status_query (struct ieee80211_hw *hw) {
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h +1 -1
@@ -46,9 +46,9 @@ void rtl_btc_special_packet_notify(struct rtl_priv *rtlpriv, u8 pkt_type);struct rtl_btc_ops *rtl_btc_get_ops_pointer (void ); -u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv);u8 rtl_get_hwpg_bt_exist (struct rtl_priv *rtlpriv);u8 rtl_get_hwpg_bt_type (struct rtl_priv *rtlpriv); +u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv);u8 rtl_get_hwpg_single_ant_path (struct rtl_priv *rtlpriv);enum rt_media_status mgnt_link_status_query (struct ieee80211_hw *hw);
drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +2 -0
@@ -2657,6 +2657,8 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, value = hwinfo[EEPROM_RF_BT_SETTING_8723B ]; rtlpriv->btcoexist.btc_info.bt_type =BT_RTL8723B ; rtlpriv->btcoexist.btc_info.ant_num = (value &0x1 ); + rtlpriv->btcoexist.btc_info.single_ant_path = + (value &0x40 );/*0xc3[6]*/ }else { rtlpriv->btcoexist.btc_info.btcoexist =0 ; rtlpriv->btcoexist.btc_info.bt_type =BT_RTL8723B ;
Signature · 1 line
2.10.2
PATCH 8/14 rtlwifi: rtl8723be: btcoex: add package_type function to btcoex
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
The new code handles the package-type of the chip.
--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 7 +++++ .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h | 2 ++ drivers/net/wireless/realtek/rtlwifi/efuse.c | 5 ++-- drivers/net/wireless/realtek/rtlwifi/efuse.h | 1 + .../net/wireless/realtek/rtlwifi/rtl8723be/hw.c | 33 ++++++++++++++++++++++ drivers/net/wireless/realtek/rtlwifi/wifi.h | 9 ++++++ 6 files changed, 54 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +7 -0
@@ -163,6 +163,13 @@ u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)return num; } +u8 rtl_get_hwpg_package_type (struct rtl_priv *rtlpriv) +{ +struct rtl_hal *rtlhal =rtl_hal (rtlpriv); + +return rtlhal->package_type; +} +static void halbtc_leave_lps (struct btc_coexist *btcoexist) {struct rtl_priv *rtlpriv;
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h +2 -0
@@ -50,6 +50,8 @@ u8 rtl_get_hwpg_bt_exist(struct rtl_priv *rtlpriv);u8 rtl_get_hwpg_bt_type (struct rtl_priv *rtlpriv);u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv);u8 rtl_get_hwpg_single_ant_path (struct rtl_priv *rtlpriv); +u8 rtl_get_hwpg_package_type (struct rtl_priv *rtlpriv); +enum rt_media_status mgnt_link_status_query (struct ieee80211_hw *hw);#endif
drivers/net/wireless/realtek/rtlwifi/efuse.c +2 -3
@@ -70,8 +70,6 @@ static void efuse_word_enable_data_read(u8 word_en, u8 *sourdata, u8 *targetdata);static u8 enable_efuse_data_write (struct ieee80211_hw *hw,u16 efuse_addr,u8 word_en,u8 *data); -static void efuse_power_switch (struct ieee80211_hw *hw,u8 write, -u8 pwrstate);static u16 efuse_get_current_size (struct ieee80211_hw *hw);static u8 efuse_calculate_word_cnts (u8 word_en);
@@ -1121,7 +1119,7 @@ static u8 enable_efuse_data_write(struct ieee80211_hw *hw,return badworden; } -static void efuse_power_switch (struct ieee80211_hw *hw,u8 write,u8 pwrstate) +void efuse_power_switch (struct ieee80211_hw *hw,u8 write,u8 pwrstate) {struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_hal *rtlhal =rtl_hal (rtl_priv (hw));
@@ -1207,6 +1205,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate) } } } +EXPORT_SYMBOL (efuse_power_switch);static u16 efuse_get_current_size (struct ieee80211_hw *hw) {
drivers/net/wireless/realtek/rtlwifi/efuse.h +1 -0
@@ -109,6 +109,7 @@ bool efuse_shadow_update_chk(struct ieee80211_hw *hw);void rtl_efuse_shadow_map_update (struct ieee80211_hw *hw);void efuse_force_write_vendor_Id (struct ieee80211_hw *hw);void efuse_re_pg_section (struct ieee80211_hw *hw,u8 section_idx); +void efuse_power_switch (struct ieee80211_hw *hw,u8 write,u8 pwrstate);int rtl_get_hwinfo (struct ieee80211_hw *hw,struct rtl_priv *rtlpriv,int max_size,u8 *hwinfo,int *params);
drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +33 -0
@@ -2022,6 +2022,37 @@ static void _rtl8723be_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, "eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory); } +static u8 _rtl8723be_read_package_type (struct ieee80211_hw *hw) +{ +u8 package_type; +u8 value; + +efuse_power_switch (hw, false, true); +if (!efuse_one_byte_read (hw,0x1FB , &value)) + value =0 ; +efuse_power_switch (hw, false, false); + +switch (value &0x7 ) { +case 0x4 : + package_type =PACKAGE_TFBGA79 ; +break ; +case 0x5 : + package_type =PACKAGE_TFBGA90 ; +break ; +case 0x6 : + package_type =PACKAGE_QFN68 ; +break ; +case 0x7 : + package_type =PACKAGE_TFBGA80 ; +break ; +default : + package_type =PACKAGE_DEFAULT ; +break ; + } + +return package_type; +} +static void _rtl8723be_read_adapter_info (struct ieee80211_hw *hw,bool pseudo_test) {
@@ -2080,6 +2111,8 @@ static void _rtl8723be_read_adapter_info(struct ieee80211_hw *hw, rtlefuse->autoload_failflag, hwinfo); + rtlhal->package_type =_rtl8723be_read_package_type (hw); +/* set channel plan from efuse */ rtlefuse->channel_plan = rtlefuse->eeprom_channelplan;
drivers/net/wireless/realtek/rtlwifi/wifi.h +9 -0
@@ -925,6 +925,14 @@ enum wolpattern_type { UNKNOWN_TYPE = 4, }; +enum package_type { +PACKAGE_DEFAULT , +PACKAGE_QFN68 , +PACKAGE_TFBGA90 , +PACKAGE_TFBGA80 , +PACKAGE_TFBGA79 +}; +struct octet_string {u8 *octet;u16 length;
@@ -1509,6 +1517,7 @@ struct rtl_hal {u32 version;/*version of chip */ u8 state;/*stop 0, start 1 */ u8 board_type; +u8 package_type;u8 external_pa;u8 pa_mode;
Signature · 1 line
2.10.2
PATCH 9/14 rtlwifi: ibtcoex: move bt_type declaration
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
Routine rtl_get_hwpg_bt_type() is better in halbtcoutsrc.c than in rtl_btc.c.
--- drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 5 +++++ drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +5 -0
@@ -151,6 +151,11 @@ u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv)return rtlpriv->btcoexist.btc_info.single_ant_path; } +u8 rtl_get_hwpg_bt_type (struct rtl_priv *rtlpriv) +{ +return rtlpriv->btcoexist.btc_info.bt_type; +} +u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv) {u8 num;
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c +0 -5
@@ -198,11 +198,6 @@ u8 rtl_get_hwpg_bt_exist(struct rtl_priv *rtlpriv)return rtlpriv->btcoexist.btc_info.btcoexist; } -u8 rtl_get_hwpg_bt_type (struct rtl_priv *rtlpriv) -{ -return rtlpriv->btcoexist.btc_info.bt_type; -} -MODULE_AUTHOR ("Page He <[email protected]>" );MODULE_AUTHOR ("Realtek WlanFAE <[email protected]>" );MODULE_AUTHOR ("Larry Finger <[email protected]>" );
Signature · 1 line
2.10.2
PATCH 10/14 rtlwifi: Add BTC_TRACE_STRING to new btcoex
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
Add a new debugging function.
--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 23 ++++++++++++++++++++++ drivers/net/wireless/realtek/rtlwifi/debug.h | 14 +++++++++++++ 2 files changed, 37 insertions(+)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +23 -0
@@ -27,6 +27,29 @@#include "../wifi.h" +#ifdef CONFIG_RTLWIFI_DEBUG + +#define BTC_SPRINTF (ptr, ...) snprintf(ptr, ##__VA_ARGS__) +#define BTC_TRACE (fmt) \ +do { \ + struct rtl_priv *rtlpriv = gl_bt_coexist.adapter; \ + if (!rtlpriv) \ + break; \ + RT_TRACE_STRING(rtlpriv, COMP_COEX, DBG_LOUD, fmt); \ +} while (0) + +#else + +static inline void BTC_SPRINTF (char *ptr, ...) +{ +} + +static inline void BTC_TRACE (const char *ptr) +{ +} + +#endif +#define NORMAL_EXEC false#define FORCE_EXEC true
drivers/net/wireless/realtek/rtlwifi/debug.h +14 -0
@@ -194,6 +194,15 @@ do { \ } \ } while (0) +#define RT_TRACE_STRING (__priv, comp, level, string) \ +do { \ + if (unlikely(((comp) & __priv->dbg.global_debugcomponents) && \ + ((level) <= __priv->dbg.global_debuglevel))) { \ + printk(KBUILD_MODNAME ":%s():<%lx> %s", \ + __func__, in_interrupt(), string); \ + } \ +} while (0) +#define RT_PRINT_DATA (rtlpriv, _comp, _level, _titlestring, _hexdata, \ _hexdatalen) \ do { \
@@ -230,6 +239,11 @@ static inline void RTPRINT(struct rtl_pr { } +static inline void RT_TRACE_STRING (struct rtl_priv *rtlpriv, +u64 comp,int level,const char *string) +{ +} + static inline void RT_PRINT_DATA(struct rtl_priv *rtlpriv, u64 comp, int level, const char *titlestring,
PATCH 11/14 rtlwifi: Add a new enumeration value to btc_set_type
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
The new value is needed for future capability.
--- drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +1 -0
@@ -286,6 +286,7 @@ enum btc_set_type {/* type trigger some action */ BTC_SET_ACT_GET_BT_RSSI ,BTC_SET_ACT_AGGREGATE_CTRL , + BTC_SET_ACT_ANTPOSREGRISTRY_CTRL,/********* for 1Ant **********/ /* type bool */
Signature · 1 line
2.10.2
PATCH 12/14 rtlwifi: btcoexist: Add vendor definition for new btcoexist
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
Routine halbtc_get() will need to be able to get the vendor ID.
--- drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 3 +++ drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 7 +++++++ 2 files changed, 10 insertions(+)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +3 -0
@@ -364,6 +364,9 @@ static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf)case BTC_GET_U4_BT_PATCH_VER : *u32_tmp =halbtc_get_bt_patch_version (btcoexist);break ; +case BTC_GET_U4_VENDOR : + *u32_tmp =BTC_VENDOR_OTHER ; +break ;case BTC_GET_U1_WIFI_DOT11_CHNL : *u8_tmp = rtlphy->current_channel;break ;
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +7 -0
@@ -251,6 +251,7 @@ enum btc_get_type {BTC_GET_U4_WIFI_FW_VER ,BTC_GET_U4_WIFI_LINK_STATUS ,BTC_GET_U4_BT_PATCH_VER , +BTC_GET_U4_VENDOR ,/* type u1Byte */ BTC_GET_U1_WIFI_DOT11_CHNL,
@@ -268,6 +269,12 @@ enum btc_get_type {BTC_GET_MAX }; +enum btc_vendor { +BTC_VENDOR_LENOVO , +BTC_VENDOR_ASUS , +BTC_VENDOR_OTHER +}; +enum btc_set_type {/* type bool */ BTC_SET_BL_BT_DISABLE ,
Signature · 1 line
2.10.2
PATCH 13/14 rtlwifi: rtl8723be: fix ant_sel code
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
When ant_sel is set, we need to fill single_ant_path to select correct antenna path.
--- drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +5 -1
@@ -2700,9 +2700,13 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, }/* override ant_num / ant_path */ -if (mod_params->ant_sel) +if (mod_params->ant_sel) { rtlpriv->btcoexist.btc_info.ant_num = (mod_params->ant_sel ==1 ?ANT_X2 :ANT_X1 ); + + rtlpriv->btcoexist.btc_info.single_ant_path = + (mod_params->ant_sel ==1 ?0 :1 ); + } }void rtl8723be_bt_reg_init (struct ieee80211_hw *hw)
Signature · 1 line
2.10.2
PATCH 14/14 rtlwifi: Add work queue for c2h cmd.
In reply to Larry FingerFrom: Ping-Ke Shih <[email protected]>
btcoex needs to sleep, thus it must run in thread context.
--- drivers/net/wireless/realtek/rtlwifi/base.c | 92 ++++++++++++++++++++++ drivers/net/wireless/realtek/rtlwifi/base.h | 3 + .../net/wireless/realtek/rtlwifi/rtl8192ee/fw.c | 15 +++- .../net/wireless/realtek/rtlwifi/rtl8192ee/fw.h | 3 +- .../net/wireless/realtek/rtlwifi/rtl8192ee/sw.c | 1 + .../net/wireless/realtek/rtlwifi/rtl8723be/fw.c | 18 ++++- .../net/wireless/realtek/rtlwifi/rtl8723be/fw.h | 3 +- .../net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 1 + .../net/wireless/realtek/rtlwifi/rtl8821ae/fw.c | 18 ++++- .../net/wireless/realtek/rtlwifi/rtl8821ae/fw.h | 3 + .../net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 1 + drivers/net/wireless/realtek/rtlwifi/wifi.h | 14 ++++ 12 files changed, 159 insertions(+), 13 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.c +92 -0
@@ -478,6 +478,8 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) (void *)rtl_swlps_rfon_wq_callback);INIT_DELAYED_WORK (&rtlpriv->works.fwevt_wq, (void *)rtl_fwevt_wq_callback); +INIT_DELAYED_WORK (&rtlpriv->works.c2hcmd_wq, + (void *)rtl_c2hcmd_wq_callback); }
@@ -492,6 +494,7 @@ void rtl_deinit_deferred_work(struct ieee80211_hw *hw)cancel_delayed_work (&rtlpriv->works.ps_work);cancel_delayed_work (&rtlpriv->works.ps_rfon_wq);cancel_delayed_work (&rtlpriv->works.fwevt_wq); +cancel_delayed_work (&rtlpriv->works.c2hcmd_wq); }EXPORT_SYMBOL_GPL (rtl_deinit_deferred_work);
@@ -559,6 +562,7 @@ int rtl_init_core(struct ieee80211_hw *hw)spin_lock_init (&rtlpriv->locks.rf_lock);spin_lock_init (&rtlpriv->locks.waitq_lock);spin_lock_init (&rtlpriv->locks.entry_list_lock); +spin_lock_init (&rtlpriv->locks.c2hcmd_lock);spin_lock_init (&rtlpriv->locks.cck_and_rw_pagea_lock);spin_lock_init (&rtlpriv->locks.check_sendpkt_lock);spin_lock_init (&rtlpriv->locks.fw_ps_lock);
@@ -566,6 +570,7 @@ int rtl_init_core(struct ieee80211_hw *hw)spin_lock_init (&rtlpriv->locks.iqk_lock);/* <5> init list */ INIT_LIST_HEAD (&rtlpriv->entry_list); +INIT_LIST_HEAD (&rtlpriv->c2hcmd_list); rtlmac->link_state =MAC80211_NOLINK ;
@@ -578,6 +583,7 @@ EXPORT_SYMBOL_GPL(rtl_init_core);void rtl_deinit_core (struct ieee80211_hw *hw) { +rtl_c2hcmd_launcher (hw,0 ); }EXPORT_SYMBOL_GPL (rtl_deinit_core);
@@ -1826,6 +1832,92 @@ void rtl_fwevt_wq_callback(void *data) rtlpriv->cfg->ops->c2h_command_handle (hw); } + +void rtl_c2hcmd_enqueue (struct ieee80211_hw *hw,u8 tag,u8 len,u8 *val) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +unsigned long flags; +struct rtl_c2hcmd *c2hcmd; + + c2hcmd =kmalloc (sizeof (*c2hcmd),GFP_KERNEL ); + +if (!c2hcmd) + goto label_err; + + c2hcmd->val =kmalloc (len,GFP_KERNEL ); + +if (!c2hcmd->val) + goto label_err2; + +/* fill data */ + c2hcmd->tag = tag; + c2hcmd->len = len; +memcpy (c2hcmd->val, val, len); + +/* enqueue */ +spin_lock_irqsave (&rtlpriv->locks.c2hcmd_lock, flags); + +list_add_tail (&c2hcmd->list, &rtlpriv->c2hcmd_list); + +spin_unlock_irqrestore (&rtlpriv->locks.c2hcmd_lock, flags); + +/* wake up wq */ +queue_delayed_work (rtlpriv->works.rtl_wq, &rtlpriv->works.c2hcmd_wq,0 ); + +return ; + +label_err2: +kfree (c2hcmd); + +label_err: +RT_TRACE (rtlpriv,COMP_CMD ,DBG_WARNING , +"C2H cmd enqueue fail.\n" ); +} +EXPORT_SYMBOL (rtl_c2hcmd_enqueue); + +void rtl_c2hcmd_launcher (struct ieee80211_hw *hw,int exec) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +unsigned long flags; +struct rtl_c2hcmd *c2hcmd; + +while (true) { +/* dequeue a task */ +spin_lock_irqsave (&rtlpriv->locks.c2hcmd_lock, flags); + + c2hcmd =list_first_entry_or_null (&rtlpriv->c2hcmd_list, + struct rtl_c2hcmd, list); + +if (c2hcmd) +list_del (&c2hcmd->list); + +spin_unlock_irqrestore (&rtlpriv->locks.c2hcmd_lock, flags); + +/* do it */ +if (!c2hcmd) +break ; + +if (rtlpriv->cfg->ops->c2h_content_parsing && exec) + rtlpriv->cfg->ops->c2h_content_parsing (hw, + c2hcmd->tag, c2hcmd->len, c2hcmd->val); + +/* free */ +kfree (c2hcmd->val); + +kfree (c2hcmd); + } +} + +void rtl_c2hcmd_wq_callback (void *data) +{ +struct rtl_works *rtlworks =container_of_dwork_rtl (data, + struct rtl_works, + c2hcmd_wq); +struct ieee80211_hw *hw = rtlworks->hw; + +rtl_c2hcmd_launcher (hw,1 ); +} +void rtl_easy_concurrent_retrytimer_callback (unsigned long data) {struct ieee80211_hw *hw = (struct ieee80211_hw *)data;
drivers/net/wireless/realtek/rtlwifi/base.h +3 -0
@@ -143,6 +143,9 @@ int rtl_rx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u16 tid);void rtl_watchdog_wq_callback (void *data);void rtl_fwevt_wq_callback (void *data); +void rtl_c2hcmd_wq_callback (void *data); +void rtl_c2hcmd_launcher (struct ieee80211_hw *hw,int exec); +void rtl_c2hcmd_enqueue (struct ieee80211_hw *hw,u8 tag,u8 len,u8 *val); void rtl_get_tcb_desc(struct ieee80211_hw *hw, struct ieee80211_tx_info *info,
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c +12 -3
@@ -842,8 +842,8 @@ static void _rtl92ee_c2h_ra_report_handler(struct ieee80211_hw *hw,rtl92ee_dm_dynamic_arfb_select (hw, rate, collision_state); } -static void _rtl92ee_c2h_content_parsing (struct ieee80211_hw *hw,u8 c2h_cmd_id, -u8 c2h_cmd_len,u8 *tmp_buf) +void rtl92ee_c2h_content_parsing (struct ieee80211_hw *hw,u8 c2h_cmd_id, +u8 c2h_cmd_len,u8 *tmp_buf) {struct rtl_priv *rtlpriv =rtl_priv (hw);
@@ -899,5 +899,14 @@ void rtl92ee_c2h_packet_handler(struct ieee80211_hw *hw, u8 *buffer, u8 len)RT_PRINT_DATA (rtlpriv,COMP_FW ,DBG_TRACE ,"[C2H packet], Content Hex:\n" , tmp_buf, c2h_cmd_len); -_rtl92ee_c2h_content_parsing (hw, c2h_cmd_id, c2h_cmd_len, tmp_buf); +switch (c2h_cmd_id) { +case C2H_8192E_BT_INFO : +case C2H_8192E_BT_MP : +rtl_c2hcmd_enqueue (hw, c2h_cmd_id, c2h_cmd_len, tmp_buf); +break ; +default : +rtl92ee_c2h_content_parsing (hw, c2h_cmd_id, c2h_cmd_len, + tmp_buf); +break ; + } }
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.h +2 -1
@@ -185,5 +185,6 @@ void rtl92ee_set_fw_media_status_rpt_cmd(struct ieee80211_hw *hw, u8 mstatus);void rtl92ee_set_fw_rsvdpagepkt (struct ieee80211_hw *hw,bool b_dl_finished);void rtl92ee_set_p2p_ps_offload_cmd (struct ieee80211_hw *hw,u8 p2p_ps_state);void rtl92ee_c2h_packet_handler (struct ieee80211_hw *hw,u8 *buffer,u8 len); - +void rtl92ee_c2h_content_parsing (struct ieee80211_hw *hw,u8 c2h_cmd_id, +u8 c2h_cmd_len,u8 *tmp_buf);#endif
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c +1 -0
@@ -252,6 +252,7 @@ static struct rtl_hal_ops rtl8192ee_hal_ops = { .fill_h2c_cmd = rtl92ee_fill_h2c_cmd, .get_btc_status = rtl92ee_get_btc_status, .rx_command_packet = rtl92ee_rx_command_packet, + .c2h_content_parsing = rtl92ee_c2h_content_parsing, };static struct rtl_mod_params rtl92ee_mod_params = {
drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c +14 -4
@@ -586,9 +586,9 @@ void rtl8723be_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, (u8 *)p2p_ps_offload); } -static void _rtl8723be_c2h_content_parsing (struct ieee80211_hw *hw, -u8 c2h_cmd_id, -u8 c2h_cmd_len,u8 *tmp_buf) +void rtl8723be_c2h_content_parsing (struct ieee80211_hw *hw, +u8 c2h_cmd_id, +u8 c2h_cmd_len,u8 *tmp_buf) {struct rtl_priv *rtlpriv =rtl_priv (hw);
@@ -637,5 +637,15 @@ void rtl8723be_c2h_packet_handler(struct ieee80211_hw *hw, u8 *buffer, u8 len)RT_PRINT_DATA (rtlpriv,COMP_FW ,DBG_TRACE ,"[C2H packet], Content Hex:\n" , tmp_buf, c2h_cmd_len); -_rtl8723be_c2h_content_parsing (hw, c2h_cmd_id, c2h_cmd_len, tmp_buf); +switch (c2h_cmd_id) { +case C2H_8723B_BT_INFO : +case C2H_8723B_BT_MP : +rtl_c2hcmd_enqueue (hw, c2h_cmd_id, c2h_cmd_len, tmp_buf); +break ; + +default : +rtl8723be_c2h_content_parsing (hw, c2h_cmd_id, c2h_cmd_len, + tmp_buf); +break ; + } }
drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.h +2 -1
@@ -148,5 +148,6 @@ void rtl8723be_set_fw_media_status_rpt_cmd(struct ieee80211_hw *hw, u8 mstatus);void rtl8723be_set_fw_rsvdpagepkt (struct ieee80211_hw *hw,bool b_dl_finished);void rtl8723be_set_p2p_ps_offload_cmd (struct ieee80211_hw *hw,u8 p2p_ps_state);void rtl8723be_c2h_packet_handler (struct ieee80211_hw *hw,u8 *buffer,u8 len); - +void rtl8723be_c2h_content_parsing (struct ieee80211_hw *hw,u8 c2h_cmd_id, +u8 c2h_cmd_len,u8 *tmp_buf);#endif
drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c +1 -0
@@ -264,6 +264,7 @@ static struct rtl_hal_ops rtl8723be_hal_ops = { .get_btc_status = rtl8723be_get_btc_status, .rx_command_packet = rtl8723be_rx_command_packet, .is_fw_header = is_fw_header, + .c2h_content_parsing = rtl8723be_c2h_content_parsing, };static struct rtl_mod_params rtl8723be_mod_params = {
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c +14 -4
@@ -1809,9 +1809,9 @@ static void rtl8821ae_c2h_ra_report_handler(struct ieee80211_hw *hw,rtl8821ae_dm_update_init_rate (hw, rate); } -static void _rtl8821ae_c2h_content_parsing (struct ieee80211_hw *hw, -u8 c2h_cmd_id,u8 c2h_cmd_len, -u8 *tmp_buf) +void rtl8821ae_c2h_content_parsing (struct ieee80211_hw *hw, +u8 c2h_cmd_id,u8 c2h_cmd_len, +u8 *tmp_buf) {struct rtl_priv *rtlpriv =rtl_priv (hw);
@@ -1856,5 +1856,15 @@ void rtl8821ae_c2h_packet_handler(struct ieee80211_hw *hw, u8 *buffer,RT_PRINT_DATA (rtlpriv,COMP_FW ,DBG_LOUD ,"[C2H packet], Content Hex:\n" , tmp_buf, c2h_cmd_len); -_rtl8821ae_c2h_content_parsing (hw, c2h_cmd_id, c2h_cmd_len, tmp_buf); + +switch (c2h_cmd_id) { +case C2H_8812_BT_INFO : +rtl_c2hcmd_enqueue (hw, c2h_cmd_id, c2h_cmd_len, tmp_buf); +break ; + +default : +rtl8821ae_c2h_content_parsing (hw, c2h_cmd_id, c2h_cmd_len, + tmp_buf); +break ; + } }
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h +3 -0
@@ -329,4 +329,7 @@ void rtl8821ae_set_fw_disconnect_decision_ctrl_cmd(struct ieee80211_hw *hw,void rtl8821ae_set_fw_global_info_cmd (struct ieee80211_hw *hw);void rtl8821ae_c2h_packet_handler (struct ieee80211_hw *hw,u8 *buffer,u8 length); +void rtl8821ae_c2h_content_parsing (struct ieee80211_hw *hw, +u8 c2h_cmd_id,u8 c2h_cmd_len, +u8 *tmp_buf);#endif
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c +1 -0
@@ -303,6 +303,7 @@ static struct rtl_hal_ops rtl8821ae_hal_ops = { .fill_h2c_cmd = rtl8821ae_fill_h2c_cmd, .get_btc_status = rtl8821ae_get_btc_status, .rx_command_packet = rtl8821ae_rx_command_packet, + .c2h_content_parsing = rtl8821ae_c2h_content_parsing, .add_wowlan_pattern = rtl8821ae_add_wowlan_pattern, };
drivers/net/wireless/realtek/rtlwifi/wifi.h +14 -0
@@ -2211,6 +2211,8 @@ struct rtl_hal_ops {struct rtl_wow_pattern *rtl_pattern, u8 index);u16 (*get_available_desc)(struct ieee80211_hw *hw,u8 q_idx); +void (*c2h_content_parsing)(struct ieee80211_hw *hw,u8 tag,u8 len, +u8 *val); };struct rtl_intf_ops {
@@ -2324,6 +2326,7 @@ struct rtl_locks {spinlock_t waitq_lock;spinlock_t entry_list_lock;spinlock_t usb_lock; +spinlock_t c2hcmd_lock;/*FW clock change */ spinlock_t fw_ps_lock;
@@ -2353,6 +2356,7 @@ struct rtl_works {struct workqueue_struct *rtl_wq;struct delayed_work watchdog_wq;struct delayed_work ips_nic_off_wq; +struct delayed_work c2hcmd_wq;/* For SW LPS */ struct delayed_work ps_work;
@@ -2570,6 +2574,13 @@ struct proxim {u8 (*proxim_get_var)(struct ieee80211_hw *hw,u8 type); }; +struct rtl_c2hcmd { +struct list_head list; +u8 tag; +u8 len; +u8 *val; +}; +struct rtl_priv {struct ieee80211_hw *hw;struct completion firmware_loading_complete;
@@ -2603,6 +2614,9 @@ struct rtl_priv {/* sta entry list for ap adhoc or mesh */ struct list_head entry_list; +/* c2hcmd list for kthread level access */ +struct list_head c2hcmd_list; +struct rtl_debug dbg;int max_fw_size;
Signature · 1 line
2.10.2
Re: [PATCH 02/14] rtlwifi: Fix programing CAM content sequence.
In reply to Larry FingerQuoted 17 lines · Larry Finger
From: Ping-Ke Shih <[email protected]>
There is a potential race condition when the control byte of a CAM entry is written first. Write in reverse order to correct the condition.
Signed-off-by Ping-Ke Shih <[email protected]>Signed-off-by shaofu <[email protected]>Signed-off-by Larry Finger <[email protected]>--- drivers/net/wireless/realtek/rtlwifi/cam.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/net/wireless/realtek/rtlwifi/cam.c +0
-0
drivers/net/wireless/realtek/rtlwifi/cam.c static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no, · line 48
Quoted 5 lines
drivers/net/wireless/realtek/rtlwifi/cam.c +1
-1@@ -45,12 +45,13 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,u32 target_command;u32 target_content =0 ; -u8 entry_i; +s8 entry_i;
Just make this an int. s8 is for very specific things like hardware registers.
regards,
dan carpenter
Re: [PATCH 05/14] rtlwifi: Add TX report and disable key will wait until report acked.
In reply to Larry FingerQuoted 6 lines · Larry Finger
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c +0
-0@@ -731,6 +731,14 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw,SET_TX_DESC_OFFSET (pdesc,USB_HWDESC_HEADER_LEN );
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw, · line 741
Quoted 10 lines
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c +8
-0} +/* tx report */ +if (ptcb_desc->use_spe_rpt) { +u16 sn =rtl_get_tx_report_sn (hw); + +SET_TX_DESC_SPE_RPT (pdesc,1 ); +SET_TX_DESC_SW_DEFINE (pdesc, sn); + } +
All the callers of rtl_get_tx_report_sn() use this same 5 line block. Let's move it to a separate function.
regards,
dan carpenter
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
In reply to Larry FingerQuoted 7 lines · Larry Finger
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +1
-0@@ -27,6 +27,29 @@#include "../wifi.h" +#ifdef CONFIG_RTLWIFI_DEBUG
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h line 40
Quoted 10 lines
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +10
-0+ +#define BTC_SPRINTF (ptr, ...) snprintf(ptr, ##__VA_ARGS__) +#define BTC_TRACE (fmt) \ +do { \ + struct rtl_priv *rtlpriv = gl_bt_coexist.adapter; \ + if (!rtlpriv) \ + break; \ + RT_TRACE_STRING(rtlpriv, COMP_COEX, DBG_LOUD, fmt); \ +} while (0) +
This sort of macro is exactly when the rtl drivers spent so long in staging... Subsystems should not invent their own tracing but in particular these macros are so very very ugly.
It's just super frustrating to even look at this...
There are a lot of staging drivers I feel good about when they leave. The HyperV drivers. The IIO stuff. A lot of the media stuff and generally the media tree is getting better and better. I like comedi and unisys, those are in staging, but they are great and could move out any time as far as I'm concerned.
But this patch just makes me super discouraged. What are we doing???
regards,
dan carpenter
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
Quoted 25 lines · Dan Carpenter
Quoted 7 lines · Larry Finger
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +1
-0@@ -27,6 +27,29 @@#include "../wifi.h" +#ifdef CONFIG_RTLWIFI_DEBUG drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h line 40
Quoted 10 lines
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +10
-0+ +#define BTC_SPRINTF (ptr, ...) snprintf(ptr, ##__VA_ARGS__) +#define BTC_TRACE (fmt) \ +do { \ + struct rtl_priv *rtlpriv = gl_bt_coexist.adapter; \ + if (!rtlpriv) \ + break; \ + RT_TRACE_STRING(rtlpriv, COMP_COEX, DBG_LOUD, fmt); \ +} while (0) +This sort of macro is exactly when the rtl drivers spent so long in staging... Subsystems should not invent their own tracing but in particular these macros are so very very ugly.
It's just super frustrating to even look at this...
Quoted 7 lines
There are a lot of staging drivers I feel good about when they leave. The HyperV drivers. The IIO stuff. A lot of the media stuff and generally the media tree is getting better and better. I like comedi and unisys, those are in staging, but they are great and could move out any time as far as I'm concerned.
But this patch just makes me super discouraged. What are we doing???
Dan,
It would not matter to me if these drivers got moved to staging, but there are a lot of users whose distros do not build staging drivers that would be very unhappy.
Can you point me to a driver with a better way to conditionally dump a debugging string to the logs?
Larry
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
Quoted 34 lines · Larry Finger
Quoted 25 lines · Dan Carpenter
Quoted 7 lines · Larry Finger
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +1
-0@@ -27,6 +27,29 @@#include "../wifi.h" +#ifdef CONFIG_RTLWIFI_DEBUG drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h line 40
Quoted 10 lines
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +10
-0+ +#define BTC_SPRINTF (ptr, ...) snprintf(ptr, ##__VA_ARGS__) +#define BTC_TRACE (fmt) \ +do { \ + struct rtl_priv *rtlpriv = gl_bt_coexist.adapter; \ + if (!rtlpriv) \ + break; \ + RT_TRACE_STRING(rtlpriv, COMP_COEX, DBG_LOUD, fmt); \ +} while (0) +This sort of macro is exactly when the rtl drivers spent so long in staging... Subsystems should not invent their own tracing but in particular these macros are so very very ugly.
It's just super frustrating to even look at this...
Quoted 7 lines
There are a lot of staging drivers I feel good about when they leave. The HyperV drivers. The IIO stuff. A lot of the media stuff and generally the media tree is getting better and better. I like comedi and unisys, those are in staging, but they are great and could move out any time as far as I'm concerned.
But this patch just makes me super discouraged. What are we doing???
Quoted 8 lines
Dan,
It would not matter to me if these drivers got moved to staging, but there are a lot of users whose distros do not build staging drivers that would be very unhappy.
Can you point me to a driver with a better way to conditionally dump a debugging string to the logs?
Just use 'dev_dbg()', or 'pr_debug()' if you don't have a device pointer (hint, all drivers should have that pointer). That can be turned on or off by a user dynamically as the kernel runs. No need to invent fancy custom macros for things we have already for many many years.
thanks,
greg k-h
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
In reply to Larry FingerQuoted 2 lines · Larry Finger
Can you point me to a driver with a better way to conditionally dump a debugging string to the logs?
People should look at using ftrace and kprobes. They really are very powerful and useful.
regards,
dan carpenter
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
In reply to Greg KHQuoted 41 lines · Greg KH
Quoted 40 lines · Larry Finger
Quoted 25 lines · Dan Carpenter
Quoted 7 lines · Larry Finger
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +1
-0@@ -27,6 +27,29 @@#include "../wifi.h" +#ifdef CONFIG_RTLWIFI_DEBUG drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h line 40
Quoted 10 lines
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +10
-0+ +#define BTC_SPRINTF (ptr, ...) snprintf(ptr, ##__VA_ARGS__) +#define BTC_TRACE (fmt) \ +do { \ + struct rtl_priv *rtlpriv = gl_bt_coexist.adapter; \ + if (!rtlpriv) \ + break; \ + RT_TRACE_STRING(rtlpriv, COMP_COEX, DBG_LOUD, fmt); \ +} while (0) +This sort of macro is exactly when the rtl drivers spent so long in staging... Subsystems should not invent their own tracing but in particular these macros are so very very ugly.
It's just super frustrating to even look at this...
Quoted 7 lines
There are a lot of staging drivers I feel good about when they leave. The HyperV drivers. The IIO stuff. A lot of the media stuff and generally the media tree is getting better and better. I like comedi and unisys, those are in staging, but they are great and could move out any time as far as I'm concerned.
But this patch just makes me super discouraged. What are we doing???
Dan,
It would not matter to me if these drivers got moved to staging, but there are a lot of users whose distros do not build staging drivers that would be very unhappy.
Quoted 7 lines
Quoted 2 lines
Can you point me to a driver with a better way to conditionally dump a debugging string to the logs?
Just use '
dev_dbg()', or 'pr_debug()' if you don't have a device pointer (hint, all drivers should have that pointer). That can be turned on or off by a user dynamically as the kernel runs. No need to invent fancy custom macros for things we have already for many many years.
We have disccused this before, but for wireless it's not really that simple. AFAIK with dyndbg you can only control the messages per line (painful to enable group of messages) or per file (enables too many messages). In wireless we have cases when we need to enable group of messages, but not all. For example, some of the messages can slow down the system so much that the bug is not reproducable anymore. So unless dyndbg gets some sort of grouping support logging wrappers are needed with wireless code.
(I'm talking in general here, I haven't looked at rtlwifi patches in detail yet.)
Signature · 1 line
Kalle Valo
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
Quoted 5 lines · Kalle Valo
We have disccused this before, but for wireless it's not really that simple. AFAIK with dyndbg you can only control the messages per line (painful to enable group of messages) or per file (enables too many messages). In wireless we have cases when we need to enable group of messages, but not all.
You can turn them on by the function or a range of lines, then disable the spammy lines. With these new debug macros you can't do that so this is a step backwards.
If I'm totally honest, I've never seen uglier macros than these. I work in staging and I've spent a lot of time in ancient code but these ones really take the cake.
regards,
dan carpenter
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
Quoted 7 lines · Dan Carpenter
Quoted 5 lines · Kalle Valo
We have disccused this before, but for wireless it's not really that simple. AFAIK with dyndbg you can only control the messages per line (painful to enable group of messages) or per file (enables too many messages). In wireless we have cases when we need to enable group of messages, but not all.
Quoted 7 lines
You can turn them on by the function or a range of lines, then disable the spammy lines. With these new debug macros you can't do that so this is a step backwards.
If I'm totally honest, I've never seen uglier macros than these. I work in staging and I've spent a lot of time in ancient code but these ones really take the cake.
They will be coming out. The Realtek engineer and I are learning more about the various options to see what to use. The dynamic debugging options seem to be the best at the moment.
Larry
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
In reply to Dan CarpenterQuoted 7 lines · Dan Carpenter
Quoted 5 lines · Kalle Valo
We have disccused this before, but for wireless it's not really that simple. AFAIK with dyndbg you can only control the messages per line (painful to enable group of messages) or per file (enables too many messages). In wireless we have cases when we need to enable group of messages, but not all.
Quoted 5 lines
You can turn them on by the function or a range of lines, then disable the spammy lines. With these new debug macros you can't do that so this is a step backwards.
From my point of view dyndbg is step backwards. Line numbers change all
the time and you can't have simple instructions like this for users and developers working with the driver:
https://wireless.wiki.kernel.org/en/users/drivers/ath10k/debug#debug_log_messages
I don't want waste time with this anymore as we seem to just disagree. My point here was that in wireless we have used log wrappers before and will continue to use them in certain drivers as dyndbg is not enough. But it would make me very happy if someone would add a similar grouping functionality to dyndbg to make it easy to enable a set of debug messages in a driver.
Signature · 1 line
Kalle Valo
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
I don't have a problem with the ath debug printks. Larry asked me for examples of better debug functions and the ath code is an example. Literally, any existing debug functions are better than the BTC_TRACE_STRING() stuff.
Quoted 3 lines · Kalle Valo
But it would make me very happy if someone would add a similar grouping functionality to dyndbg to make it easy to enable a set of debug messages in a driver.
Thats seems like a reasonable thing as well.
regards,
dan carpenter
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
Quoted 6 lines · Dan Carpenter
Quoted 3 lines · Kalle Valo
But it would make me very happy if someone would add a similar grouping functionality to dyndbg to make it easy to enable a set of debug messages in a driver.
Thats seems like a reasonable thing as well.
I actually like the ath code... We could easily change it to be more generic and make it a top level function for everyone to use.
regards,
dan carpenter
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
In reply to Dan CarpenterQuoted 4 lines · Dan Carpenter
I don't have a problem with the ath debug printks. Larry asked me for examples of better debug functions and the ath code is an example. Literally, any existing debug functions are better than the
BTC_TRACE_STRING()stuff.
Sure, I agree with that. My point was just that sometimes it's ok to have own logging wrappers and there's no hard rule for this.
Signature · 1 line
Kalle Valo
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
In reply to Dan CarpenterQuoted 10 lines · Dan Carpenter
Quoted 6 lines · Dan Carpenter
Quoted 3 lines · Kalle Valo
But it would make me very happy if someone would add a similar grouping functionality to dyndbg to make it easy to enable a set of debug messages in a driver.
Thats seems like a reasonable thing as well.
I actually like the ath code... We could easily change it to be more generic and make it a top level function for everyone to use.
That would be great. And maybe add a sysfs file with a description different levels, like module parameters have. Too bad that I can't work on that, too much stuff on my plate right now.
Signature · 1 line
Kalle Valo
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
Quoted 8 lines · Kalle Valo
Quoted 6 lines · Dan Carpenter
Quoted 5 lines · Dan Carpenter
Quoted 3 lines · Kalle Valo
But it would make me very happy if someone would add a similar grouping functionality to dyndbg to make it easy to enable a set of debug messages in a driver.
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
Thats seems like a reasonable thing as well.
I actually like the ath code... We could easily change it to be more generic and make it a top level function for everyone to use.
That would be great. And maybe add a sysfs file with a description different levels, like module parameters have. Too bad that I can't work on that, too much stuff on my plate right now.
In this case I would like to step in and try to implement grouping of messages in the dynamic debug code. This seems to be an interesting learning opportunity.
Regards,
Markus
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
Quoted 14 lines · Markus Böhme
Quoted 13 lines · Kalle Valo
Quoted 10 lines · Dan Carpenter
Quoted 6 lines · Dan Carpenter
Quoted 3 lines · Kalle Valo
But it would make me very happy if someone would add a similar grouping functionality to dyndbg to make it easy to enable a set of debug messages in a driver.
Thats seems like a reasonable thing as well.
I actually like the ath code... We could easily change it to be more generic and make it a top level function for everyone to use.
Quoted 8 lines
Quoted 4 lines
That would be great. And maybe add a sysfs file with a description different levels, like module parameters have. Too bad that I can't work on that, too much stuff on my plate right now.
In this case I would like to step in and try to implement grouping of messages in the dynamic debug code. This seems to be an interesting learning opportunity.
Use bitmaps and levels.
Re: [01/14] rtlwifi: Correct power save capability while init mac80211
In reply to Larry FingerQuoted 7 lines · Larry Finger
Set
IEEE80211_HW_SUPPORTS_PSwhen driver is fwlps
Because mac80211 control SW-LPS only, we add constraints to avoid errors.Signed-off-by Vincent Fann <[email protected]>Signed-off-by shaofu <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>Signed-off-by Larry Finger <[email protected]>
Dropped per Larry's request.
14 patches set to Changes Requested.
9457587 [01/14] rtlwifi: Correct power save capability while init mac80211 9457609 [02/14] rtlwifi: Fix programing CAM content sequence.
9457607 [03/14] rtlwifi: Set retry limit depends on vif type.
9457601 [03/14] rtlwifi: extend debug_comp to u64
9457613 [05/14] rtlwifi: Add TX report and disable key will wait until report acked. 9457611 [06/14] rtlwifi: rtl8723be: btcoexist: Add single_ant_path 9457589 [07/14] rtlwifi: move btcoex's ant_num declaration
9457603 [08/14] rtlwifi: rtl8723be: btcoex: add package_type function to btcoex 9457593 [09/14] rtlwifi: ibtcoex: move bt_type declaration
9457591 [10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
9457605 [11/14] rtlwifi: Add a new enumeration value to btc_set_type 9457595 [12/14] rtlwifi: btcoexist: Add vendor definition for new btcoexist 9457597 [13/14] rtlwifi: rtl8723be: fix ant_sel code
9457599 [14/14] rtlwifi: Add work queue for c2h cmd.
Signature · 6 lines
https://patchwork.kernel.org/patch/9457587/ Documentation about submitting wireless patches and checking status from patchwork: https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches