summaryrefslogtreecommitdiff
path: root/drivers/staging/fsl_dpa_offload/dpa_stats_ioctl.h
blob: 961373ddd45527189d5f68721645666097c3a8d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302

/* Copyright 2013 Freescale Semiconductor, Inc.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Freescale Semiconductor nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 *
 * ALTERNATIVELY, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") as published by the Free Software
 * Foundation, either version 2 of that License or (at your option) any
 * later version.
 *
 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * DPA Stats Wrapper Application Programming Interface
 */

#ifndef __DPA_STATS_IOCTL_H
#define __DPA_STATS_IOCTL_H

/* Other includes */
#include "linux/ioctl.h"
#include <linux/compat.h>

struct ioc_dpa_stats_params {
	unsigned int max_counters;
	void *virt_stg_area;
	uint64_t phys_stg_area;
	bool stg_area_mapped;
	unsigned int storage_area_len;
	int dpa_stats_id;
};

struct ioc_dpa_stats_cnt_params {
	int stats_id;
	struct dpa_stats_cnt_params cnt_params;
	int cnt_id;
};

struct ioc_dpa_stats_cls_cnt_params {
	int stats_id;
	struct dpa_stats_cls_cnt_params cnt_params;
	int cnt_id;
};

struct ioc_dpa_stats_cls_member_params {
	int cnt_id;
	struct dpa_stats_cls_member_params params;
	int member_index;
};

struct ioc_dpa_stats_cnt_request_params {
	struct dpa_stats_cnt_request_params req_params;
	int cnts_len;
	dpa_stats_request_cb request_done;
};

struct ioc_dpa_stats_cnts_reset_params {
	int *cnts_ids;
	unsigned int cnts_ids_len;
};

#ifdef CONFIG_COMPAT
struct dpa_stats_compat_params {
	unsigned int max_counters;
	compat_uptr_t virt_stg_area;
	uint64_t phys_stg_area;
	bool stg_area_mapped;
	unsigned int storage_area_len;
};

struct compat_ioc_dpa_stats_params {
	struct dpa_stats_compat_params stats_params;
	int dpa_stats_id;
};

struct dpa_stats_compat_cnt_reass {
	compat_uptr_t reass;
	unsigned int cnt_sel;
};

struct dpa_stats_compat_cnt_frag {
	compat_uptr_t frag;
	unsigned int cnt_sel;
};

struct dpa_stats_compat_cnt_plcr {
	compat_uptr_t plcr;
	unsigned int cnt_sel;
};

struct compat_ioc_dpa_offld_lookup_key {
	compat_uptr_t byte;
	compat_uptr_t mask;
	uint8_t size;
};

struct dpa_stats_compat_cnt_classif_tbl {
	int td;
	compat_uptr_t key;
	unsigned int cnt_sel;
};

struct dpa_stats_compat_cnt_classif_node {
	compat_uptr_t cc_node;
	enum dpa_stats_classif_node_type ccnode_type;
	compat_uptr_t key;
	unsigned int cnt_sel;
};

struct dpa_stats_compat_cnt_traffic_mng {
	enum dpa_stats_cnt_traffic_mng_src src;
	compat_uptr_t traffic_mng;
	enum dpa_stats_cnt_sel cnt_sel;
};

struct dpa_stats_compat_cnt_params {
	enum dpa_stats_cnt_type type;
	union {
		struct dpa_stats_cnt_eth eth_params;
		struct dpa_stats_compat_cnt_reass reass_params;
		struct dpa_stats_compat_cnt_frag frag_params;
		struct dpa_stats_compat_cnt_plcr plcr_params;
		struct dpa_stats_compat_cnt_classif_tbl classif_tbl_params;
		struct dpa_stats_compat_cnt_classif_node classif_node_params;
		struct dpa_stats_cnt_ipsec ipsec_params;
		struct dpa_stats_compat_cnt_traffic_mng traffic_mng_params;
	};
};

struct compat_ioc_dpa_stats_cnt_params {
	int stats_id;
	struct dpa_stats_compat_cnt_params cnt_params;
	int cnt_id;
};

struct dpa_stats_compat_cls_cnt_eth {
	compat_uptr_t src;
	enum dpa_stats_cnt_eth_sel cnt_sel;
};

struct dpa_stats_compat_cls_cnt_classif_tbl {
	int td;
	enum dpa_stats_classif_key_type   key_type;
	union {
		compat_uptr_t keys;
		compat_uptr_t pairs;
	};
	unsigned int cnt_sel;
};

struct dpa_stats_compat_cls_cnt_classif_node {
	compat_uptr_t cc_node;
	enum dpa_stats_classif_node_type ccnode_type;
	compat_uptr_t keys;
	unsigned int cnt_sel;
};

struct dpa_stats_compat_cls_cnt_ipsec {
	compat_uptr_t sa_id;
	enum dpa_stats_cnt_sel cnt_sel;
};

