xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_wds.h (revision 4865edfd190c086bbe2c69aae12a8226f877b91e)
1 /*
2  * Copyright (c) 2016-2017 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 - the data virtual device object
34  * @param val - the wds rx policy bitmask
35  * @return - void
36  */
37 static inline void
38 cdp_set_wds_rx_policy(ol_txrx_soc_handle soc,
39 	struct cdp_vdev *vdev,
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;
46 	}
47 
48 	if (soc->ops->wds_ops->txrx_set_wds_rx_policy)
49 		return soc->ops->wds_ops->txrx_set_wds_rx_policy(vdev, val);
50 	return;
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 vdev - the data virtual device object
60  * @param val - the wds rx policy bitmask
61  * @return - void
62  */
63 static inline void
64 cdp_set_wds_tx_policy_update(ol_txrx_soc_handle soc,
65 	struct cdp_peer *peer,
66 	int wds_tx_ucast, int wds_tx_mcast)
67 {
68 	if (!soc || !soc->ops || !soc->ops->wds_ops) {
69 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
70 			"%s invalid instance", __func__);
71 		return;
72 	}
73 
74 	if (soc->ops->wds_ops->txrx_wds_peer_tx_policy_update)
75 		return soc->ops->wds_ops->txrx_wds_peer_tx_policy_update(
76 				peer, wds_tx_ucast, wds_tx_mcast);
77 	return;
78 }
79 
80 /**
81  * cdp_vdev_set_wds() - Set/unset wds_enable flag in vdev
82  * @soc - data path soc handle
83  * @vdev - data path vap handle
84  * @val - value to be set in wds_en flag
85  *
86  *  This flag enables WDS source port learning feature on a vdev
87  *
88  * return 1 on success
89  */
90 static inline int
91 cdp_vdev_set_wds(ol_txrx_soc_handle soc, void *vdev, uint32_t val)
92 {
93 	if (soc->ops->wds_ops->vdev_set_wds)
94 		return soc->ops->wds_ops->vdev_set_wds(vdev, val);
95 	return 0;
96 }
97 #endif
98