Skip to content

Commit

Permalink
Add support for configuring station kickout threshold
Browse files Browse the repository at this point in the history
Might help with connection stability in rough RF environments,
and/or when peer device is crappy.

Signed-off-by: Ben Greear <greearb@candelatech.com>
  • Loading branch information
greearb committed Jul 27, 2016
1 parent f994077 commit a1a9a05
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
10 changes: 10 additions & 0 deletions ath10k/core.c
Expand Up @@ -2286,9 +2286,18 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
if (ar->eeprom_overrides.max_txpower != 0xFFFF)
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_MAX_TXPOWER,
ar->eeprom_overrides.max_txpower);

if (ar->eeprom_overrides.rc_rate_max_per_thr)
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_RC_MAX_PER_THR,
ar->eeprom_overrides.rc_rate_max_per_thr);

if (ar->eeprom_overrides.tx_sta_bw_mask)
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_STA_TXBW_MASK,
ar->eeprom_overrides.tx_sta_bw_mask);

if (ar->eeprom_overrides.pdev_xretry_th)
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_PDEV_XRETRY_TH,
ar->eeprom_overrides.pdev_xretry_th);
}

return 0;
Expand Down Expand Up @@ -2594,6 +2603,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
return NULL;

ar->eeprom_overrides.max_txpower = 0xFFFF;
ar->sta_xretry_kickout_thresh = DEFAULT_ATH10K_KICKOUT_THRESHOLD;

ar->ath_common.priv = ar;
ar->ath_common.hw = ar->hw;
Expand Down
5 changes: 4 additions & 1 deletion ath10k/core.h
Expand Up @@ -54,7 +54,7 @@
#define ATH10K_MAX_NUM_MGMT_PENDING 128

/* number of failed packets (20 packets with 16 sw reties each) */
#define ATH10K_KICKOUT_THRESHOLD (20 * 16)
#define DEFAULT_ATH10K_KICKOUT_THRESHOLD (20 * 16)

/*
* Use insanely high numbers to make sure that the firmware implementation
Expand Down Expand Up @@ -986,6 +986,7 @@ struct ath10k {
/* protected by conf_mutex */
bool radar_enabled;
int num_started_vdevs;
u32 sta_xretry_kickout_thresh;

/* Protected by conf-mutex */
u8 cfg_tx_chainmask;
Expand Down Expand Up @@ -1109,8 +1110,10 @@ struct ath10k {
} bands[2];
u8 thresh62_ext;
u8 rc_rate_max_per_thr; /* Firmware rate-ctrl alg. tuning. */
u8 tx_sta_bw_mask; /* 0: all, 0x1: 20Mhz, 0x2 40Mhz, 0x4 80Mhz */
bool allow_ibss_amsdu;
u16 max_txpower;
u16 pdev_xretry_th; /* Max failed retries before wifi chip is reset, 10.1 firmware default is 0x40 */
} eeprom_overrides;

/* must be last */
Expand Down
21 changes: 21 additions & 0 deletions ath10k/debug.c
Expand Up @@ -2931,6 +2931,23 @@ static ssize_t ath10k_write_ct_special(struct file *file,
else if (id == SET_SPECIAL_ID_RC_MAX_PER_THR) {
ar->eeprom_overrides.rc_rate_max_per_thr = val;
}
else if (id == SET_SPECIAL_ID_STA_TXBW_MASK) {
/* Specify Station tx bandwidth mask (20, 40, 80Mhz). */
ar->eeprom_overrides.tx_sta_bw_mask = val;
ath10k_warn(ar, "Setting sta-tx-bw-mask to 0x%x\n", val);
}
else if (id == SET_SPECIAL_ID_PDEV_XRETRY_TH) {
/* Set the threshold for resetting phy due to failed retries, U16 */
ar->eeprom_overrides.pdev_xretry_th = val;
ath10k_warn(ar, "Setting pdev-xretry-th to 0x%x\n", val);
}
/* Below here are local driver hacks, and not passed directly to firmware. */
else if (id == 0x1001) {
/* Set station failed-transmit kickout threshold. */
ar->sta_xretry_kickout_thresh = val;
ath10k_warn(ar, "Setting ar sta-xretry-kickout-thresh to 0x%x\n", val);
goto unlock;
}
/* else, pass it through to firmware...but will not be stored locally, so
* won't survive through firmware reboots, etc.
*/
Expand Down Expand Up @@ -2966,6 +2983,10 @@ static ssize_t ath10k_read_ct_special(struct file *file,
"id: 5 Allow-AMSDU-IBSS, 1 enabled, 0 disabled, global setting.\n"
"id: 6 Max TX-Power, 0-65535: Latch max-tx-power, in 0.5 dbM Units.\n"
"id: 7 RC max PER Threshold: 0-256 (50 is default). Tune with Care.\n"
"id: 8 STA-TX-BW-MASK, 0: all, 0x1: 20Mhz, 0x2 40Mhz, 0x4 80Mhz \n"
"id: 9 pdev failed retry threshold, U16, 10.1 firmware default is 0x40\n"
"\nBelow here are not actually sent to firmware directly, but configure the driver.\n"
"id: 0x1001 set sta-kickout threshold due to tx-failures (0 means disable. Default is 20 * 16.)\n"
"\n";

return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
Expand Down
2 changes: 1 addition & 1 deletion ath10k/mac.c
Expand Up @@ -745,7 +745,7 @@ static int ath10k_mac_set_kickout(struct ath10k_vif *arvif)

param = ar->wmi.pdev_param->sta_kickout_th;
ret = ath10k_wmi_pdev_set_param(ar, param,
ATH10K_KICKOUT_THRESHOLD);
ar->sta_xretry_kickout_thresh);
if (ret) {
ath10k_warn(ar, "failed to set kickout threshold on vdev %i: %d\n",
arvif->vdev_id, ret);
Expand Down
5 changes: 5 additions & 0 deletions ath10k/wmi.h
Expand Up @@ -6462,6 +6462,11 @@ struct wmi_pdev_set_special_cmd {
* the rate-ctrl logic work better in crouded RF environments. Tune with
* care. I'm not sure than anything above 100 is meaningful.
*/
#define SET_SPECIAL_ID_STA_TXBW_MASK 8 /* Set the bandwidths that station vdevs can transmit on:
* 0: all, 0x1: 20Mhz, 0x2 40Mhz, 0x4 80Mhz
*/
#define SET_SPECIAL_ID_PDEV_XRETRY_TH 9 /* Set the threshold for resetting phy due to failed retries, U16 */

#define CT_CCA_TYPE_MIN0 0
#define CT_CCA_TYPE_MIN1 1
#define CT_CCA_TYPE_MIN2 2
Expand Down

0 comments on commit a1a9a05

Please sign in to comment.