-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathrmnet_map.h
149 lines (133 loc) · 4.13 KB
/
rmnet_map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/types.h>
#include <linux/spinlock.h>
#ifndef _RMNET_MAP_H_
#define _RMNET_MAP_H_
struct rmnet_map_control_command_s {
uint8_t command_name;
#ifndef RMNET_USE_BIG_ENDIAN_STRUCTS
uint8_t cmd_type:2;
uint8_t reserved:6;
#else
uint8_t reserved:6;
uint8_t cmd_type:2;
#endif /* RMNET_USE_BIG_ENDIAN_STRUCTS */
uint16_t reserved2;
uint32_t transaction_id;
union {
uint8_t data[65528];
struct {
#ifndef RMNET_USE_BIG_ENDIAN_STRUCTS
uint16_t ip_family:2;
uint16_t reserved:14;
#else
uint16_t reserved:14;
uint16_t ip_family:2;
#endif /* RMNET_USE_BIG_ENDIAN_STRUCTS */
uint16_t flow_control_seq_num;
uint32_t qos_id;
} flow_control;
};
} __aligned(1);
struct rmnet_map_dl_checksum_trailer_s {
unsigned char reserved_h;
#if defined(__LITTLE_ENDIAN_BITFIELD)
unsigned char valid:1;
unsigned char reserved_l:7;
#elif defined(__BIG_ENDIAN_BITFIELD)
unsigned char reserved_l:7;
unsigned char valid:1;
#else
#error "Please fix <asm/byteorder.h>"
#endif
unsigned short checksum_start_offset;
unsigned short checksum_length;
unsigned short checksum_value;
} __aligned(1);
struct rmnet_map_ul_checksum_header_s {
unsigned short checksum_start_offset;
#if defined(__LITTLE_ENDIAN_BITFIELD)
unsigned short checksum_insert_offset:14;
unsigned short udp_ip4_ind:1;
unsigned short cks_en:1;
#elif defined(__BIG_ENDIAN_BITFIELD)
unsigned short cks_en:1;
unsigned short udp_ip4_ind:1;
unsigned short checksum_insert_offset:14;
#else
#error "Please fix <asm/byteorder.h>"
#endif
} __aligned(1);
enum rmnet_map_results_e {
RMNET_MAP_SUCCESS,
RMNET_MAP_CONSUMED,
RMNET_MAP_GENERAL_FAILURE,
RMNET_MAP_NOT_ENABLED,
RMNET_MAP_FAILED_AGGREGATION,
RMNET_MAP_FAILED_MUX
};
enum rmnet_map_mux_errors_e {
RMNET_MAP_MUX_SUCCESS,
RMNET_MAP_MUX_INVALID_MUX_ID,
RMNET_MAP_MUX_INVALID_PAD_LENGTH,
RMNET_MAP_MUX_INVALID_PKT_LENGTH,
/* This should always be the last element */
RMNET_MAP_MUX_ENUM_LENGTH
};
enum rmnet_map_checksum_errors_e {
RMNET_MAP_CHECKSUM_OK,
RMNET_MAP_CHECKSUM_VALID_FLAG_NOT_SET,
RMNET_MAP_CHECKSUM_VALIDATION_FAILED,
RMNET_MAP_CHECKSUM_ERR_UNKOWN,
RMNET_MAP_CHECKSUM_ERR_NOT_DATA_PACKET,
RMNET_MAP_CHECKSUM_ERR_BAD_BUFFER,
RMNET_MAP_CHECKSUM_ERR_UNKNOWN_IP_VERSION,
RMNET_MAP_CHECKSUM_ERR_UNKNOWN_TRANSPORT,
RMNET_MAP_CHECKSUM_FRAGMENTED_PACKET,
RMNET_MAP_CHECKSUM_SKIPPED,
RMNET_MAP_CHECKSUM_SW,
/* This should always be the last element */
RMNET_MAP_CHECKSUM_ENUM_LENGTH
};
enum rmnet_map_commands_e {
RMNET_MAP_COMMAND_NONE,
RMNET_MAP_COMMAND_FLOW_DISABLE,
RMNET_MAP_COMMAND_FLOW_ENABLE,
/* These should always be the last 2 elements */
RMNET_MAP_COMMAND_UNKNOWN,
RMNET_MAP_COMMAND_ENUM_LENGTH
};
enum rmnet_map_agg_state_e {
RMNET_MAP_AGG_IDLE,
RMNET_MAP_TXFER_SCHEDULED
};
#define RMNET_MAP_COMMAND_REQUEST 0
#define RMNET_MAP_COMMAND_ACK 1
#define RMNET_MAP_COMMAND_UNSUPPORTED 2
#define RMNET_MAP_COMMAND_INVALID 3
#define RMNET_MAP_NO_PAD_BYTES 0
#define RMNET_MAP_ADD_PAD_BYTES 1
uint8_t rmnet_map_demultiplex(struct sk_buff *skb);
struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,
struct rmnet_phys_ep_conf_s *config);
struct rmnet_map_header_s *rmnet_map_add_map_header(struct sk_buff *skb,
int hdrlen, int pad);
rx_handler_result_t rmnet_map_command(struct sk_buff *skb,
struct rmnet_phys_ep_conf_s *config);
void rmnet_map_aggregate(struct sk_buff *skb,
struct rmnet_phys_ep_conf_s *config);
int rmnet_map_checksum_downlink_packet(struct sk_buff *skb);
int rmnet_map_checksum_uplink_packet(struct sk_buff *skb,
struct net_device *orig_dev, uint32_t egress_data_format);
#endif /* _RMNET_MAP_H_ */