blob: 1e59efab7953bf53d4c2e82a0414fb517081d178 [file] [log] [blame]
Naveen Rawatc3226ef2016-12-15 12:44:14 -08001/*
Nachiket Kukade2fb1fdb2019-01-08 15:35:27 +05302 * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
Naveen Rawatc3226ef2016-12-15 12:44:14 -08003 *
4 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
19/**
20 * DOC: contains nan definitions exposed to other modules
21 */
22
23#ifndef _WLAN_NAN_API_H_
24#define _WLAN_NAN_API_H_
25
Nachiket Kukade63bb63d2018-11-21 14:42:14 +053026#include "wlan_objmgr_vdev_obj.h"
27#include "wlan_objmgr_psoc_obj.h"
Nachiket Kukadecf941602018-12-12 14:32:35 +053028#include "wlan_policy_mgr_public_struct.h"
Naveen Rawatbf314922017-03-21 15:56:06 -070029#include "qdf_status.h"
Nachiket Kukadecf941602018-12-12 14:32:35 +053030
Nachiket Kukade2fb1fdb2019-01-08 15:35:27 +053031#ifdef WLAN_FEATURE_NAN
Nachiket Kukadecf941602018-12-12 14:32:35 +053032
Nachiket Kukade63bb63d2018-11-21 14:42:14 +053033#include "../src/nan_main_i.h"
Naveen Rawatbf314922017-03-21 15:56:06 -070034
35struct wlan_objmgr_psoc;
36
37/**
38 * nan_init: initializes NAN component, called by dispatcher init
39 *
40 * Return: status of operation
41 */
42QDF_STATUS nan_init(void);
43
44/**
45 * nan_deinit: de-initializes NAN component, called by dispatcher init
46 *
47 * Return: status of operation
48 */
49QDF_STATUS nan_deinit(void);
50
51/**
52 * nan_psoc_enable: psoc enable API for NANitioning component
53 * @psoc: pointer to PSOC
54 *
55 * Return: status of operation
56 */
57QDF_STATUS nan_psoc_enable(struct wlan_objmgr_psoc *psoc);
58
59/**
60 * nan_psoc_disable: psoc disable API for NANitioning component
61 * @psoc: pointer to PSOC
62 *
63 * Return: status of operation
64 */
65QDF_STATUS nan_psoc_disable(struct wlan_objmgr_psoc *psoc);
66
Nachiket Kukade63bb63d2018-11-21 14:42:14 +053067/**
68 * nan_get_vdev_priv_obj: get NAN priv object from vdev object
69 * @vdev: pointer to vdev object
70 *
71 * Return: pointer to NAN vdev private object
72 */
73static inline
74struct nan_vdev_priv_obj *nan_get_vdev_priv_obj(struct wlan_objmgr_vdev *vdev)
75{
76 struct nan_vdev_priv_obj *obj;
77
78 if (!vdev) {
79 nan_err("vdev is null");
80 return NULL;
81 }
82 obj = wlan_objmgr_vdev_get_comp_private_obj(vdev, WLAN_UMAC_COMP_NAN);
83
84 return obj;
85}
86
87/**
88 * nan_get_psoc_priv_obj: get NAN priv object from psoc object
89 * @psoc: pointer to psoc object
90 *
91 * Return: pointer to NAN psoc private object
92 */
93static inline
94struct nan_psoc_priv_obj *nan_get_psoc_priv_obj(struct wlan_objmgr_psoc *psoc)
95{
96 struct nan_psoc_priv_obj *obj;
97
98 if (!psoc) {
99 nan_err("psoc is null");
100 return NULL;
101 }
102 obj = wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_NAN);
103
104 return obj;
105}
106
107/**
108 * nan_psoc_get_tx_ops: get TX ops from the NAN private object
109 * @psoc: pointer to psoc object
110 *
111 * Return: pointer to TX op callback
112 */
113static inline
114struct wlan_nan_tx_ops *nan_psoc_get_tx_ops(struct wlan_objmgr_psoc *psoc)
115{
116 struct nan_psoc_priv_obj *nan_priv;
117
118 if (!psoc) {
119 nan_err("psoc is null");
120 return NULL;
121 }
122
123 nan_priv = nan_get_psoc_priv_obj(psoc);
124 if (!nan_priv) {
125 nan_err("psoc private object is null");
126 return NULL;
127 }
128
129 return &nan_priv->tx_ops;
130}
131
132/**
133 * nan_psoc_get_rx_ops: get RX ops from the NAN private object
134 * @psoc: pointer to psoc object
135 *
136 * Return: pointer to RX op callback
137 */
138static inline
139struct wlan_nan_rx_ops *nan_psoc_get_rx_ops(struct wlan_objmgr_psoc *psoc)
140{
141 struct nan_psoc_priv_obj *nan_priv;
142
143 if (!psoc) {
144 nan_err("psoc is null");
145 return NULL;
146 }
147
148 nan_priv = nan_get_psoc_priv_obj(psoc);
149 if (!nan_priv) {
150 nan_err("psoc private object is null");
151 return NULL;
152 }
153
154 return &nan_priv->rx_ops;
155}
Nachiket Kukadecf941602018-12-12 14:32:35 +0530156
157/**
158 * wlan_nan_get_connection_info: Get NAN related connection info
159 * @psoc: pointer to psoc object
160 * @conn_info: Coonection info structure pointer
161 *
162 * Return: status of operation
163 */
164QDF_STATUS
165wlan_nan_get_connection_info(struct wlan_objmgr_psoc *psoc,
166 struct policy_mgr_vdev_entry_info *conn_info);
Nachiket Kukade2fb1fdb2019-01-08 15:35:27 +0530167#else /* WLAN_FEATURE_NAN */
Nachiket Kukade63bb63d2018-11-21 14:42:14 +0530168static inline QDF_STATUS nan_init(void)
169{
170 return QDF_STATUS_SUCCESS;
171}
172
173static inline QDF_STATUS nan_deinit(void)
174{
175 return QDF_STATUS_SUCCESS;
176}
177
178static inline QDF_STATUS nan_psoc_enable(struct wlan_objmgr_psoc *psoc)
179{
180 return QDF_STATUS_SUCCESS;
181}
182
183static inline QDF_STATUS nan_psoc_disable(struct wlan_objmgr_psoc *psoc)
184{
185 return QDF_STATUS_SUCCESS;
186}
187
Nachiket Kukadecf941602018-12-12 14:32:35 +0530188static inline QDF_STATUS
189wlan_nan_get_connection_info(struct wlan_objmgr_psoc *psoc,
190 struct policy_mgr_vdev_entry_info *conn_info)
191{
192 return QDF_STATUS_SUCCESS;
193}
Nachiket Kukade2fb1fdb2019-01-08 15:35:27 +0530194#endif /* WLAN_FEATURE_NAN */
Nachiket Kukade63bb63d2018-11-21 14:42:14 +0530195#endif /* _WLAN_NAN_API_H_ */