Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2014, Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
0003  *
0004  * Permission to use, copy, modify, and/or distribute this software for any
0005  * purpose with or without fee is hereby granted, provided that the above
0006  * copyright notice and this permission notice appear in all copies.
0007  *
0008  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0009  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0010  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0011  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0012  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0013  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0014  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0015  */
0016 
0017 #ifndef DYNACK_H
0018 #define DYNACK_H
0019 
0020 #define ATH_DYN_BUF 64
0021 
0022 struct ath_hw;
0023 struct ath_node;
0024 
0025 /**
0026  * struct ath_dyn_rxbuf - ACK frame ring buffer
0027  * @h_rb: ring buffer head
0028  * @t_rb: ring buffer tail
0029  * @tstamp: ACK RX timestamp buffer
0030  */
0031 struct ath_dyn_rxbuf {
0032     u16 h_rb, t_rb;
0033     u32 tstamp[ATH_DYN_BUF];
0034 };
0035 
0036 struct ts_info {
0037     u32 tstamp;
0038     u32 dur;
0039 };
0040 
0041 struct haddr_pair {
0042     u8 h_dest[ETH_ALEN];
0043     u8 h_src[ETH_ALEN];
0044 };
0045 
0046 /**
0047  * struct ath_dyn_txbuf - tx frame ring buffer
0048  * @h_rb: ring buffer head
0049  * @t_rb: ring buffer tail
0050  * @addr: dest/src address pair for a given TX frame
0051  * @ts: TX frame timestamp buffer
0052  */
0053 struct ath_dyn_txbuf {
0054     u16 h_rb, t_rb;
0055     struct haddr_pair addr[ATH_DYN_BUF];
0056     struct ts_info ts[ATH_DYN_BUF];
0057 };
0058 
0059 /**
0060  * struct ath_dynack - dynack processing info
0061  * @enabled: enable dyn ack processing
0062  * @ackto: current ACK timeout
0063  * @lto: last ACK timeout computation
0064  * @nodes: ath_node linked list
0065  * @qlock: ts queue spinlock
0066  * @ack_rbf: ACK ts ring buffer
0067  * @st_rbf: status ts ring buffer
0068  */
0069 struct ath_dynack {
0070     bool enabled;
0071     int ackto;
0072     unsigned long lto;
0073 
0074     struct list_head nodes;
0075 
0076     /* protect timestamp queue access */
0077     spinlock_t qlock;
0078     struct ath_dyn_rxbuf ack_rbf;
0079     struct ath_dyn_txbuf st_rbf;
0080 };
0081 
0082 #if defined(CONFIG_ATH9K_DYNACK)
0083 void ath_dynack_reset(struct ath_hw *ah);
0084 void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an);
0085 void ath_dynack_node_deinit(struct ath_hw *ah, struct ath_node *an);
0086 void ath_dynack_init(struct ath_hw *ah);
0087 void ath_dynack_sample_ack_ts(struct ath_hw *ah, struct sk_buff *skb, u32 ts);
0088 void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
0089                  struct ath_tx_status *ts,
0090                  struct ieee80211_sta *sta);
0091 #else
0092 static inline void ath_dynack_init(struct ath_hw *ah) {}
0093 static inline void ath_dynack_node_init(struct ath_hw *ah,
0094                     struct ath_node *an) {}
0095 static inline void ath_dynack_node_deinit(struct ath_hw *ah,
0096                       struct ath_node *an) {}
0097 static inline void ath_dynack_sample_ack_ts(struct ath_hw *ah,
0098                         struct sk_buff *skb, u32 ts) {}
0099 static inline void ath_dynack_sample_tx_ts(struct ath_hw *ah,
0100                        struct sk_buff *skb,
0101                        struct ath_tx_status *ts,
0102                        struct ieee80211_sta *sta) {}
0103 #endif
0104 
0105 #endif /* DYNACK_H */