qmi_rmnet.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*
  2. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _QMI_RMNET_H
  14. #define _QMI_RMNET_H
  15. #include <linux/netdevice.h>
  16. #include <linux/skbuff.h>
  17. #define CONFIG_QTI_QMI_RMNET 1
  18. #define CONFIG_QTI_QMI_DFC 1
  19. #define CONFIG_QTI_QMI_POWER_COLLAPSE 1
  20. struct qmi_rmnet_ps_ind {
  21. void (*ps_on_handler)(void *port);
  22. void (*ps_off_handler)(void *port);
  23. struct list_head list;
  24. };
  25. #ifdef CONFIG_QTI_QMI_RMNET
  26. void qmi_rmnet_qmi_exit(void *qmi_pt, void *port);
  27. int qmi_rmnet_change_link(struct net_device *dev, void *port, void *tcm_pt,
  28. int attr_len);
  29. void qmi_rmnet_enable_all_flows(struct net_device *dev);
  30. bool qmi_rmnet_all_flows_enabled(struct net_device *dev);
  31. void qmi_rmnet_lock_unlock_all_flows(struct net_device *dev, bool lock);
  32. void qmi_rmnet_get_disabled_flows(struct net_device *dev, u8 *num_bearers,
  33. u8 *bearer_id);
  34. void qmi_rmnet_reset_enabled_flows(struct net_device *dev);
  35. #else
  36. static inline void qmi_rmnet_qmi_exit(void *qmi_pt, void *port)
  37. {
  38. }
  39. static inline int
  40. qmi_rmnet_change_link(struct net_device *dev, void *port, void *tcm_pt,
  41. int attr_len)
  42. {
  43. return 0;
  44. }
  45. static inline void
  46. qmi_rmnet_enable_all_flows(struct net_device *dev)
  47. {
  48. }
  49. static inline bool
  50. qmi_rmnet_all_flows_enabled(struct net_device *dev)
  51. {
  52. return true;
  53. }
  54. static inline void qmi_rmnet_lock_unlock_all_flows(struct net_device *dev,
  55. bool lock)
  56. {
  57. }
  58. static inline void qmi_rmnet_get_disabled_flows(struct net_device *dev,
  59. u8 *num_bearers, u8 *bearer_id)
  60. {
  61. if (num_bearers)
  62. *num_bearers = 0;
  63. }
  64. static void qmi_rmnet_reset_enabled_flows(struct net_device *dev);
  65. #endif
  66. #ifdef CONFIG_QTI_QMI_DFC
  67. void *qmi_rmnet_qos_init(struct net_device *real_dev,
  68. struct net_device *vnd_dev, u8 mux_id);
  69. void qmi_rmnet_qos_exit_pre(void *qos);
  70. void qmi_rmnet_qos_exit_post(void);
  71. bool qmi_rmnet_flow_is_low_latency(struct net_device *dev,
  72. struct sk_buff *skb);
  73. void qmi_rmnet_burst_fc_check(struct net_device *dev,
  74. int ip_type, u32 mark, unsigned int len);
  75. int qmi_rmnet_get_queue(struct net_device *dev, struct sk_buff *skb);
  76. #else
  77. static inline void *
  78. qmi_rmnet_qos_init(struct net_device *real_dev,
  79. struct net_device *vnd_dev, u8 mux_id)
  80. {
  81. return NULL;
  82. }
  83. static inline void qmi_rmnet_qos_exit_pre(void *qos)
  84. {
  85. }
  86. static inline void qmi_rmnet_qos_exit_post(void)
  87. {
  88. }
  89. static inline bool qmi_rmnet_flow_is_low_latency(struct net_device *dev,
  90. struct sk_buff *skb)
  91. {
  92. return false;
  93. }
  94. static inline void
  95. qmi_rmnet_burst_fc_check(struct net_device *dev,
  96. int ip_type, u32 mark, unsigned int len)
  97. {
  98. }
  99. static inline int qmi_rmnet_get_queue(struct net_device *dev,
  100. struct sk_buff *skb)
  101. {
  102. return 0;
  103. }
  104. #endif
  105. #ifdef CONFIG_QTI_QMI_POWER_COLLAPSE
  106. int qmi_rmnet_set_powersave_mode(void *port, uint8_t enable);
  107. void qmi_rmnet_work_init(void *port);
  108. void qmi_rmnet_work_exit(void *port);
  109. void qmi_rmnet_work_maybe_restart(void *port);
  110. void qmi_rmnet_set_dl_msg_active(void *port);
  111. bool qmi_rmnet_ignore_grant(void *port);
  112. int qmi_rmnet_ps_ind_register(void *port,
  113. struct qmi_rmnet_ps_ind *ps_ind);
  114. int qmi_rmnet_ps_ind_deregister(void *port,
  115. struct qmi_rmnet_ps_ind *ps_ind);
  116. void qmi_rmnet_ps_off_notify(void *port);
  117. void qmi_rmnet_ps_on_notify(void *port);
  118. #else
  119. static inline int qmi_rmnet_set_powersave_mode(void *port, uint8_t enable)
  120. {
  121. return 0;
  122. }
  123. static inline void qmi_rmnet_work_init(void *port)
  124. {
  125. }
  126. static inline void qmi_rmnet_work_exit(void *port)
  127. {
  128. }
  129. static inline void qmi_rmnet_work_maybe_restart(void *port)
  130. {
  131. }
  132. static inline void qmi_rmnet_set_dl_msg_active(void *port)
  133. {
  134. }
  135. static inline bool qmi_rmnet_ignore_grant(void *port)
  136. {
  137. return false;
  138. }
  139. static inline int qmi_rmnet_ps_ind_register(struct rmnet_port *port,
  140. struct qmi_rmnet_ps_ind *ps_ind)
  141. {
  142. return 0;
  143. }
  144. static inline int qmi_rmnet_ps_ind_deregister(struct rmnet_port *port,
  145. struct qmi_rmnet_ps_ind *ps_ind)
  146. {
  147. return 0;
  148. }
  149. static inline void qmi_rmnet_ps_off_notify(struct rmnet_port *port)
  150. {
  151. }
  152. static inline void qmi_rmnet_ps_on_notify(struct rmnet_port *port)
  153. {
  154. }
  155. #endif
  156. #endif /*_QMI_RMNET_H*/