rt2x00dump.h 4.3 KB

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