18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. 38c2ecf20Sopenharmony_ci */ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#ifndef _RMNET_MAP_H_ 68c2ecf20Sopenharmony_ci#define _RMNET_MAP_H_ 78c2ecf20Sopenharmony_ci#include <linux/if_rmnet.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_cistruct rmnet_map_control_command { 108c2ecf20Sopenharmony_ci u8 command_name; 118c2ecf20Sopenharmony_ci u8 cmd_type:2; 128c2ecf20Sopenharmony_ci u8 reserved:6; 138c2ecf20Sopenharmony_ci u16 reserved2; 148c2ecf20Sopenharmony_ci u32 transaction_id; 158c2ecf20Sopenharmony_ci union { 168c2ecf20Sopenharmony_ci struct { 178c2ecf20Sopenharmony_ci u16 ip_family:2; 188c2ecf20Sopenharmony_ci u16 reserved:14; 198c2ecf20Sopenharmony_ci __be16 flow_control_seq_num; 208c2ecf20Sopenharmony_ci __be32 qos_id; 218c2ecf20Sopenharmony_ci } flow_control; 228c2ecf20Sopenharmony_ci u8 data[0]; 238c2ecf20Sopenharmony_ci }; 248c2ecf20Sopenharmony_ci} __aligned(1); 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cienum rmnet_map_commands { 278c2ecf20Sopenharmony_ci RMNET_MAP_COMMAND_NONE, 288c2ecf20Sopenharmony_ci RMNET_MAP_COMMAND_FLOW_DISABLE, 298c2ecf20Sopenharmony_ci RMNET_MAP_COMMAND_FLOW_ENABLE, 308c2ecf20Sopenharmony_ci /* These should always be the last 2 elements */ 318c2ecf20Sopenharmony_ci RMNET_MAP_COMMAND_UNKNOWN, 328c2ecf20Sopenharmony_ci RMNET_MAP_COMMAND_ENUM_LENGTH 338c2ecf20Sopenharmony_ci}; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define RMNET_MAP_GET_MUX_ID(Y) (((struct rmnet_map_header *) \ 368c2ecf20Sopenharmony_ci (Y)->data)->mux_id) 378c2ecf20Sopenharmony_ci#define RMNET_MAP_GET_CD_BIT(Y) (((struct rmnet_map_header *) \ 388c2ecf20Sopenharmony_ci (Y)->data)->cd_bit) 398c2ecf20Sopenharmony_ci#define RMNET_MAP_GET_PAD(Y) (((struct rmnet_map_header *) \ 408c2ecf20Sopenharmony_ci (Y)->data)->pad_len) 418c2ecf20Sopenharmony_ci#define RMNET_MAP_GET_CMD_START(Y) ((struct rmnet_map_control_command *) \ 428c2ecf20Sopenharmony_ci ((Y)->data + \ 438c2ecf20Sopenharmony_ci sizeof(struct rmnet_map_header))) 448c2ecf20Sopenharmony_ci#define RMNET_MAP_GET_LENGTH(Y) (ntohs(((struct rmnet_map_header *) \ 458c2ecf20Sopenharmony_ci (Y)->data)->pkt_len)) 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define RMNET_MAP_COMMAND_REQUEST 0 488c2ecf20Sopenharmony_ci#define RMNET_MAP_COMMAND_ACK 1 498c2ecf20Sopenharmony_ci#define RMNET_MAP_COMMAND_UNSUPPORTED 2 508c2ecf20Sopenharmony_ci#define RMNET_MAP_COMMAND_INVALID 3 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define RMNET_MAP_NO_PAD_BYTES 0 538c2ecf20Sopenharmony_ci#define RMNET_MAP_ADD_PAD_BYTES 1 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistruct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb, 568c2ecf20Sopenharmony_ci struct rmnet_port *port); 578c2ecf20Sopenharmony_cistruct rmnet_map_header *rmnet_map_add_map_header(struct sk_buff *skb, 588c2ecf20Sopenharmony_ci int hdrlen, int pad); 598c2ecf20Sopenharmony_civoid rmnet_map_command(struct sk_buff *skb, struct rmnet_port *port); 608c2ecf20Sopenharmony_ciint rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len); 618c2ecf20Sopenharmony_civoid rmnet_map_checksum_uplink_packet(struct sk_buff *skb, 628c2ecf20Sopenharmony_ci struct net_device *orig_dev); 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#endif /* _RMNET_MAP_H_ */ 65