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 16 #include <linux/skbuff.h> 17 #include <net/gro_cells.h> 18 19 #ifndef _RMNET_CONFIG_H_ 20 #define _RMNET_CONFIG_H_ 21 22 #define RMNET_MAX_LOGICAL_EP 255 23 24 struct rmnet_endpoint { 25 u8 mux_id; 26 struct net_device *egress_dev; 27 struct hlist_node hlnode; 28 }; 29 30 /* One instance of this structure is instantiated for each real_dev associated 31 * with rmnet. 32 */ 33 struct rmnet_port { 34 struct net_device *dev; 35 u32 data_format; 36 u8 nr_rmnet_devs; 37 u8 rmnet_mode; 38 struct hlist_head muxed_ep[RMNET_MAX_LOGICAL_EP]; 39 struct net_device *bridge_ep; 40 struct net_device *rmnet_dev; 41 }; 42 43 extern struct rtnl_link_ops rmnet_link_ops; 44 45 struct rmnet_vnd_stats { 46 u64 rx_pkts; 47 u64 rx_bytes; 48 u64 tx_pkts; 49 u64 tx_bytes; 50 u32 tx_drops; 51 }; 52 53 struct rmnet_pcpu_stats { 54 struct rmnet_vnd_stats stats; 55 struct u64_stats_sync syncp; 56 }; 57 58 struct rmnet_priv_stats { 59 u64 csum_ok; 60 u64 csum_valid_unset; 61 u64 csum_validation_failed; 62 u64 csum_err_bad_buffer; 63 u64 csum_err_invalid_ip_version; 64 u64 csum_err_invalid_transport; 65 u64 csum_fragmented_pkt; 66 u64 csum_skipped; 67 u64 csum_sw; 68 }; 69 70 struct rmnet_priv { 71 u8 mux_id; 72 struct net_device *real_dev; 73 struct rmnet_pcpu_stats __percpu *pcpu_stats; 74 struct gro_cells gro_cells; 75 struct rmnet_priv_stats stats; 76 }; 77 78 struct rmnet_port *rmnet_get_port_rcu(struct net_device *real_dev); 79 struct rmnet_endpoint *rmnet_get_endpoint(struct rmnet_port *port, u8 mux_id); 80 int rmnet_add_bridge(struct net_device *rmnet_dev, 81 struct net_device *slave_dev, 82 struct netlink_ext_ack *extack); 83 int rmnet_del_bridge(struct net_device *rmnet_dev, 84 struct net_device *slave_dev); 85 #endif /* _RMNET_CONFIG_H_ */ 86