rmnet_config.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2013-2014, 2016-2018, 2021 The Linux Foundation.
  3. * All rights reserved.
  4. *
  5. * RMNET Data configuration engine
  6. */
  7. #include <linux/skbuff.h>
  8. #include <linux/time.h>
  9. #include <net/gro_cells.h>
  10. #ifndef _RMNET_CONFIG_H_
  11. #define _RMNET_CONFIG_H_
  12. #define RMNET_MAX_LOGICAL_EP 255
  13. struct rmnet_endpoint {
  14. u8 mux_id;
  15. struct net_device *egress_dev;
  16. struct hlist_node hlnode;
  17. };
  18. struct rmnet_egress_agg_params {
  19. u32 bytes;
  20. u32 count;
  21. u64 time_nsec;
  22. };
  23. /* One instance of this structure is instantiated for each real_dev associated
  24. * with rmnet.
  25. */
  26. struct rmnet_port {
  27. struct net_device *dev;
  28. u32 data_format;
  29. u8 nr_rmnet_devs;
  30. u8 rmnet_mode;
  31. struct hlist_head muxed_ep[RMNET_MAX_LOGICAL_EP];
  32. struct net_device *bridge_ep;
  33. struct net_device *rmnet_dev;
  34. /* Egress aggregation information */
  35. struct rmnet_egress_agg_params egress_agg_params;
  36. /* Protect aggregation related elements */
  37. spinlock_t agg_lock;
  38. struct sk_buff *skbagg_head;
  39. struct sk_buff *skbagg_tail;
  40. int agg_state;
  41. u8 agg_count;
  42. struct timespec64 agg_time;
  43. struct timespec64 agg_last;
  44. struct hrtimer hrtimer;
  45. struct work_struct agg_wq;
  46. };
  47. extern struct rtnl_link_ops rmnet_link_ops;
  48. struct rmnet_vnd_stats {
  49. u64 rx_pkts;
  50. u64 rx_bytes;
  51. u64 tx_pkts;
  52. u64 tx_bytes;
  53. u32 tx_drops;
  54. };
  55. struct rmnet_pcpu_stats {
  56. struct rmnet_vnd_stats stats;
  57. struct u64_stats_sync syncp;
  58. };
  59. struct rmnet_priv_stats {
  60. u64 csum_ok;
  61. u64 csum_ip4_header_bad;
  62. u64 csum_valid_unset;
  63. u64 csum_validation_failed;
  64. u64 csum_err_bad_buffer;
  65. u64 csum_err_invalid_ip_version;
  66. u64 csum_err_invalid_transport;
  67. u64 csum_fragmented_pkt;
  68. u64 csum_skipped;
  69. u64 csum_sw;
  70. u64 csum_hw;
  71. };
  72. struct rmnet_priv {
  73. u8 mux_id;
  74. struct net_device *real_dev;
  75. struct rmnet_pcpu_stats __percpu *pcpu_stats;
  76. struct gro_cells gro_cells;
  77. struct rmnet_priv_stats stats;
  78. };
  79. struct rmnet_port *rmnet_get_port_rcu(struct net_device *real_dev);
  80. struct rmnet_endpoint *rmnet_get_endpoint(struct rmnet_port *port, u8 mux_id);
  81. int rmnet_add_bridge(struct net_device *rmnet_dev,
  82. struct net_device *slave_dev,
  83. struct netlink_ext_ack *extack);
  84. int rmnet_del_bridge(struct net_device *rmnet_dev,
  85. struct net_device *slave_dev);
  86. struct rmnet_port*
  87. rmnet_get_port_rtnl(const struct net_device *real_dev);
  88. #endif /* _RMNET_CONFIG_H_ */