xref: /linux/drivers/net/ipa/ipa_table.h (revision 03f7c1d2a49acd30e38789cd809d3300721e9b0e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4  * Copyright (C) 2019-2022 Linaro Ltd.
5  */
6 #ifndef _IPA_TABLE_H_
7 #define _IPA_TABLE_H_
8 
9 #include <linux/types.h>
10 
11 struct ipa;
12 
13 /* The maximum number of filter table entries (IPv4, IPv6; hashed or not) */
14 #define IPA_FILTER_COUNT_MAX	14
15 
16 /* The number of route table entries allotted to the modem */
17 #define IPA_ROUTE_MODEM_COUNT	8
18 
19 /* The maximum number of route table entries (IPv4, IPv6; hashed or not) */
20 #define IPA_ROUTE_COUNT_MAX	15
21 
22 /**
23  * ipa_table_valid() - Validate route and filter table memory regions
24  * @ipa:	IPA pointer
25  *
26  * Return:	true if all regions are valid, false otherwise
27  */
28 bool ipa_table_valid(struct ipa *ipa);
29 
30 /**
31  * ipa_filter_map_valid() - Validate a filter table endpoint bitmap
32  * @ipa:	IPA pointer
33  * @filter_mask: Filter table endpoint bitmap to check
34  *
35  * Return:	true if all regions are valid, false otherwise
36  */
37 bool ipa_filter_map_valid(struct ipa *ipa, u32 filter_mask);
38 
39 /**
40  * ipa_table_hash_support() - Return true if hashed tables are supported
41  * @ipa:	IPA pointer
42  */
43 static inline bool ipa_table_hash_support(struct ipa *ipa)
44 {
45 	return ipa->version != IPA_VERSION_4_2;
46 }
47 
48 /**
49  * ipa_table_reset() - Reset filter and route tables entries to "none"
50  * @ipa:	IPA pointer
51  * @modem:	Whether to reset modem or AP entries
52  */
53 void ipa_table_reset(struct ipa *ipa, bool modem);
54 
55 /**
56  * ipa_table_hash_flush() - Synchronize hashed filter and route updates
57  * @ipa:	IPA pointer
58  */
59 int ipa_table_hash_flush(struct ipa *ipa);
60 
61 /**
62  * ipa_table_setup() - Set up filter and route tables
63  * @ipa:	IPA pointer
64  *
65  * There is no need for a matching ipa_table_teardown() function.
66  */
67 int ipa_table_setup(struct ipa *ipa);
68 
69 /**
70  * ipa_table_config() - Configure filter and route tables
71  * @ipa:	IPA pointer
72  *
73  * There is no need for a matching ipa_table_deconfig() function.
74  */
75 void ipa_table_config(struct ipa *ipa);
76 
77 /**
78  * ipa_table_init() - Do early initialization of filter and route tables
79  * @ipa:	IPA pointer
80  */
81 int ipa_table_init(struct ipa *ipa);
82 
83 /**
84  * ipa_table_exit() - Inverse of ipa_table_init()
85  * @ipa:	IPA pointer
86  */
87 void ipa_table_exit(struct ipa *ipa);
88 
89 #endif /* _IPA_TABLE_H_ */
90