vif = wvif_to_vif(wvif); /* In AP mode, chip can reply to probe request itself */ if (*total_flags & FIF_PROBE_REQ && vif->type == NL80211_IFTYPE_AP) {
dev_dbg(wdev->dev, "do not forward probe request in AP mode\n");
*total_flags &= ~FIF_PROBE_REQ;
}
chan1 = vif_ch1->bss_conf.chanreq.oper.chan;
} if (chan0 && chan1 && vif->type != NL80211_IFTYPE_AP) { if (chan0->hw_value == chan1->hw_value) { /* It is useless to enable PS if channels are the same. */ if (enable_ps)
*enable_ps = false; if (vif->cfg.assoc && vif->cfg.ps)
dev_info(wvif->wdev->dev, "ignoring requested PS mode"); return -1;
} /* It is necessary to enable PS if channels are different. */ if (enable_ps)
*enable_ps = true; if (wfx_api_older_than(wvif->wdev, 3, 2)) return 0; else return 30;
} if (enable_ps)
*enable_ps = vif->cfg.ps; if (vif->cfg.assoc && vif->cfg.ps) return conf->dynamic_ps_timeout; else return -1;
}
int wfx_update_pm(struct wfx_vif *wvif)
{ struct ieee80211_vif *vif = wvif_to_vif(wvif); int ps_timeout; bool ps;
if (!vif->cfg.assoc) return 0;
ps_timeout = wfx_get_ps_timeout(wvif, &ps); if (!ps)
ps_timeout = 0;
WARN_ON(ps_timeout < 0); if (wvif->uapsd_mask)
ps_timeout = 0;
if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete, TU_TO_JIFFIES(512)))
dev_warn(wvif->wdev->dev, "timeout while waiting of set_pm_mode_complete\n"); return wfx_hif_set_pm(wvif, ps, ps_timeout);
}
ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, skb->data + ieoffset,
skb->len - ieoffset); if (!ptr) { /* No RSN IE is fine in open networks */
ret = 0; goto free_skb;
}
ptr += pairwise_cipher_suite_count_offset; if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) goto free_skb;
rcu_read_lock(); /* protect ssid_ie */ if (bss)
ssid_ie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); if (ssid_ie) {
ssid_len = ssid_ie[1]; if (ssid_len > IEEE80211_MAX_SSID_LEN)
ssid_len = IEEE80211_MAX_SSID_LEN;
memcpy(ssid, &ssid_ie[2], ssid_len);
}
rcu_read_unlock();
cfg80211_put_bss(wvif->wdev->hw->wiphy, bss);
wvif->join_in_progress = true;
ret = wfx_hif_join(wvif, conf, wvif->channel, ssid, ssid_len); if (ret) {
ieee80211_connection_loss(vif);
wfx_reset(wvif);
} else { /* Due to beacon filtering it is possible that the AP's beacon is not known for the * mac80211 stack. Disable filtering temporary to make sure the stack receives at * least one
*/
wfx_filter_beacon(wvif, false);
}
wfx_tx_unlock(wvif->wdev);
}
rcu_read_lock(); /* protect sta */ if (info->bssid && !vif->cfg.ibss_joined)
sta = ieee80211_find_sta(vif, info->bssid); if (sta && sta->deflink.ht_cap.ht_supported)
ampdu_density = sta->deflink.ht_cap.ampdu_density; if (sta && sta->deflink.ht_cap.ht_supported &&
!(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT))
greenfield = !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
rcu_read_unlock();
wvif->join_in_progress = false;
wfx_hif_set_association_mode(wvif, ampdu_density, greenfield, info->use_short_preamble);
wfx_hif_keep_alive_period(wvif, 0); /* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use the same value. */
wfx_hif_set_bss_params(wvif, vif->cfg.aid, 7);
wfx_hif_set_beacon_wakeup_period(wvif, 1, 1);
wfx_update_pm(wvif);
}
staticvoid wfx_enable_beacon(struct wfx_vif *wvif, bool enable)
{ /* Driver has Content After DTIM Beacon in queue. Driver is waiting for a signal from the * firmware. Since we are going to stop to send beacons, this signal will never happens. See * also wfx_suspend_resume_mc()
*/ if (!enable && wfx_tx_queues_has_cab(wvif)) {
wvif->after_dtim_tx_allowed = true;
wfx_bh_request_tx(wvif->wdev);
}
wfx_hif_beacon_transmit(wvif, enable);
}
if (changed & BSS_CHANGED_BEACON_INFO) { if (vif->type != NL80211_IFTYPE_STATION)
dev_warn(wdev->dev, "misunderstood change: BEACON_INFO\n");
wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period, info->dtim_period); /* We temporary forwarded beacon for join process. It is now no more necessary. */
wfx_filter_beacon(wvif, true);
}
if (changed & BSS_CHANGED_ARP_FILTER) { for (i = 0; i < HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES; i++) {
__be32 *arp_addr = &vif->cfg.arp_addr_list[i];
if (vif->cfg.arp_addr_cnt > HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES)
arp_addr = NULL; if (i >= vif->cfg.arp_addr_cnt)
arp_addr = NULL;
wfx_hif_set_arp_ipv4_filter(wvif, i, arp_addr);
}
}
if (changed & BSS_CHANGED_AP_PROBE_RESP || changed & BSS_CHANGED_BEACON)
wfx_upload_ap_templates(wvif);
if (changed & BSS_CHANGED_BEACON_ENABLED)
wfx_enable_beacon(wvif, info->enable_beacon);
if (changed & BSS_CHANGED_KEEP_ALIVE)
wfx_hif_keep_alive_period(wvif,
info->max_idle_period * USEC_PER_TU / USEC_PER_MSEC);
if (changed & BSS_CHANGED_ERP_CTS_PROT)
wfx_hif_erp_use_protection(wvif, info->use_cts_prot);
if (changed & BSS_CHANGED_ERP_SLOT)
wfx_hif_slot_time(wvif, info->use_short_slot ? 9 : 20);
if (changed & BSS_CHANGED_CQM)
wfx_hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold, info->cqm_rssi_hyst);
if (changed & BSS_CHANGED_TXPOWER)
wfx_hif_set_output_power(wvif, info->txpower);
if (changed & BSS_CHANGED_PS)
wfx_update_pm(wvif);
/* Device won't be able to honor CAB if a scan is in progress on any interface. Prefer to * skip this DTIM and wait for the next one.
*/ if (mutex_is_locked(&wvif->wdev->scan_lock)) return;
if (!wfx_tx_queues_has_cab(wvif) || wvif->after_dtim_tx_allowed)
dev_warn(wvif->wdev->dev, "incorrect sequence (%d CAB in queue)",
wfx_tx_queues_has_cab(wvif));
wvif->after_dtim_tx_allowed = true;
wfx_bh_request_tx(wvif->wdev);
}
int wfx_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params)
{ /* Aggregation is implemented fully in firmware */ switch (params->action) { case IEEE80211_AMPDU_RX_START: case IEEE80211_AMPDU_RX_STOP: /* Just acknowledge it to enable frame re-ordering */ return 0; default: /* Leave the firmware doing its business for tx aggregation */ return -EOPNOTSUPP;
}
}
switch (vif->type) { case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_AP: break; default:
mutex_unlock(&wdev->conf_mutex); return -EOPNOTSUPP;
}
wvif->wdev = wdev;
wvif->link_id_map = 1; /* link-id 0 is reserved for multicast */
INIT_WORK(&wvif->update_tim_work, wfx_update_tim_work);
INIT_DELAYED_WORK(&wvif->beacon_loss_work, wfx_beacon_loss_work);
for (i = 0; i < ARRAY_SIZE(wdev->vif); i++) { if (!wdev->vif[i]) {
wdev->vif[i] = vif;
wvif->id = i; break;
}
}
WARN(i == ARRAY_SIZE(wdev->vif), "try to instantiate more vif than supported");
wfx_hif_set_macaddr(wvif, vif->addr);
mutex_unlock(&wdev->conf_mutex);
wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { /* Combo mode does not support Block Acks. We can re-enable them */ if (wvif_count(wdev) == 1)
wfx_hif_set_block_ack_policy(wvif, 0xFF, 0xFF); else
wfx_hif_set_block_ack_policy(wvif, 0x00, 0x00);
} return 0;
}
wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { /* Combo mode does not support Block Acks. We can re-enable them */ if (wvif_count(wdev) == 1)
wfx_hif_set_block_ack_policy(wvif, 0xFF, 0xFF); else
wfx_hif_set_block_ack_policy(wvif, 0x00, 0x00);
}
}
#ifdef CONFIG_PM int wfx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
{ /* FIXME: hardware also support WIPHY_WOWLAN_MAGIC_PKT and other filters */ if (!wowlan->any || !wowlan->disconnect) return -EINVAL; return 0;
}
int wfx_resume(struct ieee80211_hw *hw)
{ return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.