rmnet_config.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /* Copyright (c) 2013-2014, 2016-2020 The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * RMNET Data configuration engine
  13. *
  14. */
  15. #include <linux/skbuff.h>
  16. #include <net/gro_cells.h>
  17. #ifndef _RMNET_CONFIG_H_
  18. #define _RMNET_CONFIG_H_
  19. #define RMNET_MAX_LOGICAL_EP 255
  20. #define RMNET_MAX_VEID 4
  21. struct rmnet_endpoint {
  22. u8 mux_id;
  23. struct net_device *egress_dev;
  24. struct hlist_node hlnode;
  25. };
  26. struct rmnet_agg_stats {
  27. u64 ul_agg_reuse;
  28. u64 ul_agg_alloc;
  29. };
  30. struct rmnet_port_priv_stats {
  31. u64 dl_hdr_last_qmap_vers;
  32. u64 dl_hdr_last_ep_id;
  33. u64 dl_hdr_last_trans_id;
  34. u64 dl_hdr_last_seq;
  35. u64 dl_hdr_last_bytes;
  36. u64 dl_hdr_last_pkts;
  37. u64 dl_hdr_last_flows;
  38. u64 dl_hdr_count;
  39. u64 dl_hdr_total_bytes;
  40. u64 dl_hdr_total_pkts;
  41. u64 dl_trl_last_seq;
  42. u64 dl_trl_count;
  43. struct rmnet_agg_stats agg;
  44. };
  45. struct rmnet_egress_agg_params {
  46. u16 agg_size;
  47. u8 agg_count;
  48. u8 agg_features;
  49. u32 agg_time;
  50. };
  51. struct rmnet_agg_page {
  52. struct list_head list;
  53. struct page *page;
  54. };
  55. /* One instance of this structure is instantiated for each real_dev associated
  56. * with rmnet.
  57. */
  58. struct rmnet_port {
  59. struct net_device *dev;
  60. u32 data_format;
  61. u8 nr_rmnet_devs;
  62. u8 rmnet_mode;
  63. struct hlist_head muxed_ep[RMNET_MAX_LOGICAL_EP];
  64. struct net_device *bridge_ep;
  65. void *rmnet_perf;
  66. struct rmnet_egress_agg_params egress_agg_params;
  67. /* Protect aggregation related elements */
  68. spinlock_t agg_lock;
  69. struct sk_buff *agg_skb;
  70. int agg_state;
  71. u8 agg_count;
  72. struct timespec64 agg_time;
  73. struct timespec64 agg_last;
  74. struct hrtimer hrtimer;
  75. struct work_struct agg_wq;
  76. u8 agg_size_order;
  77. struct list_head agg_list;
  78. struct rmnet_agg_page *agg_head;
  79. void *qmi_info;
  80. /* dl marker elements */
  81. struct list_head dl_list;
  82. struct rmnet_port_priv_stats stats;
  83. int dl_marker_flush;
  84. /* Descriptor pool */
  85. spinlock_t desc_pool_lock;
  86. struct rmnet_frag_descriptor_pool *frag_desc_pool;
  87. };
  88. extern struct rtnl_link_ops rmnet_link_ops;
  89. struct rmnet_vnd_stats {
  90. u64 rx_pkts;
  91. u64 rx_bytes;
  92. u64 tx_pkts;
  93. u64 tx_bytes;
  94. u32 tx_drops;
  95. };
  96. struct rmnet_pcpu_stats {
  97. struct rmnet_vnd_stats stats;
  98. struct u64_stats_sync syncp;
  99. };
  100. struct rmnet_coal_close_stats {
  101. u64 non_coal;
  102. u64 ip_miss;
  103. u64 trans_miss;
  104. u64 hw_nl;
  105. u64 hw_pkt;
  106. u64 hw_byte;
  107. u64 hw_time;
  108. u64 hw_evict;
  109. u64 coal;
  110. };
  111. struct rmnet_coal_stats {
  112. u64 coal_rx;
  113. u64 coal_pkts;
  114. u64 coal_hdr_nlo_err;
  115. u64 coal_hdr_pkt_err;
  116. u64 coal_csum_err;
  117. u64 coal_reconstruct;
  118. u64 coal_ip_invalid;
  119. u64 coal_trans_invalid;
  120. struct rmnet_coal_close_stats close;
  121. u64 coal_veid[RMNET_MAX_VEID];
  122. u64 coal_tcp;
  123. u64 coal_tcp_bytes;
  124. u64 coal_udp;
  125. u64 coal_udp_bytes;
  126. };
  127. struct rmnet_priv_stats {
  128. u64 csum_ok;
  129. u64 csum_valid_unset;
  130. u64 csum_validation_failed;
  131. u64 csum_err_bad_buffer;
  132. u64 csum_err_invalid_ip_version;
  133. u64 csum_err_invalid_transport;
  134. u64 csum_fragmented_pkt;
  135. u64 csum_skipped;
  136. u64 csum_sw;
  137. u64 csum_hw;
  138. struct rmnet_coal_stats coal;
  139. u64 ul_prio;
  140. };
  141. struct rmnet_priv {
  142. u8 mux_id;
  143. struct net_device *real_dev;
  144. struct rmnet_pcpu_stats __percpu *pcpu_stats;
  145. struct gro_cells gro_cells;
  146. struct rmnet_priv_stats stats;
  147. void __rcu *qos_info;
  148. };
  149. enum rmnet_dl_marker_prio {
  150. RMNET_PERF,
  151. RMNET_SHS,
  152. };
  153. enum rmnet_trace_func {
  154. RMNET_MODULE,
  155. NW_STACK_MODULE,
  156. };
  157. enum rmnet_trace_evt {
  158. RMNET_DLVR_SKB,
  159. RMNET_RCV_FROM_PND,
  160. RMNET_TX_UL_PKT,
  161. NW_STACK_DEV_Q_XMIT,
  162. NW_STACK_NAPI_GRO_FLUSH,
  163. NW_STACK_RX,
  164. NW_STACK_TX,
  165. };
  166. int rmnet_is_real_dev_registered(const struct net_device *real_dev);
  167. struct rmnet_port *rmnet_get_port(struct net_device *real_dev);
  168. struct rmnet_endpoint *rmnet_get_endpoint(struct rmnet_port *port, u8 mux_id);
  169. int rmnet_add_bridge(struct net_device *rmnet_dev,
  170. struct net_device *slave_dev,
  171. struct netlink_ext_ack *extack);
  172. int rmnet_del_bridge(struct net_device *rmnet_dev,
  173. struct net_device *slave_dev);
  174. #endif /* _RMNET_CONFIG_H_ */