rtlwifi: Various updates
v4 cover rtlwifi: Various updates
These 11 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.
---
V2 - Fix Kalle's comment about unended loops. It now runs a maximum of 200 times. V3 - Fix "WARNING: possible condition with no effect (if == else)" found by Test Robot V4 - No chenges -resubmitting as requested by Kalle.
---
Larry Finger (1):
rtlwifi: btcoexist: Change logging in halbtc8192e2ant.c
Ping-Ke Shih (10):
rtlwifi: Fix programing CAM content sequence.
rtlwifi: Set retry limit depends on vif type.
rtlwifi: Add a new enumeration value to btc_set_type
rtlwifi: btcoexist: Add vendor definition for new btcoexist
rtlwifi: rtl8723be: btcoexist: Add single_ant_path
rtlwifi: move btcoex's ant_num declaration
rtlwifi: rtl8723be: btcoex: add package_type function to btcoex
rtlwifi: btcoex: move bt_type declaration
rtlwifi: rtl8723be: fix ant_sel code
rtlwifi: Add work queue for c2h cmd.
drivers/net/wireless/realtek/rtlwifi/base.c | 92 +++ drivers/net/wireless/realtek/rtlwifi/base.h | 3 + .../wireless/realtek/rtlwifi/btcoexist/Makefile | 1 + .../realtek/rtlwifi/btcoexist/halbtc8192e2ant.c | 825 +++++++++++---------- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 32 + .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 8 + .../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 | 21 +- 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 | 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/hw.c | 42 +- .../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 | 24 + 25 files changed, 705 insertions(+), 449 deletions(-)
Signature · 1 line
2.10.2
PATCH v4 3/11 rtlwifi: Add a new enumeration value to btc_set_type
From: 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
@@ -263,6 +263,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 v4 5/11 rtlwifi: btcoexist: Change logging in halbtc8192e2ant.c
In reply to Larry FingerThis routine uses its own debugging macros These are changed to use the the recently rewritten RT_TRACE macro. There are also some renamed variables that were missed in the previous step.
The only functional change is that some debugging statements have been dropped based on the final code supplied by Realtek.
--- .../wireless/realtek/rtlwifi/btcoexist/Makefile | 1 + .../realtek/rtlwifi/btcoexist/halbtc8192e2ant.c | 825 +++++++++++---------- 2 files changed, 417 insertions(+), 409 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/Makefile +1 -0
@@ -1,4 +1,5 @@ btcoexist-objs := halbtc8723b2ant.o \ + halbtc8192e2ant.o \ halbtcoutsrc.o \ rtl_btc.o
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c +416 -409
1,583 lines not on this page · raw message
Signature · 1 line
2.10.2
Re: [PATCH 05/11] rtlwifi: btcoexist: Change logging in halbtc8192e2ant.c
Quoted 19 lines · Larry Finger
This routine uses its own debugging macros These are changed to use the the recently rewritten
RT_TRACEmacro. There are also some renamed variables that were missed in the previous step.The only functional change is that some debugging statements have been dropped based on the final code supplied by Realtek.
Signed-off-by Larry Finger <[email protected]>Cc Ping-Ke Shih <[email protected]>--- .../wireless/realtek/rtlwifi/btcoexist/Makefile | 1 + .../realtek/rtlwifi/btcoexist/halbtc8192e2ant.c | 825 +++++++++++---------- 2 files changed, 417 insertions(+), 409 deletions(-)drivers/net/wireless/realtek/rtlwifi/btcoexist/Makefile +0
-0
drivers/net/wireless/realtek/rtlwifi/btcoexist/Makefile line 4
Quoted 4 lines
drivers/net/wireless/realtek/rtlwifi/btcoexist/Makefile +1
-0@@ -1,4 +1,5 @@ btcoexist-objs := halbtc8723b2ant.o \ + halbtc8192e2ant.o \ halbtcoutsrc.o \ rtl_btc.o
This is what I don't get, why is it needed?
Signature · 1 line
Kalle Valo
PATCH v4 5/11 rtlwifi: btcoexist: Change logging in halbtc8192e2ant.c
In reply to Larry FingerThis routine uses its own debugging macros These are changed to use the the recently rewritten RT_TRACE macro. There are also some renamed variables that were missed in the previous step.
The only functional change is that some debugging statements have been dropped based on the final code supplied by Realtek.
---
V2 - no changes
V3 - Fix "WARNING: possible condition with no effect (if == else)" reported by Test Robot V4 - no changes
--- .../wireless/realtek/rtlwifi/btcoexist/Makefile | 1 + .../realtek/rtlwifi/btcoexist/halbtc8192e2ant.c | 845 ++++++++++----------- 2 files changed, 417 insertions(+), 429 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/Makefile +1 -0
@@ -1,4 +1,5 @@ btcoexist-objs := halbtc8723b2ant.o \ + halbtc8192e2ant.o \ halbtcoutsrc.o \ rtl_btc.o
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c +416 -429
1,627 lines not on this page · raw message
Signature · 1 line
2.10.2
PATCH v2 1/11 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.
---
V2 - no changes
--- 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; +int 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
Re: [PATCH 01/11 V2] rtlwifi: Fix programing CAM content sequence.
Quoted 10 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]>---
V2 - no changes
Weird, I don't see any of the v2 patches in patchwork:
https://patchwork.kernel.org/project/linux-wireless/list/?state=*&page=1
I do see other recent patches from you Larry, but not this set. Can you resubmit, please?
Signature · 1 line
Kalle Valo
Re: [PATCH 01/11 V3] rtlwifi: Fix programing CAM content sequence.
In reply to Larry FingerQuoted 11 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]>---
V2 - no changes
V3 - no changes
I missed in my reply to v2 that you had already sent v3 from this patchset. Strange that I don't see this v3 patchset either in patchwork, only v1.
Try submitting v4 in case it was just a temporary glitch in patchwork. But if that doesn't help I'll apply these manually.
Signature · 1 line
Kalle Valo
Re: [PATCH 01/11 V3] rtlwifi: Fix programing CAM content sequence.
Quoted 14 lines · Kalle Valo
Quoted 11 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]>---
V2 - no changes
V3 - no changes
Quoted 6 lines
I missed in my reply to v2 that you had already sent v3 from this patchset. Strange that I don't see this v3 patchset either in patchwork, only v1.
Try submitting v4 in case it was just a temporary glitch in patchwork. But if that doesn't help I'll apply these manually.
I have no idea why that patchsets are missing. I will send V4 shortly.
Sorry I did not respond more quickly. I was out of my office today.
Larry
Re: [PATCH 01/11 V3] rtlwifi: Fix programing CAM content sequence.
In reply to Kalle ValoQuoted 14 lines · Kalle Valo
Quoted 11 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]>---
V2 - no changes
V3 - no changes
Quoted 6 lines
I missed in my reply to v2 that you had already sent v3 from this patchset. Strange that I don't see this v3 patchset either in patchwork, only v1.
Try submitting v4 in case it was just a temporary glitch in patchwork. But if that doesn't help I'll apply these manually.
I have no idea why my patches are not getting handled by patchwork, but V4 is not there either.
Larry
Re: [PATCH 01/11 V3] rtlwifi: Fix programing CAM content sequence.
Quoted 19 lines · Larry Finger
Quoted 18 lines · Kalle Valo
Quoted 11 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]>---
V2 - no changes
V3 - no changesI missed in my reply to v2 that you had already sent v3 from this patchset. Strange that I don't see this v3 patchset either in patchwork, only v1.
Quoted 5 lines
Quoted 2 lines
Try submitting v4 in case it was just a temporary glitch in patchwork. But if that doesn't help I'll apply these manually.
I have no idea why my patches are not getting handled by patchwork, but V4 is not there either.
Yeah, that's odd. I do see your patches on the mailing list so I guess something in this set is breaking patchwork's email parser. The only notable difference I saw that in our patches the tags were in this format:
[PATCH 01/11 V4]
But normally we use something like this:
[PATCH V4 01/11]
I don't know if that would cause patchwork to fail and I don't really have time to investigate it right now. I'll just apply V4 manually now and let's hope that the problem doesn't reappear.
Signature · 1 line
Kalle Valo
PATCH v2 11/11 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.
---
V2 - Potential infinite loop is fixed.
--- 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 +93 -0
@@ -475,6 +475,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); }
@@ -489,6 +491,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);
@@ -556,6 +559,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);
@@ -563,6 +567,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 ;
@@ -575,6 +580,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);
@@ -1729,6 +1735,93 @@ 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; +int i; + +for (i =0 ; i <200 ; i++) { +/* 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
@@ -136,6 +136,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
@@ -764,8 +764,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);
@@ -820,5 +820,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
@@ -248,6 +248,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
@@ -585,9 +585,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);
@@ -635,5 +635,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
@@ -260,6 +260,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
@@ -1740,9 +1740,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);
@@ -1784,5 +1784,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
@@ -297,6 +297,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
@@ -2202,6 +2202,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 {
@@ -2317,6 +2319,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;
@@ -2346,6 +2349,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;
@@ -2553,6 +2557,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;
@@ -2585,6 +2596,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; +int max_fw_size;/*
Signature · 1 line
2.10.2
Re: [PATCH 11/11] rtlwifi: Add work queue for c2h cmd.
Quoted 6 lines · Larry Finger
From: Ping-Ke Shih <[email protected]>
btcoex needs to sleep, thus it must run in thread context.
Signed-off-by Ping-Ke Shih <[email protected]>Signed-off-by Larry Finger <[email protected]>
[...]
Quoted 22 lines
drivers/net/wireless/realtek/rtlwifi/base.c +22
-0+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 ; +
drivers/net/wireless/realtek/rtlwifi/base.c void rtl_fwevt_wq_callback(void *data) · line 1813
Quoted 10 lines
drivers/net/wireless/realtek/rtlwifi/base.c +10
-0+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); + } +}
Never ending loops are not really preferred in kernel, with a simple bug it could cause annoying system-wide problems. Can you add a some sort of failsafe mechanism, for example bailing out from the loop if it has been running more than 200 ms or something like that?
Signature · 1 line
Kalle Valo
Re: [PATCH 11/11] rtlwifi: Add work queue for c2h cmd.
Quoted 40 lines · Kalle Valo
Quoted 6 lines · Larry Finger
From: Ping-Ke Shih <[email protected]>
btcoex needs to sleep, thus it must run in thread context.
Signed-off-by Ping-Ke Shih <[email protected]>Signed-off-by Larry Finger <[email protected]>[...]
Quoted 29 lines
drivers/net/wireless/realtek/rtlwifi/base.c +29
-0+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); +
Quoted 8 lines
drivers/net/wireless/realtek/rtlwifi/base.c void rtl_fwevt_wq_callback(void *data) · line 1812
Quoted 3 lines
drivers/net/wireless/realtek/rtlwifi/base.c +3
-0+kfree (c2hcmd); + } +}Never ending loops are not really preferred in kernel, with a simple bug it could cause annoying system-wide problems. Can you add a some sort of failsafe mechanism, for example bailing out from the loop if it has been running more than 200 ms or something like that?
Certainly.
Larry
PATCH v3 2/11 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.
---
V2 - no changes
V3 - no changes
--- 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
@@ -233,6 +233,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,
@@ -271,6 +272,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 ;
@@ -287,6 +289,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,
@@ -300,6 +304,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 : pr_err("operation mode %d is not supported!\n",
@@ -321,6 +327,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;
@@ -645,10 +655,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 ;
@@ -1814,6 +1818,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;
@@ -1831,6 +1836,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 v3 4/11 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.
---
V2 - no changes
V3 - no changes
--- 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
@@ -335,6 +335,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
@@ -228,6 +228,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,
@@ -245,6 +246,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 v4 6/11 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.
---
V2 - no changes
V3 - no changes
V4 - no changes
--- 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
@@ -2657,6 +2657,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
@@ -2454,6 +2454,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 v4 7/11 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.
---
V2 - no changes
V3 - no changes
V4 - no changes
--- .../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
@@ -2653,6 +2653,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 v4 8/11 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.
---
V2 - no changes
V3 - no changes
V4 - no changes
--- .../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
@@ -73,8 +73,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);
@@ -1124,7 +1122,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));
@@ -1210,6 +1208,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);void rtl_fill_dummy (u8 *pfwbuf,u32 *pfwlen);
drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +33 -0
@@ -2020,6 +2020,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) {
@@ -2078,6 +2109,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 v4 9/11 rtlwifi: btcoex: 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 v4 10/11 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.
---
V2 - no changes
V3 - no changes
V4 - no changes
--- 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
@@ -2696,9 +2696,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
Quoted 18 lines · Larry Finger
These 11 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.
Signed-off-by Larry Finger <[email protected]>Cc Ping-Ke Shih <[email protected]>---
V2 - Fix Kalle's comment about unended loops. It now runs a maximum of 200 times. V3 - Fix "WARNING: possible condition with no effect (if == else)" found by Test Robot V4 - No chenges -resubmitting as requested by Kalle.
---
Larry Finger (1):
rtlwifi: btcoexist: Change logging inhalbtc8192e2ant.c
Quoted 11 lines
Ping-Ke Shih (10):
rtlwifi: Fix programing CAM content sequence.
rtlwifi: Set retry limit depends on vif type.
rtlwifi: Add a new enumeration value tobtc_set_type
rtlwifi: btcoexist: Add vendor definition for new btcoexist
rtlwifi: rtl8723be: btcoexist: Addsingle_ant_path
rtlwifi: move btcoex'sant_numdeclaration
rtlwifi: rtl8723be: btcoex: addpackage_typefunction to btcoex
rtlwifi: btcoex: movebt_typedeclaration
rtlwifi: rtl8723be: fixant_selcode
rtlwifi: Add work queue for c2h cmd.
Thanks, as patchwork doesn't seem to detect this patchset I applied these manually:
1e75622c630b rtlwifi: Fix programing CAM content sequence. 8d0d43e34208 rtlwifi: Set retry limit depends on vif type. 6f85c03bc34c rtlwifi: Add a new enumeration value to btc_set_type 1a2814739fe5 rtlwifi: btcoexist: Add vendor definition for new btcoexist d46fa3e47aeb rtlwifi: btcoexist: Change logging in halbtc8192e2ant.c db8cb0095b0e rtlwifi: rtl8723be: btcoexist: Add single_ant_path 0de9b5db9fbf rtlwifi: move btcoex's ant_num declaration 7fe1fe75c311 rtlwifi: rtl8723be: btcoex: add package_type function to btcoex e0215c142026 rtlwifi: btcoex: move bt_type declaration 0ff78adeef11 rtlwifi: rtl8723be: fix ant_sel codecceb0a597320 rtlwifi: Add work queue for c2h cmd.
Signature · 1 line
Kalle Valo