qmi_rmnet.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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_prepare_ps_bearers(struct net_device *dev, u8 *num_bearers,
  32. u8 *bearer_id);
  33. #else
  34. static inline void qmi_rmnet_qmi_exit(void *qmi_pt, void *port)
  35. {
  36. }
  37. static inline int
  38. qmi_rmnet_change_link(struct net_device *dev, void *port, void *tcm_pt,
  39. int attr_len)
  40. {
  41. return 0;
  42. }
  43. static inline void
  44. qmi_rmnet_enable_all_flows(struct net_device *dev)
  45. {
  46. }
  47. static inline bool
  48. qmi_rmnet_all_flows_enabled(struct net_device *dev)
  49. {
  50. return true;
  51. }
  52. static inline void qmi_rmnet_prepare_ps_bearers(struct net_device *dev,
  53. u8 *num_bearers, u8 *bearer_id)
  54. {
  55. if (num_bearers)
  56. *num_bearers = 0;
  57. }
  58. #endif
  59. #ifdef CONFIG_QTI_QMI_DFC
  60. void *qmi_rmnet_qos_init(struct net_device *real_dev,
  61. struct net_device *vnd_dev, u8 mux_id);
  62. void qmi_rmnet_qos_exit_pre(void *qos);
  63. void qmi_rmnet_qos_exit_post(void);
  64. bool qmi_rmnet_get_flow_state(struct net_device *dev, struct sk_buff *skb,
  65. bool *drop, bool *is_low_latency);
  66. void qmi_rmnet_burst_fc_check(struct net_device *dev,
  67. int ip_type, u32 mark, unsigned int len);
  68. int qmi_rmnet_get_queue(struct net_device *dev, struct sk_buff *skb);
  69. #else
  70. static inline void *
  71. qmi_rmnet_qos_init(struct net_device *real_dev,
  72. struct net_device *vnd_dev, u8 mux_id)
  73. {
  74. return NULL;
  75. }
  76. static inline void qmi_rmnet_qos_exit_pre(void *qos)
  77. {
  78. }
  79. static inline void qmi_rmnet_qos_exit_post(void)
  80. {
  81. }
  82. static inline bool qmi_rmnet_get_flow_state(struct net_device *dev,
  83. struct sk_buff *skb,
  84. bool *drop,
  85. bool *is_low_latency)
  86. {
  87. return false;
  88. }
  89. static inline void
  90. qmi_rmnet_burst_fc_check(struct net_device *dev,
  91. int ip_type, u32 mark, unsigned int len)
  92. {
  93. }
  94. static inline int qmi_rmnet_get_queue(struct net_device *dev,
  95. struct sk_buff *skb)
  96. {
  97. return 0;
  98. }
  99. #endif
  100. #ifdef CONFIG_QTI_QMI_POWER_COLLAPSE
  101. int qmi_rmnet_set_powersave_mode(void *port, uint8_t enable, u8 num_bearers,
  102. u8 *bearer_id);
  103. void qmi_rmnet_work_init(void *port);
  104. void qmi_rmnet_work_exit(void *port);
  105. void qmi_rmnet_work_maybe_restart(void *port);
  106. void qmi_rmnet_set_dl_msg_active(void *port);
  107. bool qmi_rmnet_ignore_grant(void *port);
  108. int qmi_rmnet_ps_ind_register(void *port,
  109. struct qmi_rmnet_ps_ind *ps_ind);
  110. int qmi_rmnet_ps_ind_deregister(void *port,
  111. struct qmi_rmnet_ps_ind *ps_ind);
  112. void qmi_rmnet_ps_off_notify(void *port);
  113. void qmi_rmnet_ps_on_notify(void *port);
  114. #else
  115. static inline int qmi_rmnet_set_powersave_mode(void *port, uint8_t enable,
  116. u8 num_bearers, u8 *bearer_id)
  117. {
  118. return 0;
  119. }
  120. static inline void qmi_rmnet_work_init(void *port)
  121. {
  122. }
  123. static inline void qmi_rmnet_work_exit(void *port)
  124. {
  125. }
  126. static inline void qmi_rmnet_work_maybe_restart(void *port)
  127. {
  128. }
  129. static inline void qmi_rmnet_set_dl_msg_active(void *port)
  130. {
  131. }
  132. static inline bool qmi_rmnet_ignore_grant(void *port)
  133. {
  134. return false;
  135. }
  136. static inline int qmi_rmnet_ps_ind_register(struct rmnet_port *port,
  137. struct qmi_rmnet_ps_ind *ps_ind)
  138. {
  139. return 0;
  140. }
  141. static inline int qmi_rmnet_ps_ind_deregister(struct rmnet_port *port,
  142. struct qmi_rmnet_ps_ind *ps_ind)
  143. {
  144. return 0;
  145. }
  146. static inline void qmi_rmnet_ps_off_notify(struct rmnet_port *port)
  147. {
  148. }
  149. static inline void qmi_rmnet_ps_on_notify(struct rmnet_port *port)
  150. {
  151. }
  152. #endif
  153. #endif /*_QMI_RMNET_H*/