1 /* SPDX-License-Identifier: GPL-2.0-only
2 * Copyright (c) 2013-2019, 2021 The Linux Foundation. All rights reserved.
5 #ifndef _LINUX_IF_RMNET_H_
6 #define _LINUX_IF_RMNET_H_
8 #include <linux/types.h>
10 struct rmnet_map_header {
11 u8 flags; /* MAP_CMD_FLAG, MAP_PAD_LEN_MASK */
13 __be16 pkt_len; /* Length of packet, including pad */
16 /* rmnet_map_header flags field:
17 * PAD_LEN: number of pad bytes following packet data
18 * CMD: 1 = packet contains a MAP command; 0 = packet contains data
19 * NEXT_HEADER: 1 = packet contains V5 CSUM header 0 = no V5 CSUM header
21 #define MAP_PAD_LEN_MASK GENMASK(5, 0)
22 #define MAP_NEXT_HEADER_FLAG BIT(6)
23 #define MAP_CMD_FLAG BIT(7)
25 struct rmnet_map_dl_csum_trailer {
27 u8 flags; /* MAP_CSUM_DL_VALID_FLAG */
28 __be16 csum_start_offset;
33 /* rmnet_map_dl_csum_trailer flags field:
34 * VALID: 1 = checksum and length valid; 0 = ignore them
36 #define MAP_CSUM_DL_VALID_FLAG BIT(0)
38 struct rmnet_map_ul_csum_header {
39 __be16 csum_start_offset;
40 __be16 csum_info; /* MAP_CSUM_UL_* */
44 * OFFSET: where (offset in bytes) to insert computed checksum
45 * UDP: 1 = UDP checksum (zero checkum means no checksum)
46 * ENABLED: 1 = checksum computation requested
48 #define MAP_CSUM_UL_OFFSET_MASK GENMASK(13, 0)
49 #define MAP_CSUM_UL_UDP_FLAG BIT(14)
50 #define MAP_CSUM_UL_ENABLED_FLAG BIT(15)
52 /* MAP CSUM headers */
53 struct rmnet_map_v5_csum_header {
59 /* v5 header_info field
60 * NEXT_HEADER: represents whether there is any next header
61 * HEADER_TYPE: represents the type of this header
65 * 1 = for UL, checksum computation is requested.
66 * 1 = for DL, validated the checksum and has found it valid
69 #define MAPV5_HDRINFO_NXT_HDR_FLAG BIT(0)
70 #define MAPV5_HDRINFO_HDR_TYPE_FMASK GENMASK(7, 1)
71 #define MAPV5_CSUMINFO_VALID_FLAG BIT(7)
73 #define RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD 2
74 #endif /* !(_LINUX_IF_RMNET_H_) */