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