• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2013-2018, 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 		u8 data[0];
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_GET_MUX_ID(Y) (((struct rmnet_map_header *) \
36 				 (Y)->data)->mux_id)
37 #define RMNET_MAP_GET_CD_BIT(Y) (((struct rmnet_map_header *) \
38 				(Y)->data)->cd_bit)
39 #define RMNET_MAP_GET_PAD(Y) (((struct rmnet_map_header *) \
40 				(Y)->data)->pad_len)
41 #define RMNET_MAP_GET_CMD_START(Y) ((struct rmnet_map_control_command *) \
42 				    ((Y)->data + \
43 				      sizeof(struct rmnet_map_header)))
44 #define RMNET_MAP_GET_LENGTH(Y) (ntohs(((struct rmnet_map_header *) \
45 					(Y)->data)->pkt_len))
46 
47 #define RMNET_MAP_COMMAND_REQUEST     0
48 #define RMNET_MAP_COMMAND_ACK         1
49 #define RMNET_MAP_COMMAND_UNSUPPORTED 2
50 #define RMNET_MAP_COMMAND_INVALID     3
51 
52 #define RMNET_MAP_NO_PAD_BYTES        0
53 #define RMNET_MAP_ADD_PAD_BYTES       1
54 
55 struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,
56 				      struct rmnet_port *port);
57 struct rmnet_map_header *rmnet_map_add_map_header(struct sk_buff *skb,
58 						  int hdrlen, int pad);
59 void rmnet_map_command(struct sk_buff *skb, struct rmnet_port *port);
60 int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len);
61 void rmnet_map_checksum_uplink_packet(struct sk_buff *skb,
62 				      struct net_device *orig_dev);
63 
64 #endif /* _RMNET_MAP_H_ */
65