Ivo van Doorn | 4d8dd66 | 2007-11-27 21:49:29 +0100 | [diff] [blame] | 1 | /* |
Gertjan van Wingerde | 9c9a0d1 | 2009-11-08 16:39:55 +0100 | [diff] [blame] | 2 | Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> |
Ivo van Doorn | 4d8dd66 | 2007-11-27 21:49:29 +0100 | [diff] [blame] | 3 | <http://rt2x00.serialmonkey.com> |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 2 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the |
| 17 | Free Software Foundation, Inc., |
| 18 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | */ |
| 20 | |
| 21 | /* |
| 22 | Module: rt2x00dump |
Gertjan van Wingerde | b4df470 | 2010-05-13 13:16:36 +0200 | [diff] [blame] | 23 | Abstract: |
| 24 | Data structures for the rt2x00debug & userspace. |
| 25 | |
| 26 | The declarations in this file can be used by both rt2x00 |
| 27 | and userspace and therefore should be kept together in |
| 28 | this file. |
Ivo van Doorn | 4d8dd66 | 2007-11-27 21:49:29 +0100 | [diff] [blame] | 29 | */ |
| 30 | |
| 31 | #ifndef RT2X00DUMP_H |
| 32 | #define RT2X00DUMP_H |
| 33 | |
| 34 | /** |
| 35 | * DOC: Introduction |
| 36 | * |
| 37 | * This header is intended to be exported to userspace, |
| 38 | * to make the structures and enumerations available to userspace |
| 39 | * applications. This means that all data types should be exportable. |
| 40 | * |
| 41 | * When rt2x00 is compiled with debugfs support enabled, |
| 42 | * it is possible to capture all data coming in and out of the device |
| 43 | * by reading the frame dump file. This file can have only a single reader. |
| 44 | * The following frames will be reported: |
| 45 | * - All incoming frames (rx) |
| 46 | * - All outgoing frames (tx, including beacon and atim) |
| 47 | * - All completed frames (txdone including atim) |
| 48 | * |
| 49 | * The data is send to the file using the following format: |
| 50 | * |
| 51 | * [rt2x00dump header][hardware descriptor][ieee802.11 frame] |
| 52 | * |
| 53 | * rt2x00dump header: The description of the dumped frame, as well as |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 54 | * additional information useful for debugging. See &rt2x00dump_hdr. |
Ivo van Doorn | 4d8dd66 | 2007-11-27 21:49:29 +0100 | [diff] [blame] | 55 | * hardware descriptor: Descriptor that was used to receive or transmit |
| 56 | * the frame. |
| 57 | * ieee802.11 frame: The actual frame that was received or transmitted. |
| 58 | */ |
| 59 | |
| 60 | /** |
| 61 | * enum rt2x00_dump_type - Frame type |
| 62 | * |
| 63 | * These values are used for the @type member of &rt2x00dump_hdr. |
| 64 | * @DUMP_FRAME_RXDONE: This frame has been received by the hardware. |
| 65 | * @DUMP_FRAME_TX: This frame is queued for transmission to the hardware. |
| 66 | * @DUMP_FRAME_TXDONE: This frame indicates the device has handled |
| 67 | * the tx event which has either succeeded or failed. A frame |
| 68 | * with this type should also have been reported with as a |
| 69 | * %DUMP_FRAME_TX frame. |
Gertjan van Wingerde | 185e5f7 | 2010-05-11 23:51:41 +0200 | [diff] [blame] | 70 | * @DUMP_FRAME_BEACON: This beacon frame is queued for transmission to the |
| 71 | * hardware. |
Ivo van Doorn | 4d8dd66 | 2007-11-27 21:49:29 +0100 | [diff] [blame] | 72 | */ |
| 73 | enum rt2x00_dump_type { |
| 74 | DUMP_FRAME_RXDONE = 1, |
| 75 | DUMP_FRAME_TX = 2, |
| 76 | DUMP_FRAME_TXDONE = 3, |
Gertjan van Wingerde | 185e5f7 | 2010-05-11 23:51:41 +0200 | [diff] [blame] | 77 | DUMP_FRAME_BEACON = 4, |
Ivo van Doorn | 4d8dd66 | 2007-11-27 21:49:29 +0100 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | /** |
| 81 | * struct rt2x00dump_hdr - Dump frame header |
| 82 | * |
| 83 | * Each frame dumped to the debugfs file starts with this header |
| 84 | * attached. This header contains the description of the actual |
| 85 | * frame which was dumped. |
| 86 | * |
| 87 | * New fields inside the structure must be appended to the end of |
| 88 | * the structure. This way userspace tools compiled for earlier |
| 89 | * header versions can still correctly handle the frame dump |
| 90 | * (although they will not handle all data passed to them in the dump). |
| 91 | * |
| 92 | * @version: Header version should always be set to %DUMP_HEADER_VERSION. |
| 93 | * This field must be checked by userspace to determine if it can |
| 94 | * handle this frame. |
| 95 | * @header_length: The length of the &rt2x00dump_hdr structure. This is |
| 96 | * used for compatibility reasons so userspace can easily determine |
| 97 | * the location of the next field in the dump. |
| 98 | * @desc_length: The length of the device descriptor. |
| 99 | * @data_length: The length of the frame data (including the ieee802.11 header. |
| 100 | * @chip_rt: RT chipset |
| 101 | * @chip_rf: RF chipset |
| 102 | * @chip_rev: Chipset revision |
| 103 | * @type: The frame type (&rt2x00_dump_type) |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 104 | * @queue_index: The index number of the data queue. |
| 105 | * @entry_index: The index number of the entry inside the data queue. |
Ivo van Doorn | 4d8dd66 | 2007-11-27 21:49:29 +0100 | [diff] [blame] | 106 | * @timestamp_sec: Timestamp - seconds |
| 107 | * @timestamp_usec: Timestamp - microseconds |
| 108 | */ |
| 109 | struct rt2x00dump_hdr { |
| 110 | __le32 version; |
| 111 | #define DUMP_HEADER_VERSION 2 |
| 112 | |
| 113 | __le32 header_length; |
| 114 | __le32 desc_length; |
| 115 | __le32 data_length; |
| 116 | |
| 117 | __le16 chip_rt; |
| 118 | __le16 chip_rf; |
John W. Linville | 1612454 | 2010-07-20 14:21:48 -0400 | [diff] [blame] | 119 | __le16 chip_rev; |
Ivo van Doorn | 4d8dd66 | 2007-11-27 21:49:29 +0100 | [diff] [blame] | 120 | |
| 121 | __le16 type; |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 122 | __u8 queue_index; |
Ivo van Doorn | 4d8dd66 | 2007-11-27 21:49:29 +0100 | [diff] [blame] | 123 | __u8 entry_index; |
| 124 | |
| 125 | __le32 timestamp_sec; |
| 126 | __le32 timestamp_usec; |
| 127 | }; |
| 128 | |
| 129 | #endif /* RT2X00DUMP_H */ |