Skylar Chang | 09e0e25 | 2017-03-20 14:51:29 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. |
Amir Levy | 0fd437e | 2016-11-08 15:04:07 +0200 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef _RMNET_IPA_FD_IOCTL_H |
| 14 | #define _RMNET_IPA_FD_IOCTL_H |
| 15 | |
| 16 | #include <linux/ioctl.h> |
| 17 | #include <linux/ipa_qmi_service_v01.h> |
| 18 | #include <linux/msm_ipa.h> |
| 19 | |
| 20 | /** |
| 21 | * unique magic number of the IPA_WAN device |
| 22 | */ |
| 23 | #define WAN_IOC_MAGIC 0x69 |
| 24 | |
| 25 | #define WAN_IOCTL_ADD_FLT_RULE 0 |
| 26 | #define WAN_IOCTL_ADD_FLT_INDEX 1 |
| 27 | #define WAN_IOCTL_VOTE_FOR_BW_MBPS 2 |
| 28 | #define WAN_IOCTL_POLL_TETHERING_STATS 3 |
| 29 | #define WAN_IOCTL_SET_DATA_QUOTA 4 |
| 30 | #define WAN_IOCTL_SET_TETHER_CLIENT_PIPE 5 |
| 31 | #define WAN_IOCTL_QUERY_TETHER_STATS 6 |
| 32 | #define WAN_IOCTL_RESET_TETHER_STATS 7 |
| 33 | #define WAN_IOCTL_QUERY_DL_FILTER_STATS 8 |
| 34 | #define WAN_IOCTL_ADD_FLT_RULE_EX 9 |
Skylar Chang | 09e0e25 | 2017-03-20 14:51:29 -0700 | [diff] [blame] | 35 | #define WAN_IOCTL_QUERY_TETHER_STATS_ALL 10 |
Amir Levy | 0fd437e | 2016-11-08 15:04:07 +0200 | [diff] [blame] | 36 | |
| 37 | /* User space may not have this defined. */ |
| 38 | #ifndef IFNAMSIZ |
| 39 | #define IFNAMSIZ 16 |
| 40 | #endif |
| 41 | |
| 42 | /** |
| 43 | * struct wan_ioctl_poll_tethering_stats - structure used for |
| 44 | * WAN_IOCTL_POLL_TETHERING_STATS IOCTL. |
| 45 | * |
| 46 | * @polling_interval_secs: Polling interval in seconds. |
| 47 | * @reset_stats: Indicate whether to reset the stats (use 1) or not. |
| 48 | * |
| 49 | * The structure to be used by the user space in order to request for the |
| 50 | * tethering stats to be polled. Setting the interval to 0 indicates to stop |
| 51 | * the polling process. |
| 52 | */ |
| 53 | struct wan_ioctl_poll_tethering_stats { |
| 54 | uint64_t polling_interval_secs; |
| 55 | uint8_t reset_stats; |
| 56 | }; |
| 57 | |
| 58 | /** |
| 59 | * struct wan_ioctl_set_data_quota - structure used for |
| 60 | * WAN_IOCTL_SET_DATA_QUOTA IOCTL. |
| 61 | * |
| 62 | * @interface_name: Name of the interface on which to set the quota. |
| 63 | * @quota_mbytes: Quota (in Mbytes) for the above interface. |
| 64 | * @set_quota: Indicate whether to set the quota (use 1) or |
| 65 | * unset the quota. |
| 66 | * |
| 67 | * The structure to be used by the user space in order to request |
| 68 | * a quota to be set on a specific interface (by specifying its name). |
| 69 | */ |
| 70 | struct wan_ioctl_set_data_quota { |
| 71 | char interface_name[IFNAMSIZ]; |
| 72 | uint64_t quota_mbytes; |
| 73 | uint8_t set_quota; |
| 74 | }; |
| 75 | |
| 76 | struct wan_ioctl_set_tether_client_pipe { |
| 77 | /* enum of tether interface */ |
| 78 | enum ipacm_client_enum ipa_client; |
| 79 | uint8_t reset_client; |
| 80 | uint32_t ul_src_pipe_len; |
| 81 | uint32_t ul_src_pipe_list[QMI_IPA_MAX_PIPES_V01]; |
| 82 | uint32_t dl_dst_pipe_len; |
| 83 | uint32_t dl_dst_pipe_list[QMI_IPA_MAX_PIPES_V01]; |
| 84 | }; |
| 85 | |
| 86 | struct wan_ioctl_query_tether_stats { |
| 87 | /* Name of the upstream interface */ |
| 88 | char upstreamIface[IFNAMSIZ]; |
| 89 | /* Name of the tethered interface */ |
| 90 | char tetherIface[IFNAMSIZ]; |
| 91 | /* enum of tether interface */ |
| 92 | enum ipacm_client_enum ipa_client; |
| 93 | uint64_t ipv4_tx_packets; |
| 94 | uint64_t ipv4_tx_bytes; |
| 95 | uint64_t ipv4_rx_packets; |
| 96 | uint64_t ipv4_rx_bytes; |
| 97 | uint64_t ipv6_tx_packets; |
| 98 | uint64_t ipv6_tx_bytes; |
| 99 | uint64_t ipv6_rx_packets; |
| 100 | uint64_t ipv6_rx_bytes; |
| 101 | }; |
| 102 | |
Skylar Chang | 09e0e25 | 2017-03-20 14:51:29 -0700 | [diff] [blame] | 103 | struct wan_ioctl_query_tether_stats_all { |
| 104 | /* Name of the upstream interface */ |
| 105 | char upstreamIface[IFNAMSIZ]; |
| 106 | /* enum of tether interface */ |
| 107 | enum ipacm_client_enum ipa_client; |
| 108 | uint8_t reset_stats; |
| 109 | uint64_t tx_bytes; |
| 110 | uint64_t rx_bytes; |
| 111 | }; |
| 112 | |
Amir Levy | 0fd437e | 2016-11-08 15:04:07 +0200 | [diff] [blame] | 113 | struct wan_ioctl_reset_tether_stats { |
| 114 | /* Name of the upstream interface, not support now */ |
| 115 | char upstreamIface[IFNAMSIZ]; |
| 116 | /* Indicate whether to reset the stats (use 1) or not */ |
| 117 | uint8_t reset_stats; |
| 118 | }; |
| 119 | |
| 120 | struct wan_ioctl_query_dl_filter_stats { |
| 121 | /* Indicate whether to reset the filter stats (use 1) or not*/ |
| 122 | uint8_t reset_stats; |
| 123 | /* Modem response QMI */ |
| 124 | struct ipa_get_data_stats_resp_msg_v01 stats_resp; |
| 125 | /* provide right index to 1st firewall rule */ |
| 126 | uint32_t index; |
| 127 | }; |
| 128 | |
| 129 | #define WAN_IOC_ADD_FLT_RULE _IOWR(WAN_IOC_MAGIC, \ |
| 130 | WAN_IOCTL_ADD_FLT_RULE, \ |
| 131 | struct ipa_install_fltr_rule_req_msg_v01 *) |
| 132 | |
| 133 | #define WAN_IOC_ADD_FLT_RULE_INDEX _IOWR(WAN_IOC_MAGIC, \ |
| 134 | WAN_IOCTL_ADD_FLT_INDEX, \ |
| 135 | struct ipa_fltr_installed_notif_req_msg_v01 *) |
| 136 | |
| 137 | #define WAN_IOC_VOTE_FOR_BW_MBPS _IOWR(WAN_IOC_MAGIC, \ |
| 138 | WAN_IOCTL_VOTE_FOR_BW_MBPS, \ |
| 139 | uint32_t *) |
| 140 | |
| 141 | #define WAN_IOC_POLL_TETHERING_STATS _IOWR(WAN_IOC_MAGIC, \ |
| 142 | WAN_IOCTL_POLL_TETHERING_STATS, \ |
| 143 | struct wan_ioctl_poll_tethering_stats *) |
| 144 | |
| 145 | #define WAN_IOC_SET_DATA_QUOTA _IOWR(WAN_IOC_MAGIC, \ |
| 146 | WAN_IOCTL_SET_DATA_QUOTA, \ |
| 147 | struct wan_ioctl_set_data_quota *) |
| 148 | |
| 149 | #define WAN_IOC_SET_TETHER_CLIENT_PIPE _IOWR(WAN_IOC_MAGIC, \ |
| 150 | WAN_IOCTL_SET_TETHER_CLIENT_PIPE, \ |
| 151 | struct wan_ioctl_set_tether_client_pipe *) |
| 152 | |
| 153 | #define WAN_IOC_QUERY_TETHER_STATS _IOWR(WAN_IOC_MAGIC, \ |
| 154 | WAN_IOCTL_QUERY_TETHER_STATS, \ |
| 155 | struct wan_ioctl_query_tether_stats *) |
| 156 | |
| 157 | #define WAN_IOC_RESET_TETHER_STATS _IOWR(WAN_IOC_MAGIC, \ |
| 158 | WAN_IOCTL_RESET_TETHER_STATS, \ |
| 159 | struct wan_ioctl_reset_tether_stats *) |
| 160 | |
| 161 | #define WAN_IOC_QUERY_DL_FILTER_STATS _IOWR(WAN_IOC_MAGIC, \ |
| 162 | WAN_IOCTL_QUERY_DL_FILTER_STATS, \ |
| 163 | struct wan_ioctl_query_dl_filter_stats *) |
| 164 | |
| 165 | #define WAN_IOC_ADD_FLT_RULE_EX _IOWR(WAN_IOC_MAGIC, \ |
| 166 | WAN_IOCTL_ADD_FLT_RULE_EX, \ |
| 167 | struct ipa_install_fltr_rule_req_ex_msg_v01 *) |
| 168 | |
Skylar Chang | 09e0e25 | 2017-03-20 14:51:29 -0700 | [diff] [blame] | 169 | #define WAN_IOC_QUERY_TETHER_STATS_ALL _IOWR(WAN_IOC_MAGIC, \ |
| 170 | WAN_IOCTL_QUERY_TETHER_STATS_ALL, \ |
| 171 | struct wan_ioctl_query_tether_stats_all *) |
| 172 | |
Amir Levy | 0fd437e | 2016-11-08 15:04:07 +0200 | [diff] [blame] | 173 | #endif /* _RMNET_IPA_FD_IOCTL_H */ |