18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> 48c2ecf20Sopenharmony_ci <http://rt2x00.serialmonkey.com> 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/* 98c2ecf20Sopenharmony_ci Module: rt2x00dump 108c2ecf20Sopenharmony_ci Abstract: 118c2ecf20Sopenharmony_ci Data structures for the rt2x00debug & userspace. 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci The declarations in this file can be used by both rt2x00 148c2ecf20Sopenharmony_ci and userspace and therefore should be kept together in 158c2ecf20Sopenharmony_ci this file. 168c2ecf20Sopenharmony_ci */ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#ifndef RT2X00DUMP_H 198c2ecf20Sopenharmony_ci#define RT2X00DUMP_H 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/** 228c2ecf20Sopenharmony_ci * DOC: Introduction 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * This header is intended to be exported to userspace, 258c2ecf20Sopenharmony_ci * to make the structures and enumerations available to userspace 268c2ecf20Sopenharmony_ci * applications. This means that all data types should be exportable. 278c2ecf20Sopenharmony_ci * 288c2ecf20Sopenharmony_ci * When rt2x00 is compiled with debugfs support enabled, 298c2ecf20Sopenharmony_ci * it is possible to capture all data coming in and out of the device 308c2ecf20Sopenharmony_ci * by reading the frame dump file. This file can have only a single reader. 318c2ecf20Sopenharmony_ci * The following frames will be reported: 328c2ecf20Sopenharmony_ci * - All incoming frames (rx) 338c2ecf20Sopenharmony_ci * - All outgoing frames (tx, including beacon and atim) 348c2ecf20Sopenharmony_ci * - All completed frames (txdone including atim) 358c2ecf20Sopenharmony_ci * 368c2ecf20Sopenharmony_ci * The data is send to the file using the following format: 378c2ecf20Sopenharmony_ci * 388c2ecf20Sopenharmony_ci * [rt2x00dump header][hardware descriptor][ieee802.11 frame] 398c2ecf20Sopenharmony_ci * 408c2ecf20Sopenharmony_ci * rt2x00dump header: The description of the dumped frame, as well as 418c2ecf20Sopenharmony_ci * additional information useful for debugging. See &rt2x00dump_hdr. 428c2ecf20Sopenharmony_ci * hardware descriptor: Descriptor that was used to receive or transmit 438c2ecf20Sopenharmony_ci * the frame. 448c2ecf20Sopenharmony_ci * ieee802.11 frame: The actual frame that was received or transmitted. 458c2ecf20Sopenharmony_ci */ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/** 488c2ecf20Sopenharmony_ci * enum rt2x00_dump_type - Frame type 498c2ecf20Sopenharmony_ci * 508c2ecf20Sopenharmony_ci * These values are used for the @type member of &rt2x00dump_hdr. 518c2ecf20Sopenharmony_ci * @DUMP_FRAME_RXDONE: This frame has been received by the hardware. 528c2ecf20Sopenharmony_ci * @DUMP_FRAME_TX: This frame is queued for transmission to the hardware. 538c2ecf20Sopenharmony_ci * @DUMP_FRAME_TXDONE: This frame indicates the device has handled 548c2ecf20Sopenharmony_ci * the tx event which has either succeeded or failed. A frame 558c2ecf20Sopenharmony_ci * with this type should also have been reported with as a 568c2ecf20Sopenharmony_ci * %DUMP_FRAME_TX frame. 578c2ecf20Sopenharmony_ci * @DUMP_FRAME_BEACON: This beacon frame is queued for transmission to the 588c2ecf20Sopenharmony_ci * hardware. 598c2ecf20Sopenharmony_ci */ 608c2ecf20Sopenharmony_cienum rt2x00_dump_type { 618c2ecf20Sopenharmony_ci DUMP_FRAME_RXDONE = 1, 628c2ecf20Sopenharmony_ci DUMP_FRAME_TX = 2, 638c2ecf20Sopenharmony_ci DUMP_FRAME_TXDONE = 3, 648c2ecf20Sopenharmony_ci DUMP_FRAME_BEACON = 4, 658c2ecf20Sopenharmony_ci}; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/** 688c2ecf20Sopenharmony_ci * struct rt2x00dump_hdr - Dump frame header 698c2ecf20Sopenharmony_ci * 708c2ecf20Sopenharmony_ci * Each frame dumped to the debugfs file starts with this header 718c2ecf20Sopenharmony_ci * attached. This header contains the description of the actual 728c2ecf20Sopenharmony_ci * frame which was dumped. 738c2ecf20Sopenharmony_ci * 748c2ecf20Sopenharmony_ci * New fields inside the structure must be appended to the end of 758c2ecf20Sopenharmony_ci * the structure. This way userspace tools compiled for earlier 768c2ecf20Sopenharmony_ci * header versions can still correctly handle the frame dump 778c2ecf20Sopenharmony_ci * (although they will not handle all data passed to them in the dump). 788c2ecf20Sopenharmony_ci * 798c2ecf20Sopenharmony_ci * @version: Header version should always be set to %DUMP_HEADER_VERSION. 808c2ecf20Sopenharmony_ci * This field must be checked by userspace to determine if it can 818c2ecf20Sopenharmony_ci * handle this frame. 828c2ecf20Sopenharmony_ci * @header_length: The length of the &rt2x00dump_hdr structure. This is 838c2ecf20Sopenharmony_ci * used for compatibility reasons so userspace can easily determine 848c2ecf20Sopenharmony_ci * the location of the next field in the dump. 858c2ecf20Sopenharmony_ci * @desc_length: The length of the device descriptor. 868c2ecf20Sopenharmony_ci * @data_length: The length of the frame data (including the ieee802.11 header. 878c2ecf20Sopenharmony_ci * @chip_rt: RT chipset 888c2ecf20Sopenharmony_ci * @chip_rf: RF chipset 898c2ecf20Sopenharmony_ci * @chip_rev: Chipset revision 908c2ecf20Sopenharmony_ci * @type: The frame type (&rt2x00_dump_type) 918c2ecf20Sopenharmony_ci * @queue_index: The index number of the data queue. 928c2ecf20Sopenharmony_ci * @entry_index: The index number of the entry inside the data queue. 938c2ecf20Sopenharmony_ci * @timestamp_sec: Timestamp - seconds 948c2ecf20Sopenharmony_ci * @timestamp_usec: Timestamp - microseconds 958c2ecf20Sopenharmony_ci */ 968c2ecf20Sopenharmony_cistruct rt2x00dump_hdr { 978c2ecf20Sopenharmony_ci __le32 version; 988c2ecf20Sopenharmony_ci#define DUMP_HEADER_VERSION 3 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci __le32 header_length; 1018c2ecf20Sopenharmony_ci __le32 desc_length; 1028c2ecf20Sopenharmony_ci __le32 data_length; 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci __le16 chip_rt; 1058c2ecf20Sopenharmony_ci __le16 chip_rf; 1068c2ecf20Sopenharmony_ci __le16 chip_rev; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci __le16 type; 1098c2ecf20Sopenharmony_ci __u8 queue_index; 1108c2ecf20Sopenharmony_ci __u8 entry_index; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci __le32 timestamp_sec; 1138c2ecf20Sopenharmony_ci __le32 timestamp_usec; 1148c2ecf20Sopenharmony_ci}; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci#endif /* RT2X00DUMP_H */ 117