ipa_table.h 2.2 KB

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