18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2014, Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#ifndef DYNACK_H 188c2ecf20Sopenharmony_ci#define DYNACK_H 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define ATH_DYN_BUF 64 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_cistruct ath_hw; 238c2ecf20Sopenharmony_cistruct ath_node; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci/** 268c2ecf20Sopenharmony_ci * struct ath_dyn_rxbuf - ACK frame ring buffer 278c2ecf20Sopenharmony_ci * @h_rb: ring buffer head 288c2ecf20Sopenharmony_ci * @t_rb: ring buffer tail 298c2ecf20Sopenharmony_ci * @tstamp: ACK RX timestamp buffer 308c2ecf20Sopenharmony_ci */ 318c2ecf20Sopenharmony_cistruct ath_dyn_rxbuf { 328c2ecf20Sopenharmony_ci u16 h_rb, t_rb; 338c2ecf20Sopenharmony_ci u32 tstamp[ATH_DYN_BUF]; 348c2ecf20Sopenharmony_ci}; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistruct ts_info { 378c2ecf20Sopenharmony_ci u32 tstamp; 388c2ecf20Sopenharmony_ci u32 dur; 398c2ecf20Sopenharmony_ci}; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistruct haddr_pair { 428c2ecf20Sopenharmony_ci u8 h_dest[ETH_ALEN]; 438c2ecf20Sopenharmony_ci u8 h_src[ETH_ALEN]; 448c2ecf20Sopenharmony_ci}; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci/** 478c2ecf20Sopenharmony_ci * struct ath_dyn_txbuf - tx frame ring buffer 488c2ecf20Sopenharmony_ci * @h_rb: ring buffer head 498c2ecf20Sopenharmony_ci * @t_rb: ring buffer tail 508c2ecf20Sopenharmony_ci * @addr: dest/src address pair for a given TX frame 518c2ecf20Sopenharmony_ci * @ts: TX frame timestamp buffer 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_cistruct ath_dyn_txbuf { 548c2ecf20Sopenharmony_ci u16 h_rb, t_rb; 558c2ecf20Sopenharmony_ci struct haddr_pair addr[ATH_DYN_BUF]; 568c2ecf20Sopenharmony_ci struct ts_info ts[ATH_DYN_BUF]; 578c2ecf20Sopenharmony_ci}; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci/** 608c2ecf20Sopenharmony_ci * struct ath_dynack - dynack processing info 618c2ecf20Sopenharmony_ci * @enabled: enable dyn ack processing 628c2ecf20Sopenharmony_ci * @ackto: current ACK timeout 638c2ecf20Sopenharmony_ci * @lto: last ACK timeout computation 648c2ecf20Sopenharmony_ci * @nodes: ath_node linked list 658c2ecf20Sopenharmony_ci * @qlock: ts queue spinlock 668c2ecf20Sopenharmony_ci * @ack_rbf: ACK ts ring buffer 678c2ecf20Sopenharmony_ci * @st_rbf: status ts ring buffer 688c2ecf20Sopenharmony_ci */ 698c2ecf20Sopenharmony_cistruct ath_dynack { 708c2ecf20Sopenharmony_ci bool enabled; 718c2ecf20Sopenharmony_ci int ackto; 728c2ecf20Sopenharmony_ci unsigned long lto; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci struct list_head nodes; 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci /* protect timestamp queue access */ 778c2ecf20Sopenharmony_ci spinlock_t qlock; 788c2ecf20Sopenharmony_ci struct ath_dyn_rxbuf ack_rbf; 798c2ecf20Sopenharmony_ci struct ath_dyn_txbuf st_rbf; 808c2ecf20Sopenharmony_ci}; 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#if defined(CONFIG_ATH9K_DYNACK) 838c2ecf20Sopenharmony_civoid ath_dynack_reset(struct ath_hw *ah); 848c2ecf20Sopenharmony_civoid ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an); 858c2ecf20Sopenharmony_civoid ath_dynack_node_deinit(struct ath_hw *ah, struct ath_node *an); 868c2ecf20Sopenharmony_civoid ath_dynack_init(struct ath_hw *ah); 878c2ecf20Sopenharmony_civoid ath_dynack_sample_ack_ts(struct ath_hw *ah, struct sk_buff *skb, u32 ts); 888c2ecf20Sopenharmony_civoid ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb, 898c2ecf20Sopenharmony_ci struct ath_tx_status *ts, 908c2ecf20Sopenharmony_ci struct ieee80211_sta *sta); 918c2ecf20Sopenharmony_ci#else 928c2ecf20Sopenharmony_cistatic inline void ath_dynack_init(struct ath_hw *ah) {} 938c2ecf20Sopenharmony_cistatic inline void ath_dynack_node_init(struct ath_hw *ah, 948c2ecf20Sopenharmony_ci struct ath_node *an) {} 958c2ecf20Sopenharmony_cistatic inline void ath_dynack_node_deinit(struct ath_hw *ah, 968c2ecf20Sopenharmony_ci struct ath_node *an) {} 978c2ecf20Sopenharmony_cistatic inline void ath_dynack_sample_ack_ts(struct ath_hw *ah, 988c2ecf20Sopenharmony_ci struct sk_buff *skb, u32 ts) {} 998c2ecf20Sopenharmony_cistatic inline void ath_dynack_sample_tx_ts(struct ath_hw *ah, 1008c2ecf20Sopenharmony_ci struct sk_buff *skb, 1018c2ecf20Sopenharmony_ci struct ath_tx_status *ts, 1028c2ecf20Sopenharmony_ci struct ieee80211_sta *sta) {} 1038c2ecf20Sopenharmony_ci#endif 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#endif /* DYNACK_H */ 106