162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> 462306a36Sopenharmony_ci <http://rt2x00.serialmonkey.com> 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci/* 962306a36Sopenharmony_ci Module: rt2x00dump 1062306a36Sopenharmony_ci Abstract: 1162306a36Sopenharmony_ci Data structures for the rt2x00debug & userspace. 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci The declarations in this file can be used by both rt2x00 1462306a36Sopenharmony_ci and userspace and therefore should be kept together in 1562306a36Sopenharmony_ci this file. 1662306a36Sopenharmony_ci */ 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#ifndef RT2X00DUMP_H 1962306a36Sopenharmony_ci#define RT2X00DUMP_H 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci/** 2262306a36Sopenharmony_ci * DOC: Introduction 2362306a36Sopenharmony_ci * 2462306a36Sopenharmony_ci * This header is intended to be exported to userspace, 2562306a36Sopenharmony_ci * to make the structures and enumerations available to userspace 2662306a36Sopenharmony_ci * applications. This means that all data types should be exportable. 2762306a36Sopenharmony_ci * 2862306a36Sopenharmony_ci * When rt2x00 is compiled with debugfs support enabled, 2962306a36Sopenharmony_ci * it is possible to capture all data coming in and out of the device 3062306a36Sopenharmony_ci * by reading the frame dump file. This file can have only a single reader. 3162306a36Sopenharmony_ci * The following frames will be reported: 3262306a36Sopenharmony_ci * - All incoming frames (rx) 3362306a36Sopenharmony_ci * - All outgoing frames (tx, including beacon and atim) 3462306a36Sopenharmony_ci * - All completed frames (txdone including atim) 3562306a36Sopenharmony_ci * 3662306a36Sopenharmony_ci * The data is send to the file using the following format: 3762306a36Sopenharmony_ci * 3862306a36Sopenharmony_ci * [rt2x00dump header][hardware descriptor][ieee802.11 frame] 3962306a36Sopenharmony_ci * 4062306a36Sopenharmony_ci * rt2x00dump header: The description of the dumped frame, as well as 4162306a36Sopenharmony_ci * additional information useful for debugging. See &rt2x00dump_hdr. 4262306a36Sopenharmony_ci * hardware descriptor: Descriptor that was used to receive or transmit 4362306a36Sopenharmony_ci * the frame. 4462306a36Sopenharmony_ci * ieee802.11 frame: The actual frame that was received or transmitted. 4562306a36Sopenharmony_ci */ 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci/** 4862306a36Sopenharmony_ci * enum rt2x00_dump_type - Frame type 4962306a36Sopenharmony_ci * 5062306a36Sopenharmony_ci * These values are used for the @type member of &rt2x00dump_hdr. 5162306a36Sopenharmony_ci * @DUMP_FRAME_RXDONE: This frame has been received by the hardware. 5262306a36Sopenharmony_ci * @DUMP_FRAME_TX: This frame is queued for transmission to the hardware. 5362306a36Sopenharmony_ci * @DUMP_FRAME_TXDONE: This frame indicates the device has handled 5462306a36Sopenharmony_ci * the tx event which has either succeeded or failed. A frame 5562306a36Sopenharmony_ci * with this type should also have been reported with as a 5662306a36Sopenharmony_ci * %DUMP_FRAME_TX frame. 5762306a36Sopenharmony_ci * @DUMP_FRAME_BEACON: This beacon frame is queued for transmission to the 5862306a36Sopenharmony_ci * hardware. 5962306a36Sopenharmony_ci */ 6062306a36Sopenharmony_cienum rt2x00_dump_type { 6162306a36Sopenharmony_ci DUMP_FRAME_RXDONE = 1, 6262306a36Sopenharmony_ci DUMP_FRAME_TX = 2, 6362306a36Sopenharmony_ci DUMP_FRAME_TXDONE = 3, 6462306a36Sopenharmony_ci DUMP_FRAME_BEACON = 4, 6562306a36Sopenharmony_ci}; 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci/** 6862306a36Sopenharmony_ci * struct rt2x00dump_hdr - Dump frame header 6962306a36Sopenharmony_ci * 7062306a36Sopenharmony_ci * Each frame dumped to the debugfs file starts with this header 7162306a36Sopenharmony_ci * attached. This header contains the description of the actual 7262306a36Sopenharmony_ci * frame which was dumped. 7362306a36Sopenharmony_ci * 7462306a36Sopenharmony_ci * New fields inside the structure must be appended to the end of 7562306a36Sopenharmony_ci * the structure. This way userspace tools compiled for earlier 7662306a36Sopenharmony_ci * header versions can still correctly handle the frame dump 7762306a36Sopenharmony_ci * (although they will not handle all data passed to them in the dump). 7862306a36Sopenharmony_ci * 7962306a36Sopenharmony_ci * @version: Header version should always be set to %DUMP_HEADER_VERSION. 8062306a36Sopenharmony_ci * This field must be checked by userspace to determine if it can 8162306a36Sopenharmony_ci * handle this frame. 8262306a36Sopenharmony_ci * @header_length: The length of the &rt2x00dump_hdr structure. This is 8362306a36Sopenharmony_ci * used for compatibility reasons so userspace can easily determine 8462306a36Sopenharmony_ci * the location of the next field in the dump. 8562306a36Sopenharmony_ci * @desc_length: The length of the device descriptor. 8662306a36Sopenharmony_ci * @data_length: The length of the frame data (including the ieee802.11 header. 8762306a36Sopenharmony_ci * @chip_rt: RT chipset 8862306a36Sopenharmony_ci * @chip_rf: RF chipset 8962306a36Sopenharmony_ci * @chip_rev: Chipset revision 9062306a36Sopenharmony_ci * @type: The frame type (&rt2x00_dump_type) 9162306a36Sopenharmony_ci * @queue_index: The index number of the data queue. 9262306a36Sopenharmony_ci * @entry_index: The index number of the entry inside the data queue. 9362306a36Sopenharmony_ci * @timestamp_sec: Timestamp - seconds 9462306a36Sopenharmony_ci * @timestamp_usec: Timestamp - microseconds 9562306a36Sopenharmony_ci */ 9662306a36Sopenharmony_cistruct rt2x00dump_hdr { 9762306a36Sopenharmony_ci __le32 version; 9862306a36Sopenharmony_ci#define DUMP_HEADER_VERSION 3 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci __le32 header_length; 10162306a36Sopenharmony_ci __le32 desc_length; 10262306a36Sopenharmony_ci __le32 data_length; 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci __le16 chip_rt; 10562306a36Sopenharmony_ci __le16 chip_rf; 10662306a36Sopenharmony_ci __le16 chip_rev; 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci __le16 type; 10962306a36Sopenharmony_ci __u8 queue_index; 11062306a36Sopenharmony_ci __u8 entry_index; 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci __le32 timestamp_sec; 11362306a36Sopenharmony_ci __le32 timestamp_usec; 11462306a36Sopenharmony_ci}; 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci#endif /* RT2X00DUMP_H */ 117