From b2340800e86425568fb9ea30ee925a8fe5e78fce Mon Sep 17 00:00:00 2001 From: Michael Adisumarta Date: Fri, 29 Jan 2021 12:19:36 -0800 Subject: [PATCH] msm_rmnet.h: Add new ioctl to add any number of parameters of any size This also includes new extended ingress-egress ioctls for configuring system pipe. Change-Id: I96f3d57037f32e1f904737439cacc8026f7cdb1f Signed-off-by: Michael Adisumarta --- include/linux/ipa.h | 9 ++ include/uapi/linux/msm_rmnet.h | 184 ++++++++++++++++++++++++++++++++- 2 files changed, 191 insertions(+), 2 deletions(-) diff --git a/include/linux/ipa.h b/include/linux/ipa.h index 042bc5569dd8..ff0d3d8da02b 100644 --- a/include/linux/ipa.h +++ b/include/linux/ipa.h @@ -655,6 +655,11 @@ struct ipa_ext_intf { * @keep_ipa_awake: when true, IPA will not be clock gated * @napi_enabled: when true, IPA call client callback to start polling * @bypass_agg: when true, IPA bypasses the aggregation + * @int_modt: GSI event ring interrupt moderation time + * cycles base interrupt moderation (32KHz clock) + * @int_modc: GSI event ring interrupt moderation packet counter + * @buff_size: Actual buff size of rx_pkt + * @ext_ioctl_v2: Flag to determine whether ioctl_v2 received */ struct ipa_sys_connect_params { struct ipa_ep_cfg ipa_ep_cfg; @@ -667,6 +672,10 @@ struct ipa_sys_connect_params { struct napi_struct *napi_obj; bool recycle_enabled; bool bypass_agg; + u32 int_modt; + u32 int_modc; + u32 buff_size; + bool ext_ioctl_v2; }; /** diff --git a/include/uapi/linux/msm_rmnet.h b/include/uapi/linux/msm_rmnet.h index 34a237e7cd32..45e0701b66e3 100644 --- a/include/uapi/linux/msm_rmnet.h +++ b/include/uapi/linux/msm_rmnet.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* - * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. */ #ifndef _UAPI_MSM_RMNET_H_ @@ -22,7 +22,8 @@ #define RMNET_IS_MODE_IP(mode) \ ((mode & RMNET_MODE_LLP_IP) == RMNET_MODE_LLP_IP) -/* IOCTL commands +/** + * IOCTL commands * Values chosen to not conflict with other drivers in the ecosystem */ @@ -39,6 +40,7 @@ #define RMNET_IOCTL_FLOW_DISABLE 0x000089FB /* Flow disable */ #define RMNET_IOCTL_FLOW_SET_HNDL 0x000089FC /* Set flow handle */ #define RMNET_IOCTL_EXTENDED 0x000089FD /* Extended IOCTLs */ +#define RMNET_IOCTL_EXTENDED_V2 0x000089FE /* Extended V2 IOCTLs */ /* RmNet Data Required IOCTLs */ #define RMNET_IOCTL_GET_SUPPORTED_FEATURES 0x0000 /* Get features */ @@ -69,6 +71,22 @@ #define RMNET_IOCTL_GET_MTU 0x0019 /* Get v4/v6 MTU */ #define RMNET_IOCTL_SET_MTU 0x0020 /* Set v4/v6 MTU */ +/** + * RMNET_IOCTL_EXTENDED_V2 ioctl types. + * Should be sent through "extended_ioctl_type" variable. + * Any number of new IOCTL type can be added. + */ +/** + * Set EDF with config values + * Includes all the egress pipe's config in one single ioctl + */ +#define RMNET_IOCTL_SET_EGRESS_DATA_FORMAT_V2 0x0000 +/** + * Set IDF with config values + * Includes all the ingress pipe's config in one single ioctl + */ +#define RMNET_IOCTL_SET_INGRESS_DATA_FORMAT_V2 0x0001 + /* Return values for the RMNET_IOCTL_GET_SUPPORTED_FEATURES IOCTL */ #define RMNET_IOCTL_FEAT_NOTIFY_MUX_CHANNEL (1<<0) #define RMNET_IOCTL_FEAT_SET_EGRESS_DATA_FORMAT (1<<1) @@ -104,6 +122,168 @@ #define IFNAMSIZ 16 #endif +/** + * enum rmnet_egress_ep_type - To specify pipe type for egress + * @RMNET_EGRESS_DEFAULT: WAN Producer pipe + * @RMNET_EGRESS_LOW_LAT_CTRL: Low latency ctrl producer pipe + * @RMNET_EGRESS_LOW_LAT_DATA: Low latency data producer pipe + * Add any number of pipes before max + */ +enum rmnet_egress_ep_type { + RMNET_EGRESS_DEFAULT = 0x0000, + RMNET_EGRESS_LOW_LAT_CTRL = 0x0001, + RMNET_EGRESS_LOW_LAT_DATA = 0x0002, + RMNET_EGRESS_MAX = 0x0003, +}; + + +/** + * enum rmnet_ingress_ep_type - To specify pipe type for ingress + * @RMNET_INGRESS_COALS: Coalescing Consumer pipe + * @RMNET_INGRESS_DEFAULT: WAN Consumer pipe + * @RMNET_INGRESS_LOW_LAT_CTRL: Low latency ctrl consumer pipe + * @RMNET_INGRESS_LOW_LAT_DATA: Low latency data consumer pipe + * Add any number of pipes before max + */ +enum rmnet_ingress_ep_type { + RMNET_INGRESS_COALS = 0x0000, + RMNET_INGRESS_DEFAULT = 0x0001, + RMNET_INGRESS_LOW_LAT_CTRL = 0x0002, + RMNET_INGRESS_LOW_LAT_DATA = 0x0003, + RMNET_INGRESS_MAX = 0x0004, +}; + +/** + * enum rmnet_egress_ingress_pipe_setup_status - To give + * back the pipe setup status info to netmngr + * @IPA_PIPE_SETUP_SUCCESS: pipe setup successful + * @IPA_PIPE_SETUP_FAILURE: pipe setup failure + * @IPA_PIPE_SETUP_EXISTS: pipe already exists + */ +enum rmnet_egress_ingress_pipe_setup_status { + IPA_PIPE_SETUP_SUCCESS = 0x0000, + IPA_PIPE_SETUP_FAILURE = 0x0001, + IPA_PIPE_SETUP_EXISTS = 0x0002, +}; + +/** + * struct rmnet_egress_param - Include all the egress params that + * needs to be configured. Structure should have even + * __u32 variables or add padding. + * @egress_ep_type: Should be from rmnet_egress_ep_type + * @pipe_setup_status: Out parameter. + * Need to place below enum + * rmnet_egress_ingress_pipe_setup_status + * @cs_offload_en: Checksum offload (1 - Enable) + * @aggr_en: Aggregation Enable (1 - Enable) + * @ulso_en: (1 - Enable) + * @ipid_min_max_idx(for ULSO): A value from the range [0, 2] determines + * the registers pair from which to read the minimum and maximum of + * IPv4 packets ID. + * @int_modt: GSI event ring interrupt moderation time + * cycles base interrupt moderation (32KHz clock) + * @int_modc: GSI event ring interrupt moderation packet counter + */ +struct rmnet_egress_param { + __u32 egress_ep_type; + __u32 pipe_setup_status; + __u32 cs_offload_en; + __u32 aggr_en; + __u32 ulso_en; + __u32 ipid_min_max_idx; + __u32 int_modt; + __u32 int_modc; +}; + +/** + * struct rmnet_ingress_param - Include all the ingress params that + * needs to be configured. Structure should have even + * __u32 variables or add padding. + * @ingress_ep_type: Should be from rmnet_ingress_ep_type + * @pipe_setup_status: Out parameter. + * Need to place below enum + * rmnet_egress_ingress_pipe_setup_status + * @cs_offload_en: Checksum offload (1 - Enable) + * @buff_size: Actual buff size of rx_pkt + * @agg_byte_limit: Aggregation byte limit + * @agg_time_limit: Aggregation time limit + * @agg_pkt_limit: Aggregation packet limit + * @int_modt: GSI event ring interrupt moderation time + * cycles base interrupt moderation (32KHz clock) + * @int_modc: GSI event ring interrupt moderation packet counter + * @padding: To make it 64 bit packed structure + */ +struct rmnet_ingress_param { + __u32 ingress_ep_type; + __u32 pipe_setup_status; + __u32 cs_offload_en; + __u32 buff_size; + __u32 agg_byte_limit; + __u32 agg_time_limit; + __u32 agg_pkt_limit; + __u32 int_modt; + __u32 int_modc; + __u32 padding; +}; + +/** + * Following uapi coding convention here + * struct mystruct { + * __u64 pointer; + * }; + * + * In userspace code: + * mystruct.pointer = (__u64)(uintptr_t) &pointer; + * In kernelspace code: + * copy_from_user(&struct, u64_to_user_ptr(mystruct.pointer), size); + */ + +/** + * struct ingress_format_v2 - To include all the ingress params that + * needs to be configured. Structure should have even + * __u32 variables or add padding. + * @ingress_param_ptr: Should be rmnet_ingress_param pointer. + * Array of ingress params for all the pipes. + * @ingress_param_size: = sizeof(rmnet_ingress_param); + * @number_of_eps: Number of ep_types, should be = RMNET_INGRESS_MAX + */ +struct ingress_format_v2 { + __u64 ingress_param_ptr; + __u32 ingress_param_size; + __u32 number_of_eps; +}; + +/** + * struct egress_format_v2 - To include all the egress params that + * needs to be configured. Structure should have even + * __u32 variables or add padding. + * @egress_param_ptr: Should be rmnet_egress_param pointer. + * Array of egress params for all the pipes. + * @egress_param_size: = sizeof(rmnet_egress_param); + * @number_of_eps: Number of ep_types, should be = RMNET_EGRESS_MAX. + */ +struct egress_format_v2 { + __u64 egress_param_ptr; + __u32 egress_param_size; + __u32 number_of_eps; +}; + +/** + * struct rmnet_ioctl_extended_s_v2: New structure to include any number of + * ioctl of any size. Structure should have even + * __u32 variables or add padding. + * @ioctl_data_size: Eg: For egress ioctl + * = sizeof(egress_format_v2) + * @ioctl_ptr: Has to be typecasted to (__u64)(uintptr_t). + * @extended_v2_ioctl_type: Should be hash defined above similar + * to RMNET_IOCTL_SET_EGRESS_DATA_FORMAT_V2. + */ +struct rmnet_ioctl_extended_s_v2 { + __u64 ioctl_ptr; + __u32 ioctl_data_size; + __u32 extended_v2_ioctl_type; +}; + struct rmnet_ioctl_extended_s { __u32 extended_ioctl; union {