Path: blob/main/sys/contrib/dev/athk/ath10k/mac.h
105254 views
/* SPDX-License-Identifier: ISC */1/*2* Copyright (c) 2005-2011 Atheros Communications Inc.3* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.4*/56#ifndef _MAC_H_7#define _MAC_H_89#include <net/mac80211.h>10#include "core.h"1112#define WEP_KEYID_SHIFT 61314enum wmi_tlv_tx_pause_id;15enum wmi_tlv_tx_pause_action;1617struct ath10k_generic_iter {18struct ath10k *ar;19int ret;20};2122struct rfc1042_hdr {23u8 llc_dsap;24u8 llc_ssap;25u8 llc_ctrl;26u8 snap_oui[3];27__be16 snap_type;28} __packed;2930struct ath10k *ath10k_mac_create(size_t priv_size);31void ath10k_mac_destroy(struct ath10k *ar);32int ath10k_mac_register(struct ath10k *ar);33void ath10k_mac_unregister(struct ath10k *ar);34struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, u32 vdev_id);35void __ath10k_scan_finish(struct ath10k *ar);36void ath10k_scan_finish(struct ath10k *ar);37void ath10k_scan_timeout_work(struct work_struct *work);38void ath10k_offchan_tx_purge(struct ath10k *ar);39void ath10k_offchan_tx_work(struct work_struct *work);40void ath10k_mgmt_over_wmi_tx_purge(struct ath10k *ar);41void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work);42void ath10k_halt(struct ath10k *ar);43void ath10k_mac_vif_beacon_free(struct ath10k_vif *arvif);44void ath10k_drain_tx(struct ath10k *ar);45bool ath10k_mac_is_peer_wep_key_set(struct ath10k *ar, const u8 *addr,46u8 keyidx);47int ath10k_mac_vif_chan(struct ieee80211_vif *vif,48struct cfg80211_chan_def *def);4950void ath10k_mac_handle_beacon(struct ath10k *ar, struct sk_buff *skb);51void ath10k_mac_handle_beacon_miss(struct ath10k *ar, u32 vdev_id);52void ath10k_mac_handle_tx_pause_vdev(struct ath10k *ar, u32 vdev_id,53enum wmi_tlv_tx_pause_id pause_id,54enum wmi_tlv_tx_pause_action action);5556u8 ath10k_mac_hw_rate_to_idx(const struct ieee80211_supported_band *sband,57u8 hw_rate, bool cck);58u8 ath10k_mac_bitrate_to_idx(const struct ieee80211_supported_band *sband,59u32 bitrate);6061void ath10k_mac_tx_lock(struct ath10k *ar, int reason);62void ath10k_mac_tx_unlock(struct ath10k *ar, int reason);63void ath10k_mac_vif_tx_lock(struct ath10k_vif *arvif, int reason);64void ath10k_mac_vif_tx_unlock(struct ath10k_vif *arvif, int reason);65bool ath10k_mac_tx_frm_has_freq(struct ath10k *ar);66void ath10k_mac_tx_push_pending(struct ath10k *ar);67int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,68struct ieee80211_txq *txq);69struct ieee80211_txq *ath10k_mac_txq_lookup(struct ath10k *ar,70u16 peer_id,71u8 tid);72int ath10k_mac_ext_resource_config(struct ath10k *ar, u32 val);73void ath10k_mac_wait_tx_complete(struct ath10k *ar);74int ath10k_mac_rfkill_enable_radio(struct ath10k *ar, bool enable);7576static inline void ath10k_tx_h_seq_no(struct ieee80211_vif *vif,77struct sk_buff *skb)78{79struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);80struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;81struct ath10k_vif *arvif = (void *)vif->drv_priv;8283if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {84if (arvif->tx_seq_no == 0)85arvif->tx_seq_no = 0x1000;8687if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)88arvif->tx_seq_no += 0x10;89hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);90hdr->seq_ctrl |= cpu_to_le16(arvif->tx_seq_no);91}92}9394#endif /* _MAC_H_ */959697