xref: /wlan-driver/qcacld-3.0/components/spatial_reuse/dispatcher/inc/spatial_reuse_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for any
5*5113495bSYour Name  * purpose with or without fee is hereby granted, provided that the above
6*5113495bSYour Name  * copyright notice and this permission notice appear in all copies.
7*5113495bSYour Name 
8*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9*5113495bSYour Name  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*5113495bSYour Name  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11*5113495bSYour Name  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*5113495bSYour Name  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13*5113495bSYour Name  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14*5113495bSYour Name  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*5113495bSYour Name  */
16*5113495bSYour Name 
17*5113495bSYour Name /**
18*5113495bSYour Name  * DOC: contains interface prototypes for spatial_reuse api
19*5113495bSYour Name  */
20*5113495bSYour Name 
21*5113495bSYour Name #ifndef _SPATIAL_REUSE_API_H_
22*5113495bSYour Name #define _SPATIAL_REUSE_API_H_
23*5113495bSYour Name 
24*5113495bSYour Name #include <qdf_types.h>
25*5113495bSYour Name #include <qdf_trace.h>
26*5113495bSYour Name #include <wlan_objmgr_vdev_obj.h>
27*5113495bSYour Name 
28*5113495bSYour Name /**
29*5113495bSYour Name  * enum sr_osif_operation - Spatial Reuse operation
30*5113495bSYour Name  * @SR_OPERATION_SUSPEND: Spatial Reuse suspend indication
31*5113495bSYour Name  * @SR_OPERATION_RESUME: Spatial Reuse resume indication
32*5113495bSYour Name  * @SR_OPERATION_UPDATE_PARAMS: Spatial Reuse parameters are updated
33*5113495bSYour Name  */
34*5113495bSYour Name enum sr_osif_operation {
35*5113495bSYour Name 	SR_OPERATION_SUSPEND = 0,
36*5113495bSYour Name 	SR_OPERATION_RESUME = 1,
37*5113495bSYour Name 	SR_OPERATION_UPDATE_PARAMS = 2,
38*5113495bSYour Name };
39*5113495bSYour Name 
40*5113495bSYour Name /**
41*5113495bSYour Name  * enum sr_osif_reason_code - Spatial Reuse reason codes
42*5113495bSYour Name  * @SR_REASON_CODE_ROAMING: Spatial Reuse reason code is Roaming will be
43*5113495bSYour Name  *			     set when SR is suspended / resumed due to roaming
44*5113495bSYour Name  * @SR_REASON_CODE_CONCURRENCY: Spatial Reuse reason code is concurrency
45*5113495bSYour Name  *				 will be set when SR is suspended / resumed
46*5113495bSYour Name  *				 due to concurrency
47*5113495bSYour Name  * @SR_REASON_CODE_BCN_IE_CHANGE: Spatial Reuse reason code is SRP IE change
48*5113495bSYour Name  *				  in the beacon/probe rsp of the associated AP
49*5113495bSYour Name  */
50*5113495bSYour Name enum sr_osif_reason_code {
51*5113495bSYour Name 	SR_REASON_CODE_ROAMING = 0,
52*5113495bSYour Name 	SR_REASON_CODE_CONCURRENCY = 1,
53*5113495bSYour Name 	SR_REASON_CODE_BCN_IE_CHANGE = 2,
54*5113495bSYour Name };
55*5113495bSYour Name 
56*5113495bSYour Name /**
57*5113495bSYour Name  * typedef sr_osif_event_cb() - CB to deliver SR events
58*5113495bSYour Name  * @vdev: objmgr manager vdev
59*5113495bSYour Name  * @sr_osif_oper: SR Operation like suspend / resume
60*5113495bSYour Name  * @sr_osif_rc: Event reason code
61*5113495bSYour Name  *
62*5113495bSYour Name  * Return: void
63*5113495bSYour Name  */
64*5113495bSYour Name typedef void (*sr_osif_event_cb)(struct wlan_objmgr_vdev *vdev,
65*5113495bSYour Name 				 enum sr_osif_operation sr_osif_oper,
66*5113495bSYour Name 				 enum sr_osif_reason_code sr_osif_rc);
67*5113495bSYour Name 
68*5113495bSYour Name #ifdef WLAN_FEATURE_SR
69*5113495bSYour Name /**
70*5113495bSYour Name  * wlan_spatial_reuse_config_set() - Set spatial reuse config
71*5113495bSYour Name  * @vdev: objmgr manager vdev
72*5113495bSYour Name  * @sr_ctrl: spatial reuse control
73*5113495bSYour Name  * @non_srg_max_pd_offset: non-srg max pd offset
74*5113495bSYour Name  *
75*5113495bSYour Name  * Return: QDF_STATUS
76*5113495bSYour Name  */
77*5113495bSYour Name QDF_STATUS wlan_spatial_reuse_config_set(struct wlan_objmgr_vdev *vdev,
78*5113495bSYour Name 					 uint8_t sr_ctrl,
79*5113495bSYour Name 					 uint8_t non_srg_max_pd_offset);
80*5113495bSYour Name 
81*5113495bSYour Name /**
82*5113495bSYour Name  * wlan_sr_register_callback() - registers SR osif events
83*5113495bSYour Name  * @psoc: pointer to psoc
84*5113495bSYour Name  * @cb: Callback to be registered
85*5113495bSYour Name  *
86*5113495bSYour Name  * Return: void
87*5113495bSYour Name  */
88*5113495bSYour Name void wlan_sr_register_callback(struct wlan_objmgr_psoc *psoc,
89*5113495bSYour Name 			       sr_osif_event_cb cb);
90*5113495bSYour Name 
91*5113495bSYour Name /**
92*5113495bSYour Name  * wlan_spatial_reuse_osif_event() - Send SR asynchronous events
93*5113495bSYour Name  * @vdev: objmgr manager vdev
94*5113495bSYour Name  * @sr_osif_oper: SR Operation like suspend / resume
95*5113495bSYour Name  * @sr_osif_rc: Event reason code
96*5113495bSYour Name  *
97*5113495bSYour Name  * Return: void
98*5113495bSYour Name  */
99*5113495bSYour Name void wlan_spatial_reuse_osif_event(struct wlan_objmgr_vdev *vdev,
100*5113495bSYour Name 				   enum sr_osif_operation sr_osif_oper,
101*5113495bSYour Name 				   enum sr_osif_reason_code sr_osif_rc);
102*5113495bSYour Name #else
103*5113495bSYour Name static inline
wlan_spatial_reuse_config_set(struct wlan_objmgr_vdev * vdev,uint8_t sr_ctrl,uint8_t non_srg_max_pd_offset)104*5113495bSYour Name QDF_STATUS wlan_spatial_reuse_config_set(struct wlan_objmgr_vdev *vdev,
105*5113495bSYour Name 					 uint8_t sr_ctrl,
106*5113495bSYour Name 					 uint8_t non_srg_max_pd_offset)
107*5113495bSYour Name {
108*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
109*5113495bSYour Name }
110*5113495bSYour Name 
111*5113495bSYour Name 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*5113495bSYour Name void wlan_spatial_reuse_osif_event(struct wlan_objmgr_vdev *vdev,
113*5113495bSYour Name 				   enum sr_osif_operation sr_osif_oper,
114*5113495bSYour Name 				   enum sr_osif_reason_code sr_osif_rc)
115*5113495bSYour Name {
116*5113495bSYour Name }
117*5113495bSYour Name #endif
118*5113495bSYour Name 
119*5113495bSYour Name /**
120*5113495bSYour Name  * wlan_spatial_reuse_he_siga_val15_allowed_set() - Set spatial reuse config
121*5113495bSYour Name  *						    he_siga_val15_allowed
122*5113495bSYour Name  * @vdev: objmgr manager vdev
123*5113495bSYour Name  * @he_siga_va15_allowed: enable/disable he_siga_val15_allowed
124*5113495bSYour Name  *
125*5113495bSYour Name  * Return: QDF_STATUS
126*5113495bSYour Name  */
127*5113495bSYour Name QDF_STATUS wlan_spatial_reuse_he_siga_val15_allowed_set(
128*5113495bSYour Name 					struct wlan_objmgr_vdev *vdev,
129*5113495bSYour Name 					bool he_siga_va15_allowed);
130*5113495bSYour Name 
131*5113495bSYour Name /**
132*5113495bSYour Name  * wlan_sr_setup_req() - Enable SR with provided pd threshold
133*5113495bSYour Name  * @vdev: objmgr vdev
134*5113495bSYour Name  * @pdev: objmgr pdev
135*5113495bSYour Name  * @is_sr_enable: sr enable/disable
136*5113495bSYour Name  * @srg_pd_threshold: SRG pd threshold
137*5113495bSYour Name  * @non_srg_pd_threshold: NON SRG PD threshold
138*5113495bSYour Name  *
139*5113495bSYour Name  * Return: QDF_STATUS
140*5113495bSYour Name  */
141*5113495bSYour Name QDF_STATUS
142*5113495bSYour Name wlan_sr_setup_req(struct wlan_objmgr_vdev *vdev,
143*5113495bSYour Name 		  struct wlan_objmgr_pdev *pdev, bool is_sr_enable,
144*5113495bSYour Name 		  int32_t srg_pd_threshold, int32_t non_srg_pd_threshold);
145*5113495bSYour Name #endif
146