1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2013-2018, 2021, The Linux Foundation. All rights reserved.
3  */
4 
5 #ifndef _RMNET_MAP_H_
6 #define _RMNET_MAP_H_
7 #include <linux/if_rmnet.h>
8 
9 struct rmnet_map_control_command {
10 	u8  command_name;
11 	u8  cmd_type:2;
12 	u8  reserved:6;
13 	u16 reserved2;
14 	u32 transaction_id;
15 	union {
16 		struct {
17 			u16 ip_family:2;
18 			u16 reserved:14;
19 			__be16 flow_control_seq_num;
20 			__be32 qos_id;
21 		} flow_control;
22 		DECLARE_FLEX_ARRAY(u8, data);
23 	};
24 }  __aligned(1);
25 
26 enum rmnet_map_commands {
27 	RMNET_MAP_COMMAND_NONE,
28 	RMNET_MAP_COMMAND_FLOW_DISABLE,
29 	RMNET_MAP_COMMAND_FLOW_ENABLE,
30 	/* These should always be the last 2 elements */
31 	RMNET_MAP_COMMAND_UNKNOWN,
32 	RMNET_MAP_COMMAND_ENUM_LENGTH
33 };
34 
35 #define RMNET_MAP_COMMAND_REQUEST     0
36 #define RMNET_MAP_COMMAND_ACK         1
37 #define RMNET_MAP_COMMAND_UNSUPPORTED 2
38 #define RMNET_MAP_COMMAND_INVALID     3
39 
40 #define RMNET_MAP_NO_PAD_BYTES        0
41 #define RMNET_MAP_ADD_PAD_BYTES       1
42 
43 struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,
44 				      struct rmnet_port *port);
45 struct rmnet_map_header *rmnet_map_add_map_header(struct sk_buff *skb,
46 						  int hdrlen,
47 						  struct rmnet_port *port,
48 						  int pad);
49 void rmnet_map_command(struct sk_buff *skb, struct rmnet_port *port);
50 int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len);
51 void rmnet_map_checksum_uplink_packet(struct sk_buff *skb,
52 				      struct rmnet_port *port,
53 				      struct net_device *orig_dev,
54 				      int csum_type);
55 int rmnet_map_process_next_hdr_packet(struct sk_buff *skb, u16 len);
56 
57 #endif /* _RMNET_MAP_H_ */
58