OLD | NEW |
(Empty) | |
| 1 #ifndef PKTLOG_H |
| 2 #define PKTLOG_H |
| 3 |
| 4 #ifdef CONFIG_ATH9K_PKTLOG |
| 5 #define CUR_PKTLOG_VER 10010 /* Packet log version */ |
| 6 #define PKTLOG_MAGIC_NUM 7735225 |
| 7 #define ATH_PKTLOG_TX 0x000000001 |
| 8 #define ATH_PKTLOG_RX 0x000000002 |
| 9 #define ATH_PKTLOG_RCFIND 0x000000004 |
| 10 #define ATH_PKTLOG_RCUPDATE 0x000000008 |
| 11 |
| 12 #define ATH_DEBUGFS_PKTLOG_SIZE_DEFAULT (1024 * 1024) |
| 13 #define ATH_PKTLOG_FILTER_DEFAULT (ATH_PKTLOG_TX | ATH_PKTLOG_RX | \ |
| 14 ATH_PKTLOG_RCFIND | ATH_PKTLOG_RCUPDATE) |
| 15 |
| 16 #define PHFLAGS_MACVERSION_MASK 0x00ff0000 |
| 17 #define PHFLAGS_MACVERSION_SFT 16 |
| 18 #define PHFLAGS_MACREV_MASK 0xff0 /* MAC revision */ |
| 19 #define PHFLAGS_MACREV_SFT 4 |
| 20 |
| 21 struct ath_pktlog_hdr { |
| 22 u32 flags; |
| 23 u16 log_type; /* Type of log information foll this header */ |
| 24 int16_t size; /* Size of variable length log information in bytes */ |
| 25 u32 timestamp; |
| 26 } __packed; |
| 27 |
| 28 /* Types of packet log events */ |
| 29 #define PKTLOG_TYPE_TXCTL 0 |
| 30 #define PKTLOG_TYPE_TXSTATUS 1 |
| 31 #define PKTLOG_TYPE_RX 2 |
| 32 #define PKTLOG_TYPE_RCFIND 3 |
| 33 #define PKTLOG_TYPE_RCUPDATE 4 |
| 34 |
| 35 #define PKTLOG_MAX_TXCTL_WORDS 12 |
| 36 #define PKTLOG_MAX_TXSTATUS_WORDS 10 |
| 37 #define PKTLOG_MAX_PROTO_WORDS 16 |
| 38 |
| 39 struct ath_pktlog_txctl { |
| 40 __le16 framectrl; /* frame control field from header */ |
| 41 __le16 seqctrl; /* frame control field from header */ |
| 42 u16 bssid_tail; /* last two octets of bssid */ |
| 43 u16 sa_tail; /* last two octets of SA */ |
| 44 u16 da_tail; /* last two octets of DA */ |
| 45 u16 resvd; |
| 46 u32 txdesc_ctl[PKTLOG_MAX_TXCTL_WORDS]; /* Tx descriptor words */ |
| 47 unsigned long proto_hdr; /* protocol header (variable length!) */ |
| 48 int32_t misc[0]; /* Can be used for HT specific or other misc info */ |
| 49 } __packed; |
| 50 |
| 51 struct ath_pktlog_txstatus { |
| 52 /* Tx descriptor status words */ |
| 53 u32 txdesc_status[PKTLOG_MAX_TXSTATUS_WORDS]; |
| 54 int32_t misc[0]; /* Can be used for HT specific or other misc info */ |
| 55 } __packed; |
| 56 |
| 57 #define PKTLOG_MAX_RXSTATUS_WORDS 11 |
| 58 |
| 59 struct ath_pktlog_rx { |
| 60 u16 framectrl; /* frame control field from header */ |
| 61 u16 seqctrl; /* sequence control field */ |
| 62 u16 bssid_tail; /* last two octets of bssid */ |
| 63 u16 sa_tail; /* last two octets of SA */ |
| 64 u16 da_tail; /* last two octets of DA */ |
| 65 u16 resvd; |
| 66 u32 rxdesc_status[PKTLOG_MAX_RXSTATUS_WORDS]; /* Rx descriptor words */ |
| 67 unsigned long proto_hdr; /* protocol header (variable length!) */ |
| 68 int32_t misc[0]; /* Can be used for HT specific or other misc info */ |
| 69 } __packed; |
| 70 |
| 71 struct ath_pktlog_rcfind { |
| 72 u8 rate; |
| 73 u8 rateCode; |
| 74 s8 rcRssiLast; |
| 75 s8 rcRssiLastPrev; |
| 76 s8 rcRssiLastPrev2; |
| 77 s8 rssiReduce; |
| 78 u8 rcProbeRate; |
| 79 s8 isProbing; |
| 80 s8 primeInUse; |
| 81 s8 currentPrimeState; |
| 82 u8 rcRateTableSize; |
| 83 u8 rcRateMax; |
| 84 u8 ac; |
| 85 int32_t misc[0]; /* Can be used for HT specific or other misc info */ |
| 86 } __packed; |
| 87 |
| 88 struct ath_pktlog_rcupdate { |
| 89 u8 txRate; |
| 90 u8 rateCode; |
| 91 s8 rssiAck; |
| 92 u8 Xretries; |
| 93 u8 retries; |
| 94 s8 rcRssiLast; |
| 95 s8 rcRssiLastLkup; |
| 96 s8 rcRssiLastPrev; |
| 97 s8 rcRssiLastPrev2; |
| 98 u8 rcProbeRate; |
| 99 u8 rcRateMax; |
| 100 s8 useTurboPrime; |
| 101 s8 currentBoostState; |
| 102 u8 rcHwMaxRetryRate; |
| 103 u8 ac; |
| 104 u8 resvd[2]; |
| 105 s8 rcRssiThres[RATE_TABLE_SIZE]; |
| 106 u8 rcPer[RATE_TABLE_SIZE]; |
| 107 u8 resv2[RATE_TABLE_SIZE + 5]; |
| 108 int32_t misc[0]; /* Can be used for HT specific or other misc info */ |
| 109 }; |
| 110 |
| 111 #define TXCTL_OFFSET(ah) (AR_SREV_9300_20_OR_LATER(ah) ? 11 : 2) |
| 112 #define TXCTL_NUMWORDS(ah) (AR_SREV_5416_20_OR_LATER(ah) ? 12 : 8) |
| 113 #define TXSTATUS_OFFSET(ah) (AR_SREV_9300_20_OR_LATER(ah) ? 2 : 14) |
| 114 #define TXSTATUS_NUMWORDS(ah) (AR_SREV_9300_20_OR_LATER(ah) ? 7 : 10) |
| 115 |
| 116 #define RXCTL_OFFSET(ah) (AR_SREV_9300_20_OR_LATER(ah) ? 0 : 3) |
| 117 #define RXCTL_NUMWORDS(ah) (AR_SREV_9300_20_OR_LATER(ah) ? 0 : 1) |
| 118 #define RXSTATUS_OFFSET(ah) (AR_SREV_9300_20_OR_LATER(ah) ? 1 : 4) |
| 119 #define RXSTATUS_NUMWORDS(ah) (AR_SREV_9300_20_OR_LATER(ah) ? 11 : 9) |
| 120 |
| 121 struct ath_desc_info { |
| 122 u8 txctl_offset; |
| 123 u8 txctl_numwords; |
| 124 u8 txstatus_offset; |
| 125 u8 txstatus_numwords; |
| 126 u8 rxctl_offset; |
| 127 u8 rxctl_numwords; |
| 128 u8 rxstatus_offset; |
| 129 u8 rxstatus_numwords; |
| 130 }; |
| 131 |
| 132 #define PKTLOG_MOV_RD_IDX(_rd_offset, _log_buf, _log_size) \ |
| 133 do { \ |
| 134 if ((_rd_offset + sizeof(struct ath_pktlog_hdr) + \ |
| 135 ((struct ath_pktlog_hdr *)((_log_buf)->log_data + \ |
| 136 (_rd_offset)))->size) <= _log_size) { \ |
| 137 _rd_offset = ((_rd_offset) + \ |
| 138 sizeof(struct ath_pktlog_hdr) + \ |
| 139 ((struct ath_pktlog_hdr *) \ |
| 140 ((_log_buf)->log_data + \ |
| 141 (_rd_offset)))->size); \ |
| 142 } else { \ |
| 143 _rd_offset = ((struct ath_pktlog_hdr *) \ |
| 144 ((_log_buf)->log_data + \ |
| 145 (_rd_offset)))->size; \ |
| 146 } \ |
| 147 (_rd_offset) = (((_log_size) - (_rd_offset)) >= \ |
| 148 sizeof(struct ath_pktlog_hdr)) ? \ |
| 149 _rd_offset : 0; \ |
| 150 } while (0); |
| 151 |
| 152 struct ath_pktlog_bufhdr { |
| 153 u32 magic_num; /* Used by post processing scripts */ |
| 154 u32 version; /* Set to CUR_PKTLOG_VER */ |
| 155 }; |
| 156 |
| 157 struct ath_pktlog_buf { |
| 158 struct ath_pktlog_bufhdr bufhdr; |
| 159 int32_t rd_offset; |
| 160 int32_t wr_offset; |
| 161 char log_data[0]; |
| 162 }; |
| 163 |
| 164 struct ath_pktlog { |
| 165 struct ath_pktlog_buf *pktlog_buf; |
| 166 u32 pktlog_filter; |
| 167 u32 pktlog_buf_size; /* Size of buffer in bytes */ |
| 168 spinlock_t pktlog_lock; |
| 169 }; |
| 170 |
| 171 struct ath_pktlog_debugfs { |
| 172 struct dentry *debugfs_pktlog; |
| 173 struct dentry *pktlog_enable; |
| 174 struct dentry *pktlog_start; |
| 175 struct dentry *pktlog_filter; |
| 176 struct dentry *pktlog_size; |
| 177 struct dentry *pktlog_dump; |
| 178 struct ath_pktlog pktlog; |
| 179 }; |
| 180 |
| 181 void ath_pktlog_txctl(struct ath_softc *sc, struct ath_buf *bf); |
| 182 void ath_pktlog_txstatus(struct ath_softc *sc, void *ds); |
| 183 void ath_pktlog_rx(struct ath_softc *sc, void *ds, struct sk_buff *skb); |
| 184 void ath9k_pktlog_rc(struct ath_softc *sc, struct ath_rate_priv *ath_rc_priv, |
| 185 int8_t ratecode, u8 rate, int8_t is_probing, u16 ac); |
| 186 void ath9k_pktlog_rcupdate(struct ath_softc *sc, |
| 187 struct ath_rate_priv *ath_rc_priv, u8 tx_rate, |
| 188 u8 rate_code, u8 xretries, u8 retries, int8_t rssi, |
| 189 u16 ac); |
| 190 void ath9k_pktlog_txcomplete(struct ath_softc *sc ,struct list_head *bf_head, |
| 191 struct ath_buf *bf, struct ath_buf *bf_last); |
| 192 void ath9k_pktlog_txctrl(struct ath_softc *sc, struct list_head *bf_head, |
| 193 struct ath_buf *lastbf); |
| 194 int ath9k_init_pktlog(struct ath_softc *sc); |
| 195 void ath9k_deinit_pktlog(struct ath_softc *sc); |
| 196 #else /* CONFIG_ATH9K_PKTLOG */ |
| 197 static inline void ath_pktlog_txstatus(struct ath_softc *sc, void *ds) |
| 198 { |
| 199 } |
| 200 |
| 201 static inline void ath_pktlog_rx(struct ath_softc *sc, void *ds, |
| 202 struct sk_buff *skb) |
| 203 { |
| 204 } |
| 205 |
| 206 static inline void ath9k_pktlog_rc(struct ath_softc *sc, |
| 207 struct ath_rate_priv *ath_rc_priv, |
| 208 int8_t ratecode, u8 rate, |
| 209 int8_t is_probing, u16 ac) |
| 210 { |
| 211 } |
| 212 |
| 213 static inline void ath9k_pktlog_rcupdate(struct ath_softc *sc, |
| 214 struct ath_rate_priv *ath_rc_priv, |
| 215 u8 tx_rate, u8 rate_code, |
| 216 u8 xretries, u8 retries, |
| 217 int8_t rssi, u16 ac) |
| 218 { |
| 219 } |
| 220 |
| 221 static inline void ath9k_pktlog_txcomplete(struct ath_softc *sc, |
| 222 struct list_head *bf_head, |
| 223 struct ath_buf *bf, |
| 224 struct ath_buf *bf_last) |
| 225 { |
| 226 } |
| 227 |
| 228 static inline void ath9k_pktlog_txctrl(struct ath_softc *sc, |
| 229 struct list_head *bf_head, |
| 230 struct ath_buf *lastbf) |
| 231 { |
| 232 } |
| 233 static inline int ath9k_init_pktlog(struct ath_softc *sc) |
| 234 { |
| 235 return 0; |
| 236 } |
| 237 static inline void ath9k_deinit_pktlog(struct ath_softc *sc) |
| 238 { |
| 239 } |
| 240 #endif /* CONFIG_ATH9K_PKTLOG */ |
| 241 |
| 242 #endif |
OLD | NEW |