struct dpa_stats_compat_cls_cnt_params {
	unsigned int class_members;
	enum dpa_stats_cnt_type type;
	union {
		struct dpa_stats_compat_cls_cnt_eth eth_params;
		struct dpa_stats_compat_cnt_reass reass_params;
		struct dpa_stats_compat_cnt_frag frag_params;
		struct dpa_stats_compat_cnt_plcr plcr_params;
		struct dpa_stats_compat_cls_cnt_classif_tbl classif_tbl_params;
		struct dpa_stats_compat_cls_cnt_classif_node ccnode_params;
		struct dpa_stats_compat_cls_cnt_ipsec ipsec_params;
		struct dpa_stats_compat_cnt_traffic_mng traffic_mng_params;
	};
};

struct compat_ioc_dpa_stats_cls_cnt_params {
	int stats_id;
	struct dpa_stats_compat_cls_cnt_params cnt_params;
	int cnt_id;
};

struct compat_ioc_dpa_offld_lookup_key_pair {
	compat_uptr_t first_key;
	compat_uptr_t second_key;
};

struct dpa_stats_compat_cls_member_params {
	enum dpa_stats_cls_member_type type;
	union {
		compat_uptr_t key;
		compat_uptr_t pair;
		int sa_id;
	};
};

struct compat_ioc_dpa_stats_cls_member_params {
	int cnt_id;
	struct dpa_stats_compat_cls_member_params params;
	int member_index;
};

struct dpa_stats_compat_cnt_request_params {
	compat_uptr_t cnts_ids;
	unsigned int cnts_ids_len;
	bool reset_cnts;
	unsigned int storage_area_offset;
};

struct compat_ioc_dpa_stats_cnt_request_params {
	struct dpa_stats_compat_cnt_request_params req_params;
	int cnts_len;
	compat_uptr_t request_done;
};

struct compat_ioc_dpa_stats_cnts_reset_params {
	compat_uptr_t cnts_ids;
	unsigned int cnts_ids_len;
};
#endif
#define DPA_STATS_IOC_MAGIC				0xde

#define DPA_STATS_IOC_INIT						\
	_IOWR(DPA_STATS_IOC_MAGIC, 0, struct ioc_dpa_stats_params)

#ifdef CONFIG_COMPAT
#define DPA_STATS_IOC_COMPAT_INIT					\
	_IOWR(DPA_STATS_IOC_MAGIC, 0, struct compat_ioc_dpa_stats_params)
#endif /* CONFIG_COMPAT */

#define DPA_STATS_IOC_FREE						\
	_IOW(DPA_STATS_IOC_MAGIC, 1, int)

#define DPA_STATS_IOC_CREATE_COUNTER					\
	_IOWR(DPA_STATS_IOC_MAGIC, 2, struct ioc_dpa_stats_cnt_params)

#ifdef CONFIG_COMPAT
#define DPA_STATS_IOC_COMPAT_CREATE_COUNTER				\
	_IOWR(DPA_STATS_IOC_MAGIC, 2, struct compat_ioc_dpa_stats_cnt_params)
#endif /* CONFIG_COMPAT */

#define DPA_STATS_IOC_CREATE_CLASS_COUNTER				\
	_IOWR(DPA_STATS_IOC_MAGIC, 3, struct ioc_dpa_stats_cls_cnt_params)

#ifdef CONFIG_COMPAT
#define DPA_STATS_IOC_COMPAT_CREATE_CLASS_COUNTER			\
	_IOWR(DPA_STATS_IOC_MAGIC, 3,					\
				struct compat_ioc_dpa_stats_cls_cnt_params)
#endif /* CONFIG_COMPAT */

#define DPA_STATS_IOC_MODIFY_CLASS_COUNTER				\
	_IOWR(DPA_STATS_IOC_MAGIC, 4, struct ioc_dpa_stats_cls_member_params)

#ifdef CONFIG_COMPAT
#define DPA_STATS_IOC_COMPAT_MODIFY_CLASS_COUNTER			\
	_IOWR(DPA_STATS_IOC_MAGIC, 4,					\
				struct compat_ioc_dpa_stats_cls_member_params)
#endif /* CONFIG_COMPAT */

#define DPA_STATS_IOC_REMOVE_COUNTER					\
	_IOW(DPA_STATS_IOC_MAGIC, 5, int)

#define DPA_STATS_IOC_GET_COUNTERS					\
	_IOWR(DPA_STATS_IOC_MAGIC, 6, struct ioc_dpa_stats_cnt_request_params)

#ifdef CONFIG_COMPAT
#define DPA_STATS_IOC_COMPAT_GET_COUNTERS				\
	_IOWR(DPA_STATS_IOC_MAGIC, 6,					\
				struct compat_ioc_dpa_stats_cnt_request_params)
#endif

#define DPA_STATS_IOC_RESET_COUNTERS					\
	_IOWR(DPA_STATS_IOC_MAGIC, 7, struct ioc_dpa_stats_cnts_reset_params)

#ifdef CONFIG_COMPAT
#define DPA_STATS_IOC_COMPAT_RESET_COUNTERS				\
	_IOWR(DPA_STATS_IOC_MAGIC, 7,					\
				struct compat_ioc_dpa_stats_cnts_reset_params)
#endif

#endif /* __DPA_STATS_IOCTL_H */