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 OS_IF layer
19 */
20 #ifndef _SPATIAL_REUSE_UCFG_API_H_
21 #define _SPATIAL_REUSE_UCFG_API_H_
22
23 #include <qdf_trace.h>
24 #include <wlan_objmgr_vdev_obj.h>
25 #include <spatial_reuse_api.h>
26
27 #ifdef WLAN_FEATURE_SR
28 /**
29 * ucfg_spatial_reuse_register_cb() - Registers CB for SR
30 * @psoc: pointer to psoc
31 * @cb: SR osif event callback
32 *
33 * Return: void
34 */
35 void ucfg_spatial_reuse_register_cb(struct wlan_objmgr_psoc *psoc,
36 sr_osif_event_cb cb);
37
38 /**
39 * ucfg_spatial_reuse_get_sr_config() - Spatial reuse config get
40 *
41 * @vdev: object manager vdev
42 * @sr_ctrl: spatial reuse sr control
43 * @non_srg_max_pd_offset: non-srg max pd offset
44 * @he_spr_enabled: spatial reuse enabled
45 *
46 * Return: void
47 */
48 void ucfg_spatial_reuse_get_sr_config(struct wlan_objmgr_vdev *vdev,
49 uint8_t *sr_ctrl,
50 uint8_t *non_srg_max_pd_offset,
51 bool *he_spr_enabled);
52 /**
53 * ucfg_spatial_reuse_set_sr_config() - Spatial reuse config set
54 *
55 * @vdev: object manager vdev
56 * @sr_ctrl: spatial reuse sr control
57 * @non_srg_max_pd_offset: non-srg max pd offset
58 *
59 * Return: void
60 */
61 void ucfg_spatial_reuse_set_sr_config(struct wlan_objmgr_vdev *vdev,
62 uint8_t sr_ctrl,
63 uint8_t non_srg_max_pd_offset);
64
65 /**
66 * ucfg_spatial_reuse_is_sr_disabled_due_conc() - Spatial reuse get concurrency
67 * status
68 *
69 * @vdev: object manager vdev
70 *
71 * Return: True when SR is disabled due to concurrency or else False
72 */
73 bool ucfg_spatial_reuse_is_sr_disabled_due_conc(struct wlan_objmgr_vdev *vdev);
74
75 /**
76 * ucfg_spatial_reuse_set_sr_conc_stat() - Spatial reuse disable config set
77 *
78 * @vdev: object manager vdev
79 * @sr_conc_disabled: spatial reuse disabled due to concurrency
80 *
81 * Return: void
82 */
83 void ucfg_spatial_reuse_set_sr_conc_stat(struct wlan_objmgr_vdev *vdev,
84 bool sr_conc_disabled);
85
86 /**
87 * ucfg_spatial_reuse_send_sr_config() - Send spatial reuse config to fw
88 *
89 * @vdev: object manager vdev
90 * @enable: spatial reuse config to be enabled or not
91 *
92 * Return: void
93 */
94 void ucfg_spatial_reuse_send_sr_config(struct wlan_objmgr_vdev *vdev,
95 bool enable);
96
97 /**
98 * ucfg_spatial_reuse_set_sr_enable() - set enable/disable Spatial reuse
99 *
100 * @vdev: object manager vdev
101 * @enable: spatial reuse to be enabled or not
102 *
103 * Return: void
104 */
105 void ucfg_spatial_reuse_set_sr_enable(struct wlan_objmgr_vdev *vdev,
106 bool enable);
107
108 /**
109 * ucfg_spatial_reuse_send_sr_prohibit() - Send spatial reuse config to enable
110 * or disable he_siga_val15_allowed
111 *
112 * @vdev: object manager vdev
113 * @enable_he_siga_val15_prohibit: enable/disable he_siga_val15_allowed
114 *
115 * Return: success/failure
116 */
117 QDF_STATUS
118 ucfg_spatial_reuse_send_sr_prohibit(struct wlan_objmgr_vdev *vdev,
119 bool enable_he_siga_val15_prohibit);
120
121 /**
122 * ucfg_spatial_reuse_setup_req() - To enable/disable SR (Spatial Reuse)
123 * @vdev: object manager vdev
124 * @pdev: object manager pdev
125 * @is_sr_enable: SR enable/disable
126 * @srg_pd_threshold: SRG pd threshold
127 * @non_srg_pd_threshold: NON SRG pd threshold
128 *
129 * Return: Success/Failure
130 */
131 QDF_STATUS
132 ucfg_spatial_reuse_setup_req(struct wlan_objmgr_vdev *vdev,
133 struct wlan_objmgr_pdev *pdev,
134 bool is_sr_enable, int32_t srg_pd_threshold,
135 int32_t non_srg_pd_threshold);
136
137 /**
138 * ucfg_spatial_reuse_operation_allowed() - Checks whether SR is allowed or not
139 * @psoc: Object manager psoc
140 * @vdev: object manager vdev
141 *
142 * Return: QDF_STATUS_SUCCESS when SR is allowed else Failure
143 */
144 QDF_STATUS
145 ucfg_spatial_reuse_operation_allowed(struct wlan_objmgr_psoc *psoc,
146 struct wlan_objmgr_vdev *vdev);
147 #else
148 static inline
ucfg_spatial_reuse_register_cb(struct wlan_objmgr_psoc * psoc,sr_osif_event_cb cb)149 void ucfg_spatial_reuse_register_cb(struct wlan_objmgr_psoc *psoc,
150 sr_osif_event_cb cb)
151 {
152 }
153 #endif
154 #endif
155