xref: /wlan-dirver/qca-wifi-host-cmn/target_if/init_deinit/inc/mlo_global_h_shmem_arena.h (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
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: mlo_global_h_shmem_arena.h
19  *  This file contains APIs and data structures that are used to parse the MLO
20  *  global shared memory arena.
21  */
22 
23 #ifndef _MLO_GLOBAL_H_SHMEM_ARENA_H_
24 #define _MLO_GLOBAL_H_SHMEM_ARENA_H_
25 
26 #include <qdf_types.h>
27 #include <target_if.h>
28 #include "wmi.h"
29 #include <osdep.h>
30 
31 /**
32  * wlan_host_mlo_glb_h_shmem_params - MLO global shared memory parameters
33  * @major_version: Major version
34  * @minor_version: Minor version
35  */
36 struct wlan_host_mlo_glb_h_shmem_params {
37 	uint16_t major_version;
38 	uint16_t minor_version;
39 };
40 
41 /**
42  * wlan_host_mlo_glb_rx_reo_per_link_info - MGMT Rx REO information of a link in
43  * MLO global shared memory
44  * @link_id: Hardware link ID
45  * @fw_consumed: Address of FW consumed snapshot
46  * @fw_forwarded: Address of FW forwarded snapshot
47  * @hw_forwarded: Address of HW forwarded snapshot
48  */
49 struct wlan_host_mlo_glb_rx_reo_per_link_info {
50 	uint8_t link_id;
51 	void *fw_consumed;
52 	void *fw_forwarded;
53 	void *hw_forwarded;
54 };
55 
56 /**
57  * wlan_host_mlo_glb_rx_reo_snapshot_info - MGMT Rx REO information in MLO
58  * global shared memory
59  * @num_links: Number of valid links
60  * @valid_link_bmap: Valid link bitmap
61  * @link_info: pointer to an array of Rx REO per-link information
62  */
63 struct wlan_host_mlo_glb_rx_reo_snapshot_info {
64 	uint8_t num_links;
65 	uint16_t valid_link_bmap;
66 	struct wlan_host_mlo_glb_rx_reo_per_link_info *link_info;
67 };
68 
69 /**
70  * wlan_host_mlo_glb_h_shmem_arena_ctx - MLO Global shared memory arena context
71  * @shmem_params: shared memory parameters
72  * @rx_reo_snapshot_info: MGMT Rx REO snapshot information
73  * @init_count: Number of init calls
74  */
75 struct wlan_host_mlo_glb_h_shmem_arena_ctx {
76 	struct wlan_host_mlo_glb_h_shmem_params shmem_params;
77 	struct wlan_host_mlo_glb_rx_reo_snapshot_info rx_reo_snapshot_info;
78 	qdf_atomic_t init_count;
79 };
80 
81 /**
82  * mlo_glb_h_shmem_arena_ctx_init() - Initialize MLO Global shared memory arena
83  * context on Host
84  * @arena_vaddr: Virtual address of the MLO Global shared memory arena
85  * @arena_len: Length (in bytes) of the MLO Global shared memory arena
86  *
87  * Return: QDF_STATUS of operation
88  */
89 QDF_STATUS mlo_glb_h_shmem_arena_ctx_init(void *arena_vaddr,
90 					  size_t arena_len);
91 
92 /**
93  * mlo_glb_h_shmem_arena_ctx_deinit() - De-initialize MLO Global shared memory
94  * arena context on Host
95  *
96  * Return: QDF_STATUS of operation
97  */
98 QDF_STATUS mlo_glb_h_shmem_arena_ctx_deinit(void);
99 
100 /**
101  * mgmt_rx_reo_get_num_links() - Get number of links to be used by MGMT Rx REO
102  *
103  * Return: number of links in case of success, else -1
104  */
105 int mgmt_rx_reo_get_num_links(void);
106 
107 /**
108  * mgmt_rx_reo_get_snapshot_address() - Get the address of MGMT Rx REO snapshot
109  * @link_id: Link ID of the radio to which this snapshot belongs
110  * @snapshot_id: ID of the snapshot
111  *
112  * Return: virtual address of the snapshot on success, else NULL
113  */
114 void *mgmt_rx_reo_get_snapshot_address(
115 	uint8_t link_id, enum mgmt_rx_reo_shared_snapshot_id snapshot_id);
116 #endif
117