1 /*
2 * Copyright (c) 2011-2012, 2014-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /**=========================================================================
21
22 \file rrm_api.h
23
24 \brief RRM APIs
25
26 ========================================================================*/
27
28 /* $Header$ */
29
30 #ifndef __RRM_API_H__
31 #define __RRM_API_H__
32
33 #define RRM_BCN_RPT_NO_BSS_INFO 0
34 #define RRM_BCN_RPT_MIN_RPT 1
35 #define RRM_CH_BUF_LEN 45
36
37 QDF_STATUS rrm_initialize(struct mac_context *mac);
38
39 /**
40 * rrm_cleanup - cleanup RRM measurement related data for the measurement
41 * index
42 * @mac: Pointer to mac context
43 * @idx: Measurement index
44 *
45 * Return: None
46 */
47 void rrm_cleanup(struct mac_context *mac, uint8_t idx);
48
49 QDF_STATUS rrm_process_link_measurement_request(struct mac_context *mac,
50 uint8_t *pRxPacketInfo,
51 tDot11fLinkMeasurementRequest
52 *pLinkReq,
53 struct pe_session *
54 pe_session);
55
56 QDF_STATUS
57 rrm_process_radio_measurement_request(struct mac_context *mac_ctx,
58 tSirMacAddr peer,
59 tDot11fRadioMeasurementRequest *rrm_req,
60 struct pe_session *session_entry);
61
62 QDF_STATUS rrm_process_neighbor_report_response(struct mac_context *mac,
63 tDot11fNeighborReportResponse
64 *pNeighborRep,
65 struct pe_session *
66 pe_session);
67
68 QDF_STATUS rrm_send_set_max_tx_power_req(struct mac_context *mac,
69 int8_t txPower,
70 struct pe_session *pe_session);
71
72 int8_t rrm_get_mgmt_tx_power(struct mac_context *mac,
73 struct pe_session *pe_session);
74
75 void rrm_cache_mgmt_tx_power(struct mac_context *mac,
76 int8_t txPower, struct pe_session *pe_session);
77
78 tpRRMCaps rrm_get_capabilities(struct mac_context *mac,
79 struct pe_session *pe_session);
80
81 void rrm_get_start_tsf(struct mac_context *mac, uint32_t *pStartTSF);
82
83 QDF_STATUS rrm_set_max_tx_power_rsp(struct mac_context *mac,
84 struct scheduler_msg *limMsgQ);
85
86 QDF_STATUS
87 rrm_process_neighbor_report_req(struct mac_context *mac,
88 tpSirNeighborReportReqInd pNeighborReq);
89
90 QDF_STATUS
91 rrm_process_beacon_report_xmit(struct mac_context *mac_ctx,
92 tpSirBeaconReportXmitInd beacon_xmit_ind);
93
94 /**
95 * rrm_process_chan_load_report_xmit() - process channel load report xmit
96 * @mac_ctx: Mac context
97 * @chan_load_ind: channel load xmit structure
98 *
99 * Return: None
100 */
101 void
102 rrm_process_chan_load_report_xmit(struct mac_context *mac_ctx,
103 struct chan_load_xmit_ind *chan_load_ind);
104
105 /**
106 * rrm_get_country_code_from_connected_profile() - get country code
107 * from connected profile
108 * @mac: Mac context
109 * @vdev_id: vdev_id or csr session id
110 * @country_code: country code
111 *
112 * Return: None
113 */
114 void rrm_get_country_code_from_connected_profile(struct mac_context *mac,
115 uint8_t vdev_id,
116 uint8_t *country_code);
117 /**
118 * rrm_reject_req - Reject rrm request
119 * @radiomes_report: radio measurement report
120 * @rrm_req: Array of Measurement request IEs
121 * @num_report: Num of report
122 * @index: Measurement index
123 * @measurement_type: Measurement Type
124 *
125 * Reject the Radio Resource Measurement request, if one is
126 * already in progress
127 *
128 * Return: QDF_STATUS
129 */
130 QDF_STATUS rrm_reject_req(tpSirMacRadioMeasureReport *radiomes_report,
131 tDot11fRadioMeasurementRequest *rrm_req,
132 uint8_t *num_report, uint8_t index,
133 uint8_t measurement_type);
134
135 void lim_update_rrm_capability(struct mac_context *mac_ctx);
136
137 #ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
138 /**
139 * rrm_send_sta_stats_req - Send RRM STA STATS request
140 * @mac: mac context
141 * @session: pe session
142 * @peer_mac: peer mac
143 *
144 * Return: QDF_STATUS
145 */
146 QDF_STATUS
147 rrm_send_sta_stats_req(struct mac_context *mac,
148 struct pe_session *session,
149 tSirMacAddr peer_mac);
150 #else
151 static inline QDF_STATUS
rrm_send_sta_stats_req(struct mac_context * mac,struct pe_session * session,tSirMacAddr peer_mac)152 rrm_send_sta_stats_req(struct mac_context *mac,
153 struct pe_session *session,
154 tSirMacAddr peer_mac)
155 {
156 return QDF_STATUS_E_NOSUPPORT;
157 }
158 #endif
159
160 /**
161 * rrm_process_rrm_sta_stats_request_failure: send RRM STA Stats report with
162 * failure
163 * @mac: mac context
164 * @pe_session: pe session
165 * @peer: peer mac
166 * @status: failure status
167 * @index: index of report
168 *
169 * Return: void
170 */
171 void
172 rrm_process_rrm_sta_stats_request_failure(struct mac_context *mac,
173 struct pe_session *pe_session,
174 tSirMacAddr peer,
175 tRrmRetStatus status, uint8_t index);
176 #endif
177