rmnet_config.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /* Copyright (c) 2013-2014, 2016-2021 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. #define RMNET_SHS_STMP_ALL BIT(0)
  22. #define RMNET_SHS_NO_PSH BIT(1)
  23. #define RMNET_SHS_NO_DLMKR BIT(2)
  24. struct rmnet_shs_clnt_s {
  25. u16 config;
  26. u16 map_mask;
  27. u16 max_pkts;
  28. union {
  29. struct rmnet_port *port;
  30. } info;
  31. };
  32. struct rmnet_endpoint {
  33. u8 mux_id;
  34. struct net_device *egress_dev;
  35. struct hlist_node hlnode;
  36. };
  37. struct rmnet_agg_stats {
  38. u64 ul_agg_reuse;
  39. u64 ul_agg_alloc;
  40. };
  41. struct rmnet_port_priv_stats {
  42. u64 dl_hdr_last_qmap_vers;
  43. u64 dl_hdr_last_ep_id;
  44. u64 dl_hdr_last_trans_id;
  45. u64 dl_hdr_last_seq;
  46. u64 dl_hdr_last_bytes;
  47. u64 dl_hdr_last_pkts;
  48. u64 dl_hdr_last_flows;
  49. u64 dl_hdr_count;
  50. u64 dl_hdr_total_bytes;
  51. u64 dl_hdr_total_pkts;
  52. u64 dl_trl_last_seq;
  53. u64 dl_trl_count;
  54. struct rmnet_agg_stats agg;
  55. };
  56. struct rmnet_egress_agg_params {
  57. u16 agg_size;
  58. u8 agg_count;
  59. u8 agg_features;
  60. u32 agg_time;
  61. };
  62. struct rmnet_agg_page {
  63. struct list_head list;
  64. struct page *page;
  65. };
  66. /* One instance of this structure is instantiated for each real_dev associated
  67. * with rmnet.
  68. */
  69. struct rmnet_port {
  70. struct net_device *dev;
  71. u32 data_format;
  72. u8 nr_rmnet_devs;
  73. u8 rmnet_mode;
  74. struct hlist_head muxed_ep[RMNET_MAX_LOGICAL_EP];
  75. struct net_device *bridge_ep;
  76. void *rmnet_perf;
  77. struct rmnet_egress_agg_params egress_agg_params;
  78. /* Protect aggregation related elements */
  79. spinlock_t agg_lock;
  80. struct sk_buff *agg_skb;
  81. int agg_state;
  82. u8 agg_count;
  83. struct timespec64 agg_time;
  84. struct timespec64 agg_last;
  85. struct hrtimer hrtimer;
  86. struct work_struct agg_wq;
  87. u8 agg_size_order;
  88. struct list_head agg_list;
  89. struct rmnet_agg_page *agg_head;
  90. void *qmi_info;
  91. /* dl marker elements */
  92. struct list_head dl_list;
  93. struct rmnet_port_priv_stats stats;
  94. int dl_marker_flush;
  95. /* Port Config for shs */
  96. struct rmnet_shs_clnt_s shs_cfg;
  97. struct rmnet_shs_clnt_s phy_shs_cfg;
  98. /* Descriptor pool */
  99. spinlock_t desc_pool_lock;
  100. struct rmnet_frag_descriptor_pool *frag_desc_pool;
  101. };
  102. extern struct rtnl_link_ops rmnet_link_ops;
  103. struct rmnet_vnd_stats {
  104. u64 rx_pkts;
  105. u64 rx_bytes;
  106. u64 tx_pkts;
  107. u64 tx_bytes;
  108. u32 tx_drops;
  109. };
  110. struct rmnet_pcpu_stats {
  111. struct rmnet_vnd_stats stats;
  112. struct u64_stats_sync syncp;
  113. };
  114. struct rmnet_coal_close_stats {
  115. u64 non_coal;
  116. u64 ip_miss;
  117. u64 trans_miss;
  118. u64 hw_nl;
  119. u64 hw_pkt;
  120. u64 hw_byte;
  121. u64 hw_time;
  122. u64 hw_evict;
  123. u64 coal;
  124. };
  125. struct rmnet_coal_stats {
  126. u64 coal_rx;
  127. u64 coal_pkts;
  128. u64 coal_hdr_nlo_err;
  129. u64 coal_hdr_pkt_err;
  130. u64 coal_csum_err;
  131. u64 coal_reconstruct;
  132. u64 coal_ip_invalid;
  133. u64 coal_trans_invalid;
  134. struct rmnet_coal_close_stats close;
  135. u64 coal_veid[RMNET_MAX_VEID];
  136. u64 coal_tcp;
  137. u64 coal_tcp_bytes;
  138. u64 coal_udp;
  139. u64 coal_udp_bytes;
  140. };
  141. struct rmnet_priv_stats {
  142. u64 csum_ok;
  143. u64 csum_valid_unset;
  144. u64 csum_validation_failed;
  145. u64 csum_err_bad_buffer;
  146. u64 csum_err_invalid_ip_version;
  147. u64 csum_err_invalid_transport;
  148. u64 csum_fragmented_pkt;
  149. u64 csum_skipped;
  150. u64 csum_sw;
  151. u64 csum_hw;
  152. struct rmnet_coal_stats coal;
  153. u64 ul_prio;
  154. u64 tso_pkts;
  155. u64 tso_arriv_errs;
  156. };
  157. struct rmnet_priv {
  158. u8 mux_id;
  159. struct net_device *real_dev;
  160. struct rmnet_pcpu_stats __percpu *pcpu_stats;
  161. struct gro_cells gro_cells;
  162. struct rmnet_priv_stats stats;
  163. void __rcu *qos_info;
  164. };
  165. enum rmnet_dl_marker_prio {
  166. RMNET_PERF,
  167. RMNET_SHS,
  168. };
  169. enum rmnet_trace_func {
  170. RMNET_MODULE,
  171. NW_STACK_MODULE,
  172. };
  173. enum rmnet_trace_evt {
  174. RMNET_DLVR_SKB,
  175. RMNET_RCV_FROM_PND,
  176. RMNET_TX_UL_PKT,
  177. NW_STACK_DEV_Q_XMIT,
  178. NW_STACK_NAPI_GRO_FLUSH,
  179. NW_STACK_RX,
  180. NW_STACK_TX,
  181. };
  182. int rmnet_is_real_dev_registered(const struct net_device *real_dev);
  183. struct rmnet_port *rmnet_get_port(struct net_device *real_dev);
  184. struct rmnet_endpoint *rmnet_get_endpoint(struct rmnet_port *port, u8 mux_id);
  185. int rmnet_add_bridge(struct net_device *rmnet_dev,
  186. struct net_device *slave_dev,
  187. struct netlink_ext_ack *extack);
  188. int rmnet_del_bridge(struct net_device *rmnet_dev,
  189. struct net_device *slave_dev);
  190. #endif /* _RMNET_CONFIG_H_ */