rt2x00dump.h 4.2 KB

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