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