blob: c349f31bc4a1edd97a5468d59ee0f9efa0132f63 [file] [log] [blame]
Dhanashri Atre9c222b12016-03-22 13:26:13 -07001/*
2 * Copyright (c) 2016 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27 /**
28 * @file cdp_txrx_peer.h
29 * @brief Define the host data path peer API functions
30 * called by the host control SW and the OS interface module
31 */
32#ifndef _CDP_TXRX_PEER_H_
33#define _CDP_TXRX_PEER_H_
34
35typedef QDF_STATUS (*ol_rx_callback_fp)(void *p_cds_gctx,
36 qdf_nbuf_t pDataBuff,
37 uint8_t ucSTAId);
38
39/**
40 * struct ol_txrx_peer_state - Peer state information
41 */
42enum ol_txrx_peer_state {
43 OL_TXRX_PEER_STATE_INVALID,
44 OL_TXRX_PEER_STATE_DISC, /* initial state */
45 OL_TXRX_PEER_STATE_CONN, /* authentication in progress */
46 OL_TXRX_PEER_STATE_AUTH, /* authentication successful */
47};
48
49/**
50 * struct ol_txrx_desc_type - txrx descriptor type
51 * @sta_id: sta id
52 * @is_qos_enabled: is station qos enabled
53 * @is_wapi_supported: is station wapi supported
54 */
55struct ol_txrx_desc_type {
56 uint8_t sta_id;
57 uint8_t is_qos_enabled;
58 uint8_t is_wapi_supported;
59};
60
61QDF_STATUS ol_txrx_register_peer(struct ol_txrx_desc_type *sta_desc);
62
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080063/**
64 * ol_txrx_vdev_peer_remove_cb - wma_remove_peer callback
65 */
66typedef void (*ol_txrx_vdev_peer_remove_cb)(void *handle, uint8_t *bssid,
67 uint8_t vdev_id,
68 ol_txrx_peer_handle peer,
69 bool roam_synch_in_progress);
70
Dhanashri Atre9c222b12016-03-22 13:26:13 -070071QDF_STATUS ol_txrx_clear_peer(uint8_t sta_id);
72
73QDF_STATUS ol_txrx_change_peer_state(uint8_t sta_id,
74 enum ol_txrx_peer_state sta_state,
75 bool roam_synch_in_progress);
76
77ol_txrx_peer_handle ol_txrx_find_peer_by_addr(ol_txrx_pdev_handle pdev,
78 uint8_t *peer_addr,
79 uint8_t *peer_id);
80
81ol_txrx_peer_handle
82ol_txrx_find_peer_by_addr_and_vdev(ol_txrx_pdev_handle pdev,
83 ol_txrx_vdev_handle vdev,
84 uint8_t *peer_addr, uint8_t *peer_id);
85
Manjunathappa Prakasha22c2162016-03-01 03:21:55 -080086#ifdef QCA_SUPPORT_TXRX_LOCAL_PEER_ID
Dhanashri Atre9c222b12016-03-22 13:26:13 -070087uint16_t ol_txrx_local_peer_id(ol_txrx_peer_handle peer);
Manjunathappa Prakasha22c2162016-03-01 03:21:55 -080088ol_txrx_peer_handle ol_txrx_find_peer_by_addr(ol_txrx_pdev_handle pdev,
89 uint8_t *peer_addr,
90 uint8_t *peer_id);
91ol_txrx_peer_handle
92ol_txrx_find_peer_by_addr_and_vdev(ol_txrx_pdev_handle pdev,
93 ol_txrx_vdev_handle vdev,
94 uint8_t *peer_addr, uint8_t *peer_id);
Dhanashri Atre9c222b12016-03-22 13:26:13 -070095ol_txrx_peer_handle
96ol_txrx_peer_find_by_local_id(ol_txrx_pdev_handle pdev, uint8_t local_peer_id);
Manjunathappa Prakasha22c2162016-03-01 03:21:55 -080097#else
98#define ol_txrx_local_peer_id(peer) OL_TXRX_INVALID_LOCAL_PEER_ID
99#define ol_txrx_find_peer_by_addr(pdev, peer_addr, peer_id) NULL
100#define ol_txrx_find_peer_by_addr_and_vdev(pdev, vdev, peer_addr, peer_id) NULL
101#define ol_txrx_peer_find_by_local_id(pdev, local_peer_id) NULL
102#endif /* QCA_SUPPORT_TXRX_LOCAL_PEER_ID */
Dhanashri Atre9c222b12016-03-22 13:26:13 -0700103
104QDF_STATUS
105ol_txrx_peer_state_update(ol_txrx_pdev_handle pdev, uint8_t *peer_addr,
106 enum ol_txrx_peer_state state);
107
108QDF_STATUS ol_txrx_get_vdevid(struct ol_txrx_peer_t *peer, uint8_t *vdev_id);
109void *ol_txrx_get_vdev_by_sta_id(uint8_t sta_id);
110
111QDF_STATUS ol_txrx_register_ocb_peer(void *cds_ctx, uint8_t *mac_addr,
112 uint8_t *peer_id);
113
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -0800114/**
115 * ol_txrx_peer_get_peer_mac_addr() - return mac_addr from peer handle.
116 * @peer: handle to peer
117 *
118 * returns mac addrs for module which do not know peer type
119 *
120 * Return: the mac_addr from peer
121 */
122uint8_t *ol_txrx_peer_get_peer_mac_addr(ol_txrx_peer_handle peer);
123
124/**
125 * ol_txrx_get_peer_state() - Return peer state of peer
126 * @peer: peer handle
127 *
128 * Return: return peer state
129 */
130int ol_txrx_get_peer_state(ol_txrx_peer_handle peer);
131
132/**
133 * ol_txrx_get_vdev_for_peer() - Return vdev from peer handle
134 * @peer: peer handle
135 *
136 * Return: vdev handle from peer
137 */
138ol_txrx_vdev_handle
139ol_txrx_get_vdev_for_peer(ol_txrx_peer_handle peer);
140
141/**
142 * ol_txrx_update_ibss_add_peer_num_of_vdev() - update and return peer num
143 * @vdev: vdev handle
144 * @peer_num_delta: peer nums to be adjusted
145 *
146 * Return: -1 for failure or total peer nums after adjustment.
147 */
148int16_t
149ol_txrx_update_ibss_add_peer_num_of_vdev(ol_txrx_vdev_handle vdev,
150 int16_t peer_num_delta);
151/**
152 * ol_txrx_remove_peers_for_vdev() - remove all vdev peers with lock held
153 * @vdev: vdev handle
154 * @callback: callback function to remove the peer.
155 * @callback_context: handle for callback function
156 * @remove_last_peer: Does it required to last peer.
157 *
158 * Return: NONE
159 */
160void
161ol_txrx_remove_peers_for_vdev(ol_txrx_vdev_handle vdev,
162 ol_txrx_vdev_peer_remove_cb callback,
163 void *callback_context, bool remove_last_peer);
164/**
165 * ol_txrx_remove_peers_for_vdev_no_lock() - remove vdev peers with no lock.
166 * @vdev: vdev handle
167 * @callback: callback function to remove the peer.
168 * @callback_context: handle for callback function
169 *
170 * Return: NONE
171 */
172void
173ol_txrx_remove_peers_for_vdev_no_lock(ol_txrx_vdev_handle vdev,
174 ol_txrx_vdev_peer_remove_cb callback,
175 void *callback_context);
Dhanashri Atre9c222b12016-03-22 13:26:13 -0700176#endif /* _CDP_TXRX_PEER_H_ */