1 /*
2 * Copyright (c) 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 EPCS (Emergency Preparedness Communications Service)
19 * related functionality
20 */
21 #ifndef _WLAN_EPCS_API_H_
22 #define _WLAN_EPCS_API_H_
23
24 #include "lim_types.h"
25 #include "lim_utils.h"
26 #include "lim_send_sme_rsp_messages.h"
27 #include "parser_api.h"
28 #include "lim_send_messages.h"
29
30 #define RSVD_SHIFT_BIT 0x7
31 #define ACI_SHIFT_BIT 0x5
32 #define ACM_SHIFT_BIT 0x4
33 #define AIFSN_SHIFT_BIT 0x0
34 #define CWMAX_SHIFT_BIT 0x4
35 #define CWMIN_SHIFT_BIT 0x0
36
37 #define RSVD_MASK 0x1
38 #define ACI_MASK 0x3
39 #define ACM_MASK 0x1
40 #define AIFSN_MASK 0xf
41 #define CWMAX_MASK 0xf
42 #define CWMIN_MASK 0xf
43
44 #define WMM_VENDOR_HEADER_LEN 7
45
46 /**
47 * enum wlan_epcs_evt: EPCS manager events
48 * @WLAN_EPCS_EV_ACTION_FRAME_RX_REQ:Handle EPCS request frame received from AP
49 * @WLAN_EPCS_EV_ACTION_FRAME_TX_RESP:Handle EPCS response frame sent to AP
50 * @WLAN_EPCS_EV_ACTION_FRAME_TX_REQ:Handle EPCS request frame sent by STA
51 * @WLAN_EPCS_EV_ACTION_FRAME_RX_RESP:Handle EPCS response frame received from AP
52 * @WLAN_EPCS_EV_ACTION_FRAME_RX_TEARDOWN:Handle received teardown frame event
53 * @WLAN_EPCS_EV_ACTION_FRAME_TX_TEARDOWN:Handle sending teardown frame event
54 * @WLAN_EPCS_EV_ACTION_FRAME_MAX: Maximum EPCS action frame event value
55 */
56 enum wlan_epcs_evt {
57 WLAN_EPCS_EV_ACTION_FRAME_RX_REQ = 0,
58 WLAN_EPCS_EV_ACTION_FRAME_TX_RESP = 1,
59 WLAN_EPCS_EV_ACTION_FRAME_TX_REQ = 2,
60 WLAN_EPCS_EV_ACTION_FRAME_RX_RESP = 3,
61 WLAN_EPCS_EV_ACTION_FRAME_RX_TEARDOWN = 4,
62 WLAN_EPCS_EV_ACTION_FRAME_TX_TEARDOWN = 5,
63 WLAN_EPCS_EV_ACTION_FRAME_MAX = 6,
64 };
65
66 #ifdef WLAN_FEATURE_11BE_MLO
67 /**
68 * wlan_epcs_deliver_event() - Handler to deliver EPCS event
69 * @vdev: vdev pointer
70 * @peer: pointer to peer
71 * @event: EPCS event
72 * @event_data: EPCS event data pointer
73 * @len: length of data
74 *
75 * This api will be called from lim layers, to process EPCS event
76 *
77 * Return: QDF_STATUS
78 */
79 QDF_STATUS wlan_epcs_deliver_event(struct wlan_objmgr_vdev *vdev,
80 struct wlan_objmgr_peer *peer,
81 enum wlan_epcs_evt event,
82 void *event_data, uint32_t len);
83
84 /**
85 * wlan_epcs_set_config() - Set EPCS enable flag
86 * @vdev: vdev pointer
87 * @flag: EPCS flag
88 *
89 * This api will be called from os_if layers, to set EPCS flag
90 *
91 * Return: QDF_STATUS
92 */
93 QDF_STATUS wlan_epcs_set_config(struct wlan_objmgr_vdev *vdev,
94 uint8_t flag);
95
96 /**
97 * wlan_epcs_get_config() - Get EPCS config
98 * @vdev: vdev pointer
99 *
100 * This api will be called from other module
101 *
102 * Return: bool
103 */
104 bool wlan_epcs_get_config(struct wlan_objmgr_vdev *vdev);
105
106 /**
107 * wlan_epcs_deliver_cmd() - Handler to deliver EPCS command
108 * @vdev: vdev pointer
109 * @event: EPCS event
110 *
111 * This api will be called from os_if layers, to process EPCS command
112 *
113 * Return: QDF_STATUS
114 */
115 QDF_STATUS wlan_epcs_deliver_cmd(struct wlan_objmgr_vdev *vdev,
116 enum wlan_epcs_evt event);
117 #else
118 static inline
wlan_epcs_deliver_event(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_peer * peer,enum wlan_epcs_evt event,void * event_data,uint32_t len)119 QDF_STATUS wlan_epcs_deliver_event(struct wlan_objmgr_vdev *vdev,
120 struct wlan_objmgr_peer *peer,
121 enum wlan_epcs_evt event,
122 void *event_data, uint32_t len)
123 {
124 return QDF_STATUS_E_NOSUPPORT;
125 }
126
127 static inline QDF_STATUS
wlan_epcs_set_config(struct wlan_objmgr_vdev * vdev,uint8_t flag)128 wlan_epcs_set_config(struct wlan_objmgr_vdev *vdev, uint8_t flag)
129 {
130 return QDF_STATUS_E_NOSUPPORT;
131 }
132
wlan_epcs_get_config(struct wlan_objmgr_vdev * vdev)133 static inline bool wlan_epcs_get_config(struct wlan_objmgr_vdev *vdev)
134 {
135 return false;
136 }
137
138 static inline
wlan_epcs_deliver_cmd(struct wlan_objmgr_vdev * vdev,enum wlan_epcs_evt event)139 QDF_STATUS wlan_epcs_deliver_cmd(struct wlan_objmgr_vdev *vdev,
140 enum wlan_epcs_evt event)
141 {
142 return QDF_STATUS_E_NOSUPPORT;
143 }
144 #endif
145 #endif
146