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 };
32 
33 extern struct rtnl_link_ops rmnet_link_ops;
34 
35 struct rmnet_vnd_stats {
36 	u64 rx_pkts;
37 	u64 rx_bytes;
38 	u64 tx_pkts;
39 	u64 tx_bytes;
40 	u32 tx_drops;
41 };
42 
43 struct rmnet_pcpu_stats {
44 	struct rmnet_vnd_stats stats;
45 	struct u64_stats_sync syncp;
46 };
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 
60 struct rmnet_priv {
61 	u8 mux_id;
62 	struct net_device *real_dev;
63 	struct rmnet_pcpu_stats __percpu *pcpu_stats;
64 	struct gro_cells gro_cells;
65 	struct rmnet_priv_stats stats;
66 };
67 
68 struct rmnet_port *rmnet_get_port(struct net_device *real_dev);
69 struct rmnet_endpoint *rmnet_get_endpoint(struct rmnet_port *port, u8 mux_id);
70 int rmnet_add_bridge(struct net_device *rmnet_dev,
71 		     struct net_device *slave_dev,
72 		     struct netlink_ext_ack *extack);
73 int rmnet_del_bridge(struct net_device *rmnet_dev,
74 		     struct net_device *slave_dev);
75 #endif /* _RMNET_CONFIG_H_ */
76