rt2x00dump.h 4.0 KB

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