M7350v3_en_gpl

This commit is contained in:
T
2024-09-09 08:55:19 +00:00
parent 801e6d2ad8
commit 2d95e8761a
2791 changed files with 89608 additions and 390711 deletions

View File

@ -31,8 +31,6 @@
#include "testmode.h"
#include "wmiconfig.h"
int cfg80211_ap_start_failure_notify(struct net_device *dev);
#define RATETAB_ENT(_rate, _rateid, _flags) { \
.bitrate = (_rate), \
.flags = (_flags), \
@ -2824,7 +2822,7 @@ int ath6kl_restore_htcap(struct ath6kl_vif *vif)
htcap->cap_info = 0;
htcap->ht_enable = wiphy->bands[band]->ht_cap.ht_supported;
htcap->require_ht = 0;
htcap->ext_chan = 0;
htcap->ext_ch_mask = 0;
ret = ath6kl_set_htcap(vif, band,
wiphy->bands[band]->ht_cap.ht_supported);
if (ret)
@ -3039,20 +3037,19 @@ u8 ath6kl_get_ht40_ext_ch_mask(struct cfg80211_ap_settings *info,
{
u8 is_sec_ch = 0;
u8 mask_sec_ch = 0;
struct ieee80211_ht_operation *ht_op_ie = NULL;
const u8 *ie = cfg80211_find_ie(WLAN_EID_HT_OPERATION,
info->beacon.tail, info->beacon.tail_len);
if (!ie)
struct ieee80211_ht_operation *ht_op_ie =
(struct ieee80211_ht_operation *)(cfg80211_find_ie(WLAN_EID_HT_OPERATION,
info->beacon.tail,
info->beacon.tail_len) + 2);
if (!ht_op_ie || !ht_op_ie->ht_param)
return mask_sec_ch;
ht_op_ie = (struct ieee80211_ht_operation *)(ie + 2);
if (ht_op_ie->ht_param & IEEE80211_HT_PARAM_CHA_SEC_ABOVE ||
ht_op_ie->ht_param & IEEE80211_HT_PARAM_CHA_SEC_BELOW)
is_sec_ch = 1;
if (!is_sec_ch && (cap_info & IEEE80211_HT_CAP_SUP_WIDTH_20_40))
mask_sec_ch = IEEE80211_HT_CAP_EXT_CH_MASK;
mask_sec_ch = 1;
else
mask_sec_ch = 0;
@ -3139,37 +3136,6 @@ u32 ath6kl_get_chmask_for_acstype(struct ath6kl_vif *vif, u32 ch) {
return chan_mask;
}
static struct ath6kl *gAr;
static void ath6kl_ap_check_work(struct work_struct *work)
{
struct ath6kl_vif *vif = ath6kl_vif_first(gAr);
int tx_power_check = -1;
int tx_power = -1;
int ap_status_abnormal = 0;
if(!(test_bit(CONNECTED, &vif->flags) && netif_running(vif->ndev))){
/* ap status abnormal */
ath6kl_warn("ap running status abnormal.\n");
ap_status_abnormal = 1;
}
/* Check if tx power is ok */
tx_power_check = ath6kl_cfg80211_get_txpower(gAr->wiphy, &tx_power);
ath6kl_info("tx power=%d dBm", tx_power);
if (!(tx_power_check == 0 && tx_power > 0)) {
/* tx power abnormal */
ath6kl_warn("tx power[%d dBm] abnormal.\n", tx_power);
ap_status_abnormal = 1;
}
if (ap_status_abnormal) {
ath6kl_warn("notify upper's to restart...\n");
cfg80211_ap_start_failure_notify(vif->ndev);
}
}
static DECLARE_DELAYED_WORK(ap_check_work, ath6kl_ap_check_work);
static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_ap_settings *info)
{
@ -3188,6 +3154,7 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_channel *tmp_channel = NULL;
u32 max_num_sta = 0;
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s:\n", __func__);
if (!ath6kl_cfg80211_ready(vif))
@ -3197,7 +3164,8 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
return -EOPNOTSUPP;
list_for_each_entry(tmp_vif, &ar->vif_list, list)
if (tmp_vif->nw_type == AP_NETWORK)
if ((tmp_vif->nw_type == AP_NETWORK) &&
test_bit(CONNECTED, &tmp_vif->flags))
max_num_sta += tmp_vif->max_num_sta;
if (!info->max_num_sta || max_num_sta + info->max_num_sta >
@ -3507,9 +3475,8 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
if(info->ht_cap_info) {
htcap->cap_info = info->ht_cap_info;
htcap->ext_chan = ath6kl_get_ht40_ext_ch_mask(info,
htcap->ext_ch_mask = ath6kl_get_ht40_ext_ch_mask(info,
htcap->cap_info);
htcap->ext_chan |= info->ht40_sec_choff;
} else {
if (band != IEEE80211_BAND_2GHZ) {
htcap->cap_info = ath6kl_ap_a_htcap;
@ -3568,10 +3535,6 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
if (!(cfg80211_find_ie(WLAN_EID_COUNTRY, info->beacon.tail, info->beacon.tail_len)))
ath6kl_wmi_set_regdomain_cmd(ar->wmi, vif->fw_vif_idx, WMI_DISABLE_REGULATORY_CODE);
/* schedule a delay work to check the interface status */
gAr = ar;
schedule_delayed_work(&ap_check_work, 5 * HZ);
return 0;
}
@ -3599,13 +3562,6 @@ static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev)
if (vif->nw_type != AP_NETWORK)
return -EOPNOTSUPP;
ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx);
clear_bit(CONNECTED, &vif->flags);
vif->prwise_crypto = NONE_CRYPT;
vif->max_num_sta = 0;
vif->ap_hold_conn = 0;
list_for_each_entry(vif_tmp, &ar->vif_list, list) {
if (vif_tmp->nw_type == AP_NETWORK) {
if (vif_tmp->ap_hold_conn) {
@ -3623,6 +3579,15 @@ static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev)
}
}
if (!test_bit(CONNECTED, &vif->flags))
return -ENOTCONN;
ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx);
clear_bit(CONNECTED, &vif->flags);
vif->prwise_crypto = NONE_CRYPT;
vif->max_num_sta = 0;
/* Restore ht setting in firmware */
return ath6kl_restore_htcap(vif);
}
@ -4055,22 +4020,6 @@ static int ath6kl_set_mac_acl(struct wiphy *wiphy,
int i, err;
static const u8 zero_mac[ETH_ALEN] = { 0 };
/* Reset the acl list */
err = ath6kl_wmi_set_acl_list(ar->wmi, vif->fw_vif_idx, 0, zero_mac, 0,
acl_info->acl_policy,
WMI_ACL_RESET_MAC_ADDR);
if (err)
return err;
if (!acl_info->n_acl_entries) {
err = ath6kl_wmi_set_acl_policy(ar->wmi, vif->fw_vif_idx,
NL80211_ACL_POLICY_DISABLE);
if (err < 0)
return err;
return 0;
}
memset(&(vif->ap_acl_list),0,sizeof(struct wmi_ap_acl_list));
#ifndef CONFIG_ACL_BLWL_MAC
/* Set the acl policy */
err = ath6kl_wmi_set_acl_policy(ar->wmi, vif->fw_vif_idx,
@ -4078,6 +4027,11 @@ static int ath6kl_set_mac_acl(struct wiphy *wiphy,
if (err < 0)
return err;
#endif
/* Reset the acl list */
err = ath6kl_wmi_set_acl_list(ar->wmi, vif->fw_vif_idx, 0, zero_mac, 0,
acl_info->acl_policy, WMI_ACL_RESET_MAC_ADDR);
if (err)
return err;
for (i = 0; i < acl_info->n_acl_entries; i++) {
err = ath6kl_wmi_set_acl_list(ar->wmi, vif->fw_vif_idx, i,
@ -4087,13 +4041,6 @@ static int ath6kl_set_mac_acl(struct wiphy *wiphy,
if (err)
return err;
}
err = ath6kl_wmi_set_acl_list(ar->wmi, vif->fw_vif_idx, 0,
acl_info->mac_addrs[0].addr,
acl_info->mac_addrs[0].wild,
acl_info->acl_policy, WMI_ACL_END_MAC_LIST);
if (err)
return err;
#ifdef CONFIG_ACL_BLWL_MAC
/*
@ -4212,6 +4159,7 @@ void ath6kl_cfg80211_stop(struct ath6kl_vif *vif)
ath6kl_lte_coex_update_wlan_data(vif, 0);
clear_bit(CONNECTED, &vif->flags);
clear_bit(CONNECT_PEND, &vif->flags);
vif->max_num_sta = 0;
/* Stop netdev queues, needed during recovery */
netif_stop_queue(vif->ndev);
netif_carrier_off(vif->ndev);

View File

@ -32,12 +32,10 @@ unsigned int debug_mask;
static unsigned int wow_mode;
static unsigned int ath6kl_p2p;
static unsigned int devmode = ATH6KL_DEFAULT_DEV_MODE;
unsigned int debug_quirks = ATH6KL_DEF_DEBUG_QUIRKS;
static unsigned int debug_quirks = ATH6KL_DEF_DEBUG_QUIRKS;
static unsigned int mcc_adj_ch_spacing = ATH6KL_DEF_MCC_ADJ_CH_SPACING;
static unsigned int heart_beat_poll;
static unsigned int lte_margin = ATH6KL_DEF_LTE_MARGIN;
static unsigned int enable_ani = 0;
static unsigned int reg_hint = 1;
module_param(debug_mask, uint, 0644);
module_param(wow_mode, uint, 0644);
@ -47,20 +45,9 @@ module_param(devmode, uint, 0644);
module_param(mcc_adj_ch_spacing, uint, 0644);
module_param(heart_beat_poll, uint, 0644);
module_param(lte_margin, uint, 0644);
module_param(enable_ani, uint, 0644);
module_param(reg_hint, uint, 0644);
EXPORT_SYMBOL(debug_quirks);
struct ath6kl_fw_err_recovery *fw_recovery;
int cfg80211_ap_fw_error_notify(struct wiphy *wy);
int ath6kl_use_regulatory_hint(void)
{
return !!reg_hint;
}
EXPORT_SYMBOL(ath6kl_use_regulatory_hint);
void ath6kl_core_tx_complete(struct ath6kl *ar, struct sk_buff *skb)
{
ath6kl_htc_tx_complete(ar, skb);
@ -135,12 +122,8 @@ void ath6kl_recovery_work(struct work_struct *work)
void ath6kl_recovery_err_notify(struct ath6kl *ar, enum ath6kl_fw_err reason)
{
if (!ath6kl_debug_quirks_any(ar, ATH6KL_MODULE_FW_ERROR_RECOVERY)) {
ath6kl_info("Fw error detected, reason :: %d notify hostapd\n",
reason);
cfg80211_ap_fw_error_notify(ar->wiphy);
if (!ath6kl_debug_quirks_any(ar, ATH6KL_MODULE_FW_ERROR_RECOVERY))
return;
}
if (!test_bit(WMI_READY, &ar->flag))
return;
@ -364,7 +347,6 @@ int ath6kl_core_init(struct ath6kl *ar, enum ath6kl_htc_type htc_type)
ath6kl_cookie_init(ar);
ar->mcc_adj_ch_spacing = mcc_adj_ch_spacing;
ar->enable_ani = enable_ani;
ar->conf_flags = ATH6KL_CONF_IGNORE_ERP_BARKER |
ATH6KL_CONF_ENABLE_11N | ATH6KL_CONF_ENABLE_TX_BURST;

View File

@ -58,36 +58,6 @@
#define ATH6KL_MCC_FLOWCTRL_NULL_CONNID (0xFF)
#define ATH6KL_MCC_FLOWCTRL_RECYCLE_LIMIT (10)
#define BDATA_SELF_BIN_PATH "/misc/bdata_self.bin"
#define BDATA_SELF_BIN_PATH_FT_MODE "/lib/firmware/ath6k/AR6004/hw3.0/bdata_self.bin"
#define CAL_DATA_PATH "/misc/calData"
#define CAL_DATA_PATH_FT_MODE "/lib/firmware/ath6k/AR6004/hw3.0/calData"
#define CAL_DATA_NUM 22 /* 2 chain: 3@2.4G, 8@5G */
#define CAL_DATA_STR_LEN 4 /* pwr delt can't > 10 or < -10, so max len is 3, eg: -90 */
#define CAL_DATA_MAX_INT 100 /* pwr delt can't > 10 or < -10 */
/* For 2.4G chain0 */
#define OFFSE_REF_POWER_G_0_0 0x0198
#define OFFSE_REF_POWER_G_0_3 0x01CE
/* For 2.4G chain1 */
#define OFFSE_REF_POWER_G_1_0 0x0270
#define OFFSE_REF_POWER_G_1_3 0x02A6
/* For 5G chain0 */
#define OFFSE_REF_POWER_A_0_0 0x06DC
#define OFFSE_REF_POWER_A_0_8 0x076C
/* For 5G chain1 */
#define OFFSE_REF_POWER_A_1_0 0x088C
#define OFFSE_REF_POWER_A_1_8 0x091C
struct ath6kl_fw_board_self {
u8 *fw_board;
size_t fw_board_len;
};
#define BDATA_CHECKSUM_OFFSET 4
#define BDATA_MAC_ADDR_OFFSET 8
@ -678,7 +648,7 @@ struct ath6kl_htcap {
u8 ampdu_factor;
unsigned short cap_info;
bool require_ht;
u8 ext_chan;
u8 ext_ch_mask;
};
/*
@ -1051,7 +1021,6 @@ struct ath6kl {
u16 pas_chdwell_time;
u32 bootstrap_mode;
u8 lte_margin;
bool enable_ani;
};
@ -1170,7 +1139,6 @@ static inline u32 ath6kl_get_hi_item_addr(struct ath6kl *ar,
return addr;
}
int ath6kl_use_regulatory_hint(void);
int ath6kl_configure_target(struct ath6kl *ar);
void ath6kl_detect_error(unsigned long ptr);
void disconnect_timer_handler(unsigned long ptr);

View File

@ -41,8 +41,6 @@ static u32 refclk_hz;
module_param(ath6kl_wifi_mac, charp, 0000);
module_param(refclk_hz, uint, 0644);
extern unsigned int debug_mask;
static const struct ath6kl_hw hw_list[] = {
{
.id = AR6003_HW_2_0_VERSION,
@ -875,271 +873,6 @@ static bool check_device_tree(struct ath6kl *ar)
}
#endif /* CONFIG_OF */
static int compose_bdata_self_bin(struct ath6kl *ar, const char *filename)
{
int ret = 0;
struct ath6kl_fw_board_self board_self;
struct file *filp = (struct file *)-ENOENT;
mm_segment_t oldfs;
oldfs = get_fs();
set_fs(KERNEL_DS);
filp = filp_open(filename, O_RDONLY, 0);
if (IS_ERR(filp) || (NULL == filp))
{
ath6kl_err("File %s open failed! Ignore the composition!\n", filename);
if (!IS_ERR(filp))
filp_close(filp, NULL);
set_fs(oldfs);
return -1;
}
filp_close(filp, NULL);
set_fs(oldfs);
memset(&board_self, 0, sizeof(struct ath6kl_fw_board_self));
ret = ath6kl_get_fw(ar, filename, &board_self.fw_board, &board_self.fw_board_len);
if (ret == 0)
{
ath6kl_info("Got self board file %s\n", filename);
/* replace [2G_0_0, 2G_0_3) */
memcpy(&ar->fw_board[OFFSE_REF_POWER_G_0_0], &board_self.fw_board[OFFSE_REF_POWER_G_0_0],
OFFSE_REF_POWER_G_0_3 - OFFSE_REF_POWER_G_0_0);
/* replace [2G_1_0, 2G_1_3) */
memcpy(&ar->fw_board[OFFSE_REF_POWER_G_1_0], &board_self.fw_board[OFFSE_REF_POWER_G_1_0],
OFFSE_REF_POWER_G_1_3 - OFFSE_REF_POWER_G_1_0);
/* replace [5G_0_0, 5G_0_8) */
memcpy(&ar->fw_board[OFFSE_REF_POWER_A_0_0], &board_self.fw_board[OFFSE_REF_POWER_A_0_0],
OFFSE_REF_POWER_A_0_8 - OFFSE_REF_POWER_A_0_0);
/* replace [5G_1_0, 5G_1_8) */
memcpy(&ar->fw_board[OFFSE_REF_POWER_A_1_0], &board_self.fw_board[OFFSE_REF_POWER_A_1_0],
OFFSE_REF_POWER_A_1_8 - OFFSE_REF_POWER_A_1_0);
if (debug_mask & ATH6KL_DBG_BOOT)
{
ath6kl_info("refPower_G_0_0: %d, olpcGainDelta_t10_G_0_2: %d\n",
(char)ar->fw_board[OFFSE_REF_POWER_G_0_0],
(short)((ar->fw_board[OFFSE_REF_POWER_G_1_3 - 0xD] << 8) + ar->fw_board[OFFSE_REF_POWER_G_1_3 - 0xE]));
ath6kl_info("refPower_G_1_0: %d, olpcGainDelta_t10_G_1_2: %d\n",
(char)ar->fw_board[OFFSE_REF_POWER_G_1_0],
(short)((ar->fw_board[OFFSE_REF_POWER_G_1_3 - 0xD] << 8) + ar->fw_board[OFFSE_REF_POWER_G_1_3 - 0xE]));
ath6kl_info("refPower_A_0_0: %d, olpcGainDelta_t10_A_0_7: %d\n",
(char)ar->fw_board[OFFSE_REF_POWER_A_0_0],
(short)((ar->fw_board[OFFSE_REF_POWER_A_0_8 - 0xD] << 8) + ar->fw_board[OFFSE_REF_POWER_A_0_8 - 0xE]));
ath6kl_info("refPower_A_1_0: %d, olpcGainDelta_t10_A_1_7: %d\n",
(char)ar->fw_board[OFFSE_REF_POWER_A_1_0],
(short)((ar->fw_board[OFFSE_REF_POWER_A_1_8 - 0xD] << 8) + ar->fw_board[OFFSE_REF_POWER_A_1_8 - 0xE]));
}
}
else
{
ath6kl_err("Failed to get file %s: %d. Ignore the composition!\n", filename, ret);
}
if (board_self.fw_board != NULL)
{
kfree(board_self.fw_board);
board_self.fw_board = NULL;
}
return ret;
}
static int read_cal_data(const char *filename, char cal_data[][CAL_DATA_STR_LEN])
{
int ret = 0;
int i = 0, j = 0;
char ch;
char *buf = NULL;
char *pos = NULL;
struct file *filp = (struct file *)-ENOENT;
struct inode *inode = NULL;
loff_t fsize = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
mm_segment_t oldfs;
oldfs = get_fs();
set_fs(KERNEL_DS);
filp = filp_open(filename, O_RDONLY, 0);
if (IS_ERR(filp) || !filp->f_op)
{
ath6kl_err("File %s open failed! Ignore the composition!\n", filename);
ret = -ENOENT;
goto close_fs;
}
else
{
ath6kl_info("Got calibration data file %s!\n", filename);
}
if (!filp->f_op->read)
{
ath6kl_err("Read callbacks not supported in %s\n", __func__);
ret = -ENOENT;
goto close_fs;
}
inode = filp->f_dentry->d_inode;
fsize = inode->i_size;
buf = (char *)kmalloc(fsize + 16, GFP_KERNEL);
if (buf == NULL)
{
ath6kl_err("Read buffer alloc fail in %s\n", __func__);
ret = -ENOENT;
goto close_fs;
}
memset(buf, 0, sizeof(buf));
vfs_read(filp, buf, fsize, &(filp->f_pos));
ath6kl_info("calibration data: ||%s||\n", buf);
/* calData format: 0,1,2,3,4,5,6,7,8,9,-10,11,12,13,14,-15,16,17,18,19,20,21,
* index 0~3 is olpc delta for 2.4G chain 0
* index 4~6 is olpc delta for 2.4G chain 1
* index 7~13 is olpc delta for 5G chain 0
* index 14~21 is olpc delta for 5G chain 1
*/
pos = buf;
while((ch = *pos) != '\0')
{
if (ch != ',')
{
cal_data[i][j++] = ch;
}
else
{
i++;
j = 0;
}
if (i == CAL_DATA_NUM)
{
break;
}
if (j >= CAL_DATA_STR_LEN)
{
ath6kl_err("Calibration data has too much symbols(index: %d, ch: ||%c||)\n", i, ch);
ret = -ENOENT;
goto close_fs;
}
pos++;
}
close_fs:
if (buf != NULL)
{
kfree(buf);
buf = NULL;
}
if (!IS_ERR(filp))
filp_close(filp, NULL);
set_fs(oldfs);
return ret;
}
static int compose_calibration_data(struct ath6kl *ar, const char *filename)
{
int ret = 0;
u16 before_olpc_u = 0;
short before_olpc_s = 0;
short delta_olpc = 0;
short after_olpc = 0;
short ref_power = 0;
unsigned char i = 0;
unsigned char index = 0;
int start_offset = 0;
int ref_power_offset = 0;
int olpc_offset = 0;
char cal_data[CAL_DATA_NUM][CAL_DATA_STR_LEN];
memset(cal_data, 0, CAL_DATA_NUM * CAL_DATA_STR_LEN);
ret = read_cal_data(filename, cal_data);
if (ret < 0)
return -1;
for(i = 0; i < CAL_DATA_NUM; i++)
{
delta_olpc = simple_strtol(cal_data[i], NULL, 10);
if (delta_olpc >= CAL_DATA_MAX_INT || delta_olpc <= -CAL_DATA_MAX_INT)
{
ath6kl_err("Calibration data in file %s is too much or too large!\n", filename);
return -1;
}
if (i >=0 && i<= 2)
{
/* For 2.4G chain0 */
start_offset = OFFSE_REF_POWER_G_0_0;
index = i;
}
else if (i >=3 && i<= 5)
{
/* For 2.4G chain1 */
start_offset = OFFSE_REF_POWER_G_1_0;
index = i - 3;
}
else if (i >=6 && i<= 13)
{
/* For 5G chain0 */
start_offset = OFFSE_REF_POWER_A_0_0;
index = i - 6;
}
else if (i >=14 && i<= 21)
{
/* For 5G chain1 */
start_offset = OFFSE_REF_POWER_A_1_0;
index = i - 14;
}
ref_power_offset = start_offset + index * 0x12;
olpc_offset = ref_power_offset + 0x4;
before_olpc_u = (ar->fw_board[olpc_offset + 1] << 8) + ar->fw_board[olpc_offset];
//olpc was got as an unsigned symbol, but accually it is a signed symbol,
// so it must be converted.
before_olpc_s = before_olpc_u;
after_olpc = before_olpc_s + delta_olpc;
ref_power = after_olpc / 5;
ar->fw_board[ref_power_offset] = (ref_power & 0xff);
ar->fw_board[olpc_offset] = (after_olpc & 0xff);
ar->fw_board[olpc_offset + 1] = ((after_olpc >> 8) & 0xff);
if (debug_mask & ATH6KL_DBG_BOOT)
{
ath6kl_info("i: %d, ref_power_offset: 0x%04x, olpc_offset: 0x%04x\n",
i, ref_power_offset, olpc_offset);
ath6kl_info("before_olpc: %d, delta_olpc: %d, after_olpc: %d, ref_power: %d\n",
before_olpc_s, delta_olpc, after_olpc, ref_power);
}
}
return 0;
}
static int ath6kl_replace_with_module_param(struct ath6kl *ar, char *str_mac)
{
int i;
@ -1165,25 +898,6 @@ static int ath6kl_replace_with_module_param(struct ath6kl *ar, char *str_mac)
/* replace the mac address with module parameter input */
memcpy(&ar->fw_board[BDATA_MAC_ADDR_OFFSET], macaddr, ETH_ALEN);
/* Compose files at specified path based on mode */
if (ath6kl_debug_quirks(ar, ATH6KL_MODULE_TESTMODE_UTF)) {
ath6kl_info("Start composing files at factory mode.\n");
if (compose_bdata_self_bin(ar, BDATA_SELF_BIN_PATH_FT_MODE)
|| compose_calibration_data(ar, CAL_DATA_PATH_FT_MODE))
{
ath6kl_warn("Failed to composing files from factory mode path, try normal mode path\n");
compose_bdata_self_bin(ar, BDATA_SELF_BIN_PATH);
compose_calibration_data(ar, CAL_DATA_PATH);
}
} else {
ath6kl_info("Start composing files at normal mode.\n");
/* [lixiangkui] compose bdata.bin and bdata_self.bin */
compose_bdata_self_bin(ar, BDATA_SELF_BIN_PATH);
/* [lixiangkui] compose calibration data */
compose_calibration_data(ar, CAL_DATA_PATH);
}
p = (u16 *) ar->fw_board;
/* calculate check sum */
@ -2032,8 +1746,7 @@ static int ath6kl_init_upload(struct ath6kl *ar)
return status;
address = MBOX_BASE_ADDRESS + LOCAL_SCRATCH_ADDRESS;
if (!(ar->enable_ani))
param = options | 0x20;
param = options | 0x20;
status = ath6kl_bmi_reg_write(ar, address, param);
if (status)
return status;

View File

@ -32,8 +32,6 @@
#define ATH6KL_TID_MASK 0xf
#define ATH6KL_AID_SHIFT 4
extern unsigned int debug_quirks;
static void ath6kl_mcc_event_ctrl_timer_handler(unsigned long ptr);
/* Dont define if IPA conf. Manager is not present */
@ -723,7 +721,7 @@ void ath6kl_disconnect_sysbam_pipes(struct ath6kl *ar)
int status,i;
/* If Rx SW path, then no need to create/delete sysbam pipe */
if (!!(debug_quirks & ATH6KL_MODULE_BAM_RX_SW_PATH))
if (ath6kl_debug_quirks(ar, ATH6KL_MODULE_BAM_RX_SW_PATH))
return;
for (i = 0; i < MAX_SYSBAM_PIPE; i++) {
@ -742,7 +740,7 @@ int ath6kl_usb_create_sysbam_pipes(struct ath6kl *ar)
int status,i;
/* If Rx SW path, then no need to create/delete sysbam pipe */
if (!!(debug_quirks & ATH6KL_MODULE_BAM_RX_SW_PATH))
if (ath6kl_debug_quirks(ar, ATH6KL_MODULE_BAM_RX_SW_PATH))
return 0;
/* The config is similar to the RX Bam pipe configuration */
@ -923,13 +921,13 @@ void ath6kl_remove_filter_rule(enum ipa_ip_type ip_type, uint32_t hdl)
void ath6kl_remove_ipa_exception_filters(struct ath6kl *ar)
{
/* In Rx SW path, no need to create/delete the exception filter */
if (!!(debug_quirks & ATH6KL_MODULE_BAM_RX_SW_PATH))
if (ath6kl_debug_quirks(ar, ATH6KL_MODULE_BAM_RX_SW_PATH))
return;
/* Remove the filters */
ath6kl_remove_filter_rule(IPA_IP_v4, flt_hdl_ipv4);
if (!!(debug_quirks & ATH6KL_MODULE_IPA_WITH_IPV6))
if (ath6kl_debug_quirks(ar, ATH6KL_MODULE_IPA_WITH_IPV6))
ath6kl_remove_filter_rule(IPA_IP_v6, flt_hdl_ipv6);
}
EXPORT_SYMBOL(ath6kl_remove_ipa_exception_filters);
@ -1030,10 +1028,8 @@ int ath6kl_send_msg_ipa(struct ath6kl_vif *vif, enum ipa_wlan_event type,
"IPA-CM: AP mode Adding Partial hdr: %s, %pM\n",
vif->ndev->name, vif->ndev->dev_addr);
/* Add partial header with IPA for this interface */
if (!(test_bit(CONNECTED, &vif->flags))) {
ath6kl_ipa_add_header_info(vif->ar, 1, vif->fw_vif_idx,
vif->ndev->name, vif->ndev->dev_addr);
}
ath6kl_ipa_add_header_info(vif->ar, 1, vif->fw_vif_idx,
vif->ndev->name, vif->ndev->dev_addr);
break;
case WLAN_AP_DISCONNECT:
@ -1520,15 +1516,6 @@ int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev)
"%s: skb=0x%p, data=0x%p, len=0x%x\n", __func__,
skb, skb->data, skb->len);
if(skb_cloned(skb)) {
skb = skb_unshare(skb, GFP_ATOMIC);
if(skb == NULL) {
ath6kl_dbg(ATH6KL_DBG_WLAN_TX,
"skb cannot be shared\n");
goto fail_tx;
}
}
/* If target is not associated */
if (!test_bit(CONNECTED, &vif->flags) &&
!test_bit(TESTMODE_EPPING, &ar->flag))
@ -3278,8 +3265,7 @@ void ath6kl_rx(struct htc_target *target, struct htc_packet *packet)
datap = (struct ethhdr *) skb->data;
if (!((is_multicast_ether_addr(datap->h_dest)) &&
(vif->nw_type == INFRA_NETWORK))) {
if (is_unicast_ether_addr(datap->h_dest)) {
if (vif->nw_type == AP_NETWORK) {
conn = ath6kl_find_sta(vif, datap->h_source, false);
if (!conn)

View File

@ -33,8 +33,6 @@
#define RX_URB_COUNT 32
#define ATH6KL_USB_RX_BUFFER_SIZE 1700
extern unsigned int debug_quirks;
/* tx/rx pipes for usb */
enum ATH6KL_USB_PIPE_ID {
ATH6KL_USB_PIPE_TX_CTRL = 0,
@ -278,13 +276,13 @@ static inline void *ath6kl_get_context(struct sk_buff *skb)
#ifdef CONFIG_ATH6KL_BAM2BAM
static void ath6kl_usb_bam_set_pipe_mask(struct ath6kl_usb *ar_usb)
{
if (!(!!(debug_quirks & ATH6KL_MODULE_BAM2BAM)))
if (!ath6kl_debug_quirks(ar_usb->ar, ATH6KL_MODULE_BAM2BAM))
return;
if (!(!!(debug_quirks & ATH6KL_MODULE_BAM_RX_SW_PATH)))
if (!ath6kl_debug_quirks(ar_usb->ar, ATH6KL_MODULE_BAM_RX_SW_PATH))
ar_usb->bam_pipe_mask |= BIT(ATH6KL_USB_PIPE_RX_DATA2);
if (!(!!(debug_quirks & ATH6KL_MODULE_BAM_TX_SW_PATH))) {
if (!ath6kl_debug_quirks(ar_usb->ar, ATH6KL_MODULE_BAM_TX_SW_PATH)) {
ar_usb->bam_pipe_mask |= BIT(ATH6KL_USB_PIPE_TX_DATA_LP);
ar_usb->bam_pipe_mask |= BIT(ATH6KL_USB_PIPE_TX_DATA_MP);
ar_usb->bam_pipe_mask |= BIT(ATH6KL_USB_PIPE_TX_DATA_HP);
@ -311,28 +309,6 @@ static void ath6kl_usb_bam_free_urb(struct urb *urb)
usb_free_urb(urb);
}
static void ath6kl_kill_bam_urbs(struct ath6kl_usb *ar_usb)
{
int i;
struct ath6kl_usb_bam_pipe *bam_pipe;
for (i = 0; i < ATH6KL_USB_PIPE_MAX; i++) {
bam_pipe = &ar_usb->pipes[i].bam_pipe;
/* If bam pipe not connected then dont kill dummy urbs attached
* to bam pipes */
if (!bam_pipe->connected)
continue;
/* kill the dummy urbs attached to bam pipe during error
* condition. If we are not clearing here, while unloading the
* driver usb will try to clear these urbs and the callback
* registered will be invalid at that time */
usb_kill_urb(bam_pipe->urb);
}
}
/* Disconnects all the bam pipes Tx-4, Rx-1 */
static void ath6kl_disconnect_bam_pipes(struct ath6kl_usb *ar_usb)
{
@ -349,7 +325,6 @@ static void ath6kl_disconnect_bam_pipes(struct ath6kl_usb *ar_usb)
bam_pipe->connected = 0;
usb_bam_disconnect_ipa(&bam_pipe->ipa_params);
ath6kl_usb_bam_free_urb(bam_pipe->urb);
}
}
@ -419,22 +394,12 @@ int ath6kl_usb_bam_activity_cb(void *priv)
{
struct ath6kl_usb_pipe *pipe = (struct ath6kl_usb_pipe *) priv;
struct ath6kl_usb *ar_usb = pipe->ar_usb;
int autopm_state;
ath6kl_dbg(ATH6KL_DBG_SUSPEND,
"BAM Activity indication callback, pipe_num: %d\n",
pipe->logical_pipe_num);
spin_lock_bh(&ar_usb->pm_lock);
autopm_state = atomic_read(&ar_usb->autopm_state);
if(autopm_state != ATH6KL_USB_AUTOPM_STATE_ON ||
(atomic_read(&ar_usb->interface->pm_usage_cnt) == 0))
usb_autopm_get_interface_async(ar_usb->interface);
spin_unlock_bh(&ar_usb->pm_lock);
usb_autopm_get_interface_async(ar_usb->interface);
ar_usb->pm_stats.bam_activity++;
return 0;
@ -444,22 +409,12 @@ int ath6kl_usb_bam_inactivity_cb(void *priv)
{
struct ath6kl_usb_pipe *pipe = (struct ath6kl_usb_pipe *) priv;
struct ath6kl_usb *ar_usb = pipe->ar_usb;
int autopm_state;
ath6kl_dbg(ATH6KL_DBG_SUSPEND,
"BAM Inactivity indication callback, pipe_num: %d\n",
pipe->logical_pipe_num);
spin_lock_bh(&ar_usb->pm_lock);
autopm_state = atomic_read(&ar_usb->autopm_state);
if(autopm_state == ATH6KL_USB_AUTOPM_STATE_ON &&
(atomic_read(&ar_usb->interface->pm_usage_cnt)>0))
usb_autopm_put_interface_async(ar_usb->interface);
spin_unlock_bh(&ar_usb->pm_lock);
usb_autopm_put_interface_async(ar_usb->interface);
ar_usb->pm_stats.bam_inactivity++;
return 0;
@ -706,7 +661,6 @@ static int ath6kl_usb_bam_resubmit_urbs(struct ath6kl_usb *ar_usb)
struct ath6kl_usb_pipe *pipe;
int usb_status = 0;
int i;
int autopm_state;
if (!ath6kl_debug_quirks(ar_usb->ar, ATH6KL_MODULE_BAM2BAM))
return 0;
@ -735,14 +689,7 @@ static int ath6kl_usb_bam_resubmit_urbs(struct ath6kl_usb *ar_usb)
}
#ifdef CONFIG_ATH6KL_AUTO_PM
spin_lock_bh(&ar_usb->pm_lock);
autopm_state = atomic_read(&ar_usb->autopm_state);
if(autopm_state != ATH6KL_USB_AUTOPM_STATE_ON)
usb_autopm_get_interface_async(ar_usb->interface);
spin_unlock_bh(&ar_usb->pm_lock);
usb_autopm_get_interface_async(ar_usb->interface);
#endif
return 0;
@ -930,7 +877,7 @@ static int ath6kl_usb_setup_bampipe_resources(struct ath6kl_usb *ar_usb)
int status = 0;
struct ath6kl_usb_pipe *pipe;
if (!(!!(debug_quirks & ATH6KL_MODULE_BAM2BAM))) {
if (!ath6kl_debug_quirks(ar_usb->ar, ATH6KL_MODULE_BAM2BAM)) {
ath6kl_dbg(ATH6KL_DBG_BAM2BAM, "BAM2BAM mode is not"
" enabled!\n");
return 0;
@ -980,7 +927,6 @@ static int ath6kl_usb_setup_bampipe_resources(struct ath6kl_usb *ar_usb)
return 0;
cleanup_bam_pipe:
ath6kl_kill_bam_urbs(ar_usb);
ath6kl_disconnect_bam_pipes(ar_usb);
return status;
@ -1182,25 +1128,6 @@ static void ath6kl_usb_flush_all(struct ath6kl_usb *ar_usb)
#endif
}
static void ath6kl_usb_suspend_flush_all(struct ath6kl_usb *ar_usb)
{
int i;
struct ath6kl_usb_pipe *pipe;
for (i = 0; i < ATH6KL_USB_PIPE_MAX; i++) {
pipe = &ar_usb->pipes[i].ar_usb->pipes[i];
if (!pipe->ar_usb)
continue;
flush_work(&pipe->tx_io_complete_work);
flush_work(&pipe->rx_io_complete_work);
usb_kill_anchored_urbs(&pipe->urb_submitted);
}
#ifdef CONFIG_ATH6KL_AUTO_PM
flush_work(&ar_usb->pm_resume_work);
#endif
}
static void ath6kl_usb_start_recv_pipes(struct ath6kl_usb *ar_usb)
{
/*
@ -1440,7 +1367,6 @@ static void ath6kl_usb_destroy(struct ath6kl_usb *ar_usb)
ath6kl_usb_flush_all(ar_usb);
#ifdef CONFIG_ATH6KL_AUTO_PM
spin_lock_bh(&ar_usb->pm_lock);
while (!list_empty(&ar_usb->pm_q)) {
struct ath6kl_urb_context *urb_context;
@ -1450,7 +1376,6 @@ static void ath6kl_usb_destroy(struct ath6kl_usb *ar_usb)
list_del(&urb_context->link);
ath6kl_usb_cleanup_urb_context(urb_context);
}
spin_unlock_bh(&ar_usb->pm_lock);
#endif
ath6kl_usb_cleanup_pipe_resources(ar_usb);
@ -1527,7 +1452,7 @@ static void ath6kl_usb_device_detached(struct usb_interface *interface)
ath6kl_stop_txrx(ar_usb->ar);
/* Delay to wait for target to reboot */
mdelay(50);
mdelay(20);
#ifdef CONFIG_ATH6KL_BAM2BAM
if (ath6kl_debug_quirks(ar_usb->ar, ATH6KL_MODULE_BAM2BAM)) {
@ -2334,22 +2259,6 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
ret = -ENOMEM;
goto err_usb_put;
}
mdelay(500);
#ifdef CONFIG_ATH6KL_BAM2BAM
ath6kl_usb_bam_set_pipe_mask(ar_usb);
#endif
#ifdef CONFIG_ATH6KL_BAM2BAM
ret = ath6kl_usb_setup_bampipe_resources(ar_usb);
if (ret) {
ath6kl_err("Failed to init ath6kl bampipe: %d\n", ret);
ath6kl_remove_ipa_exception_filters(ar_usb->ar);
ath6kl_disconnect_sysbam_pipes(ar_usb->ar);
goto err_usb_destroy;
}
#endif
#ifdef CONFIG_ATH6KL_AUTO_PM
spin_lock_init(&ar_usb->pm_lock);
@ -2373,6 +2282,9 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
ar->bmi.max_data_size = 252;
ar_usb->ar = ar;
#ifdef CONFIG_ATH6KL_BAM2BAM
ath6kl_usb_bam_set_pipe_mask(ar_usb);
#endif
ret = ath6kl_core_init(ar, ATH6KL_HTC_TYPE_PIPE);
if (ret) {
@ -2380,6 +2292,18 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
goto err_core_free;
}
#ifdef CONFIG_ATH6KL_BAM2BAM
ret = ath6kl_usb_setup_bampipe_resources(ar_usb);
if (ret) {
ath6kl_err("Failed to init ath6kl bampipe: %d\n", ret);
ath6kl_remove_ipa_exception_filters(ar_usb->ar);
ath6kl_disconnect_sysbam_pipes(ar_usb->ar);
goto err_core_cleanup;
}
#endif
#ifdef CONFIG_ATH6KL_AUTO_PM
/* Enable Autsuspend (Delay 2sec)
Note, Autosuspend is enabled only after ath6kl_core_create is done
@ -2393,13 +2317,14 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
return ret;
err_core_free:
#ifdef CONFIG_ATH6KL_BAM2BAM
if ((!!(debug_quirks & ATH6KL_MODULE_BAM2BAM))) {
ath6kl_remove_ipa_exception_filters(ar_usb->ar);
ath6kl_disconnect_sysbam_pipes(ar_usb->ar);
err_core_cleanup:
if (ath6kl_debug_quirks(ar_usb->ar, ATH6KL_MODULE_BAM2BAM)) {
ath6kl_stop_txrx(ar_usb->ar);
ath6kl_core_cleanup(ar_usb->ar);
}
#endif
err_core_free:
ath6kl_core_destroy(ar);
err_usb_destroy:
ath6kl_usb_destroy(ar_usb);
@ -2484,7 +2409,7 @@ end:
return ret;
}
ath6kl_usb_suspend_flush_all(ar_usb);
ath6kl_usb_flush_all(ar_usb);
#ifdef CONFIG_ATH6KL_AUTO_PM
atomic_set(&ar_usb->autopm_state,
ATH6KL_USB_AUTOPM_STATE_SUSPENDED);

View File

@ -873,7 +873,7 @@ static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len,
ath6kl_connect_ap_mode_bss(
vif, le16_to_cpu(ev->u.ap_bss.ch),
sec_ch, phymode);
if (htcap->ext_chan & IEEE80211_HT_CAP_EXT_CH_MASK) {
if (htcap->ext_ch_mask) {
memset(&rate, 0, sizeof(rate));
rate.fix_rate_mask[0] = ATH6KL_HT40_RATE_MASK;
ath6kl_wmi_set_fixrates(vif->ar->wmi,
@ -1047,12 +1047,10 @@ static void ath6kl_wmi_regdomain_event(struct wmi *wmi, u8 *datap, int len)
alpha2[0] = country->isoName[0];
alpha2[1] = country->isoName[1];
if (ath6kl_use_regulatory_hint()) {
regulatory_hint(wmi->parent_dev->wiphy, alpha2);
ath6kl_dbg(ATH6KL_DBG_WMI,
"Country alpha2 being used: %c%c\n",
alpha2[0], alpha2[1]);
}
regulatory_hint(wmi->parent_dev->wiphy, alpha2);
ath6kl_dbg(ATH6KL_DBG_WMI, "Country alpha2 being used: %c%c\n",
alpha2[0], alpha2[1]);
}
}
@ -3261,12 +3259,8 @@ int ath6kl_wmi_set_htcap_cmd(struct wmi *wmi, u8 if_idx,
cmd->ht20_sgi = !!(htcap->cap_info & IEEE80211_HT_CAP_SGI_20);
cmd->ht40_supported =
!!(htcap->cap_info & IEEE80211_HT_CAP_SUP_WIDTH_20_40);
if (htcap->ext_chan & IEEE80211_HT_CAP_EXT_CH_MASK)
if (htcap->ext_ch_mask)
cmd->ht40_supported |= IEEE80211_HT_CAP_EXT_CH_MASK;
if (htcap->ext_chan & IEEE80211_HT_SC_CH_ABOVE)
cmd->ht40_supported |= IEEE80211_HT_SC_CH_ABOVE;
else if (htcap->ext_chan & IEEE80211_HT_SC_CH_BELOW)
cmd->ht40_supported |= IEEE80211_HT_SC_CH_BELOW;
cmd->ht40_sgi = !!(htcap->cap_info & IEEE80211_HT_CAP_SGI_40);
cmd->intolerant_40mhz =
@ -4098,10 +4092,7 @@ int ath6kl_wmi_set_acl_policy(struct wmi *wmi, u8 if_idx, bool enable_acl)
#ifdef CONFIG_ACL_BLWL_MAC
cmd->policy = enable_acl ? WMI_ACL_BLWL_MAC : 0;
#else
if (enable_acl == NL80211_ACL_POLICY_DISABLE)
cmd->policy = WMI_ACL_DISABLE;
else
cmd->policy = enable_acl ? WMI_ACL_DENY_MAC : WMI_ACL_ALLOW_MAC;
cmd->policy = enable_acl ? WMI_ACL_DENY_MAC : WMI_ACL_ALLOW_MAC;
#endif
ath6kl_dbg(ATH6KL_DBG_WMI, "Set acl policy=%d\n", cmd->policy);
@ -4204,20 +4195,17 @@ int ath6kl_wmi_set_acl_list(struct wmi *wmi, u8 if_idx, int index,
cmd->action = WMI_ACL_RESET_LIST;
else if (acl_action == WMI_ACL_DEL_MAC_ADDR)
cmd->action = WMI_ACL_DEL_MAC_ADDR;
else if (acl_action == WMI_ACL_END_MAC_LIST)
cmd->action = WMI_ACL_END_MAC_LIST;
else
cmd->action = WMI_ACL_ADD_MAC_ADDR;
if (!((acl_action == WMI_ACL_RESET_MAC_ADDR) ||
(acl_action == WMI_ACL_END_MAC_LIST))) {
if (acl_action != WMI_ACL_RESET_MAC_ADDR) {
cmd->wildcard = wildcard;
vif = ath6kl_get_vif_by_index(wmi->parent_dev, if_idx);
if (!ath6kl_acl_add_del_mac(&(vif->ap_acl_list), cmd)) {
ath6kl_info("could not set acl mac: index:%d action:%d mac:%pM wild:%d acl_action:%d\n",
ath6kl_dbg(ATH6KL_DBG_WMI, "could not set acl mac: index:%d action:%d mac:%pM wild:%d acl_action:%d\n",
cmd->index, cmd->action, cmd->mac, cmd->wildcard, acl_action);
dev_kfree_skb(skb);
return 0;
return -2;
}
}
#endif

View File

@ -2884,7 +2884,6 @@ struct wmi_ap_mode_stat {
/* Special mac index to notify eol */
#define MAC_ACL_INDEX_EOL 0xff
#define WMI_ACL_DISABLE 0x0
#define WMI_ACL_ALLOW_MAC 0x1
#define WMI_ACL_DENY_MAC 0x2
#define WMI_ACL_BLWL_MAC 0x3
@ -2893,7 +2892,6 @@ struct wmi_ap_mode_stat {
#define WMI_ACL_RESET_MAC_ADDR 0
#define WMI_ACL_ADD_MAC_ADDR 1
#define WMI_ACL_DEL_MAC_ADDR 2
#define WMI_ACL_END_MAC_LIST 3
enum wmi_mac_acl_action {
WMI_ACL_ADD_WHITE_MAC_ADDR = 0x01,