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