rmnet_config.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* Copyright (c) 2013-2014, 2016-2018 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. struct rmnet_endpoint {
  21. u8 mux_id;
  22. struct net_device *egress_dev;
  23. struct hlist_node hlnode;
  24. };
  25. /* One instance of this structure is instantiated for each real_dev associated
  26. * with rmnet.
  27. */
  28. struct rmnet_port {
  29. struct net_device *dev;
  30. u32 data_format;
  31. u8 nr_rmnet_devs;
  32. u8 rmnet_mode;
  33. struct hlist_head muxed_ep[RMNET_MAX_LOGICAL_EP];
  34. struct net_device *bridge_ep;
  35. };
  36. extern struct rtnl_link_ops rmnet_link_ops;
  37. struct rmnet_vnd_stats {
  38. u64 rx_pkts;
  39. u64 rx_bytes;
  40. u64 tx_pkts;
  41. u64 tx_bytes;
  42. u32 tx_drops;
  43. };
  44. struct rmnet_pcpu_stats {
  45. struct rmnet_vnd_stats stats;
  46. struct u64_stats_sync syncp;
  47. };
  48. struct rmnet_priv_stats {
  49. u64 csum_ok;
  50. u64 csum_valid_unset;
  51. u64 csum_validation_failed;
  52. u64 csum_err_bad_buffer;
  53. u64 csum_err_invalid_ip_version;
  54. u64 csum_err_invalid_transport;
  55. u64 csum_fragmented_pkt;
  56. u64 csum_skipped;
  57. u64 csum_sw;
  58. };
  59. struct rmnet_priv {
  60. u8 mux_id;
  61. struct net_device *real_dev;
  62. struct rmnet_pcpu_stats __percpu *pcpu_stats;
  63. struct gro_cells gro_cells;
  64. struct rmnet_priv_stats stats;
  65. };
  66. struct rmnet_port *rmnet_get_port(struct net_device *real_dev);
  67. struct rmnet_endpoint *rmnet_get_endpoint(struct rmnet_port *port, u8 mux_id);
  68. int rmnet_add_bridge(struct net_device *rmnet_dev,
  69. struct net_device *slave_dev,
  70. struct netlink_ext_ack *extack);
  71. int rmnet_del_bridge(struct net_device *rmnet_dev,
  72. struct net_device *slave_dev);
  73. #endif /* _RMNET_CONFIG_H_ */