if_rmnet.h (2084B)
1/* SPDX-License-Identifier: GPL-2.0-only 2 * Copyright (c) 2013-2019, 2021 The Linux Foundation. All rights reserved. 3 */ 4 5#ifndef _LINUX_IF_RMNET_H_ 6#define _LINUX_IF_RMNET_H_ 7 8struct rmnet_map_header { 9 u8 flags; /* MAP_CMD_FLAG, MAP_PAD_LEN_MASK */ 10 u8 mux_id; 11 __be16 pkt_len; /* Length of packet, including pad */ 12} __aligned(1); 13 14/* rmnet_map_header flags field: 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 18 */ 19#define MAP_PAD_LEN_MASK GENMASK(5, 0) 20#define MAP_NEXT_HEADER_FLAG BIT(6) 21#define MAP_CMD_FLAG BIT(7) 22 23struct rmnet_map_dl_csum_trailer { 24 u8 reserved1; 25 u8 flags; /* MAP_CSUM_DL_VALID_FLAG */ 26 __be16 csum_start_offset; 27 __be16 csum_length; 28 __sum16 csum_value; 29} __aligned(1); 30 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 36struct rmnet_map_ul_csum_header { 37 __be16 csum_start_offset; 38 __be16 csum_info; /* MAP_CSUM_UL_* */ 39} __aligned(1); 40 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 50/* MAP CSUM headers */ 51struct 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 72#endif /* !(_LINUX_IF_RMNET_H_) */