xref: /wlan-driver/qcacld-3.0/components/pmo/dispatcher/src/wlan_pmo_tgt_mc_addr_filtering.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2018, 2020 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  * DOC: Implements public API for pmo to interact with target/WMI
21  */
22 
23 #include "wlan_pmo_tgt_api.h"
24 #include "wlan_pmo_mc_addr_filtering_public_struct.h"
25 #include "wlan_pmo_obj_mgmt_public_struct.h"
26 #include "wlan_pmo_main.h"
27 
pmo_tgt_set_mc_filter_req(struct wlan_objmgr_vdev * vdev,struct qdf_mac_addr multicast_addr)28 QDF_STATUS pmo_tgt_set_mc_filter_req(struct wlan_objmgr_vdev *vdev,
29 		struct qdf_mac_addr multicast_addr)
30 {
31 	QDF_STATUS status;
32 	struct wlan_objmgr_psoc *psoc;
33 	struct wlan_pmo_tx_ops pmo_tx_ops;
34 
35 	pmo_enter();
36 
37 	psoc = pmo_vdev_get_psoc(vdev);
38 
39 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
40 	if (!pmo_tx_ops.send_set_mc_filter_req) {
41 		pmo_err("send_add_clear_mcbc_filter_request is null");
42 		status = QDF_STATUS_E_NULL_VALUE;
43 		goto out;
44 	}
45 
46 	status = pmo_tx_ops.send_set_mc_filter_req(
47 			vdev, multicast_addr);
48 	if (status != QDF_STATUS_SUCCESS)
49 		pmo_err("Failed to add/clear mc filter");
50 out:
51 	pmo_exit();
52 
53 	return status;
54 }
55 
pmo_tgt_clear_mc_filter_req(struct wlan_objmgr_vdev * vdev,struct qdf_mac_addr multicast_addr)56 QDF_STATUS pmo_tgt_clear_mc_filter_req(struct wlan_objmgr_vdev *vdev,
57 		struct qdf_mac_addr multicast_addr)
58 {
59 	QDF_STATUS status;
60 	struct wlan_objmgr_psoc *psoc;
61 	struct wlan_pmo_tx_ops pmo_tx_ops;
62 
63 	pmo_enter();
64 
65 	psoc = pmo_vdev_get_psoc(vdev);
66 
67 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
68 	if (!pmo_tx_ops.send_clear_mc_filter_req) {
69 		pmo_err("send_add_clear_mcbc_filter_request is null");
70 		status = QDF_STATUS_E_NULL_VALUE;
71 		goto out;
72 	}
73 
74 	status = pmo_tx_ops.send_clear_mc_filter_req(
75 			vdev, multicast_addr);
76 	if (status != QDF_STATUS_SUCCESS)
77 		pmo_err("Failed to add/clear mc filter");
78 out:
79 	pmo_exit();
80 
81 	return status;
82 }
83 
pmo_tgt_get_multiple_mc_filter_support(struct wlan_objmgr_vdev * vdev)84 bool pmo_tgt_get_multiple_mc_filter_support(struct wlan_objmgr_vdev *vdev)
85 {
86 	struct wlan_pmo_tx_ops pmo_tx_ops;
87 	struct wlan_objmgr_psoc *psoc;
88 
89 	psoc = pmo_vdev_get_psoc(vdev);
90 
91 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
92 	if (!pmo_tx_ops.get_multiple_mc_filter_support) {
93 		pmo_err("get_multiple_mc_filter_support is null");
94 		return QDF_STATUS_E_NULL_VALUE;
95 	}
96 
97 	return pmo_tx_ops.get_multiple_mc_filter_support(psoc);
98 }
99 
pmo_tgt_set_multiple_mc_filter_req(struct wlan_objmgr_vdev * vdev,struct pmo_mc_addr_list * mc_list)100 QDF_STATUS pmo_tgt_set_multiple_mc_filter_req(struct wlan_objmgr_vdev *vdev,
101 		struct pmo_mc_addr_list *mc_list)
102 {
103 	QDF_STATUS status;
104 	struct wlan_objmgr_psoc *psoc;
105 	struct wlan_pmo_tx_ops pmo_tx_ops;
106 
107 	psoc = pmo_vdev_get_psoc(vdev);
108 
109 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
110 	if (!pmo_tx_ops.send_set_multiple_mc_filter_req) {
111 		pmo_err("send_set_multiple_mc_filter_req is null");
112 		status = QDF_STATUS_E_NULL_VALUE;
113 		goto out;
114 	}
115 
116 	status = pmo_tx_ops.send_set_multiple_mc_filter_req(
117 			vdev, mc_list);
118 	if (status != QDF_STATUS_SUCCESS)
119 		pmo_err("Failed to add/clear multiple mc filter");
120 out:
121 
122 	return status;
123 }
124 
pmo_tgt_clear_multiple_mc_filter_req(struct wlan_objmgr_vdev * vdev,struct pmo_mc_addr_list * mc_list)125 QDF_STATUS pmo_tgt_clear_multiple_mc_filter_req(struct wlan_objmgr_vdev *vdev,
126 		struct pmo_mc_addr_list *mc_list)
127 {
128 	QDF_STATUS status;
129 	struct wlan_objmgr_psoc *psoc;
130 	struct wlan_pmo_tx_ops pmo_tx_ops;
131 
132 	psoc = pmo_vdev_get_psoc(vdev);
133 
134 	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
135 	if (!pmo_tx_ops.send_clear_multiple_mc_filter_req) {
136 		pmo_err("send_clear_multiple_mc_filter_req is null");
137 		status = QDF_STATUS_E_NULL_VALUE;
138 		goto out;
139 	}
140 
141 	status = pmo_tx_ops.send_clear_multiple_mc_filter_req(
142 			vdev, mc_list);
143 	if (status != QDF_STATUS_SUCCESS)
144 		pmo_err("Failed to add/clear multiple mc filter");
145 out:
146 
147 	return status;
148 }
149 
150 
151