1 /*
2 * Copyright (c) 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 #if !defined(WLAN_HDD_PACKET_FILTER_API_H__)
21 #define WLAN_HDD_PACKET_FILTER_API_H__
22
23 /**
24 * DOC: wlan_hdd_packet_filter_rules.h
25 *
26 */
27
28 /* Include files */
29 #include "wlan_hdd_assoc.h"
30 #include "wlan_hdd_power.h"
31
32 #ifdef WLAN_FEATURE_PACKET_FILTERING
33
34 /**
35 * hdd_enable_default_pkt_filters() - Enable default packet filters based
36 * on, filters bit map provided in INI, when target goes to suspend mode
37 * @hdd_ctx: Global HDD Context
38 * @vdev_id: vdev_id
39 *
40 * Return: zero if success, non-zero otherwise
41 */
42 int
43 hdd_enable_default_pkt_filters(struct hdd_context *hdd_ctx, uint8_t vdev_id);
44
45 /**
46 * hdd_disable_default_pkt_filters() - Disable default packet filters based
47 * on, filters bit map provided in INI, when target resumes
48 * @hdd_ctx: Global HDD Context
49 * @vdev_id: vdev_id
50 *
51 * Return: zero if success, non-zero otherwise
52 */
53 int
54 hdd_disable_default_pkt_filters(struct hdd_context *hdd_ctx, uint8_t vdev_id);
55
56 /**
57 * wlan_hdd_set_filter() - Set packet filter
58 * @hdd_ctx: Global HDD context
59 * @request: Packet filter request struct
60 * @vdev_id: Target vdev for the request
61 *
62 * Return: 0 on success, non-zero on error
63 */
64 int wlan_hdd_set_filter(struct hdd_context *hdd_ctx,
65 struct pkt_filter_cfg *request,
66 uint8_t vdev_id);
67
68 #else /* WLAN_FEATURE_PACKET_FILTERING */
69
70 static inline int
hdd_enable_default_pkt_filters(struct hdd_context * hdd_ctx,uint8_t vdev_id)71 hdd_enable_default_pkt_filters(struct hdd_context *hdd_ctx, uint8_t vdev_id)
72 {
73 return 0;
74 }
75
76 static inline int
hdd_disable_default_pkt_filters(struct hdd_context * hdd_ctx,uint8_t vdev_id)77 hdd_disable_default_pkt_filters(struct hdd_context *hdd_ctx, uint8_t vdev_id)
78 {
79 return 0;
80 }
81
82 #endif /* WLAN_FEATURE_PACKET_FILTERING */
83 #endif
84