From 3434256d68ecdaf50cf6ac442649a9175ac0159b Mon Sep 17 00:00:00 2001 From: Michael Adisumarta Date: Mon, 26 Dec 2022 01:34:20 -0800 Subject: [PATCH] msm: ipa: Add DSCP PCP mapping info ioctl Adding DSCP PCP mapping ioctl support for easymesh R3. Change-Id: I7a7fcc3fdc22cdf1970638e8163bda7ef74dc7b3 Signed-off-by: Michael Adisumarta --- include/uapi/linux/msm_ipa.h | 51 ++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/msm_ipa.h b/include/uapi/linux/msm_ipa.h index 594cc65c2d0c..9b6786c29b21 100644 --- a/include/uapi/linux/msm_ipa.h +++ b/include/uapi/linux/msm_ipa.h @@ -150,6 +150,7 @@ #define IPA_IOCTL_DEL_MACSEC_MAPPING 93 #define IPA_IOCTL_QUERY_CACHED_DRIVER_MSG 94 #define IPA_IOCTL_SET_EXT_ROUTER_MODE 95 +#define IPA_IOCTL_ADD_DEL_DSCP_PCP_MAPPING 96 /** * max size of the header to be inserted */ @@ -215,6 +216,11 @@ #define IPA_MAX_IPPT_NUM_PORT_FLT 5 +/** + * Max number of DSCP entries in uc + */ +#define IPA_UC_MAX_DSCP_VAL 64 + /** * New feature flag for CV2X config. */ @@ -1522,6 +1528,7 @@ enum ipa_hdr_l2_type { * IPA_HDR_PROC_SET_DSCP: * IPA_HDR_PROC_EoGRE_HEADER_ADD: Add IPV[46] and GRE header * IPA_HDR_PROC_EoGRE_HEADER_REMOVE: Remove IPV[46] and GRE header + * IPA_HDR_PROC_WWAN_TO_ETHII_EX: To update PCP value for E2E traffic. */ enum ipa_hdr_proc_type { IPA_HDR_PROC_NONE, @@ -1537,8 +1544,9 @@ enum ipa_hdr_proc_type { IPA_HDR_PROC_SET_DSCP, IPA_HDR_PROC_EoGRE_HEADER_ADD, IPA_HDR_PROC_EoGRE_HEADER_REMOVE, + IPA_HDR_PROC_WWAN_TO_ETHII_EX, }; -#define IPA_HDR_PROC_MAX (IPA_HDR_PROC_EoGRE_HEADER_REMOVE + 1) +#define IPA_HDR_PROC_MAX (IPA_HDR_PROC_WWAN_TO_ETHII_EX + 1) /** * struct ipa_rt_rule - attributes of a routing rule @@ -1863,12 +1871,34 @@ struct ipa_eogre_hdr_proc_ctx_params { * (in bytes) from the start of the input IP hdr * @output_ethhdr_negative_offset: Specifies where the ethernet hdr offset is * (in bytes) from the end of the template hdr + * @output_dscp_pcp_update: Specifies if VLAN PCP needs to be updated based on + * DSCP<->PCP mapping table. * @reserved: for future use */ struct ipa_eth_II_to_eth_II_ex_procparams { uint32_t input_ethhdr_negative_offset : 8; uint32_t output_ethhdr_negative_offset : 8; - uint32_t reserved : 16; + uint32_t output_dscp_pcp_update : 1; + uint32_t reserved : 15; +}; + +/** + * struct ipa_wwan_to_eth_II_ex_procparams - + * @input_ethhdr_negative_offset: Specifies where the ethernet hdr offset is + * (in bytes) from the start of the input IP hdr + * @output_ethhdr_negative_offset: Specifies where the ethernet hdr offset is + * (in bytes) from the end of the template hdr + * @output_dscp_pcp_update: Specifies if VLAN PCP needs to be updated based on + * DSCP<->PCP mapping table. + * @input_ethhdr_valid: Specifies whether input ethernet header is valid or not. + * @reserved: for future use + */ +struct ipa_wwan_to_eth_II_ex_procparams { + uint32_t input_ethhdr_negative_offset : 8; + uint32_t output_ethhdr_negative_offset : 8; + uint32_t output_dscp_pcp_update : 1; + uint32_t input_ethhdr_valid : 1; + uint32_t reserved : 14; }; #define L2TP_USER_SPACE_SPECIFY_DST_PIPE @@ -1881,6 +1911,7 @@ struct ipa_eth_II_to_eth_II_ex_procparams { * @l2tp_params: l2tp parameters * @eogre_params: eogre parameters * @generic_params: generic proc_ctx params + * @generic_params_v2: generic proc_ctx params for bridging * @proc_ctx_hdl: out parameter, handle to proc_ctx, valid when status is 0 * @status: out parameter, status of header add operation, * 0 for success, @@ -1894,6 +1925,7 @@ struct ipa_hdr_proc_ctx_add { struct ipa_l2tp_hdr_proc_ctx_params l2tp_params; struct ipa_eogre_hdr_proc_ctx_params eogre_params; struct ipa_eth_II_to_eth_II_ex_procparams generic_params; + struct ipa_wwan_to_eth_II_ex_procparams generic_params_v2; }; #define IPA_L2TP_HDR_PROC_SUPPORT @@ -3654,6 +3686,18 @@ struct ipa_ioc_ext_router_info { uint32_t idu_client_prefix[IPA_PREFIX_MAPPING_MAX][4]; }; +/** + * struct ipa_ioc_dscp_pcp_map_info - provide dscp pcp mapping info to add/delete + * @add: Boolean to indicate add or delete the mapping + * @dscp_pcp_map: DSCP <6 bits> and PCP <3 bits>. + * Only 3 bits are valid(0-7) for PCP. + * DSCP is used as index (0-63). + */ +struct ipa_ioc_dscp_pcp_map_info { + uint32_t add; + uint8_t dscp_pcp_map[IPA_UC_MAX_DSCP_VAL]; +}; + /** * actual IOCTLs supported by IPA driver */ @@ -3975,6 +4019,9 @@ struct ipa_ioc_ext_router_info { IPA_IOCTL_SET_EXT_ROUTER_MODE, \ struct ipa_ioc_ext_router_info) +#define IPA_IOC_ADD_DEL_DSCP_PCP_MAPPING _IOWR(IPA_IOC_MAGIC, \ + IPA_IOCTL_ADD_DEL_DSCP_PCP_MAPPING, \ + struct ipa_ioc_dscp_pcp_map_info) /* * unique magic number of the Tethering bridge ioctls