summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.h
blob: ff03cc462a37a3b02ae4fd79c87f17b6d48b99f2 (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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
/* SPDX-License-Identifier: GPL-2.0-only */
/* Atlantic Network Driver
 * Copyright (C) 2020 Marvell International Ltd.
 */

#ifndef __MACSEC_API_H__
#define __MACSEC_API_H__

#include "aq_hw.h"
#include "macsec_struct.h"

#define NUMROWS_INGRESSPRECTLFRECORD 24
#define ROWOFFSET_INGRESSPRECTLFRECORD 0

#define NUMROWS_INGRESSPRECLASSRECORD 48
#define ROWOFFSET_INGRESSPRECLASSRECORD 0

#define NUMROWS_INGRESSPOSTCLASSRECORD 48
#define ROWOFFSET_INGRESSPOSTCLASSRECORD 0

#define NUMROWS_INGRESSSCRECORD 32
#define ROWOFFSET_INGRESSSCRECORD 0

#define NUMROWS_INGRESSSARECORD 32
#define ROWOFFSET_INGRESSSARECORD 32

#define NUMROWS_INGRESSSAKEYRECORD 32
#define ROWOFFSET_INGRESSSAKEYRECORD 0

#define NUMROWS_INGRESSPOSTCTLFRECORD 24
#define ROWOFFSET_INGRESSPOSTCTLFRECORD 0

#define NUMROWS_EGRESSCTLFRECORD 24
#define ROWOFFSET_EGRESSCTLFRECORD 0

#define NUMROWS_EGRESSCLASSRECORD 48
#define ROWOFFSET_EGRESSCLASSRECORD 0

#define NUMROWS_EGRESSSCRECORD 32
#define ROWOFFSET_EGRESSSCRECORD 0

#define NUMROWS_EGRESSSARECORD 32
#define ROWOFFSET_EGRESSSARECORD 32

#define NUMROWS_EGRESSSAKEYRECORD 32
#define ROWOFFSET_EGRESSSAKEYRECORD 96

/*!  Read the raw table data from the specified row of the Egress CTL
 *   Filter table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 23).
 */
int aq_mss_get_egress_ctlf_record(struct aq_hw_s *hw,
				  struct aq_mss_egress_ctlf_record *rec,
				  u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Egress CTL Filter table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write(max 23).
 */
int aq_mss_set_egress_ctlf_record(struct aq_hw_s *hw,
				  const struct aq_mss_egress_ctlf_record *rec,
				  u16 table_index);

/*!  Read the raw table data from the specified row of the Egress
 *   Packet Classifier table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 47).
 */
int aq_mss_get_egress_class_record(struct aq_hw_s *hw,
				   struct aq_mss_egress_class_record *rec,
				   u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Egress Packet Classifier table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write (max 47).
 */
int aq_mss_set_egress_class_record(struct aq_hw_s *hw,
				   const struct aq_mss_egress_class_record *rec,
				   u16 table_index);

/*!  Read the raw table data from the specified row of the Egress SC
 *   Lookup table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 31).
 */
int aq_mss_get_egress_sc_record(struct aq_hw_s *hw,
				struct aq_mss_egress_sc_record *rec,
				u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Egress SC Lookup table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write (max 31).
 */
int aq_mss_set_egress_sc_record(struct aq_hw_s *hw,
				const struct aq_mss_egress_sc_record *rec,
				u16 table_index);

/*!  Read the raw table data from the specified row of the Egress SA
 *   Lookup table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 31).
 */
int aq_mss_get_egress_sa_record(struct aq_hw_s *hw,
				struct aq_mss_egress_sa_record *rec,
				u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Egress SA Lookup table.
 *  rec  - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write (max 31).
 */
int aq_mss_set_egress_sa_record(struct aq_hw_s *hw,
				const struct aq_mss_egress_sa_record *rec,
				u16 table_index);

/*!  Read the raw table data from the specified row of the Egress SA
 *   Key Lookup table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 31).
 */
int aq_mss_get_egress_sakey_record(struct aq_hw_s *hw,
				   struct aq_mss_egress_sakey_record *rec,
				   u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Egress SA Key Lookup table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write (max 31).
 */
int aq_mss_set_egress_sakey_record(struct aq_hw_s *hw,
				   const struct aq_mss_egress_sakey_record *rec,
				   u16 table_index);

/*!  Read the raw table data from the specified row of the Ingress
 *   Pre-MACSec CTL Filter table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 23).
 */
int aq_mss_get_ingress_prectlf_record(struct aq_hw_s *hw,
				      struct aq_mss_ingress_prectlf_record *rec,
				      u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Ingress Pre-MACSec CTL Filter table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write(max 23).
 */
int aq_mss_set_ingress_prectlf_record(struct aq_hw_s *hw,
	const struct aq_mss_ingress_prectlf_record *rec,
	u16 table_index);

/*!  Read the raw table data from the specified row of the Ingress
 *   Pre-MACSec Packet Classifier table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 47).
 */
int aq_mss_get_ingress_preclass_record(struct aq_hw_s *hw,
	struct aq_mss_ingress_preclass_record *rec,
	u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Ingress Pre-MACSec Packet Classifier table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write(max 47).
 */
int aq_mss_set_ingress_preclass_record(struct aq_hw_s *hw,
	const struct aq_mss_ingress_preclass_record *rec,
	u16 table_index);

/*!  Read the raw table data from the specified row of the Ingress SC
 *   Lookup table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 31).
 */
int aq_mss_get_ingress_sc_record(struct aq_hw_s *hw,
				 struct aq_mss_ingress_sc_record *rec,
				 u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Ingress SC Lookup table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write(max 31).
 */
int aq_mss_set_ingress_sc_record(struct aq_hw_s *hw,
				 const struct aq_mss_ingress_sc_record *rec,
				 u16 table_index);

/*!  Read the raw table data from the specified row of the Ingress SA
 *   Lookup table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 31).
 */
int aq_mss_get_ingress_sa_record(struct aq_hw_s *hw,
				 struct aq_mss_ingress_sa_record *rec,
				 u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Ingress SA Lookup table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write(max 31).
 */
int aq_mss_set_ingress_sa_record(struct aq_hw_s *hw,
				 const struct aq_mss_ingress_sa_record *rec,
				 u16 table_index);

/*!  Read the raw table data from the specified row of the Ingress SA
 *   Key Lookup table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 31).
 */
int aq_mss_get_ingress_sakey_record(struct aq_hw_s *hw,
				    struct aq_mss_ingress_sakey_record *rec,
				    u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Ingress SA Key Lookup table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write(max 31).
 */
int aq_mss_set_ingress_sakey_record(struct aq_hw_s *hw,
	const struct aq_mss_ingress_sakey_record *rec,
	u16 table_index);

/*!  Read the raw table data from the specified row of the Ingress
 *   Post-MACSec Packet Classifier table, and unpack it into the
 *   fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 48).
 */
int aq_mss_get_ingress_postclass_record(struct aq_hw_s *hw,
	struct aq_mss_ingress_postclass_record *rec,
	u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Ingress Post-MACSec Packet Classifier table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write(max 48).
 */
int aq_mss_set_ingress_postclass_record(struct aq_hw_s *hw,
	const struct aq_mss_ingress_postclass_record *rec,
	u16 table_index);

/*!  Read the raw table data from the specified row of the Ingress
 *   Post-MACSec CTL Filter table, and unpack it into the fields of rec.
 *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
 *  table_index - The table row to read (max 23).
 */
int aq_mss_get_ingress_postctlf_record(struct aq_hw_s *hw,
	struct aq_mss_ingress_postctlf_record *rec,
	u16 table_index);

/*!  Pack the fields of rec, and write the packed data into the
 *   specified row of the Ingress Post-MACSec CTL Filter table.
 *  rec - [IN] The bitfield values to write to the table row.
 *  table_index - The table row to write(max 23).
 */
int aq_mss_set_ingress_postctlf_record(struct aq_hw_s *hw,
	const struct aq_mss_ingress_postctlf_record *rec,
	u16 table_index);

/*!  Read the counters for the specified SC, and unpack them into the
 *   fields of counters.
 *  counters - [OUT] The raw table row data will be unpacked here.
 *  sc_index - The table row to read (max 31).
 */
int aq_mss_get_egress_sc_counters(struct aq_hw_s *hw,
				  struct aq_mss_egress_sc_counters *counters,
				  u16 sc_index);

/*!  Read the counters for the specified SA, and unpack them into the
 *   fields of counters.
 *  counters - [OUT] The raw table row data will be unpacked here.
 *  sa_index - The table row to read (max 31).
 */
int aq_mss_get_egress_sa_counters(struct aq_hw_s *hw,
				  struct aq_mss_egress_sa_counters *counters,
				  u16 sa_index);

/*!  Read the counters for the common egress counters, and unpack them
 *   into the fields of counters.
 *  counters - [OUT] The raw table row data will be unpacked here.
 */
int aq_mss_get_egress_common_counters(struct aq_hw_s *hw,
	struct aq_mss_egress_common_counters *counters);

/*!  Clear all Egress counters to 0.*/
int aq_mss_clear_egress_counters(struct aq_hw_s *hw);

/*!  Read the counters for the specified SA, and unpack them into the
 *   fields of counters.
 *  counters - [OUT] The raw table row data will be unpacked here.
 *  sa_index - The table row to read (max 31).
 */
int aq_mss_get_ingress_sa_counters(struct aq_hw_s *hw,
				   struct aq_mss_ingress_sa_counters *counters,
				   u16 sa_index);

/*!  Read the counters for the common ingress counters, and unpack them
 *   into the fields of counters.
 *  counters - [OUT] The raw table row data will be unpacked here.
 */
int aq_mss_get_ingress_common_counters(struct aq_hw_s *hw,
	struct aq_mss_ingress_common_counters *counters);

/*!  Clear all Ingress counters to 0. */
int aq_mss_clear_ingress_counters(struct aq_hw_s *hw);

/*!  Get Egress SA expired. */
int aq_mss_get_egress_sa_expired(struct aq_hw_s *hw, u32 *expired);
/*!  Get Egress SA threshold expired. */
int aq_mss_get_egress_sa_threshold_expired(struct aq_hw_s *hw,
					   u32 *expired);
/*!  Set Egress SA expired. */
int aq_mss_set_egress_sa_expired(struct aq_hw_s *hw, u32 expired);
/*!  Set Egress SA threshold expired. */
int aq_mss_set_egress_sa_threshold_expired(struct aq_hw_s *hw,
					   u32 expired);

#endif /* __MACSEC_API_H__ */