1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Atlantic Network Driver
3  * Copyright (C) 2020 Marvell International Ltd.
4  */
5 
6 #ifndef __MACSEC_API_H__
7 #define __MACSEC_API_H__
8 
9 #include "aq_hw.h"
10 #include "macsec_struct.h"
11 
12 #define NUMROWS_EGRESSCTLFRECORD 24
13 #define ROWOFFSET_EGRESSCTLFRECORD 0
14 
15 #define NUMROWS_EGRESSCLASSRECORD 48
16 #define ROWOFFSET_EGRESSCLASSRECORD 0
17 
18 #define NUMROWS_EGRESSSCRECORD 32
19 #define ROWOFFSET_EGRESSSCRECORD 0
20 
21 #define NUMROWS_EGRESSSARECORD 32
22 #define ROWOFFSET_EGRESSSARECORD 32
23 
24 #define NUMROWS_EGRESSSAKEYRECORD 32
25 #define ROWOFFSET_EGRESSSAKEYRECORD 96
26 
27 /*!  Read the raw table data from the specified row of the Egress CTL
28  *   Filter table, and unpack it into the fields of rec.
29  *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
30  *  table_index - The table row to read (max 23).
31  */
32 int aq_mss_get_egress_ctlf_record(struct aq_hw_s *hw,
33 				  struct aq_mss_egress_ctlf_record *rec,
34 				  u16 table_index);
35 
36 /*!  Pack the fields of rec, and write the packed data into the
37  *   specified row of the Egress CTL Filter table.
38  *  rec - [IN] The bitfield values to write to the table row.
39  *  table_index - The table row to write(max 23).
40  */
41 int aq_mss_set_egress_ctlf_record(struct aq_hw_s *hw,
42 				  const struct aq_mss_egress_ctlf_record *rec,
43 				  u16 table_index);
44 
45 /*!  Read the raw table data from the specified row of the Egress
46  *   Packet Classifier table, and unpack it into the fields of rec.
47  *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
48  *  table_index - The table row to read (max 47).
49  */
50 int aq_mss_get_egress_class_record(struct aq_hw_s *hw,
51 				   struct aq_mss_egress_class_record *rec,
52 				   u16 table_index);
53 
54 /*!  Pack the fields of rec, and write the packed data into the
55  *   specified row of the Egress Packet Classifier table.
56  *  rec - [IN] The bitfield values to write to the table row.
57  *  table_index - The table row to write (max 47).
58  */
59 int aq_mss_set_egress_class_record(struct aq_hw_s *hw,
60 				   const struct aq_mss_egress_class_record *rec,
61 				   u16 table_index);
62 
63 /*!  Read the raw table data from the specified row of the Egress SC
64  *   Lookup table, and unpack it into the fields of rec.
65  *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
66  *  table_index - The table row to read (max 31).
67  */
68 int aq_mss_get_egress_sc_record(struct aq_hw_s *hw,
69 				struct aq_mss_egress_sc_record *rec,
70 				u16 table_index);
71 
72 /*!  Pack the fields of rec, and write the packed data into the
73  *   specified row of the Egress SC Lookup table.
74  *  rec - [IN] The bitfield values to write to the table row.
75  *  table_index - The table row to write (max 31).
76  */
77 int aq_mss_set_egress_sc_record(struct aq_hw_s *hw,
78 				const struct aq_mss_egress_sc_record *rec,
79 				u16 table_index);
80 
81 /*!  Read the raw table data from the specified row of the Egress SA
82  *   Lookup table, and unpack it into the fields of rec.
83  *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
84  *  table_index - The table row to read (max 31).
85  */
86 int aq_mss_get_egress_sa_record(struct aq_hw_s *hw,
87 				struct aq_mss_egress_sa_record *rec,
88 				u16 table_index);
89 
90 /*!  Pack the fields of rec, and write the packed data into the
91  *   specified row of the Egress SA Lookup table.
92  *  rec  - [IN] The bitfield values to write to the table row.
93  *  table_index - The table row to write (max 31).
94  */
95 int aq_mss_set_egress_sa_record(struct aq_hw_s *hw,
96 				const struct aq_mss_egress_sa_record *rec,
97 				u16 table_index);
98 
99 /*!  Read the raw table data from the specified row of the Egress SA
100  *   Key Lookup table, and unpack it into the fields of rec.
101  *  rec - [OUT] The raw table row data will be unpacked into the fields of rec.
102  *  table_index - The table row to read (max 31).
103  */
104 int aq_mss_get_egress_sakey_record(struct aq_hw_s *hw,
105 				   struct aq_mss_egress_sakey_record *rec,
106 				   u16 table_index);
107 
108 /*!  Pack the fields of rec, and write the packed data into the
109  *   specified row of the Egress SA Key Lookup table.
110  *  rec - [IN] The bitfield values to write to the table row.
111  *  table_index - The table row to write (max 31).
112  */
113 int aq_mss_set_egress_sakey_record(struct aq_hw_s *hw,
114 				   const struct aq_mss_egress_sakey_record *rec,
115 				   u16 table_index);
116 
117 /*!  Get Egress SA expired. */
118 int aq_mss_get_egress_sa_expired(struct aq_hw_s *hw, u32 *expired);
119 /*!  Get Egress SA threshold expired. */
120 int aq_mss_get_egress_sa_threshold_expired(struct aq_hw_s *hw,
121 					   u32 *expired);
122 /*!  Set Egress SA expired. */
123 int aq_mss_set_egress_sa_expired(struct aq_hw_s *hw, u32 expired);
124 /*!  Set Egress SA threshold expired. */
125 int aq_mss_set_egress_sa_threshold_expired(struct aq_hw_s *hw,
126 					   u32 expired);
127 
128 #endif /* __MACSEC_API_H__ */
129