diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2007-11-27 15:49:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:05:08 -0500 |
commit | 4d8dd66c1659ba0d1b110ed0488f4f6ffbc90e71 (patch) | |
tree | 03ae5e8fc993ec504f099ddb5d1f40f3a371289d /drivers/net/wireless/rt2x00/rt2x00dump.h | |
parent | 08992f7fb139c7dbaf593402312ee5a055352f05 (diff) |
rt2x00: Add TX/RX frame dumping facility
This adds TX/RX frame dumping capabilities through debugfs.
The intention is that with this approach debugging of rt2x00 is
simplified since _all_ frames going in and out of the device
are send to debugfs as well along with additional information
like the hardware descriptor.
Based on the patch by Mattias Nissler.
Mattias also has some tools that will make the dumped frames
available to wireshark: http://www-user.rhrk.uni-kl.de/~nissler/rt2x00/
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00dump.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dump.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dump.h b/drivers/net/wireless/rt2x00/rt2x00dump.h new file mode 100644 index 000000000000..99f3f367adce --- /dev/null +++ b/drivers/net/wireless/rt2x00/rt2x00dump.h | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | Copyright (C) 2004 - 2007 rt2x00 SourceForge Project | ||
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 | ||
23 | Abstract: Data structures for the rt2x00debug & userspace. | ||
24 | */ | ||
25 | |||
26 | #ifndef RT2X00DUMP_H | ||
27 | #define RT2X00DUMP_H | ||
28 | |||
29 | /** | ||
30 | * DOC: Introduction | ||
31 | * | ||
32 | * This header is intended to be exported to userspace, | ||
33 | * to make the structures and enumerations available to userspace | ||
34 | * applications. This means that all data types should be exportable. | ||
35 | * | ||
36 | * When rt2x00 is compiled with debugfs support enabled, | ||
37 | * it is possible to capture all data coming in and out of the device | ||
38 | * by reading the frame dump file. This file can have only a single reader. | ||
39 | * The following frames will be reported: | ||
40 | * - All incoming frames (rx) | ||
41 | * - All outgoing frames (tx, including beacon and atim) | ||
42 | * - All completed frames (txdone including atim) | ||
43 | * | ||
44 | * The data is send to the file using the following format: | ||
45 | * | ||
46 | * [rt2x00dump header][hardware descriptor][ieee802.11 frame] | ||
47 | * | ||
48 | * rt2x00dump header: The description of the dumped frame, as well as | ||
49 | * additional information usefull for debugging. See &rt2x00dump_hdr. | ||
50 | * hardware descriptor: Descriptor that was used to receive or transmit | ||
51 | * the frame. | ||
52 | * ieee802.11 frame: The actual frame that was received or transmitted. | ||
53 | */ | ||
54 | |||
55 | /** | ||
56 | * enum rt2x00_dump_type - Frame type | ||
57 | * | ||
58 | * These values are used for the @type member of &rt2x00dump_hdr. | ||
59 | * @DUMP_FRAME_RXDONE: This frame has been received by the hardware. | ||
60 | * @DUMP_FRAME_TX: This frame is queued for transmission to the hardware. | ||
61 | * @DUMP_FRAME_TXDONE: This frame indicates the device has handled | ||
62 | * the tx event which has either succeeded or failed. A frame | ||
63 | * with this type should also have been reported with as a | ||
64 | * %DUMP_FRAME_TX frame. | ||
65 | */ | ||
66 | enum rt2x00_dump_type { | ||
67 | DUMP_FRAME_RXDONE = 1, | ||
68 | DUMP_FRAME_TX = 2, | ||
69 | DUMP_FRAME_TXDONE = 3, | ||
70 | }; | ||
71 | |||
72 | /** | ||
73 | * struct rt2x00dump_hdr - Dump frame header | ||
74 | * | ||
75 | * Each frame dumped to the debugfs file starts with this header | ||
76 | * attached. This header contains the description of the actual | ||
77 | * frame which was dumped. | ||
78 | * | ||
79 | * New fields inside the structure must be appended to the end of | ||
80 | * the structure. This way userspace tools compiled for earlier | ||
81 | * header versions can still correctly handle the frame dump | ||
82 | * (although they will not handle all data passed to them in the dump). | ||
83 | * | ||
84 | * @version: Header version should always be set to %DUMP_HEADER_VERSION. | ||
85 | * This field must be checked by userspace to determine if it can | ||
86 | * handle this frame. | ||
87 | * @header_length: The length of the &rt2x00dump_hdr structure. This is | ||
88 | * used for compatibility reasons so userspace can easily determine | ||
89 | * the location of the next field in the dump. | ||
90 | * @desc_length: The length of the device descriptor. | ||
91 | * @data_length: The length of the frame data (including the ieee802.11 header. | ||
92 | * @chip_rt: RT chipset | ||
93 | * @chip_rf: RF chipset | ||
94 | * @chip_rev: Chipset revision | ||
95 | * @type: The frame type (&rt2x00_dump_type) | ||
96 | * @ring_index: The index number of the data ring. | ||
97 | * @entry_index: The index number of the entry inside the data ring. | ||
98 | * @timestamp_sec: Timestamp - seconds | ||
99 | * @timestamp_usec: Timestamp - microseconds | ||
100 | */ | ||
101 | struct rt2x00dump_hdr { | ||
102 | __le32 version; | ||
103 | #define DUMP_HEADER_VERSION 2 | ||
104 | |||
105 | __le32 header_length; | ||
106 | __le32 desc_length; | ||
107 | __le32 data_length; | ||
108 | |||
109 | __le16 chip_rt; | ||
110 | __le16 chip_rf; | ||
111 | __le32 chip_rev; | ||
112 | |||
113 | __le16 type; | ||
114 | __u8 ring_index; | ||
115 | __u8 entry_index; | ||
116 | |||
117 | __le32 timestamp_sec; | ||
118 | __le32 timestamp_usec; | ||
119 | }; | ||
120 | |||
121 | #endif /* RT2X00DUMP_H */ | ||