From patchwork Tue May 16 13:19:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9729197 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D9F50602B4 for ; Tue, 16 May 2017 13:20:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBD7F28A25 for ; Tue, 16 May 2017 13:20:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0B3128A31; Tue, 16 May 2017 13:20:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F6D528A1F for ; Tue, 16 May 2017 13:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753280AbdEPNUZ (ORCPT ); Tue, 16 May 2017 09:20:25 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:32913 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752596AbdEPNUH (ORCPT ); Tue, 16 May 2017 09:20:07 -0400 Received: by mail-oi0-f67.google.com with SMTP id h4so3309909oib.0 for ; Tue, 16 May 2017 06:20:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=AZsmeTNACUEh1uhIUkDklg7kg7mMq3ZMLbqSukPf4oU=; b=jh0jNe5J5Q5ewNHQkbMrxrhixtXrwdhxAXPPoVSdeJ5wVu60TCySc+ccbTHrvuaUTj uxXF7xIn91JVlVjjPG3UDA2BfaahWQ7z4+EwtWX+O2bb/DjLTKjwDalJAfLcf7TXfEJG CmfmRb3tGmWg4pkhTq4RKqkKhshEHgvlXiL4Dpic2MEzsfL63v+yPaR1IcBr51qWHfj7 gyCIt4iJqUrkCGjT/msBstrThSZGn5OzOkpqWYlXEFFHUYs8vNtEg95hDZ7VjgdN2bwA LFEF3696ddnpoh6kLo+edZkt4S/+4KcXBhGcUrginnUm0yt7no2bDJK65VgtEXfaLtpR KIZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=AZsmeTNACUEh1uhIUkDklg7kg7mMq3ZMLbqSukPf4oU=; b=ZSwp9OoCFrJY6lqx7extgwBMFhAu6zwwt25dVQaaMngdFnfF8gF2Io7iGKxiJBGeCu WHe945MUUjsJdOehgP/Hv2uIeqhxKA2+teCZ+1AG6nwJ7vGV0k2kmdcGeQpFz6l9bdjY pwe+24BouoIvxkOoXDU6AErvKCBf2M2qjhb1p3zPRpmltv6kLcJUikZosPCBByNWXB+O 1nsrvs5A3gCiI/pTYvaLcLgIDlBm4Nzn7v3bd9VjAAt9dFZFi5KZxf3Q7AmM6p3bcKOd yVA4Y11N5lTHanPDTX9oyx4MQL4bsepz/n5tgdkYu3xUSFT+wgpvaHzXCywUdS5oTvRv GEJw== X-Gm-Message-State: AODbwcCSnuvZAv+5r8IFefcqCmxYSOx1AH4xd6S02Ldv9Lz+ct3HXBwt 7ij5ec8C1QkUqw== X-Received: by 10.157.2.101 with SMTP id 92mr4959540otb.211.1494940807095; Tue, 16 May 2017 06:20:07 -0700 (PDT) Received: from linux-4v1g.suse (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id k23sm6813543ote.23.2017.05.16.06.20.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 May 2017 06:20:06 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, Ping-Ke Shih , Larry Finger , Yan-Hsuan Chuang , Birming Chiu , Shaofu , Steven Ting Subject: [PATCH 06/10] rtlwifi: btcoex: 23b 1ant: TDMA duration for ACL busy Date: Tue, 16 May 2017 08:19:53 -0500 Message-Id: <20170516131957.9513-7-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170516131957.9513-1-Larry.Finger@lwfinger.net> References: <20170516131957.9513-1-Larry.Finger@lwfinger.net> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ping-Ke Shih BT ACL is a special case, so we create a routine to deal this case. Signed-off-by: Ping-Ke Shih Signed-off-by: Larry Finger Cc: Yan-Hsuan Chuang Cc: Birming Chiu Cc: Shaofu Cc: Steven Ting --- .../realtek/rtlwifi/btcoexist/halbtc8723b1ant.c | 54 +++++++++++++--------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c index 2e1ba8fed982..523e1acfe1cf 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c @@ -1124,6 +1124,11 @@ void btc8723b1ant_tdma_dur_adj_for_acl(struct btc_coexist *btcoexist, /* acquire the BT TRx retry count from BT_Info byte2 */ retry_count = coex_sta->bt_retry_cnt; bt_info_ext = coex_sta->bt_info_ext; + + if ((coex_sta->low_priority_tx) > 1050 || + (coex_sta->low_priority_rx) > 1250) + retry_count++; + result = 0; wait_count++; /* no retry in the last 2-second duration */ @@ -1135,6 +1140,9 @@ void btc8723b1ant_tdma_dur_adj_for_acl(struct btc_coexist *btcoexist, dn = 0; if (up >= n) { + /* if retry count during continuous n*2 seconds + * is 0, enlarge WiFi duration + */ wait_count = 0; n = 3; up = 0; @@ -1144,6 +1152,7 @@ void btc8723b1ant_tdma_dur_adj_for_acl(struct btc_coexist *btcoexist, "[BTCoex], Increase wifi duration!!\n"); } } else if (retry_count <= 3) { + /* <=3 retry in the last 2-second duration */ up--; dn++; @@ -1151,12 +1160,20 @@ void btc8723b1ant_tdma_dur_adj_for_acl(struct btc_coexist *btcoexist, up = 0; if (dn == 2) { + /* if continuous 2 retry count(every 2 seconds) + * >0 and < 3, reduce WiFi duration + */ if (wait_count <= 2) + /* avoid loop between the two levels */ m++; else m = 1; if (m >= 20) + /* maximum of m = 20 ' will recheck if + * need to adjust wifi duration in + * maximum time interval 120 seconds + */ m = 20; n = 3 * m; @@ -1168,12 +1185,20 @@ void btc8723b1ant_tdma_dur_adj_for_acl(struct btc_coexist *btcoexist, "[BTCoex], Decrease wifi duration for retryCounter<3!!\n"); } } else { + /* retry count > 3, once retry count > 3, to reduce + * WiFi duration + */ if (wait_count == 1) + /* to avoid loop between the two levels */ m++; else m = 1; if (m >= 20) + /* maximum of m = 20 ' will recheck if need to + * adjust wifi duration in maximum time interval + * 120 seconds + */ m = 20; n = 3 * m; @@ -1186,13 +1211,7 @@ void btc8723b1ant_tdma_dur_adj_for_acl(struct btc_coexist *btcoexist, } if (result == -1) { - if ((BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(bt_info_ext)) && - ((coex_dm->cur_ps_tdma == 1) || - (coex_dm->cur_ps_tdma == 2))) { - halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, - true, 9); - coex_dm->ps_tdma_du_adj_type = 9; - } else if (coex_dm->cur_ps_tdma == 1) { + if (coex_dm->cur_ps_tdma == 1) { halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 2); coex_dm->ps_tdma_du_adj_type = 2; @@ -1206,13 +1225,7 @@ void btc8723b1ant_tdma_dur_adj_for_acl(struct btc_coexist *btcoexist, coex_dm->ps_tdma_du_adj_type = 11; } } else if (result == 1) { - if ((BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(bt_info_ext)) && - ((coex_dm->cur_ps_tdma == 1) || - (coex_dm->cur_ps_tdma == 2))) { - halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, - true, 9); - coex_dm->ps_tdma_du_adj_type = 9; - } else if (coex_dm->cur_ps_tdma == 11) { + if (coex_dm->cur_ps_tdma == 11) { halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 9); coex_dm->ps_tdma_du_adj_type = 9; @@ -1225,11 +1238,6 @@ void btc8723b1ant_tdma_dur_adj_for_acl(struct btc_coexist *btcoexist, true, 1); coex_dm->ps_tdma_du_adj_type = 1; } - } else { - /* if busy / idle change */ - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, - "[BTCoex],********* TDMA(on, %d) ********\n", - coex_dm->cur_ps_tdma); } if (coex_dm->cur_ps_tdma != 1 && coex_dm->cur_ps_tdma != 2 && @@ -1448,12 +1456,12 @@ static void halbtc8723b1ant_action_wifi_connected_bt_acl_busy( halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2); coex_dm->auto_tdma_adjust = false; - } else { /* for low BT RSSI */ - halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, - true, 11); + } else { + btc8723b1ant_tdma_dur_adj_for_acl(btcoexist, + wifi_status); halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 1); - coex_dm->auto_tdma_adjust = false; + coex_dm->auto_tdma_adjust = true; } } else if (bt_link_info->hid_exist && bt_link_info->a2dp_exist) { /* HID + A2DP */