1 /*
2  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  *  DOC: wlan_mgmt_txrx_rx_reo_public_structs.h
19  *  Contains MGMT Rx REO structure definitions
20  */
21 
22 #ifndef _WLAN_MGMT_TXRX_RX_REO_PUBLIC_STRUCTS_H
23 #define _WLAN_MGMT_TXRX_RX_REO_PUBLIC_STRUCTS_H
24 #ifdef WLAN_MGMT_RX_REO_SUPPORT
25 /*
26  * enum mgmt_rx_reo_shared_snapshot_id - Represents the management
27  * rx-reorder snapshots shared between host and target in the host DDR.
28  * These snapshots are written by FW/HW and read by Host.
29  * @MGMT_RX_REO_SHARED_SNAPSHOT_MAC_HW: MAC HW snapshot
30  * @MGMT_RX_REO_SHARED_SNAPSHOT_FW_CONSUMED: FW consumed snapshot
31  * @MGMT_RX_REO_SHARED_SNAPSHOT_FW_FORWADED: FW forwarded snapshot
32  * @MGMT_RX_REO_SHARED_SNAPSHOT_MAX: Max number of snapshots
33  * @MGMT_RX_REO_SHARED_SNAPSHOT_INVALID: Invalid snapshot
34  */
35 enum mgmt_rx_reo_shared_snapshot_id {
36 	MGMT_RX_REO_SHARED_SNAPSHOT_MAC_HW = 0,
37 	MGMT_RX_REO_SHARED_SNAPSHOT_FW_CONSUMED = 1,
38 	MGMT_RX_REO_SHARED_SNAPSHOT_FW_FORWADED = 2,
39 	MGMT_RX_REO_SHARED_SNAPSHOT_MAX = 3,
40 	MGMT_RX_REO_SHARED_SNAPSHOT_INVALID,
41 };
42 
43 /*
44  * struct mgmt_rx_reo_snapshot_params - Represents the simplified version of
45  * Management Rx Frame snapshot for Host use. Note that this is different from
46  * the structure shared between the Host and FW/HW
47  * @valid: Whether this snapshot is valid
48  * @mgmt_pkt_ctr: MGMT packet counter. This will be local to a particular
49  * HW link
50  * @global_timestamp: Global timestamp.This is taken from a clock which is
51  * common across all the HW links
52  */
53 struct mgmt_rx_reo_snapshot_params {
54 	bool valid;
55 	uint16_t mgmt_pkt_ctr;
56 	uint32_t global_timestamp;
57 };
58 
59 /*
60  * struct mgmt_rx_reo_snapshot - Represents the management rx-reorder snapshot
61  * @mgmt_rx_reo_snapshot_low: Lower 32 bits of the reo snapshot
62  * @mgmt_rx_reo_snapshot_high: Higher 32 bits of the reo snapshot
63  */
64 struct mgmt_rx_reo_snapshot {
65 	uint32_t mgmt_rx_reo_snapshot_low;
66 	uint32_t mgmt_rx_reo_snapshot_high;
67 };
68 
69 /*
70  * struct mgmt_rx_reo_params - MGMT Rx REO parameters
71  * @valid: Whether these params are valid
72  * @pdev_id: pdev ID for which FW consumed event is received
73  * @link_id: link ID for which FW consumed event is received
74  * @mgmt_pkt_ctr: MGMT packet counter of the frame that is consumed
75  * @global_timestamp: Global timestamp of the frame that is consumed
76  */
77 struct mgmt_rx_reo_params {
78 	bool valid;
79 	uint8_t pdev_id;
80 	uint8_t link_id;
81 	uint16_t mgmt_pkt_ctr;
82 	uint32_t global_timestamp;
83 };
84 
85 /*
86  * struct mgmt_rx_reo_filter - MGMT Rx REO filter
87  * @filter_low: Least significant 32-bits of the filter
88  * @filter_high: Most significant 32-bits of the filter
89  */
90 struct mgmt_rx_reo_filter {
91 	uint32_t low;
92 	uint32_t high;
93 };
94 
95 /*
96  * struct mgmt_rx_reo_pdev_info - Pdev information required by the Management
97  * Rx REO module
98  * @host_snapshot: Latest snapshot seen at the Host.
99  * It considers both MGMT Rx and MGMT FW consumed.
100  * @last_valid_shared_snapshot: Array of last valid snapshots(for snapshots
101  * shared between host and target)
102  * @host_target_shared_snapshot: Array of snapshot addresses(for snapshots
103  * shared between host and target)
104  * @filter: MGMT Rx REO filter
105  */
106 struct mgmt_rx_reo_pdev_info {
107 	struct mgmt_rx_reo_snapshot_params host_snapshot;
108 	struct mgmt_rx_reo_snapshot_params last_valid_shared_snapshot
109 				[MGMT_RX_REO_SHARED_SNAPSHOT_MAX];
110 	struct mgmt_rx_reo_snapshot *host_target_shared_snapshot
111 				[MGMT_RX_REO_SHARED_SNAPSHOT_MAX];
112 	struct mgmt_rx_reo_filter filter;
113 };
114 #endif /* WLAN_MGMT_RX_REO_SUPPORT */
115 #endif /* _WLAN_MGMT_TXRX_RX_REO_PUBLIC_STRUCTS_H */
116