1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Atlantic Network Driver
3 * Copyright (C) 2020 Marvell International Ltd.
6 #ifndef __MACSEC_API_H__
7 #define __MACSEC_API_H__
10 #include "macsec_struct.h"
12 #define NUMROWS_INGRESSPRECTLFRECORD 24
13 #define ROWOFFSET_INGRESSPRECTLFRECORD 0
15 #define NUMROWS_INGRESSPRECLASSRECORD 48
16 #define ROWOFFSET_INGRESSPRECLASSRECORD 0
18 #define NUMROWS_INGRESSPOSTCLASSRECORD 48
19 #define ROWOFFSET_INGRESSPOSTCLASSRECORD 0
21 #define NUMROWS_INGRESSSCRECORD 32
22 #define ROWOFFSET_INGRESSSCRECORD 0
24 #define NUMROWS_INGRESSSARECORD 32
25 #define ROWOFFSET_INGRESSSARECORD 32
27 #define NUMROWS_INGRESSSAKEYRECORD 32
28 #define ROWOFFSET_INGRESSSAKEYRECORD 0
30 #define NUMROWS_INGRESSPOSTCTLFRECORD 24
31 #define ROWOFFSET_INGRESSPOSTCTLFRECORD 0
33 #define NUMROWS_EGRESSCTLFRECORD 24
34 #define ROWOFFSET_EGRESSCTLFRECORD 0
36 #define NUMROWS_EGRESSCLASSRECORD 48
37 #define ROWOFFSET_EGRESSCLASSRECORD 0
39 #define NUMROWS_EGRESSSCRECORD 32
40 #define ROWOFFSET_EGRESSSCRECORD 0
42 #define NUMROWS_EGRESSSARECORD 32
43 #define ROWOFFSET_EGRESSSARECORD 32
45 #define NUMROWS_EGRESSSAKEYRECORD 32
46 #define ROWOFFSET_EGRESSSAKEYRECORD 96
48 /*! Read the raw table data from the specified row of the Egress CTL
49 * Filter table, and unpack it into the fields of rec.
50 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
51 * table_index - The table row to read (max 23).
53 int aq_mss_get_egress_ctlf_record(struct aq_hw_s
*hw
,
54 struct aq_mss_egress_ctlf_record
*rec
,
57 /*! Pack the fields of rec, and write the packed data into the
58 * specified row of the Egress CTL Filter table.
59 * rec - [IN] The bitfield values to write to the table row.
60 * table_index - The table row to write(max 23).
62 int aq_mss_set_egress_ctlf_record(struct aq_hw_s
*hw
,
63 const struct aq_mss_egress_ctlf_record
*rec
,
66 /*! Read the raw table data from the specified row of the Egress
67 * Packet Classifier table, and unpack it into the fields of rec.
68 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
69 * table_index - The table row to read (max 47).
71 int aq_mss_get_egress_class_record(struct aq_hw_s
*hw
,
72 struct aq_mss_egress_class_record
*rec
,
75 /*! Pack the fields of rec, and write the packed data into the
76 * specified row of the Egress Packet Classifier table.
77 * rec - [IN] The bitfield values to write to the table row.
78 * table_index - The table row to write (max 47).
80 int aq_mss_set_egress_class_record(struct aq_hw_s
*hw
,
81 const struct aq_mss_egress_class_record
*rec
,
84 /*! Read the raw table data from the specified row of the Egress SC
85 * Lookup table, and unpack it into the fields of rec.
86 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
87 * table_index - The table row to read (max 31).
89 int aq_mss_get_egress_sc_record(struct aq_hw_s
*hw
,
90 struct aq_mss_egress_sc_record
*rec
,
93 /*! Pack the fields of rec, and write the packed data into the
94 * specified row of the Egress SC Lookup table.
95 * rec - [IN] The bitfield values to write to the table row.
96 * table_index - The table row to write (max 31).
98 int aq_mss_set_egress_sc_record(struct aq_hw_s
*hw
,
99 const struct aq_mss_egress_sc_record
*rec
,
102 /*! Read the raw table data from the specified row of the Egress SA
103 * Lookup table, and unpack it into the fields of rec.
104 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
105 * table_index - The table row to read (max 31).
107 int aq_mss_get_egress_sa_record(struct aq_hw_s
*hw
,
108 struct aq_mss_egress_sa_record
*rec
,
111 /*! Pack the fields of rec, and write the packed data into the
112 * specified row of the Egress SA Lookup table.
113 * rec - [IN] The bitfield values to write to the table row.
114 * table_index - The table row to write (max 31).
116 int aq_mss_set_egress_sa_record(struct aq_hw_s
*hw
,
117 const struct aq_mss_egress_sa_record
*rec
,
120 /*! Read the raw table data from the specified row of the Egress SA
121 * Key Lookup table, and unpack it into the fields of rec.
122 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
123 * table_index - The table row to read (max 31).
125 int aq_mss_get_egress_sakey_record(struct aq_hw_s
*hw
,
126 struct aq_mss_egress_sakey_record
*rec
,
129 /*! Pack the fields of rec, and write the packed data into the
130 * specified row of the Egress SA Key Lookup table.
131 * rec - [IN] The bitfield values to write to the table row.
132 * table_index - The table row to write (max 31).
134 int aq_mss_set_egress_sakey_record(struct aq_hw_s
*hw
,
135 const struct aq_mss_egress_sakey_record
*rec
,
138 /*! Read the raw table data from the specified row of the Ingress
139 * Pre-MACSec CTL Filter table, and unpack it into the fields of rec.
140 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
141 * table_index - The table row to read (max 23).
143 int aq_mss_get_ingress_prectlf_record(struct aq_hw_s
*hw
,
144 struct aq_mss_ingress_prectlf_record
*rec
,
147 /*! Pack the fields of rec, and write the packed data into the
148 * specified row of the Ingress Pre-MACSec CTL Filter table.
149 * rec - [IN] The bitfield values to write to the table row.
150 * table_index - The table row to write(max 23).
152 int aq_mss_set_ingress_prectlf_record(struct aq_hw_s
*hw
,
153 const struct aq_mss_ingress_prectlf_record
*rec
,
156 /*! Read the raw table data from the specified row of the Ingress
157 * Pre-MACSec Packet Classifier table, and unpack it into the fields of rec.
158 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
159 * table_index - The table row to read (max 47).
161 int aq_mss_get_ingress_preclass_record(struct aq_hw_s
*hw
,
162 struct aq_mss_ingress_preclass_record
*rec
,
165 /*! Pack the fields of rec, and write the packed data into the
166 * specified row of the Ingress Pre-MACSec Packet Classifier table.
167 * rec - [IN] The bitfield values to write to the table row.
168 * table_index - The table row to write(max 47).
170 int aq_mss_set_ingress_preclass_record(struct aq_hw_s
*hw
,
171 const struct aq_mss_ingress_preclass_record
*rec
,
174 /*! Read the raw table data from the specified row of the Ingress SC
175 * Lookup table, and unpack it into the fields of rec.
176 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
177 * table_index - The table row to read (max 31).
179 int aq_mss_get_ingress_sc_record(struct aq_hw_s
*hw
,
180 struct aq_mss_ingress_sc_record
*rec
,
183 /*! Pack the fields of rec, and write the packed data into the
184 * specified row of the Ingress SC Lookup table.
185 * rec - [IN] The bitfield values to write to the table row.
186 * table_index - The table row to write(max 31).
188 int aq_mss_set_ingress_sc_record(struct aq_hw_s
*hw
,
189 const struct aq_mss_ingress_sc_record
*rec
,
192 /*! Read the raw table data from the specified row of the Ingress SA
193 * Lookup table, and unpack it into the fields of rec.
194 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
195 * table_index - The table row to read (max 31).
197 int aq_mss_get_ingress_sa_record(struct aq_hw_s
*hw
,
198 struct aq_mss_ingress_sa_record
*rec
,
201 /*! Pack the fields of rec, and write the packed data into the
202 * specified row of the Ingress SA Lookup table.
203 * rec - [IN] The bitfield values to write to the table row.
204 * table_index - The table row to write(max 31).
206 int aq_mss_set_ingress_sa_record(struct aq_hw_s
*hw
,
207 const struct aq_mss_ingress_sa_record
*rec
,
210 /*! Read the raw table data from the specified row of the Ingress SA
211 * Key Lookup table, and unpack it into the fields of rec.
212 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
213 * table_index - The table row to read (max 31).
215 int aq_mss_get_ingress_sakey_record(struct aq_hw_s
*hw
,
216 struct aq_mss_ingress_sakey_record
*rec
,
219 /*! Pack the fields of rec, and write the packed data into the
220 * specified row of the Ingress SA Key Lookup table.
221 * rec - [IN] The bitfield values to write to the table row.
222 * table_index - The table row to write(max 31).
224 int aq_mss_set_ingress_sakey_record(struct aq_hw_s
*hw
,
225 const struct aq_mss_ingress_sakey_record
*rec
,
228 /*! Read the raw table data from the specified row of the Ingress
229 * Post-MACSec Packet Classifier table, and unpack it into the
231 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
232 * table_index - The table row to read (max 48).
234 int aq_mss_get_ingress_postclass_record(struct aq_hw_s
*hw
,
235 struct aq_mss_ingress_postclass_record
*rec
,
238 /*! Pack the fields of rec, and write the packed data into the
239 * specified row of the Ingress Post-MACSec Packet Classifier table.
240 * rec - [IN] The bitfield values to write to the table row.
241 * table_index - The table row to write(max 48).
243 int aq_mss_set_ingress_postclass_record(struct aq_hw_s
*hw
,
244 const struct aq_mss_ingress_postclass_record
*rec
,
247 /*! Read the raw table data from the specified row of the Ingress
248 * Post-MACSec CTL Filter table, and unpack it into the fields of rec.
249 * rec - [OUT] The raw table row data will be unpacked into the fields of rec.
250 * table_index - The table row to read (max 23).
252 int aq_mss_get_ingress_postctlf_record(struct aq_hw_s
*hw
,
253 struct aq_mss_ingress_postctlf_record
*rec
,
256 /*! Pack the fields of rec, and write the packed data into the
257 * specified row of the Ingress Post-MACSec CTL Filter table.
258 * rec - [IN] The bitfield values to write to the table row.
259 * table_index - The table row to write(max 23).
261 int aq_mss_set_ingress_postctlf_record(struct aq_hw_s
*hw
,
262 const struct aq_mss_ingress_postctlf_record
*rec
,
265 /*! Read the counters for the specified SC, and unpack them into the
266 * fields of counters.
267 * counters - [OUT] The raw table row data will be unpacked here.
268 * sc_index - The table row to read (max 31).
270 int aq_mss_get_egress_sc_counters(struct aq_hw_s
*hw
,
271 struct aq_mss_egress_sc_counters
*counters
,
274 /*! Read the counters for the specified SA, and unpack them into the
275 * fields of counters.
276 * counters - [OUT] The raw table row data will be unpacked here.
277 * sa_index - The table row to read (max 31).
279 int aq_mss_get_egress_sa_counters(struct aq_hw_s
*hw
,
280 struct aq_mss_egress_sa_counters
*counters
,
283 /*! Read the counters for the common egress counters, and unpack them
284 * into the fields of counters.
285 * counters - [OUT] The raw table row data will be unpacked here.
287 int aq_mss_get_egress_common_counters(struct aq_hw_s
*hw
,
288 struct aq_mss_egress_common_counters
*counters
);
290 /*! Clear all Egress counters to 0.*/
291 int aq_mss_clear_egress_counters(struct aq_hw_s
*hw
);
293 /*! Read the counters for the specified SA, and unpack them into the
294 * fields of counters.
295 * counters - [OUT] The raw table row data will be unpacked here.
296 * sa_index - The table row to read (max 31).
298 int aq_mss_get_ingress_sa_counters(struct aq_hw_s
*hw
,
299 struct aq_mss_ingress_sa_counters
*counters
,
302 /*! Read the counters for the common ingress counters, and unpack them
303 * into the fields of counters.
304 * counters - [OUT] The raw table row data will be unpacked here.
306 int aq_mss_get_ingress_common_counters(struct aq_hw_s
*hw
,
307 struct aq_mss_ingress_common_counters
*counters
);
309 /*! Clear all Ingress counters to 0. */
310 int aq_mss_clear_ingress_counters(struct aq_hw_s
*hw
);
312 /*! Get Egress SA expired. */
313 int aq_mss_get_egress_sa_expired(struct aq_hw_s
*hw
, u32
*expired
);
314 /*! Get Egress SA threshold expired. */
315 int aq_mss_get_egress_sa_threshold_expired(struct aq_hw_s
*hw
,
317 /*! Set Egress SA expired. */
318 int aq_mss_set_egress_sa_expired(struct aq_hw_s
*hw
, u32 expired
);
319 /*! Set Egress SA threshold expired. */
320 int aq_mss_set_egress_sa_threshold_expired(struct aq_hw_s
*hw
,
323 #endif /* __MACSEC_API_H__ */