Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
0004  * Copyright (C) 2019-2021 Linaro Ltd.
0005  */
0006 #ifndef _IPA_TABLE_H_
0007 #define _IPA_TABLE_H_
0008 
0009 #include <linux/types.h>
0010 
0011 struct ipa;
0012 
0013 /* The maximum number of filter table entries (IPv4, IPv6; hashed or not) */
0014 #define IPA_FILTER_COUNT_MAX    14
0015 
0016 /* The number of route table entries allotted to the modem */
0017 #define IPA_ROUTE_MODEM_COUNT   8
0018 
0019 /* The maximum number of route table entries (IPv4, IPv6; hashed or not) */
0020 #define IPA_ROUTE_COUNT_MAX 15
0021 
0022 /**
0023  * ipa_table_valid() - Validate route and filter table memory regions
0024  * @ipa:    IPA pointer
0025  *
0026  * Return:  true if all regions are valid, false otherwise
0027  */
0028 bool ipa_table_valid(struct ipa *ipa);
0029 
0030 /**
0031  * ipa_filter_map_valid() - Validate a filter table endpoint bitmap
0032  * @ipa:    IPA pointer
0033  * @filter_mask: Filter table endpoint bitmap to check
0034  *
0035  * Return:  true if all regions are valid, false otherwise
0036  */
0037 bool ipa_filter_map_valid(struct ipa *ipa, u32 filter_mask);
0038 
0039 /**
0040  * ipa_table_hash_support() - Return true if hashed tables are supported
0041  * @ipa:    IPA pointer
0042  */
0043 static inline bool ipa_table_hash_support(struct ipa *ipa)
0044 {
0045     return ipa->version != IPA_VERSION_4_2;
0046 }
0047 
0048 /**
0049  * ipa_table_reset() - Reset filter and route tables entries to "none"
0050  * @ipa:    IPA pointer
0051  * @modem:  Whether to reset modem or AP entries
0052  */
0053 void ipa_table_reset(struct ipa *ipa, bool modem);
0054 
0055 /**
0056  * ipa_table_hash_flush() - Synchronize hashed filter and route updates
0057  * @ipa:    IPA pointer
0058  */
0059 int ipa_table_hash_flush(struct ipa *ipa);
0060 
0061 /**
0062  * ipa_table_setup() - Set up filter and route tables
0063  * @ipa:    IPA pointer
0064  *
0065  * There is no need for a matching ipa_table_teardown() function.
0066  */
0067 int ipa_table_setup(struct ipa *ipa);
0068 
0069 /**
0070  * ipa_table_config() - Configure filter and route tables
0071  * @ipa:    IPA pointer
0072  *
0073  * There is no need for a matching ipa_table_deconfig() function.
0074  */
0075 void ipa_table_config(struct ipa *ipa);
0076 
0077 /**
0078  * ipa_table_init() - Do early initialization of filter and route tables
0079  * @ipa:    IPA pointer
0080  */
0081 int ipa_table_init(struct ipa *ipa);
0082 
0083 /**
0084  * ipa_table_exit() - Inverse of ipa_table_init()
0085  * @ipa:    IPA pointer
0086  */
0087 void ipa_table_exit(struct ipa *ipa);
0088 
0089 #endif /* _IPA_TABLE_H_ */