From patchwork Sun Jun 18 16:12:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9794931 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 5C1F2601C8 for ; Sun, 18 Jun 2017 16:13:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D5F727FA9 for ; Sun, 18 Jun 2017 16:13:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 420E127FB2; Sun, 18 Jun 2017 16:13:21 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 A74E527FA9 for ; Sun, 18 Jun 2017 16:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753285AbdFRQNT (ORCPT ); Sun, 18 Jun 2017 12:13:19 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:34526 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753185AbdFRQNE (ORCPT ); Sun, 18 Jun 2017 12:13:04 -0400 Received: by mail-oi0-f66.google.com with SMTP id w127so7234032oiw.1 for ; Sun, 18 Jun 2017 09:13:04 -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=6qgfiQaUdwmwVpRpI4cHUyCa4kaKwNd0Vl4WoGrnyEE=; b=Q3rIMe2LLpMm3an4D3MVHWr8YsaJ25FBY2245J0PtVTSVTXBI4zU8rfeaiIbYe2PBX V22czqvJUR9afwuG5GNdHNGAHMguzK8CGASQaMWxcNUWzawozU2lTNaWxQkF/pAHBBLB 7LEU2x4x4QiGXZr/VTX1oNNuAKZrklDaiwoHVqeaMi/PHlTZl7OrN/+LRB7PzoS8V5z7 L1tubb9roQTvxdQCDokXHau1FGws3dwzXTAeBqTSrxNexKxh+6rdJWLZyUmqMbgRXSsc piTsSN/2YXJB3fxcMpJeKDAP7aQUO6wPPjM4+Yl32FeWMo6Vh/kJU0fIQg39e9UdSurn p5eA== 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=6qgfiQaUdwmwVpRpI4cHUyCa4kaKwNd0Vl4WoGrnyEE=; b=HhCMI/zIGPh/xDWhRgIhCIEiya0W1itMUIKfOsekI7cpX6kE0xMd/1ZEvxN+sP5nWm WwTkk2KAAwLGPjAy7zhfq/cMPGrjfT1whVhrtqzu3bhVOmwhZOM+5VBJKQhc3SowB9k4 0gIGccuTIPyfrzdsRgEUdYGBdRQesjKkojG5PM5+uDYx5cr1fTxfo4AsxtlLo8fjDoOz jsqAtlz+ke+V7KXYUJQUVgGKud8Q71JtJQCOAcpA7L8lC5oKAaW/BKcdwwPRfdyIsUJE 4vtgjPgxa5KrXGKmqW4vRhC7JzbeEm6Y0274poiZ6bIJrHIhV12ofSmhFF5SCNzW+oBc J4IA== X-Gm-Message-State: AKS2vOxR2ZutI6sPJ3BJhDJNHwbvPTDJ9gSNvdIoXsWsYBEL5A4jDWqb pg4f1ur69Ryx7Q== X-Received: by 10.202.252.10 with SMTP id a10mr11239461oii.63.1497802383955; Sun, 18 Jun 2017 09:13:03 -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 s41sm4473985ots.54.2017.06.18.09.13.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Jun 2017 09:13:03 -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 09/11] rtlwifi: Add rx ampdu cfg for btcoexist. Date: Sun, 18 Jun 2017 11:12:47 -0500 Message-Id: <20170618161249.6146-10-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170618161249.6146-1-Larry.Finger@lwfinger.net> References: <20170618161249.6146-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 If RX ampdu is too long, BT will have less time. Signed-off-by: Ping-Ke Shih Signed-off-by: Larry Finger Cc: Yan-Hsuan Chuang Cc: Birming Chiu Cc: Shaofu Cc: Steven Ting --- drivers/net/wireless/realtek/rtlwifi/base.c | 27 ++++++++++++++++++++++ drivers/net/wireless/realtek/rtlwifi/base.h | 1 + .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 16 +++++++++++-- .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 12 ++++++++++ .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.h | 2 ++ drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 ++ 6 files changed, 58 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c index 897ec3cfa8c8..c6fef54f6543 100644 --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -1582,6 +1582,7 @@ int rtl_rx_agg_start(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_tid_data *tid_data; struct rtl_sta_info *sta_entry = NULL; + u8 reject_agg; if (sta == NULL) return -EINVAL; @@ -1589,6 +1590,14 @@ int rtl_rx_agg_start(struct ieee80211_hw *hw, if (unlikely(tid >= MAX_TID_COUNT)) return -EINVAL; + if (rtlpriv->cfg->ops->get_btc_status()) { + rtlpriv->btcoexist.btc_ops->btc_get_ampdu_cfg(rtlpriv, + &reject_agg, + NULL, NULL); + if (reject_agg) + return -EINVAL; + } + sta_entry = (struct rtl_sta_info *)sta->drv_priv; if (!sta_entry) return -ENXIO; @@ -1643,6 +1652,24 @@ int rtl_tx_agg_oper(struct ieee80211_hw *hw, return 0; } +void rtl_rx_ampdu_apply(struct rtl_priv *rtlpriv) +{ + struct rtl_btc_ops *btc_ops = rtlpriv->btcoexist.btc_ops; + u8 reject_agg, ctrl_agg_size = 0, agg_size; + + if (rtlpriv->cfg->ops->get_btc_status()) + btc_ops->btc_get_ampdu_cfg(rtlpriv, &reject_agg, + &ctrl_agg_size, &agg_size); + + RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, + "Set RX AMPDU: coex - reject=%d, ctrl_agg_size=%d, size=%d", + reject_agg, ctrl_agg_size, agg_size); + + rtlpriv->hw->max_rx_aggregation_subframes = + (ctrl_agg_size ? agg_size : IEEE80211_MAX_AMPDU_BUF); +} +EXPORT_SYMBOL(rtl_rx_ampdu_apply); + /********************************************************* * * wq & timer callback functions diff --git a/drivers/net/wireless/realtek/rtlwifi/base.h b/drivers/net/wireless/realtek/rtlwifi/base.h index a619fc92a9c0..21fa4562f631 100644 --- a/drivers/net/wireless/realtek/rtlwifi/base.h +++ b/drivers/net/wireless/realtek/rtlwifi/base.h @@ -147,6 +147,7 @@ int rtl_rx_agg_start(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u16 tid); int rtl_rx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u16 tid); +void rtl_rx_ampdu_apply(struct rtl_priv *rtlpriv); void rtl_watchdog_wq_callback(void *data); void rtl_fwevt_wq_callback(void *data); void rtl_c2hcmd_wq_callback(void *data); diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c index 451039ac7b0a..226927a752f8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c @@ -272,14 +272,24 @@ static void halbtc_disable_low_power(struct btc_coexist *btcoexist, static void halbtc_aggregation_check(struct btc_coexist *btcoexist) { bool need_to_act = false; + static unsigned long pre_time; + unsigned long cur_time = 0; + struct rtl_priv *rtlpriv = btcoexist->adapter; /* To void continuous deleteBA=>addBA=>deleteBA=>addBA * This function is not allowed to continuous called * It can only be called after 8 seconds */ + cur_time = jiffies; + if (jiffies_to_msecs(cur_time - pre_time) <= 8000) { + /* over 8 seconds you can execute this function again. */ + return; + } + pre_time = cur_time; + if (btcoexist->bt_info.reject_agg_pkt) { - ;/* TODO: reject */ + need_to_act = true; btcoexist->bt_info.pre_reject_agg_pkt = btcoexist->bt_info.reject_agg_pkt; } else { @@ -304,8 +314,10 @@ static void halbtc_aggregation_check(struct btc_coexist *btcoexist) btcoexist->bt_info.pre_agg_buf_size = btcoexist->bt_info.agg_buf_size; } - } + if (need_to_act) + rtl_rx_ampdu_apply(rtlpriv); + } } static u32 halbtc_get_bt_patch_version(struct btc_coexist *btcoexist) diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c index 3b976dab712f..96c1ccbf70ac 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c @@ -46,6 +46,7 @@ static struct rtl_btc_ops rtl_btc_operation = { .btc_is_bt_disabled = rtl_btc_is_bt_disabled, .btc_special_packet_notify = rtl_btc_special_packet_notify, .btc_record_pwr_mode = rtl_btc_record_pwr_mode, + .btc_get_ampdu_cfg = rtl_btc_get_ampdu_cfg, }; void rtl_btc_record_pwr_mode(struct rtl_priv *rtlpriv, u8 *buf, u8 len) @@ -60,6 +61,17 @@ void rtl_btc_record_pwr_mode(struct rtl_priv *rtlpriv, u8 *buf, u8 len) memcpy(gl_bt_coexist.pwr_mode_val, buf, safe_len); } +void rtl_btc_get_ampdu_cfg(struct rtl_priv *rtlpriv, u8 *reject_agg, + u8 *ctrl_agg_size, u8 *agg_size) +{ + if (reject_agg) + *reject_agg = gl_bt_coexist.bt_info.reject_agg_pkt; + if (ctrl_agg_size) + *ctrl_agg_size = gl_bt_coexist.bt_info.bt_ctrl_agg_buf_size; + if (agg_size) + *agg_size = gl_bt_coexist.bt_info.agg_buf_size; +} + void rtl_btc_init_variables(struct rtl_priv *rtlpriv) { exhalbtc_initlize_variables(); diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h index 9eeb4fdeaec1..c1c32d685c5d 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h @@ -44,6 +44,8 @@ bool rtl_btc_is_disable_edca_turbo(struct rtl_priv *rtlpriv); bool rtl_btc_is_bt_disabled(struct rtl_priv *rtlpriv); void rtl_btc_special_packet_notify(struct rtl_priv *rtlpriv, u8 pkt_type); void rtl_btc_record_pwr_mode(struct rtl_priv *rtlpriv, u8 *buf, u8 len); +void rtl_btc_get_ampdu_cfg(struct rtl_priv *rtlpriv, u8 *reject_agg, + u8 *ctrl_agg_size, u8 *agg_size); struct rtl_btc_ops *rtl_btc_get_ops_pointer(void); diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index 41ebdb9d3627..0591adedce76 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -2561,6 +2561,8 @@ struct rtl_btc_ops { void (*btc_special_packet_notify)(struct rtl_priv *rtlpriv, u8 pkt_type); void (*btc_record_pwr_mode)(struct rtl_priv *rtlpriv, u8 *buf, u8 len); + void (*btc_get_ampdu_cfg)(struct rtl_priv *rtlpriv, u8 *reject_agg, + u8 *ctrl_agg_size, u8 *agg_size); }; struct proxim {