qmi_rmnet.h 4.5 KB

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