Skip to content

Commit

Permalink
Support rx stats in 4.9 kernel, disable su-beamform in 4.9, 4.13
Browse files Browse the repository at this point in the history
  • Loading branch information
greearb committed Feb 21, 2018
1 parent 3d72607 commit 7f3e9fd
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 47 deletions.
9 changes: 9 additions & 0 deletions ath10k-4.13/core.c
Expand Up @@ -1209,6 +1209,12 @@ static int ath10k_fetch_fwcfg_file(struct ath10k *ar)
ar->fwcfg.flags |= ATH10K_FWCFG_NOBEAMFORM_MU;
}
}
else if (strcasecmp(filename, "nobeamform_su") == 0) {
if (kstrtol(val, 0, &t) == 0) {
ar->fwcfg.nobeamform_su = t;
ar->fwcfg.flags |= ATH10K_FWCFG_NOBEAMFORM_SU;
}
}
else if (strcasecmp(filename, "rate_ctrl_objs") == 0) {
if (kstrtol(val, 0, &t) == 0) {
ar->fwcfg.rate_ctrl_objs = t;
Expand Down Expand Up @@ -2382,6 +2388,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)

ar->request_nohwcrypt = ath10k_modparam_nohwcrypt;
ar->request_nobeamform_mu = ath10k_modparam_nobeamform_mu;
ar->request_nobeamform_su = ath10k_modparam_nobeamform_su;
ar->num_ratectrl_objs = ath10k_modparam_target_num_rate_ctrl_objs_ct;
ar->eeprom_regdom = _modparam_override_eeprom_regdomain;

Expand All @@ -2396,6 +2403,8 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
ar->request_nohwcrypt = ar->fwcfg.nohwcrypt;
if (ar->fwcfg.flags & ATH10K_FWCFG_NOBEAMFORM_MU)
ar->request_nobeamform_mu = ar->fwcfg.nobeamform_mu;
if (ar->fwcfg.flags & ATH10K_FWCFG_NOBEAMFORM_SU)
ar->request_nobeamform_su = ar->fwcfg.nobeamform_su;
if (ar->fwcfg.flags & ATH10K_FWCFG_RATE_CTRL_OBJS)
ar->num_ratectrl_objs = ar->fwcfg.rate_ctrl_objs;
if (ar->fwcfg.flags & ATH10K_FWCFG_TX_DESC)
Expand Down
3 changes: 3 additions & 0 deletions ath10k-4.13/core.h
Expand Up @@ -1006,6 +1006,7 @@ struct ath10k {
#define ATH10K_FWCFG_BMISS_VDEVS (1<<12)
#define ATH10K_FWCFG_MAX_AMSDUS (1<<13)
#define ATH10K_FWCFG_NOBEAMFORM_MU (1<<14)
#define ATH10K_FWCFG_NOBEAMFORM_SU (1<<15)

u32 flags; /* let us know which fields have been set */
char calname[100];
Expand All @@ -1017,6 +1018,7 @@ struct ath10k {
u32 peers;
u32 nohwcrypt;
u32 nobeamform_mu;
u32 nobeamform_su;
u32 rate_ctrl_objs;
u32 tx_desc; /* max_num_pending_tx descriptors */
u32 max_nss; /* max_spatial_stream */
Expand Down Expand Up @@ -1126,6 +1128,7 @@ struct ath10k {
int num_tids;
bool request_nohwcrypt; /* desired setting */
bool request_nobeamform_mu;
bool request_nobeamform_su;
u32 num_ratectrl_objs;
u32 skid_limit;
u32 bmiss_offload_max_vdev;
Expand Down
4 changes: 4 additions & 0 deletions ath10k-4.13/mac.c
Expand Up @@ -219,6 +219,10 @@ int ath10k_modparam_nobeamform_mu;
module_param_named(nobeamform_mu, ath10k_modparam_nobeamform_mu, int, 0444);
MODULE_PARM_DESC(nobeamform_mu, "Disable TX/RX MU Beamforming capabilities");

int ath10k_modparam_nobeamform_su;
module_param_named(nobeamform_su, ath10k_modparam_nobeamform_su, int, 0444);
MODULE_PARM_DESC(nobeamform_su, "Disable TX/RX SU Beamforming capabilities");

int ath10k_modparam_target_num_vdevs_ct = DEF_TARGET_10X_NUM_VDEVS_CT;
module_param_named(num_vdevs_ct, ath10k_modparam_target_num_vdevs_ct, int, 0444);
MODULE_PARM_DESC(num_vdevs_ct, "Maximum vdevs to request from firmware");
Expand Down
1 change: 1 addition & 0 deletions ath10k-4.13/mac.h
Expand Up @@ -28,6 +28,7 @@ enum wmi_tlv_tx_pause_action;

extern int ath10k_modparam_nohwcrypt;
extern int ath10k_modparam_nobeamform_mu;
extern int ath10k_modparam_nobeamform_su;
extern int ath10k_modparam_target_num_vdevs_ct;
extern int ath10k_modparam_target_num_peers_ct;
extern int ath10k_modparam_target_num_msdu_desc_ct;
Expand Down
3 changes: 3 additions & 0 deletions ath10k-4.13/wmi.c
Expand Up @@ -4984,6 +4984,9 @@ static void ath10k_wmi_event_service_ready_work(struct work_struct *work)
if (ar->request_nobeamform_mu)
ar->vht_cap_info &= ~(IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE);

if (ar->request_nobeamform_su)
ar->vht_cap_info &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);

if (ar->num_rf_chains > ar->max_spatial_stream) {
ath10k_warn(ar, "hardware advertises support for more spatial streams than it should (%d > %d)\n",
ar->num_rf_chains, ar->max_spatial_stream);
Expand Down
18 changes: 18 additions & 0 deletions ath10k-4.9/core.c
Expand Up @@ -1117,6 +1117,18 @@ static int ath10k_fetch_fwcfg_file(struct ath10k *ar)
ar->fwcfg.flags |= ATH10K_FWCFG_NOHWCRYPT;
}
}
else if (strcasecmp(filename, "nobeamform_mu") == 0) {
if (kstrtol(val, 0, &t) == 0) {
ar->fwcfg.nobeamform_mu = t;
ar->fwcfg.flags |= ATH10K_FWCFG_NOBEAMFORM_MU;
}
}
else if (strcasecmp(filename, "nobeamform_su") == 0) {
if (kstrtol(val, 0, &t) == 0) {
ar->fwcfg.nobeamform_su = t;
ar->fwcfg.flags |= ATH10K_FWCFG_NOBEAMFORM_SU;
}
}
else if (strcasecmp(filename, "rate_ctrl_objs") == 0) {
if (kstrtol(val, 0, &t) == 0) {
ar->fwcfg.rate_ctrl_objs = t;
Expand Down Expand Up @@ -2237,6 +2249,8 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
}

ar->request_nohwcrypt = ath10k_modparam_nohwcrypt;
ar->request_nobeamform_mu = ath10k_modparam_nobeamform_mu;
ar->request_nobeamform_su = ath10k_modparam_nobeamform_su;
ar->num_ratectrl_objs = ath10k_modparam_target_num_rate_ctrl_objs_ct;
ar->eeprom_regdom = _modparam_override_eeprom_regdomain;

Expand All @@ -2249,6 +2263,10 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
ar->max_num_stations = ar->fwcfg.stations;
if (ar->fwcfg.flags & ATH10K_FWCFG_NOHWCRYPT)
ar->request_nohwcrypt = ar->fwcfg.nohwcrypt;
if (ar->fwcfg.flags & ATH10K_FWCFG_NOBEAMFORM_MU)
ar->request_nobeamform_mu = ar->fwcfg.nobeamform_mu;
if (ar->fwcfg.flags & ATH10K_FWCFG_NOBEAMFORM_SU)
ar->request_nobeamform_su = ar->fwcfg.nobeamform_su;
if (ar->fwcfg.flags & ATH10K_FWCFG_RATE_CTRL_OBJS)
ar->num_ratectrl_objs = ar->fwcfg.rate_ctrl_objs;
if (ar->fwcfg.flags & ATH10K_FWCFG_TX_DESC)
Expand Down
10 changes: 10 additions & 0 deletions ath10k-4.9/core.h
Expand Up @@ -531,6 +531,10 @@ struct ath10k_debug {

/* These counters are kept in software. */
u64 rx_bytes; /* counter, total received bytes */
u32 rx_drop_unchain_oom; /* AMSDU Dropped due to un-chain OOM case */
u32 rx_drop_decap_non_raw_chained;
u32 rx_drop_no_freq;
u32 rx_drop_cac_running;

u32 tx_ok; /* counter, OK tx status count. */
u32 tx_noack; /* counter, no-ack tx status count. */
Expand Down Expand Up @@ -959,6 +963,8 @@ struct ath10k {
#define ATH10K_FWCFG_REGDOM (1<<11)
#define ATH10K_FWCFG_BMISS_VDEVS (1<<12)
#define ATH10K_FWCFG_MAX_AMSDUS (1<<13)
#define ATH10K_FWCFG_NOBEAMFORM_MU (1<<14)
#define ATH10K_FWCFG_NOBEAMFORM_SU (1<<15)

u32 flags; /* let us know which fields have been set */
char calname[100];
Expand All @@ -969,6 +975,8 @@ struct ath10k {
u32 stations;
u32 peers;
u32 nohwcrypt;
u32 nobeamform_mu;
u32 nobeamform_su;
u32 rate_ctrl_objs;
u32 tx_desc; /* max_num_pending_tx descriptors */
u32 max_nss; /* max_spatial_stream */
Expand Down Expand Up @@ -1075,6 +1083,8 @@ struct ath10k {
int num_active_peers;
int num_tids;
bool request_nohwcrypt; /* desired setting */
bool request_nobeamform_mu;
bool request_nobeamform_su;
u32 num_ratectrl_objs;
u32 skid_limit;
u32 bmiss_offload_max_vdev;
Expand Down
46 changes: 45 additions & 1 deletion ath10k-4.9/debug.c
Expand Up @@ -915,6 +915,18 @@ static ssize_t ath10k_read_rx_reorder_stats(struct file *file, char __user *user
PRINT_MY_STATS(rx_flush_ind); // Flushed these due to timeout, etc.
PRINT_MY_STATS(rx_flush_ie_add); // Flushed these due to timeout, etc

/* Wave-2 specific */
PRINT_MY_STATS(rx_mesh_wrong_dest);
PRINT_MY_STATS(rx_mesh_filter_ra);
PRINT_MY_STATS(rx_mesh_filter_fromds);
PRINT_MY_STATS(rx_mesh_filter_tods);
PRINT_MY_STATS(rx_mesh_filter_nods);
PRINT_MY_STATS(rx_radar_fft_war);
PRINT_MY_STATS(rx_drop_encrypt_required);
PRINT_MY_STATS(rx_mpdu_tid_err);
PRINT_MY_STATS(rx_ba_statemachine_err);
PRINT_MY_STATS(rx_drop_replay);

if (len > buf_len)
len = buf_len;

Expand Down Expand Up @@ -1479,7 +1491,7 @@ static void ath10k_dbg_drop_dbg_buffer(struct ath10k *ar)
{
/* Find next message boundary */
u32 lg_hdr;
int acnt;
unsigned int acnt;
int tail_idx = ar->debug.dbglog_entry_data.tail_idx;
int h_idx = (tail_idx + 1) % ATH10K_DBGLOG_DATA_LEN;

Expand Down Expand Up @@ -1509,9 +1521,33 @@ void ath10k_dbg_save_fw_dbg_buffer(struct ath10k *ar, __le32 *buffer, int len)
{
int i;
int z;
u32 lg_hdr = 0;
unsigned int acnt = 0;

lockdep_assert_held(&ar->data_lock);

/* Make sure input is sane */
i = 0;
while (i < len) {
lg_hdr = le32_to_cpu(buffer[i + 1]);
acnt = (lg_hdr & DBGLOG_NUM_ARGS_MASK) >> DBGLOG_NUM_ARGS_OFFSET;

if (acnt > DBGLOG_NUM_ARGS_MAX) {
bad:
ath10k_err(ar, "Invalid fw-dbg-buffer, hdr-at[%i], len: %d arg-len: %d hdr: 0x%x\n",
i + 1, len, acnt, lg_hdr);
for (i = 0; i<len; i++) {
ath10k_err(ar, "buffer[%i] 0x%x\n", i, le32_to_cpu(buffer[i]));
}
return;
}
i += 2 + acnt;
}

/* Some trailing garbage? */
if (i != len)
goto bad;

z = ar->debug.dbglog_entry_data.head_idx;

/* Don't save any new logs until user-space reads this. */
Expand Down Expand Up @@ -2211,6 +2247,10 @@ static const char ath10k_gstrings_stats[][ETH_GSTRING_LEN] = {
"tx_bytes_to_fw", /* sent to firmware, counts all failures */
"rx_pkts_nic", /* From firmware...maybe should be from driver for symmetry? */
"rx_bytes_nic", /* from driver, firmware does not keep this stat. */
"rx_drop_unchain_oom", /* Dropped due to OOM pressure in unchain_msdu path */
"rx_drop_decap_non_raw_chained",
"rx_drop_no_freq",
"rx_drop_cac_running",
"d_noise_floor",
"d_cycle_count", /* this is duty cycle counter, basically channel-time. 88MHz clock */
"d_tx_cycle_count", /* tx cycle count */
Expand Down Expand Up @@ -2329,6 +2369,10 @@ void ath10k_debug_get_et_stats(struct ieee80211_hw *hw,
data[i++] = ar->debug.tx_bytes;
data[i++] = pdev_stats->htt_mpdus;
data[i++] = ar->debug.rx_bytes;
data[i++] = ar->debug.rx_drop_unchain_oom;
data[i++] = ar->debug.rx_drop_decap_non_raw_chained;
data[i++] = ar->debug.rx_drop_no_freq;
data[i++] = ar->debug.rx_drop_cac_running;
data[i++] = pdev_stats->ch_noise_floor;
data[i++] = pdev_stats->cycle_count;
data[i++] = pdev_stats->tx_frame_count;
Expand Down
9 changes: 6 additions & 3 deletions ath10k-4.9/htt_rx.c
Expand Up @@ -1469,7 +1469,7 @@ static void ath10k_htt_rx_h_deliver(struct ath10k *ar,
}
}

static int ath10k_unchain_msdu(struct sk_buff_head *amsdu)
static int ath10k_unchain_msdu(struct ath10k *ar, struct sk_buff_head *amsdu)
{
struct sk_buff *skb, *first;
int space;
Expand All @@ -1491,10 +1491,10 @@ static int ath10k_unchain_msdu(struct sk_buff_head *amsdu)
space = total_len - skb_tailroom(first);
if ((space > 0) &&
(pskb_expand_head(first, 0, space, GFP_ATOMIC) < 0)) {
/* TODO: bump some rx-oom error stat */
/* put it back together so we can free the
* whole list at once.
*/
ar->debug.rx_drop_unchain_oom++;
__skb_queue_head(amsdu, first);
return -1;
}
Expand Down Expand Up @@ -1535,11 +1535,12 @@ static void ath10k_htt_rx_h_unchain(struct ath10k *ar,
*/
if (decap != RX_MSDU_DECAP_RAW ||
skb_queue_len(amsdu) != 1 + rxd->frag_info.ring2_more_count) {
ar->debug.rx_drop_decap_non_raw_chained++;
__skb_queue_purge(amsdu);
return;
}

ath10k_unchain_msdu(amsdu);
ath10k_unchain_msdu(ar, amsdu);
}

static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
Expand All @@ -1552,11 +1553,13 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,

if (!rx_status->freq) {
ath10k_warn(ar, "no channel configured; ignoring frame(s)!\n");
ar->debug.rx_drop_no_freq++;
return false;
}

if (test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) {
ath10k_dbg(ar, ATH10K_DBG_HTT, "htt rx cac running\n");
ar->debug.rx_drop_cac_running++;
return false;
}

Expand Down
9 changes: 9 additions & 0 deletions ath10k-4.9/mac.c
Expand Up @@ -213,6 +213,15 @@ int ath10k_mac_ext_resource_config(struct ath10k *ar, u32 val)
int ath10k_modparam_nohwcrypt;
module_param_named(nohwcrypt, ath10k_modparam_nohwcrypt, int, 0444);
MODULE_PARM_DESC(nohwcrypt, "Disable hardware rx decrypt feature");

int ath10k_modparam_nobeamform_mu;
module_param_named(nobeamform_mu, ath10k_modparam_nobeamform_mu, int, 0444);
MODULE_PARM_DESC(nobeamform_mu, "Disable TX/RX MU Beamforming capabilities");

int ath10k_modparam_nobeamform_su;
module_param_named(nobeamform_su, ath10k_modparam_nobeamform_su, int, 0444);
MODULE_PARM_DESC(nobeamform_su, "Disable TX/RX SU Beamforming capabilities");

int ath10k_modparam_target_num_vdevs_ct = DEF_TARGET_10X_NUM_VDEVS_CT;
module_param_named(num_vdevs_ct, ath10k_modparam_target_num_vdevs_ct, int, 0444);
MODULE_PARM_DESC(num_vdevs_ct, "Maximum vdevs to request from firmware");
Expand Down
2 changes: 2 additions & 0 deletions ath10k-4.9/mac.h
Expand Up @@ -27,6 +27,8 @@ enum wmi_tlv_tx_pause_id;
enum wmi_tlv_tx_pause_action;

extern int ath10k_modparam_nohwcrypt;
extern int ath10k_modparam_nobeamform_mu;
extern int ath10k_modparam_nobeamform_su;
extern int ath10k_modparam_target_num_vdevs_ct;
extern int ath10k_modparam_target_num_peers_ct;
extern int ath10k_modparam_target_num_msdu_desc_ct;
Expand Down
6 changes: 6 additions & 0 deletions ath10k-4.9/wmi.c
Expand Up @@ -4909,6 +4909,12 @@ static void ath10k_wmi_event_service_ready_work(struct work_struct *work)
ar->request_nohwcrypt)
ar->vht_cap_info &= ~IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;

if (ar->request_nobeamform_mu)
ar->vht_cap_info &= ~(IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE);

if (ar->request_nobeamform_su)
ar->vht_cap_info &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);

if (ar->num_rf_chains > ar->max_spatial_stream) {
ath10k_warn(ar, "hardware advertises support for more spatial streams than it should (%d > %d)\n",
ar->num_rf_chains, ar->max_spatial_stream);
Expand Down

0 comments on commit 7f3e9fd

Please sign in to comment.