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