mac.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright (c) 2005-2011 Atheros Communications Inc.
  3. * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef _MAC_H_
  18. #define _MAC_H_
  19. #include <net/mac80211.h>
  20. #include "core.h"
  21. #define WEP_KEYID_SHIFT 6
  22. enum wmi_tlv_tx_pause_id;
  23. enum wmi_tlv_tx_pause_action;
  24. struct ath10k_generic_iter {
  25. struct ath10k *ar;
  26. int ret;
  27. };
  28. struct rfc1042_hdr {
  29. u8 llc_dsap;
  30. u8 llc_ssap;
  31. u8 llc_ctrl;
  32. u8 snap_oui[3];
  33. __be16 snap_type;
  34. } __packed;
  35. struct ath10k *ath10k_mac_create(size_t priv_size);
  36. void ath10k_mac_destroy(struct ath10k *ar);
  37. int ath10k_mac_register(struct ath10k *ar);
  38. void ath10k_mac_unregister(struct ath10k *ar);
  39. struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, u32 vdev_id);
  40. void __ath10k_scan_finish(struct ath10k *ar);
  41. void ath10k_scan_finish(struct ath10k *ar);
  42. void ath10k_scan_timeout_work(struct work_struct *work);
  43. void ath10k_offchan_tx_purge(struct ath10k *ar);
  44. void ath10k_offchan_tx_work(struct work_struct *work);
  45. void ath10k_mgmt_over_wmi_tx_purge(struct ath10k *ar);
  46. void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work);
  47. void ath10k_halt(struct ath10k *ar);
  48. void ath10k_mac_vif_beacon_free(struct ath10k_vif *arvif);
  49. void ath10k_drain_tx(struct ath10k *ar);
  50. bool ath10k_mac_is_peer_wep_key_set(struct ath10k *ar, const u8 *addr,
  51. u8 keyidx);
  52. int ath10k_mac_vif_chan(struct ieee80211_vif *vif,
  53. struct cfg80211_chan_def *def);
  54. void ath10k_mac_handle_beacon(struct ath10k *ar, struct sk_buff *skb);
  55. void ath10k_mac_handle_beacon_miss(struct ath10k *ar, u32 vdev_id);
  56. void ath10k_mac_handle_tx_pause_vdev(struct ath10k *ar, u32 vdev_id,
  57. enum wmi_tlv_tx_pause_id pause_id,
  58. enum wmi_tlv_tx_pause_action action);
  59. u8 ath10k_mac_hw_rate_to_idx(const struct ieee80211_supported_band *sband,
  60. u8 hw_rate);
  61. u8 ath10k_mac_bitrate_to_idx(const struct ieee80211_supported_band *sband,
  62. u32 bitrate);
  63. void ath10k_mac_tx_lock(struct ath10k *ar, int reason);
  64. void ath10k_mac_tx_unlock(struct ath10k *ar, int reason);
  65. void ath10k_mac_vif_tx_lock(struct ath10k_vif *arvif, int reason);
  66. void ath10k_mac_vif_tx_unlock(struct ath10k_vif *arvif, int reason);
  67. static inline struct ath10k_vif *ath10k_vif_to_arvif(struct ieee80211_vif *vif)
  68. {
  69. return (struct ath10k_vif *)vif->drv_priv;
  70. }
  71. static inline void ath10k_tx_h_seq_no(struct ieee80211_vif *vif,
  72. struct sk_buff *skb)
  73. {
  74. struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  75. struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  76. struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
  77. if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
  78. if (arvif->tx_seq_no == 0)
  79. arvif->tx_seq_no = 0x1000;
  80. if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
  81. arvif->tx_seq_no += 0x10;
  82. hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
  83. hdr->seq_ctrl |= cpu_to_le16(arvif->tx_seq_no);
  84. }
  85. }
  86. #endif /* _MAC_H_ */