Commit | Line | Data |
---|---|---|
9395da4e | 1 | /* SPDX-License-Identifier: GPL-2.0-only |
e1d9a90a | 2 | * Copyright (c) 2013-2019, 2021 The Linux Foundation. All rights reserved. |
9395da4e SAK |
3 | */ |
4 | ||
5 | #ifndef _LINUX_IF_RMNET_H_ | |
6 | #define _LINUX_IF_RMNET_H_ | |
7 | ||
8 | struct rmnet_map_header { | |
16653c16 AE |
9 | u8 flags; /* MAP_CMD_FLAG, MAP_PAD_LEN_MASK */ |
10 | u8 mux_id; | |
11 | __be16 pkt_len; /* Length of packet, including pad */ | |
9395da4e SAK |
12 | } __aligned(1); |
13 | ||
16653c16 | 14 | /* rmnet_map_header flags field: |
e1d9a90a SCV |
15 | * PAD_LEN: number of pad bytes following packet data |
16 | * CMD: 1 = packet contains a MAP command; 0 = packet contains data | |
17 | * NEXT_HEADER: 1 = packet contains V5 CSUM header 0 = no V5 CSUM header | |
16653c16 AE |
18 | */ |
19 | #define MAP_PAD_LEN_MASK GENMASK(5, 0) | |
e1d9a90a | 20 | #define MAP_NEXT_HEADER_FLAG BIT(6) |
16653c16 AE |
21 | #define MAP_CMD_FLAG BIT(7) |
22 | ||
9395da4e | 23 | struct rmnet_map_dl_csum_trailer { |
cc1b21ba AE |
24 | u8 reserved1; |
25 | u8 flags; /* MAP_CSUM_DL_VALID_FLAG */ | |
45f3a13c AE |
26 | __be16 csum_start_offset; |
27 | __be16 csum_length; | |
be754f64 | 28 | __sum16 csum_value; |
9395da4e SAK |
29 | } __aligned(1); |
30 | ||
cc1b21ba AE |
31 | /* rmnet_map_dl_csum_trailer flags field: |
32 | * VALID: 1 = checksum and length valid; 0 = ignore them | |
33 | */ | |
34 | #define MAP_CSUM_DL_VALID_FLAG BIT(0) | |
35 | ||
9395da4e SAK |
36 | struct rmnet_map_ul_csum_header { |
37 | __be16 csum_start_offset; | |
86ca860e | 38 | __be16 csum_info; /* MAP_CSUM_UL_* */ |
9395da4e SAK |
39 | } __aligned(1); |
40 | ||
86ca860e AE |
41 | /* csum_info field: |
42 | * OFFSET: where (offset in bytes) to insert computed checksum | |
43 | * UDP: 1 = UDP checksum (zero checkum means no checksum) | |
44 | * ENABLED: 1 = checksum computation requested | |
45 | */ | |
46 | #define MAP_CSUM_UL_OFFSET_MASK GENMASK(13, 0) | |
47 | #define MAP_CSUM_UL_UDP_FLAG BIT(14) | |
48 | #define MAP_CSUM_UL_ENABLED_FLAG BIT(15) | |
49 | ||
e1d9a90a SCV |
50 | /* MAP CSUM headers */ |
51 | struct rmnet_map_v5_csum_header { | |
52 | u8 header_info; | |
53 | u8 csum_info; | |
54 | __be16 reserved; | |
55 | } __aligned(1); | |
56 | ||
57 | /* v5 header_info field | |
58 | * NEXT_HEADER: represents whether there is any next header | |
59 | * HEADER_TYPE: represents the type of this header | |
60 | * | |
61 | * csum_info field | |
62 | * CSUM_VALID_OR_REQ: | |
63 | * 1 = for UL, checksum computation is requested. | |
64 | * 1 = for DL, validated the checksum and has found it valid | |
65 | */ | |
66 | ||
67 | #define MAPV5_HDRINFO_NXT_HDR_FLAG BIT(0) | |
68 | #define MAPV5_HDRINFO_HDR_TYPE_FMASK GENMASK(7, 1) | |
69 | #define MAPV5_CSUMINFO_VALID_FLAG BIT(7) | |
70 | ||
71 | #define RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD 2 | |
9395da4e | 72 | #endif /* !(_LINUX_IF_RMNET_H_) */ |