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 /** 17 * ipa_filter_map_valid() - Validate a filter table endpoint bitmap 18 * @ipa: IPA pointer 19 * @filter_mask: Filter table endpoint bitmap to check 20 * 21 * Return: true if all regions are valid, false otherwise 22 */ 23 bool ipa_filter_map_valid(struct ipa *ipa, u32 filter_mask); 24 25 /** 26 * ipa_table_hash_support() - Return true if hashed tables are supported 27 * @ipa: IPA pointer 28 */ 29 static inline bool ipa_table_hash_support(struct ipa *ipa) 30 { 31 return ipa->version != IPA_VERSION_4_2; 32 } 33 34 /** 35 * ipa_table_reset() - Reset filter and route tables entries to "none" 36 * @ipa: IPA pointer 37 * @modem: Whether to reset modem or AP entries 38 */ 39 void ipa_table_reset(struct ipa *ipa, bool modem); 40 41 /** 42 * ipa_table_hash_flush() - Synchronize hashed filter and route updates 43 * @ipa: IPA pointer 44 */ 45 int ipa_table_hash_flush(struct ipa *ipa); 46 47 /** 48 * ipa_table_setup() - Set up filter and route tables 49 * @ipa: IPA pointer 50 * 51 * There is no need for a matching ipa_table_teardown() function. 52 */ 53 int ipa_table_setup(struct ipa *ipa); 54 55 /** 56 * ipa_table_config() - Configure filter and route tables 57 * @ipa: IPA pointer 58 * 59 * There is no need for a matching ipa_table_deconfig() function. 60 */ 61 void ipa_table_config(struct ipa *ipa); 62 63 /** 64 * ipa_table_init() - Do early initialization of filter and route tables 65 * @ipa: IPA pointer 66 */ 67 int ipa_table_init(struct ipa *ipa); 68 69 /** 70 * ipa_table_exit() - Inverse of ipa_table_init() 71 * @ipa: IPA pointer 72 */ 73 void ipa_table_exit(struct ipa *ipa); 74 75 /** 76 * ipa_table_mem_valid() - Validate sizes of table memory regions 77 * @ipa: IPA pointer 78 * @filter: Whether to check filter or routing tables 79 */ 80 bool ipa_table_mem_valid(struct ipa *ipa, bool filter); 81 82 #endif /* _IPA_TABLE_H_ */ 83