aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/failed-syscalls-by-pid.py
diff options
context:
space:
mode:
authorFlorian Ragwitz <rafl@debian.org>2010-04-27 00:47:04 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-05-03 23:34:33 -0700
commitf81bc788ff91d4efd4baf88b2c29713838caa8e5 (patch)
treee2e629399bc1fbca262fb6d46cfa5af6debae2f4 /tools/perf/scripts/python/failed-syscalls-by-pid.py
parent225c61aad38b12924b3df5f4ef43150c0d6bae8c (diff)
Input: elantech - allow forcing Elantech protocol
Apparently hardware vendors now ship elantech touchpads with different version magic. This options allows for them to be tested easier with the current driver in order to add their magic to the whitelist later. Signed-off-by: Florian Ragwitz <rafl@debian.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'tools/perf/scripts/python/failed-syscalls-by-pid.py')
0 files changed, 0 insertions, 0 deletions
ure caps failed\n"); else wcn36xx_feat_caps_info(wcn); } /* DMA channel initialization */ ret = wcn36xx_dxe_init(wcn); if (ret) { wcn36xx_err("DXE init failed\n"); goto out_smd_stop; } wcn36xx_debugfs_init(wcn); INIT_LIST_HEAD(&wcn->vif_list); spin_lock_init(&wcn->dxe_lock); spin_lock_init(&wcn->survey_lock); return 0; out_smd_stop: wcn36xx_smd_stop(wcn); out_free_dxe_ctl: wcn36xx_dxe_free_ctl_blks(wcn); out_free_dxe_pool: wcn36xx_dxe_free_mem_pools(wcn); out_smd_close: wcn36xx_smd_close(wcn); out_err: return ret; } static void wcn36xx_stop(struct ieee80211_hw *hw, bool suspend) { struct wcn36xx *wcn = hw->priv; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac stop\n"); mutex_lock(&wcn->scan_lock); if (wcn->scan_req) { struct cfg80211_scan_info scan_info = { .aborted = true, }; ieee80211_scan_completed(wcn->hw, &scan_info); } wcn->scan_req = NULL; mutex_unlock(&wcn->scan_lock); wcn36xx_debugfs_exit(wcn); wcn36xx_smd_stop(wcn); wcn36xx_dxe_deinit(wcn); wcn36xx_smd_close(wcn); wcn36xx_dxe_free_mem_pools(wcn); wcn36xx_dxe_free_ctl_blks(wcn); } static void wcn36xx_change_ps(struct wcn36xx *wcn, bool enable) { struct ieee80211_vif *vif = NULL; struct wcn36xx_vif *tmp; list_for_each_entry(tmp, &wcn->vif_list, list) { vif = wcn36xx_priv_to_vif(tmp); if (enable && !wcn->sw_scan) { if (vif->cfg.ps) /* ps allowed ? */ wcn36xx_pmc_enter_bmps_state(wcn, vif); } else { wcn36xx_pmc_exit_bmps_state(wcn, vif); } } } static void wcn36xx_change_opchannel(struct wcn36xx *wcn, int ch) { struct ieee80211_vif *vif = NULL; struct wcn36xx_vif *tmp; struct ieee80211_supported_band *band; struct ieee80211_channel *channel = NULL; unsigned long flags; int i, j; for (i = 0; i < ARRAY_SIZE(wcn->hw->wiphy->bands); i++) { band = wcn->hw->wiphy->bands[i]; if (!band) break; for (j = 0; j < band->n_channels; j++) { if (HW_VALUE_CHANNEL(band->channels[j].hw_value) == ch) { channel = &band->channels[j]; break; } } if (channel) break; } if (!channel) { wcn36xx_err("Cannot tune to channel %d\n", ch); return; } spin_lock_irqsave(&wcn->survey_lock, flags); wcn->band = band; wcn->channel = channel; spin_unlock_irqrestore(&wcn->survey_lock, flags); list_for_each_entry(tmp, &wcn->vif_list, list) { vif = wcn36xx_priv_to_vif(tmp); wcn36xx_smd_switch_channel(wcn, vif, ch); } return; } static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed) { struct wcn36xx *wcn = hw->priv; int ret; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac config changed 0x%08x\n", changed); mutex_lock(&wcn->conf_mutex); if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { int ch = WCN36XX_HW_CHANNEL(wcn); wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n", ch); if (wcn->sw_scan_opchannel == ch && wcn->sw_scan_channel) { /* If channel is the initial operating channel, we may * want to receive/transmit regular data packets, then * simply stop the scan session and exit PS mode. */ if (wcn->sw_scan_channel) wcn36xx_smd_end_scan(wcn, wcn->sw_scan_channel); if (wcn->sw_scan_init) { wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, wcn->sw_scan_vif); } } else if (wcn->sw_scan) { /* A scan is ongoing, do not change the operating * channel, but start a scan session on the channel. */ if (wcn->sw_scan_channel) wcn36xx_smd_end_scan(wcn, wcn->sw_scan_channel); if (!wcn->sw_scan_init) { /* This can fail if we are unable to notify the * operating channel. */ ret = wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN, wcn->sw_scan_vif); if (ret) { mutex_unlock(&wcn->conf_mutex); return -EIO; } } wcn36xx_smd_start_scan(wcn, ch); } else { wcn36xx_change_opchannel(wcn, ch); } } if (changed & IEEE80211_CONF_CHANGE_PS) wcn36xx_change_ps(wcn, hw->conf.flags & IEEE80211_CONF_PS); if (changed & IEEE80211_CONF_CHANGE_IDLE) { if (hw->conf.flags & IEEE80211_CONF_IDLE) wcn36xx_smd_enter_imps(wcn); else wcn36xx_smd_exit_imps(wcn); } mutex_unlock(&wcn->conf_mutex); return 0; } static void wcn36xx_configure_filter(struct ieee80211_hw *hw, unsigned int changed, unsigned int *total, u64 multicast) { struct wcn36xx_hal_rcv_flt_mc_addr_list_type *fp; struct wcn36xx *wcn = hw->priv; struct wcn36xx_vif *tmp; struct ieee80211_vif *vif = NULL; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac configure filter\n"); mutex_lock(&wcn->conf_mutex); *total &= FIF_ALLMULTI; fp = (void *)(unsigned long)multicast; list_for_each_entry(tmp, &wcn->vif_list, list) { vif = wcn36xx_priv_to_vif(tmp); /* FW handles MC filtering only when connected as STA */ if (*total & FIF_ALLMULTI) wcn36xx_smd_set_mc_list(wcn, vif, NULL); else if (NL80211_IFTYPE_STATION == vif->type && tmp->sta_assoc) wcn36xx_smd_set_mc_list(wcn, vif, fp); } mutex_unlock(&wcn->conf_mutex); kfree(fp); } static u64 wcn36xx_prepare_multicast(struct ieee80211_hw *hw, struct netdev_hw_addr_list *mc_list) { struct wcn36xx_hal_rcv_flt_mc_addr_list_type *fp; struct netdev_hw_addr *ha; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac prepare multicast list\n"); fp = kzalloc(sizeof(*fp), GFP_ATOMIC); if (!fp) { wcn36xx_err("Out of memory setting filters.\n"); return 0; } fp->mc_addr_count = 0; /* update multicast filtering parameters */ if (netdev_hw_addr_list_count(mc_list) <= WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS) { netdev_hw_addr_list_for_each(ha, mc_list) { memcpy(fp->mc_addr[fp->mc_addr_count], ha->addr, ETH_ALEN); fp->mc_addr_count++; } } return (u64)(unsigned long)fp; } static void wcn36xx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb) { struct wcn36xx *wcn = hw->priv; struct wcn36xx_sta *sta_priv = NULL; if (control->sta) sta_priv = wcn36xx_sta_to_priv(control->sta); if (wcn36xx_start_tx(wcn, sta_priv, skb)) ieee80211_free_txskb(wcn->hw, skb); } static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key_conf) { struct wcn36xx *wcn = hw->priv; struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); struct wcn36xx_sta *sta_priv = sta ? wcn36xx_sta_to_priv(sta) : NULL; int ret = 0; u8 key[WLAN_MAX_KEY_LEN]; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac80211 set key\n"); wcn36xx_dbg(WCN36XX_DBG_MAC, "Key: cmd=0x%x algo:0x%x, id:%d, len:%d flags 0x%x\n", cmd, key_conf->cipher, key_conf->keyidx, key_conf->keylen, key_conf->flags); wcn36xx_dbg_dump(WCN36XX_DBG_MAC, "KEY: ", key_conf->key, key_conf->keylen); mutex_lock(&wcn->conf_mutex); switch (key_conf->cipher) { case WLAN_CIPHER_SUITE_WEP40: vif_priv->encrypt_type = WCN36XX_HAL_ED_WEP40; break; case WLAN_CIPHER_SUITE_WEP104: vif_priv->encrypt_type = WCN36XX_HAL_ED_WEP104; break; case WLAN_CIPHER_SUITE_CCMP: vif_priv->encrypt_type = WCN36XX_HAL_ED_CCMP; break; case WLAN_CIPHER_SUITE_TKIP: vif_priv->encrypt_type = WCN36XX_HAL_ED_TKIP; break; default: wcn36xx_err("Unsupported key type 0x%x\n", key_conf->cipher); ret = -EOPNOTSUPP; goto out; } switch (cmd) { case SET_KEY: if (WCN36XX_HAL_ED_TKIP == vif_priv->encrypt_type) { /* * Supplicant is sending key in the wrong order: * Temporal Key (16 b) - TX MIC (8 b) - RX MIC (8 b) * but HW expects it to be in the order as described in * IEEE 802.11 spec (see chapter 11.7) like this: * Temporal Key (16 b) - RX MIC (8 b) - TX MIC (8 b) */ memcpy(key, key_conf->key, 16); memcpy(key + 16, key_conf->key + 24, 8); memcpy(key + 24, key_conf->key + 16, 8); } else { memcpy(key, key_conf->key, key_conf->keylen); } if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) { sta_priv->is_data_encrypted = true; /* Reconfigure bss with encrypt_type */ if (NL80211_IFTYPE_STATION == vif->type) { wcn36xx_smd_config_bss(wcn, vif, sta, sta->addr, true); wcn36xx_smd_config_sta(wcn, vif, sta); } wcn36xx_smd_set_stakey(wcn, vif_priv->encrypt_type, key_conf->keyidx, key_conf->keylen, key, get_sta_index(vif, sta_priv)); } else { wcn36xx_smd_set_bsskey(wcn, vif_priv->encrypt_type, vif_priv->bss_index, key_conf->keyidx, key_conf->keylen, key); if ((WLAN_CIPHER_SUITE_WEP40 == key_conf->cipher) || (WLAN_CIPHER_SUITE_WEP104 == key_conf->cipher)) { list_for_each_entry(sta_priv, &vif_priv->sta_list, list) { sta_priv->is_data_encrypted = true; wcn36xx_smd_set_stakey(wcn, vif_priv->encrypt_type, key_conf->keyidx, key_conf->keylen, key, get_sta_index(vif, sta_priv)); } } } break; case DISABLE_KEY: if (!(IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags)) { if (vif_priv->bss_index != WCN36XX_HAL_BSS_INVALID_IDX) wcn36xx_smd_remove_bsskey(wcn, vif_priv->encrypt_type, vif_priv->bss_index, key_conf->keyidx); vif_priv->encrypt_type = WCN36XX_HAL_ED_NONE; } else { sta_priv->is_data_encrypted = false; /* do not remove key if disassociated */ if (sta_priv->aid) wcn36xx_smd_remove_stakey(wcn, vif_priv->encrypt_type, key_conf->keyidx, get_sta_index(vif, sta_priv)); } break; default: wcn36xx_err("Unsupported key cmd 0x%x\n", cmd); ret = -EOPNOTSUPP; goto out; } out: mutex_unlock(&wcn->conf_mutex); return ret; } static int wcn36xx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_scan_request *hw_req) { struct wcn36xx *wcn = hw->priv; if (!wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) { /* fallback to mac80211 software scan */ return 1; } /* Firmware scan offload is limited to 48 channels, fallback to * software driven scanning otherwise. */ if (hw_req->req.n_channels > 48) { wcn36xx_warn("Offload scan aborted, n_channels=%u", hw_req->req.n_channels); return 1; } mutex_lock(&wcn->scan_lock); if (wcn->scan_req) { mutex_unlock(&wcn->scan_lock); return -EBUSY; } wcn->scan_aborted = false; wcn->scan_req = &hw_req->req; mutex_unlock(&wcn->scan_lock); wcn36xx_smd_update_channel_list(wcn, &hw_req->req); return wcn36xx_smd_start_hw_scan(wcn, vif, &hw_req->req); } static void wcn36xx_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wcn36xx *wcn = hw->priv; mutex_lock(&wcn->scan_lock); wcn->scan_aborted = true; mutex_unlock(&wcn->scan_lock); if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) { /* ieee80211_scan_completed will be called on FW scan * indication */ wcn36xx_smd_stop_hw_scan(wcn); } } static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const u8 *mac_addr) { struct wcn36xx *wcn = hw->priv; struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); wcn36xx_dbg(WCN36XX_DBG_MAC, "sw_scan_start"); wcn->sw_scan = true; wcn->sw_scan_vif = vif; wcn->sw_scan_channel = 0; if (vif_priv->sta_assoc) wcn->sw_scan_opchannel = WCN36XX_HW_CHANNEL(wcn); else wcn->sw_scan_opchannel = 0; } static void wcn36xx_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wcn36xx *wcn = hw->priv; wcn36xx_dbg(WCN36XX_DBG_MAC, "sw_scan_complete"); /* ensure that any scan session is finished */ if (wcn->sw_scan_channel) wcn36xx_smd_end_scan(wcn, wcn->sw_scan_channel); if (wcn->sw_scan_init) { wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, wcn->sw_scan_vif); } wcn->sw_scan = false; wcn->sw_scan_opchannel = 0; } static void wcn36xx_update_allowed_rates(struct ieee80211_sta *sta, enum nl80211_band band) { int i, size; u16 *rates_table; struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta); u32 rates = sta->deflink.supp_rates[band]; memset(&sta_priv->supported_rates, 0, sizeof(sta_priv->supported_rates)); sta_priv->supported_rates.op_rate_mode = STA_11n; size = ARRAY_SIZE(sta_priv->supported_rates.dsss_rates); rates_table = sta_priv->supported_rates.dsss_rates; if (band == NL80211_BAND_2GHZ) { for (i = 0; i < size; i++) { if (rates & 0x01) { rates_table[i] = wcn_2ghz_rates[i].hw_value; rates = rates >> 1; } } } size = ARRAY_SIZE(sta_priv->supported_rates.ofdm_rates); rates_table = sta_priv->supported_rates.ofdm_rates; for (i = 0; i < size; i++) { if (rates & 0x01) { rates_table[i] = wcn_5ghz_rates[i].hw_value; rates = rates >> 1; } } if (sta->deflink.ht_cap.ht_supported) { BUILD_BUG_ON(sizeof(sta->deflink.ht_cap.mcs.rx_mask) > sizeof(sta_priv->supported_rates.supported_mcs_set)); memcpy(sta_priv->supported_rates.supported_mcs_set, sta->deflink.ht_cap.mcs.rx_mask, sizeof(sta->deflink.ht_cap.mcs.rx_mask)); } if (sta->deflink.vht_cap.vht_supported) { sta_priv->supported_rates.op_rate_mode = STA_11ac; sta_priv->supported_rates.vht_rx_mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map); sta_priv->supported_rates.vht_tx_mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.tx_mcs_map); } } void wcn36xx_set_default_rates(struct wcn36xx_hal_supported_rates *rates) { u16 ofdm_rates[WCN36XX_HAL_NUM_OFDM_RATES] = { HW_RATE_INDEX_6MBPS, HW_RATE_INDEX_9MBPS, HW_RATE_INDEX_12MBPS, HW_RATE_INDEX_18MBPS, HW_RATE_INDEX_24MBPS, HW_RATE_INDEX_36MBPS, HW_RATE_INDEX_48MBPS, HW_RATE_INDEX_54MBPS }; u16 dsss_rates[WCN36XX_HAL_NUM_DSSS_RATES] = { HW_RATE_INDEX_1MBPS, HW_RATE_INDEX_2MBPS, HW_RATE_INDEX_5_5MBPS, HW_RATE_INDEX_11MBPS }; rates->op_rate_mode = STA_11n; memcpy(rates->dsss_rates, dsss_rates, sizeof(*dsss_rates) * WCN36XX_HAL_NUM_DSSS_RATES); memcpy(rates->ofdm_rates, ofdm_rates, sizeof(*ofdm_rates) * WCN36XX_HAL_NUM_OFDM_RATES); rates->supported_mcs_set[0] = 0xFF; } void wcn36xx_set_default_rates_v1(struct wcn36xx_hal_supported_rates_v1 *rates) { rates->op_rate_mode = STA_11ac; rates->vht_rx_mcs_map = IEEE80211_VHT_MCS_SUPPORT_0_9; rates->vht_tx_mcs_map = IEEE80211_VHT_MCS_SUPPORT_0_9; } static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf, u64 changed) { struct wcn36xx *wcn = hw->priv; struct sk_buff *skb = NULL; u16 tim_off, tim_len; enum wcn36xx_hal_link_state link_state; struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss info changed vif %p changed 0x%llx\n", vif, changed); mutex_lock(&wcn->conf_mutex); if (changed & BSS_CHANGED_BEACON_INFO) { wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed dtim period %d\n", bss_conf->dtim_period); vif_priv->dtim_period = bss_conf->dtim_period; } if (changed & BSS_CHANGED_BSSID) { wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed_bssid %pM\n", bss_conf->bssid); if (!is_zero_ether_addr(bss_conf->bssid)) { vif_priv->is_joining = true; vif_priv->bss_index = WCN36XX_HAL_BSS_INVALID_IDX; wcn36xx_smd_set_link_st(wcn, bss_conf->bssid, vif->addr, WCN36XX_HAL_LINK_PREASSOC_STATE); wcn36xx_smd_join(wcn, bss_conf->bssid, vif->addr, WCN36XX_HW_CHANNEL(wcn)); wcn36xx_smd_config_bss(wcn, vif, NULL, bss_conf->bssid, false); } else { vif_priv->is_joining = false; wcn36xx_smd_delete_bss(wcn, vif); wcn36xx_smd_set_link_st(wcn, bss_conf->bssid, vif->addr, WCN36XX_HAL_LINK_IDLE_STATE); vif_priv->encrypt_type = WCN36XX_HAL_ED_NONE; } } if (changed & BSS_CHANGED_SSID) { wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed ssid\n"); wcn36xx_dbg_dump(WCN36XX_DBG_MAC, "ssid ", vif->cfg.ssid, vif->cfg.ssid_len); vif_priv->ssid.length = vif->cfg.ssid_len; memcpy(&vif_priv->ssid.ssid, vif->cfg.ssid, vif->cfg.ssid_len); } if (changed & BSS_CHANGED_ASSOC) { vif_priv->is_joining = false; if (vif->cfg.assoc) { struct ieee80211_sta *sta; struct wcn36xx_sta *sta_priv; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac assoc bss %pM vif %pM AID=%d\n", bss_conf->bssid, vif->addr, vif->cfg.aid); vif_priv->sta_assoc = true; /* * Holding conf_mutex ensures mutal exclusion with * wcn36xx_sta_remove() and as such ensures that sta * won't be freed while we're operating on it. As such * we do not need to hold the rcu_read_lock(). */ sta = ieee80211_find_sta(vif, bss_conf->bssid); if (!sta) { wcn36xx_err("sta %pM is not found\n", bss_conf->bssid); goto out; } sta_priv = wcn36xx_sta_to_priv(sta); wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn)); wcn36xx_smd_set_link_st(wcn, bss_conf->bssid, vif->addr, WCN36XX_HAL_LINK_POSTASSOC_STATE); wcn36xx_smd_config_bss(wcn, vif, sta, bss_conf->bssid, true); sta_priv->aid = vif->cfg.aid; /* * config_sta must be called from because this is the * place where AID is available. */ wcn36xx_smd_config_sta(wcn, vif, sta); if (vif->type == NL80211_IFTYPE_STATION) wcn36xx_smd_add_beacon_filter(wcn, vif); wcn36xx_enable_keep_alive_null_packet(wcn, vif); } else { wcn36xx_dbg(WCN36XX_DBG_MAC, "disassociated bss %pM vif %pM AID=%d\n", bss_conf->bssid, vif->addr, vif->cfg.aid); vif_priv->sta_assoc = false; wcn36xx_smd_set_link_st(wcn, bss_conf->bssid, vif->addr, WCN36XX_HAL_LINK_IDLE_STATE); } } if (changed & BSS_CHANGED_AP_PROBE_RESP) { wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed ap probe resp\n"); skb = ieee80211_proberesp_get(hw, vif); if (!skb) { wcn36xx_err("failed to alloc probereq skb\n"); goto out; } wcn36xx_smd_update_proberesp_tmpl(wcn, vif, skb); dev_kfree_skb(skb); } if (changed & BSS_CHANGED_BEACON_ENABLED || changed & BSS_CHANGED_BEACON) { wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed beacon enabled %d\n", bss_conf->enable_beacon); if (bss_conf->enable_beacon) { vif_priv->dtim_period = bss_conf->dtim_period; vif_priv->bss_index = WCN36XX_HAL_BSS_INVALID_IDX; wcn36xx_smd_config_bss(wcn, vif, NULL, vif->addr, false); skb = ieee80211_beacon_get_tim(hw, vif, &tim_off, &tim_len, 0); if (!skb) { wcn36xx_err("failed to alloc beacon skb\n"); goto out; } wcn36xx_smd_send_beacon(wcn, vif, skb, tim_off, 0); dev_kfree_skb(skb); if (vif->type == NL80211_IFTYPE_ADHOC || vif->type == NL80211_IFTYPE_MESH_POINT) link_state = WCN36XX_HAL_LINK_IBSS_STATE; else link_state = WCN36XX_HAL_LINK_AP_STATE; wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr, link_state); } else { wcn36xx_smd_delete_bss(wcn, vif); wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr, WCN36XX_HAL_LINK_IDLE_STATE); } } out: mutex_unlock(&wcn->conf_mutex); } /* this is required when using IEEE80211_HW_HAS_RATE_CONTROL */ static int wcn36xx_set_rts_threshold(struct ieee80211_hw *hw, u32 value) { struct wcn36xx *wcn = hw->priv; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac set RTS threshold %d\n", value); mutex_lock(&wcn->conf_mutex); wcn36xx_smd_update_cfg(wcn, WCN36XX_HAL_CFG_RTS_THRESHOLD, value); mutex_unlock(&wcn->conf_mutex); return 0; } static void wcn36xx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wcn36xx *wcn = hw->priv; struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); wcn36xx_dbg(WCN36XX_DBG_MAC, "mac remove interface vif %p\n", vif); mutex_lock(&wcn->conf_mutex); list_del(&vif_priv->list); wcn36xx_smd_delete_sta_self(wcn, vif->addr); mutex_unlock(&wcn->conf_mutex); } static int wcn36xx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wcn36xx *wcn = hw->priv; struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); wcn36xx_dbg(WCN36XX_DBG_MAC, "mac add interface vif %p type %d\n", vif, vif->type); if (!(NL80211_IFTYPE_STATION == vif->type || NL80211_IFTYPE_AP == vif->type || NL80211_IFTYPE_ADHOC == vif->type || NL80211_IFTYPE_MESH_POINT == vif->type)) { wcn36xx_warn("Unsupported interface type requested: %d\n", vif->type); return -EOPNOTSUPP; } mutex_lock(&wcn->conf_mutex); vif_priv->bss_index = WCN36XX_HAL_BSS_INVALID_IDX; INIT_LIST_HEAD(&vif_priv->sta_list); list_add(&vif_priv->list, &wcn->vif_list); wcn36xx_smd_add_sta_self(wcn, vif); mutex_unlock(&wcn->conf_mutex); return 0; } static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { struct wcn36xx *wcn = hw->priv; struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta); wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta add vif %p sta %pM\n", vif, sta->addr); mutex_lock(&wcn->conf_mutex); spin_lock_init(&sta_priv->ampdu_lock); sta_priv->vif = vif_priv; list_add(&sta_priv->list, &vif_priv->sta_list); /* * For STA mode HW will be configured on BSS_CHANGED_ASSOC because * at this stage AID is not available yet. */ if (NL80211_IFTYPE_STATION != vif->type) { wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn)); sta_priv->aid = sta->aid; wcn36xx_smd_config_sta(wcn, vif, sta); } mutex_unlock(&wcn->conf_mutex); return 0; } static int wcn36xx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { struct wcn36xx *wcn = hw->priv; struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta); wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta remove vif %p sta %pM index %d\n", vif, sta->addr, sta_priv->sta_index); mutex_lock(&wcn->conf_mutex); list_del(&sta_priv->list); wcn36xx_smd_delete_sta(wcn, sta_priv->sta_index); sta_priv->vif = NULL; mutex_unlock(&wcn->conf_mutex); return 0; } #ifdef CONFIG_PM static struct ieee80211_vif *wcn36xx_get_first_assoc_vif(struct wcn36xx *wcn) { struct wcn36xx_vif *vif_priv = NULL; struct ieee80211_vif *vif = NULL; list_for_each_entry(vif_priv, &wcn->vif_list, list) { if (vif_priv->sta_assoc) { vif = wcn36xx_priv_to_vif(vif_priv); break; } } return vif; } static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) { struct wcn36xx *wcn = hw->priv; struct ieee80211_vif *vif = NULL; int ret = 0; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n"); mutex_lock(&wcn->conf_mutex); vif = wcn36xx_get_first_assoc_vif(wcn); if (vif) { ret = wcn36xx_smd_arp_offload(wcn, vif, true); if (ret) goto out; ret = wcn36xx_smd_ipv6_ns_offload(wcn, vif, true); if (ret) goto out; ret = wcn36xx_smd_gtk_offload(wcn, vif, true); if (ret) goto out; ret = wcn36xx_smd_set_power_params(wcn, true); if (ret) goto out; ret = wcn36xx_smd_wlan_host_suspend_ind(wcn); } /* Disable IRQ, we don't want to handle any packet before mac80211 is * resumed and ready to receive packets. */ disable_irq(wcn->tx_irq); disable_irq(wcn->rx_irq); out: mutex_unlock(&wcn->conf_mutex); return ret; } static int wcn36xx_resume(struct ieee80211_hw *hw) { struct wcn36xx *wcn = hw->priv; struct ieee80211_vif *vif = NULL; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac resume\n"); mutex_lock(&wcn->conf_mutex); vif = wcn36xx_get_first_assoc_vif(wcn); if (vif) { wcn36xx_smd_host_resume(wcn); wcn36xx_smd_set_power_params(wcn, false); wcn36xx_smd_gtk_offload_get_info(wcn, vif); wcn36xx_smd_gtk_offload(wcn, vif, false); wcn36xx_smd_ipv6_ns_offload(wcn, vif, false); wcn36xx_smd_arp_offload(wcn, vif, false); } enable_irq(wcn->tx_irq); enable_irq(wcn->rx_irq); mutex_unlock(&wcn->conf_mutex); return 0; } static void wcn36xx_set_rekey_data(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct cfg80211_gtk_rekey_data *data) { struct wcn36xx *wcn = hw->priv; struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); mutex_lock(&wcn->conf_mutex); memcpy(vif_priv->rekey_data.kek, data->kek, NL80211_KEK_LEN); memcpy(vif_priv->rekey_data.kck, data->kck,