106 lines · c
1/*2 * Copyright (c) 2014, Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>3 *4 * Permission to use, copy, modify, and/or distribute this software for any5 * purpose with or without fee is hereby granted, provided that the above6 * copyright notice and this permission notice appear in all copies.7 *8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.15 */16 17#ifndef DYNACK_H18#define DYNACK_H19 20#define ATH_DYN_BUF 6421 22struct ath_hw;23struct ath_node;24 25/**26 * struct ath_dyn_rxbuf - ACK frame ring buffer27 * @h_rb: ring buffer head28 * @t_rb: ring buffer tail29 * @tstamp: ACK RX timestamp buffer30 */31struct ath_dyn_rxbuf {32 u16 h_rb, t_rb;33 u32 tstamp[ATH_DYN_BUF];34};35 36struct ts_info {37 u32 tstamp;38 u32 dur;39};40 41struct haddr_pair {42 u8 h_dest[ETH_ALEN];43 u8 h_src[ETH_ALEN];44};45 46/**47 * struct ath_dyn_txbuf - tx frame ring buffer48 * @h_rb: ring buffer head49 * @t_rb: ring buffer tail50 * @addr: dest/src address pair for a given TX frame51 * @ts: TX frame timestamp buffer52 */53struct ath_dyn_txbuf {54 u16 h_rb, t_rb;55 struct haddr_pair addr[ATH_DYN_BUF];56 struct ts_info ts[ATH_DYN_BUF];57};58 59/**60 * struct ath_dynack - dynack processing info61 * @enabled: enable dyn ack processing62 * @ackto: current ACK timeout63 * @lto: last ACK timeout computation64 * @nodes: ath_node linked list65 * @qlock: ts queue spinlock66 * @ack_rbf: ACK ts ring buffer67 * @st_rbf: status ts ring buffer68 */69struct ath_dynack {70 bool enabled;71 int ackto;72 unsigned long lto;73 74 struct list_head nodes;75 76 /* protect timestamp queue access */77 spinlock_t qlock;78 struct ath_dyn_rxbuf ack_rbf;79 struct ath_dyn_txbuf st_rbf;80};81 82#if defined(CONFIG_ATH9K_DYNACK)83void ath_dynack_reset(struct ath_hw *ah);84void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an);85void ath_dynack_node_deinit(struct ath_hw *ah, struct ath_node *an);86void ath_dynack_init(struct ath_hw *ah);87void ath_dynack_sample_ack_ts(struct ath_hw *ah, struct sk_buff *skb, u32 ts);88void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,89 struct ath_tx_status *ts,90 struct ieee80211_sta *sta);91#else92static inline void ath_dynack_init(struct ath_hw *ah) {}93static inline void ath_dynack_node_init(struct ath_hw *ah,94 struct ath_node *an) {}95static inline void ath_dynack_node_deinit(struct ath_hw *ah,96 struct ath_node *an) {}97static inline void ath_dynack_sample_ack_ts(struct ath_hw *ah,98 struct sk_buff *skb, u32 ts) {}99static inline void ath_dynack_sample_tx_ts(struct ath_hw *ah,100 struct sk_buff *skb,101 struct ath_tx_status *ts,102 struct ieee80211_sta *sta) {}103#endif104 105#endif /* DYNACK_H */106