xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_wds.h (revision d18654812f1bb47a293e05470b563c873bdca762)
1 /*
2  * Copyright (c) 2016-2017, 2019 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: cdp_txrx_wds.h
22  * Define the host data path WDS API functions
23  * called by the host control SW and the OS interface module
24  */
25 #ifndef _CDP_TXRX_WDS_H_
26 #define _CDP_TXRX_WDS_H_
27 #include "cdp_txrx_handle.h"
28 
29 /**
30  * cdp_set_wds_rx_policy() - set the wds rx filter policy of the device
31  * @soc: psoc object
32  * @vdev_id: id of the data virtual device object
33  * @val: the wds rx policy bitmask
34  *
35  * This flag sets the wds rx policy on the vdev. Rx frames not compliant
36  * with the policy will be dropped.
37  *
38  * Return: QDF_STATUS
39  */
40 static inline QDF_STATUS
41 cdp_set_wds_rx_policy(ol_txrx_soc_handle soc,
42 	uint8_t vdev_id,
43 	u_int32_t val)
44 {
45 	if (!soc || !soc->ops || !soc->ops->wds_ops) {
46 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
47 			"%s invalid instance", __func__);
48 		return QDF_STATUS_E_FAILURE;
49 	}
50 
51 	if (soc->ops->wds_ops->txrx_set_wds_rx_policy)
52 		soc->ops->wds_ops->txrx_set_wds_rx_policy(soc, vdev_id, val);
53 	return QDF_STATUS_SUCCESS;
54 }
55 
56 /**
57  * cdp_set_wds_tx_policy_update() - set the wds tx filter policy of the device
58  * @soc: psoc object
59  * @vdev_id: id of the data virtual device object
60  * @peer_mac: peer mac address
61  * @wds_tx_ucast: the wds unicast tx policy bitmask
62  * @wds_tx_mcast: the wds multicast tx policy bitmask
63  *
64  * This flag sets the wds xx policy on the vdev. Tx frames not compliant
65  * with the policy will be dropped.
66  *
67  * Return: QDF_STATUS
68  */
69 static inline QDF_STATUS
70 cdp_set_wds_tx_policy_update(ol_txrx_soc_handle soc,
71 	uint8_t vdev_id, uint8_t *peer_mac,
72 	int wds_tx_ucast, int wds_tx_mcast)
73 {
74 	if (!soc || !soc->ops || !soc->ops->wds_ops) {
75 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
76 			"%s invalid instance", __func__);
77 		return QDF_STATUS_E_FAILURE;
78 	}
79 
80 	if (soc->ops->wds_ops->txrx_wds_peer_tx_policy_update)
81 		soc->ops->wds_ops->txrx_wds_peer_tx_policy_update(
82 				soc, vdev_id, peer_mac, wds_tx_ucast,
83 				wds_tx_mcast);
84 	return QDF_STATUS_SUCCESS;
85 }
86 
87 /**
88  * cdp_vdev_set_wds() - Set/unset wds_enable flag in vdev
89  * @soc: data path soc handle
90  * @vdev_id: id of data path vap handle
91  * @val: value to be set in wds_en flag
92  *
93  *  This flag enables WDS source port learning feature on a vdev
94  *
95  * Return: 1 on success
96  */
97 static inline int
98 cdp_vdev_set_wds(ol_txrx_soc_handle soc, uint8_t vdev_id, uint32_t val)
99 {
100 	if (soc->ops->wds_ops->vdev_set_wds)
101 		return soc->ops->wds_ops->vdev_set_wds(soc, vdev_id, val);
102 	return 0;
103 }
104 #endif
105