xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_wds.h (revision 503663c6daafffe652fa360bde17243568cd6d2a)
1 /*
2  * Copyright (c) 2016-2017, 2019 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_wds.h
21  * @brief Define the host data path WDS API functions
22  * called by the host control SW and the OS interface module
23  */
24 #ifndef _CDP_TXRX_WDS_H_
25 #define _CDP_TXRX_WDS_H_
26 #include "cdp_txrx_handle.h"
27 /**
28  * @brief set the wds rx filter policy of the device
29  * @details
30  *  This flag sets the wds rx policy on the vdev. Rx frames not compliant
31  *  with the policy will be dropped.
32  *
33  * @param vdev_id - id of the data virtual device object
34  * @param val - the wds rx policy bitmask
35  * @return - QDF_STATUS
36  */
37 static inline QDF_STATUS
38 cdp_set_wds_rx_policy(ol_txrx_soc_handle soc,
39 	uint8_t vdev_id,
40 	u_int32_t val)
41 {
42 	if (!soc || !soc->ops || !soc->ops->wds_ops) {
43 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
44 			"%s invalid instance", __func__);
45 		return QDF_STATUS_E_FAILURE;
46 	}
47 
48 	if (soc->ops->wds_ops->txrx_set_wds_rx_policy)
49 		soc->ops->wds_ops->txrx_set_wds_rx_policy(soc, vdev_id, val);
50 	return QDF_STATUS_SUCCESS;
51 }
52 
53 /**
54  * @brief set the wds rx filter policy of the device
55  * @details
56  *  This flag sets the wds rx policy on the vdev. Rx frames not compliant
57  *  with the policy will be dropped.
58  *
59  * @param psoc - psoc object
60  * @param vdev_id - id of the data virtual device object
61  * @param peer_mac - peer mac address
62  * @param val - the wds rx policy bitmask
63  * @return - QDF_STATUS
64  */
65 static inline QDF_STATUS
66 cdp_set_wds_tx_policy_update(ol_txrx_soc_handle soc,
67 	uint8_t vdev_id, uint8_t *peer_mac,
68 	int wds_tx_ucast, int wds_tx_mcast)
69 {
70 	if (!soc || !soc->ops || !soc->ops->wds_ops) {
71 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
72 			"%s invalid instance", __func__);
73 		return QDF_STATUS_E_FAILURE;
74 	}
75 
76 	if (soc->ops->wds_ops->txrx_wds_peer_tx_policy_update)
77 		soc->ops->wds_ops->txrx_wds_peer_tx_policy_update(
78 				soc, vdev_id, peer_mac, wds_tx_ucast,
79 				wds_tx_mcast);
80 	return QDF_STATUS_SUCCESS;
81 }
82 
83 /**
84  * cdp_vdev_set_wds() - Set/unset wds_enable flag in vdev
85  * @soc - data path soc handle
86  * @vdev_id - id of data path vap handle
87  * @val - value to be set in wds_en flag
88  *
89  *  This flag enables WDS source port learning feature on a vdev
90  *
91  * return 1 on success
92  */
93 static inline int
94 cdp_vdev_set_wds(ol_txrx_soc_handle soc, uint8_t vdev_id, uint32_t val)
95 {
96 	if (soc->ops->wds_ops->vdev_set_wds)
97 		return soc->ops->wds_ops->vdev_set_wds(soc, vdev_id, val);
98 	return 0;
99 }
100 #endif
101