1 /*
2 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. 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: contains interface prototypes for spatial_reuse api
19 */
20
21 #ifndef _SPATIAL_REUSE_API_H_
22 #define _SPATIAL_REUSE_API_H_
23
24 #include <qdf_types.h>
25 #include <qdf_trace.h>
26 #include <wlan_objmgr_vdev_obj.h>
27
28 /**
29 * enum sr_osif_operation - Spatial Reuse operation
30 * @SR_OPERATION_SUSPEND: Spatial Reuse suspend indication
31 * @SR_OPERATION_RESUME: Spatial Reuse resume indication
32 * @SR_OPERATION_UPDATE_PARAMS: Spatial Reuse parameters are updated
33 */
34 enum sr_osif_operation {
35 SR_OPERATION_SUSPEND = 0,
36 SR_OPERATION_RESUME = 1,
37 SR_OPERATION_UPDATE_PARAMS = 2,
38 };
39
40 /**
41 * enum sr_osif_reason_code - Spatial Reuse reason codes
42 * @SR_REASON_CODE_ROAMING: Spatial Reuse reason code is Roaming will be
43 * set when SR is suspended / resumed due to roaming
44 * @SR_REASON_CODE_CONCURRENCY: Spatial Reuse reason code is concurrency
45 * will be set when SR is suspended / resumed
46 * due to concurrency
47 * @SR_REASON_CODE_BCN_IE_CHANGE: Spatial Reuse reason code is SRP IE change
48 * in the beacon/probe rsp of the associated AP
49 */
50 enum sr_osif_reason_code {
51 SR_REASON_CODE_ROAMING = 0,
52 SR_REASON_CODE_CONCURRENCY = 1,
53 SR_REASON_CODE_BCN_IE_CHANGE = 2,
54 };
55
56 /**
57 * typedef sr_osif_event_cb() - CB to deliver SR events
58 * @vdev: objmgr manager vdev
59 * @sr_osif_oper: SR Operation like suspend / resume
60 * @sr_osif_rc: Event reason code
61 *
62 * Return: void
63 */
64 typedef void (*sr_osif_event_cb)(struct wlan_objmgr_vdev *vdev,
65 enum sr_osif_operation sr_osif_oper,
66 enum sr_osif_reason_code sr_osif_rc);
67
68 #ifdef WLAN_FEATURE_SR
69 /**
70 * wlan_spatial_reuse_config_set() - Set spatial reuse config
71 * @vdev: objmgr manager vdev
72 * @sr_ctrl: spatial reuse control
73 * @non_srg_max_pd_offset: non-srg max pd offset
74 *
75 * Return: QDF_STATUS
76 */
77 QDF_STATUS wlan_spatial_reuse_config_set(struct wlan_objmgr_vdev *vdev,
78 uint8_t sr_ctrl,
79 uint8_t non_srg_max_pd_offset);
80
81 /**
82 * wlan_sr_register_callback() - registers SR osif events
83 * @psoc: pointer to psoc
84 * @cb: Callback to be registered
85 *
86 * Return: void
87 */
88 void wlan_sr_register_callback(struct wlan_objmgr_psoc *psoc,
89 sr_osif_event_cb cb);
90
91 /**
92 * wlan_spatial_reuse_osif_event() - Send SR asynchronous events
93 * @vdev: objmgr manager vdev
94 * @sr_osif_oper: SR Operation like suspend / resume
95 * @sr_osif_rc: Event reason code
96 *
97 * Return: void
98 */
99 void wlan_spatial_reuse_osif_event(struct wlan_objmgr_vdev *vdev,
100 enum sr_osif_operation sr_osif_oper,
101 enum sr_osif_reason_code sr_osif_rc);
102 #else
103 static inline
wlan_spatial_reuse_config_set(struct wlan_objmgr_vdev * vdev,uint8_t sr_ctrl,uint8_t non_srg_max_pd_offset)104 QDF_STATUS wlan_spatial_reuse_config_set(struct wlan_objmgr_vdev *vdev,
105 uint8_t sr_ctrl,
106 uint8_t non_srg_max_pd_offset)
107 {
108 return QDF_STATUS_SUCCESS;
109 }
110
111 static inline
wlan_spatial_reuse_osif_event(struct wlan_objmgr_vdev * vdev,enum sr_osif_operation sr_osif_oper,enum sr_osif_reason_code sr_osif_rc)112 void wlan_spatial_reuse_osif_event(struct wlan_objmgr_vdev *vdev,
113 enum sr_osif_operation sr_osif_oper,
114 enum sr_osif_reason_code sr_osif_rc)
115 {
116 }
117 #endif
118
119 /**
120 * wlan_spatial_reuse_he_siga_val15_allowed_set() - Set spatial reuse config
121 * he_siga_val15_allowed
122 * @vdev: objmgr manager vdev
123 * @he_siga_va15_allowed: enable/disable he_siga_val15_allowed
124 *
125 * Return: QDF_STATUS
126 */
127 QDF_STATUS wlan_spatial_reuse_he_siga_val15_allowed_set(
128 struct wlan_objmgr_vdev *vdev,
129 bool he_siga_va15_allowed);
130
131 /**
132 * wlan_sr_setup_req() - Enable SR with provided pd threshold
133 * @vdev: objmgr vdev
134 * @pdev: objmgr pdev
135 * @is_sr_enable: sr enable/disable
136 * @srg_pd_threshold: SRG pd threshold
137 * @non_srg_pd_threshold: NON SRG PD threshold
138 *
139 * Return: QDF_STATUS
140 */
141 QDF_STATUS
142 wlan_sr_setup_req(struct wlan_objmgr_vdev *vdev,
143 struct wlan_objmgr_pdev *pdev, bool is_sr_enable,
144 int32_t srg_pd_threshold, int32_t non_srg_pd_threshold);
145 #endif
146