Skip to content

Commit

Permalink
rtlwifi: Add rx ampdu cfg for btcoexist.
Browse files Browse the repository at this point in the history
If RX ampdu is too long, BT will have less time.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
Ping-Ke Shih authored and Kalle Valo committed Jun 21, 2017
1 parent 54685f9 commit 2635664
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 2 deletions.
27 changes: 27 additions & 0 deletions drivers/net/wireless/realtek/rtlwifi/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1582,13 +1582,22 @@ 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;

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;
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/realtek/rtlwifi/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 14 additions & 2 deletions drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/realtek/rtlwifi/wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2635664

Please sign in to comment.