xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_ctrl_def.h (revision a175314c51a4ce5cec2835cc8a8c7dc0c1810915)
1 /*
2  * Copyright (c) 2011-2016,2018 The Linux Foundation. All rights reserved.
3  *
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  * @file cdp_txrx_ctrl.h
21  * @brief Define the host data path control API functions
22  * called by the host control SW and the OS interface module
23  */
24 
25 #ifndef _CDP_TXRX_CTRL_DEF_H_
26 #define _CDP_TXRX_CTRL_DEF_H_
27 /* TODO: adf need to be replaced with qdf */
28 /*
29  * Cleanups --  Might need cleanup
30  */
31 #if !QCA_OL_TX_PDEV_LOCK && QCA_NSS_PLATFORM || \
32 	(defined QCA_PARTNER_PLATFORM && QCA_PARTNER_SUPPORT_FAST_TX)
33 #define VAP_TX_SPIN_LOCK(_x) spin_lock(_x)
34 #define VAP_TX_SPIN_UNLOCK(_x) spin_unlock(_x)
35 #else /* QCA_OL_TX_PDEV_LOCK */
36 #define VAP_TX_SPIN_LOCK(_x)
37 #define VAP_TX_SPIN_UNLOCK(_x)
38 #endif /* QCA_OL_TX_PDEV_LOCK */
39 
40 #if QCA_OL_TX_PDEV_LOCK
41 void ol_ll_pdev_tx_lock(void *);
42 void ol_ll_pdev_tx_unlock(void *);
43 #define OL_TX_LOCK(_x)  ol_ll_pdev_tx_lock(_x)
44 #define OL_TX_UNLOCK(_x) ol_ll_pdev_tx_unlock(_x)
45 
46 #define OL_TX_PDEV_LOCK(_x)  qdf_spin_lock_bh(_x)
47 #define OL_TX_PDEV_UNLOCK(_x) qdf_spin_unlock_bh(_x)
48 #else
49 #define OL_TX_PDEV_LOCK(_x)
50 #define OL_TX_PDEV_UNLOCK(_x)
51 
52 #define OL_TX_LOCK(_x)
53 #define OL_TX_UNLOCK(_x)
54 #endif /* QCA_OL_TX_PDEV_LOCK */
55 
56 #if !QCA_OL_TX_PDEV_LOCK
57 #define OL_TX_FLOW_CTRL_LOCK(_x)  qdf_spin_lock_bh(_x)
58 #define OL_TX_FLOW_CTRL_UNLOCK(_x) qdf_spin_unlock_bh(_x)
59 
60 #define OL_TX_DESC_LOCK(_x)  qdf_spin_lock_bh(_x)
61 #define OL_TX_DESC_UNLOCK(_x) qdf_spin_unlock_bh(_x)
62 
63 #define OSIF_VAP_TX_LOCK(_y, _x)  spin_lock(&((_x)->tx_lock))
64 #define OSIF_VAP_TX_UNLOCK(_y, _x)  spin_unlock(&((_x)->tx_lock))
65 
66 #define OL_TX_PEER_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->peer_lock[_id]))
67 #define OL_TX_PEER_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->peer_lock[_id]))
68 
69 #define OL_TX_PEER_UPDATE_LOCK(_x, _id) \
70 	qdf_spin_lock_bh(&((_x)->peer_lock[_id]))
71 #define OL_TX_PEER_UPDATE_UNLOCK(_x, _id) \
72 	qdf_spin_unlock_bh(&((_x)->peer_lock[_id]))
73 
74 #else
75 #define OSIF_VAP_TX_LOCK(_y, _x)  cdp_vdev_tx_lock( \
76 			_y, wlan_vdev_get_dp_handle((_x)->ctrl_vdev))
77 #define OSIF_VAP_TX_UNLOCK(_y, _x) cdp_vdev_tx_unlock( \
78 			_y, wlan_vdev_get_dp_handle((_x)->ctrl_vdev))
79 
80 #define OL_TX_FLOW_CTRL_LOCK(_x)
81 #define OL_TX_FLOW_CTRL_UNLOCK(_x)
82 
83 #define OL_TX_DESC_LOCK(_x)
84 #define OL_TX_DESC_UNLOCK(_x)
85 
86 #define OL_TX_PEER_LOCK(_x, _id)
87 #define OL_TX_PEER_UNLOCK(_x, _id)
88 
89 #define OL_TX_PEER_UPDATE_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->tx_lock))
90 #define OL_TX_PEER_UPDATE_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->tx_lock))
91 
92 #endif /* !QCA_OL_TX_PDEV_LOCK */
93 #endif
94 
95