197fb5e8dSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2e1d9a90aSSharath Chandra Vurukala /* Copyright (c) 2013-2018, 2021, The Linux Foundation. All rights reserved. 3ceed73a2SSubash Abhinov Kasiviswanathan */ 4ceed73a2SSubash Abhinov Kasiviswanathan 5ceed73a2SSubash Abhinov Kasiviswanathan #ifndef _RMNET_MAP_H_ 6ceed73a2SSubash Abhinov Kasiviswanathan #define _RMNET_MAP_H_ 79395da4eSSubash Abhinov Kasiviswanathan #include <linux/if_rmnet.h> 8ceed73a2SSubash Abhinov Kasiviswanathan 9ceed73a2SSubash Abhinov Kasiviswanathan struct rmnet_map_control_command { 10ceed73a2SSubash Abhinov Kasiviswanathan u8 command_name; 11ceed73a2SSubash Abhinov Kasiviswanathan u8 cmd_type:2; 12ceed73a2SSubash Abhinov Kasiviswanathan u8 reserved:6; 13ceed73a2SSubash Abhinov Kasiviswanathan u16 reserved2; 14ceed73a2SSubash Abhinov Kasiviswanathan u32 transaction_id; 15ceed73a2SSubash Abhinov Kasiviswanathan union { 16ceed73a2SSubash Abhinov Kasiviswanathan struct { 17ceed73a2SSubash Abhinov Kasiviswanathan u16 ip_family:2; 18ceed73a2SSubash Abhinov Kasiviswanathan u16 reserved:14; 196e010dd9SSubash Abhinov Kasiviswanathan __be16 flow_control_seq_num; 206e010dd9SSubash Abhinov Kasiviswanathan __be32 qos_id; 21ceed73a2SSubash Abhinov Kasiviswanathan } flow_control; 22c87e4ad1SGustavo A. R. Silva DECLARE_FLEX_ARRAY(u8, data); 23ceed73a2SSubash Abhinov Kasiviswanathan }; 24ceed73a2SSubash Abhinov Kasiviswanathan } __aligned(1); 25ceed73a2SSubash Abhinov Kasiviswanathan 26ceed73a2SSubash Abhinov Kasiviswanathan enum rmnet_map_commands { 27ceed73a2SSubash Abhinov Kasiviswanathan RMNET_MAP_COMMAND_NONE, 28ceed73a2SSubash Abhinov Kasiviswanathan RMNET_MAP_COMMAND_FLOW_DISABLE, 29ceed73a2SSubash Abhinov Kasiviswanathan RMNET_MAP_COMMAND_FLOW_ENABLE, 30ceed73a2SSubash Abhinov Kasiviswanathan /* These should always be the last 2 elements */ 31ceed73a2SSubash Abhinov Kasiviswanathan RMNET_MAP_COMMAND_UNKNOWN, 32ceed73a2SSubash Abhinov Kasiviswanathan RMNET_MAP_COMMAND_ENUM_LENGTH 33ceed73a2SSubash Abhinov Kasiviswanathan }; 34ceed73a2SSubash Abhinov Kasiviswanathan 35ceed73a2SSubash Abhinov Kasiviswanathan #define RMNET_MAP_COMMAND_REQUEST 0 36ceed73a2SSubash Abhinov Kasiviswanathan #define RMNET_MAP_COMMAND_ACK 1 37ceed73a2SSubash Abhinov Kasiviswanathan #define RMNET_MAP_COMMAND_UNSUPPORTED 2 38ceed73a2SSubash Abhinov Kasiviswanathan #define RMNET_MAP_COMMAND_INVALID 3 39ceed73a2SSubash Abhinov Kasiviswanathan 40ceed73a2SSubash Abhinov Kasiviswanathan #define RMNET_MAP_NO_PAD_BYTES 0 41ceed73a2SSubash Abhinov Kasiviswanathan #define RMNET_MAP_ADD_PAD_BYTES 1 42ceed73a2SSubash Abhinov Kasiviswanathan 43bbd21b24SSubash Abhinov Kasiviswanathan struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb, 44bbd21b24SSubash Abhinov Kasiviswanathan struct rmnet_port *port); 45ceed73a2SSubash Abhinov Kasiviswanathan struct rmnet_map_header *rmnet_map_add_map_header(struct sk_buff *skb, 46b6e5d27eSSharath Chandra Vurukala int hdrlen, 47b6e5d27eSSharath Chandra Vurukala struct rmnet_port *port, 48b6e5d27eSSharath Chandra Vurukala int pad); 492ffbbf0fSSubash Abhinov Kasiviswanathan void rmnet_map_command(struct sk_buff *skb, struct rmnet_port *port); 50bbd21b24SSubash Abhinov Kasiviswanathan int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len); 515eb5f860SSubash Abhinov Kasiviswanathan void rmnet_map_checksum_uplink_packet(struct sk_buff *skb, 52b6e5d27eSSharath Chandra Vurukala struct rmnet_port *port, 53b6e5d27eSSharath Chandra Vurukala struct net_device *orig_dev, 54b6e5d27eSSharath Chandra Vurukala int csum_type); 55e1d9a90aSSharath Chandra Vurukala int rmnet_map_process_next_hdr_packet(struct sk_buff *skb, u16 len); 56*64b5d1f8SDaniele Palmas unsigned int rmnet_map_tx_aggregate(struct sk_buff *skb, struct rmnet_port *port, 57*64b5d1f8SDaniele Palmas struct net_device *orig_dev); 58*64b5d1f8SDaniele Palmas void rmnet_map_tx_aggregate_init(struct rmnet_port *port); 59*64b5d1f8SDaniele Palmas void rmnet_map_tx_aggregate_exit(struct rmnet_port *port); 60*64b5d1f8SDaniele Palmas void rmnet_map_update_ul_agg_config(struct rmnet_port *port, u32 size, 61*64b5d1f8SDaniele Palmas u32 count, u32 time); 62ceed73a2SSubash Abhinov Kasiviswanathan 63ceed73a2SSubash Abhinov Kasiviswanathan #endif /* _RMNET_MAP_H_ */ 64