From e8be6092f8f40d49ff67e8bc024635023eddcf75 Mon Sep 17 00:00:00 2001 From: Amir Levy Date: Wed, 28 Apr 2021 20:48:08 +0300 Subject: [PATCH] msm: ipa: Add QMI messages for moving NAT table Add interface for receiving QMI request to move NAT table to DDR or to SRAM and forward request to IPACM. Add IOCTL for sending indication when move was completed. Change-Id: Idb886a56586d830664a25371d48d2fac5a5e51c5 Signed-off-by: Amir Levy --- include/uapi/linux/ipa_qmi_service_v01.h | 51 ++++++++++++++++++++++++ include/uapi/linux/msm_ipa.h | 8 +++- include/uapi/linux/rmnet_ipa_fd_ioctl.h | 7 +++- 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/ipa_qmi_service_v01.h b/include/uapi/linux/ipa_qmi_service_v01.h index 8b5150bb8b4c..5e6170028c4d 100644 --- a/include/uapi/linux/ipa_qmi_service_v01.h +++ b/include/uapi/linux/ipa_qmi_service_v01.h @@ -2717,6 +2717,54 @@ struct ipa_bw_change_ind_msg_v01 { }; /* Message */ #define IPA_BW_CHANGE_IND_MSG_V01_MAX_MSG_LEN 14 +enum ipa_move_nat_type_enum_v01 { + QMI_IPA_MOVE_NAT_TO_DDR_V01 = 0, + QMI_IPA_MOVE_NAT_TO_SRAM_V01 = 1, +}; + +/* + * Request Message; Requestes remote IPA driver to move IPA NAT table + * according to requested direction TO_DDR\TO_SRAM. + */ +struct ipa_move_nat_req_msg_v01 { + enum ipa_move_nat_type_enum_v01 nat_move_direction; +}; +#define IPA_MOVE_NAT_REQ_MSG_V01_MAX_MSG_LEN 8 + +/* + * Response Message; Requestes remote IPA driver to move IPA NAT table + * according to requested direction TO_DDR\TO_SRAM. + */ +struct ipa_move_nat_resp_msg_v01 { + + /* Mandatory */ + /* Result Code */ + struct ipa_qmi_response_type_v01 resp; + /* + * Standard response type. + * Standard response type. Contains the following data members: + * qmi_result_type -- QMI_RESULT_SUCCESS or QMI_RESULT_FAILURE + * qmi_error_type -- Error code. Possible error code values are + * described in the error codes section of each message definition. + */ +}; /* Message */ +#define IPA_MOVE_NAT_RESP_MSG_V01_MAX_MSG_LEN 7 + + /* Indication Message; Indication sent to the Modem IPA driver from + * master IPA driver about NAT table move result. + */ +struct ipa_move_nat_table_complt_ind_msg_v01 { + /* Mandatory */ + /* Master driver initialization completion status */ + struct ipa_qmi_response_type_v01 nat_table_move_status; + /* Indicates the status of nat table mvoe. If everything went + * as expected, this field is set to SUCCESS. ERROR is set + * otherwise. Extended error info may be used to convey + * additional information about the error + */ +}; /* Message */ +#define QMI_IPA_NAT_TABLE_MOVE_COMPLETE_IND_MAX_MSG_LEN_V01 7 + /*Service Message Definition*/ #define QMI_IPA_INDICATION_REGISTER_REQ_V01 0x0020 #define QMI_IPA_INDICATION_REGISTER_RESP_V01 0x0020 @@ -2772,6 +2820,9 @@ struct ipa_bw_change_ind_msg_v01 { #define QMI_IPA_REMOVE_OFFLOAD_CONNECTION_REQ_V01 0x0042 #define QMI_IPA_REMOVE_OFFLOAD_CONNECTION_RESP_V01 0x0042 #define QMI_IPA_BW_CHANGE_INDICATION_V01 0x0044 +#define QMI_IPA_MOVE_NAT_REQ_V01 0x0046 +#define QMI_IPA_MOVE_NAT_RESP_V01 0x0046 +#define QMI_IPA_MOVE_NAT_COMPLETE_IND_V01 0x0046 /* add for max length*/ #define QMI_IPA_INIT_MODEM_DRIVER_REQ_MAX_MSG_LEN_V01 186 diff --git a/include/uapi/linux/msm_ipa.h b/include/uapi/linux/msm_ipa.h index ca0f4935fb1f..87cfa7485478 100644 --- a/include/uapi/linux/msm_ipa.h +++ b/include/uapi/linux/msm_ipa.h @@ -828,7 +828,13 @@ enum ipa_pkt_threshold_event { #define IPA_PKT_THRESHOLD_EVENT_MAX IPA_PKT_THRESHOLD_EVENT_MAX }; -#define IPA_EVENT_MAX_NUM (IPA_PKT_THRESHOLD_EVENT_MAX) +enum ipa_move_nat_table_event { + IPA_MOVE_NAT_TABLE = IPA_PKT_THRESHOLD_EVENT_MAX, + IPA_MOVE_NAT_EVENT_MAX +#define IPA_MOVE_NAT_EVENT_MAX IPA_MOVE_NAT_EVENT_MAX +}; + +#define IPA_EVENT_MAX_NUM (IPA_MOVE_NAT_EVENT_MAX) #define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM) /** diff --git a/include/uapi/linux/rmnet_ipa_fd_ioctl.h b/include/uapi/linux/rmnet_ipa_fd_ioctl.h index 61132ade6c2c..a8e40ef427b1 100644 --- a/include/uapi/linux/rmnet_ipa_fd_ioctl.h +++ b/include/uapi/linux/rmnet_ipa_fd_ioctl.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* - * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved. */ #ifndef _RMNET_IPA_FD_IOCTL_H @@ -36,6 +36,7 @@ #define WAN_IOCTL_ADD_OFFLOAD_CONNECTION 18 #define WAN_IOCTL_RMV_OFFLOAD_CONNECTION 19 #define WAN_IOCTL_GET_WAN_MTU 20 +#define WAN_IOCTL_NOTIFY_NAT_MOVE_RES 21 /* User space may not have this defined. */ #ifndef IFNAMSIZ @@ -273,4 +274,8 @@ struct wan_ioctl_query_per_client_stats { #define WAN_IOC_GET_WAN_MTU _IOWR(WAN_IOC_MAGIC, \ WAN_IOCTL_GET_WAN_MTU, \ struct ipa_mtu_info *) + +#define WAN_IOC_NOTIFY_NAT_MOVE_RES _IOWR(WAN_IOC_MAGIC, \ + WAN_IOCTL_NOTIFY_NAT_MOVE_RES, \ + bool) #endif /* _RMNET_IPA_FD_IOCTL_H */