2 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
3 * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl>
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.
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.
18 #ifndef __MT76X02_UTIL_H
19 #define __MT76X02_UTIL_H
21 extern struct ieee80211_rate mt76x02_rates[12];
23 void mt76x02_configure_filter(struct ieee80211_hw *hw,
24 unsigned int changed_flags,
25 unsigned int *total_flags, u64 multicast);
26 int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
27 struct ieee80211_sta *sta);
28 int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
29 struct ieee80211_sta *sta);
31 void mt76x02_vif_init(struct mt76_dev *dev, struct ieee80211_vif *vif,
33 int mt76x02_add_interface(struct ieee80211_hw *hw,
34 struct ieee80211_vif *vif);
35 void mt76x02_remove_interface(struct ieee80211_hw *hw,
36 struct ieee80211_vif *vif);
38 int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
39 struct ieee80211_ampdu_params *params);
40 int mt76x02_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
41 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
42 struct ieee80211_key_conf *key);
43 int mt76x02_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
44 u16 queue, const struct ieee80211_tx_queue_params *params);
45 void mt76x02_sta_rate_tbl_update(struct ieee80211_hw *hw,
46 struct ieee80211_vif *vif,
47 struct ieee80211_sta *sta);
48 int mt76x02_insert_hdr_pad(struct sk_buff *skb);
49 void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len);
50 void mt76x02_tx_complete(struct mt76_dev *dev, struct sk_buff *skb);
51 void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
52 struct mt76_queue_entry *e, bool flush);
53 bool mt76x02_tx_status_data(struct mt76_dev *dev, u8 *update);
55 extern const u16 mt76x02_beacon_offsets[16];
56 void mt76x02_set_beacon_offsets(struct mt76_dev *dev);
57 void mt76x02_set_irq_mask(struct mt76_dev *dev, u32 clear, u32 set);
58 void mt76x02_mac_start(struct mt76_dev *dev);
60 static inline void mt76x02_irq_enable(struct mt76_dev *dev, u32 mask)
62 mt76x02_set_irq_mask(dev, 0, mask);
65 static inline void mt76x02_irq_disable(struct mt76_dev *dev, u32 mask)
67 mt76x02_set_irq_mask(dev, mask, 0);
71 mt76x02_wait_for_txrx_idle(struct mt76_dev *dev)
73 return __mt76_poll_msec(dev, MT_MAC_STATUS,
74 MT_MAC_STATUS_TX | MT_MAC_STATUS_RX,