rt2x00dump.h 3.7 KB

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