Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 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 | |
| 18 | #ifndef _MAC_H_ |
| 19 | #define _MAC_H_ |
| 20 | |
| 21 | #include <net/mac80211.h> |
| 22 | #include "core.h" |
| 23 | |
| 24 | struct ath10k_generic_iter { |
| 25 | struct ath10k *ar; |
| 26 | int ret; |
| 27 | }; |
| 28 | |
| 29 | struct ath10k *ath10k_mac_create(void); |
| 30 | void ath10k_mac_destroy(struct ath10k *ar); |
| 31 | int ath10k_mac_register(struct ath10k *ar); |
| 32 | void ath10k_mac_unregister(struct ath10k *ar); |
| 33 | struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, u32 vdev_id); |
| 34 | void ath10k_reset_scan(unsigned long ptr); |
| 35 | void ath10k_offchan_tx_purge(struct ath10k *ar); |
| 36 | void ath10k_offchan_tx_work(struct work_struct *work); |
Michal Kazior | affd321 | 2013-07-16 09:54:35 +0200 | [diff] [blame] | 37 | void ath10k_halt(struct ath10k *ar); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 38 | |
| 39 | static inline struct ath10k_vif *ath10k_vif_to_arvif(struct ieee80211_vif *vif) |
| 40 | { |
| 41 | return (struct ath10k_vif *)vif->drv_priv; |
| 42 | } |
| 43 | |
| 44 | static inline void ath10k_tx_h_seq_no(struct sk_buff *skb) |
| 45 | { |
| 46 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 47 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
| 48 | struct ieee80211_vif *vif = info->control.vif; |
| 49 | struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif); |
| 50 | |
| 51 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
| 52 | if (arvif->tx_seq_no == 0) |
| 53 | arvif->tx_seq_no = 0x1000; |
| 54 | |
| 55 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) |
| 56 | arvif->tx_seq_no += 0x10; |
| 57 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); |
| 58 | hdr->seq_ctrl |= cpu_to_le16(arvif->tx_seq_no); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | #endif /* _MAC_H_ */ |