summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/fman/inc/Peripherals/fm_macsec_ext.h
blob: 57925f1040b9b4872f770586fce1d10df5f5835f (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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
/*
 * Copyright 2008-2015 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.
 */

/**************************************************************************//**
 @File          fm_macsec_ext.h

 @Description   FM MACSEC ...
*//***************************************************************************/
#ifndef __FM_MACSEC_EXT_H
#define __FM_MACSEC_EXT_H

#include "std_ext.h"


/**************************************************************************//**
 @Group         FM_grp Frame Manager API

 @Description   FM API functions, definitions and enums

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Group         FM_MACSEC_grp FM MACSEC

 @Description   FM MACSEC API functions, definitions and enums

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Description   MACSEC Exceptions
*//***************************************************************************/
typedef enum e_FmMacsecExceptions {
    e_FM_MACSEC_EX_SINGLE_BIT_ECC,          /**< Single bit ECC error */
    e_FM_MACSEC_EX_MULTI_BIT_ECC            /**< Multi bit ECC error */
} e_FmMacsecExceptions;


/**************************************************************************//**
 @Group         FM_MACSEC_init_grp FM-MACSEC Initialization Unit

 @Description   FM MACSEC Initialization Unit

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Function      t_FmMacsecExceptionsCallback

 @Description   Exceptions user callback routine, will be called upon an
                exception passing the exception identification.

 @Param[in]     h_App       A handle to an application layer object; This handle
                            will be passed by the driver upon calling this callback.
 @Param[in]     exception   The exception.
*//***************************************************************************/
typedef void (t_FmMacsecExceptionsCallback) ( t_Handle                  h_App,
                                              e_FmMacsecExceptions      exception);


/**************************************************************************//**
 @Description   FM MACSEC config input
*//***************************************************************************/
typedef struct t_FmMacsecParams {
    t_Handle                                h_Fm;               /**< A handle to the FM object related to */
    bool                                    guestMode;          /**< Partition-id */
    union {
        struct {
            uint8_t                         fmMacId;            /**< FM MAC id */
        } guestParams;

        struct {
            uintptr_t                       baseAddr;           /**< Base of memory mapped FM MACSEC registers */
            t_Handle                        h_FmMac;            /**< A handle to the FM MAC object  related to */
            t_FmMacsecExceptionsCallback    *f_Exception;       /**< Exception Callback Routine         */
            t_Handle                        h_App;              /**< A handle to an application layer object; This handle will
                                                                     be passed by the driver upon calling the above callbacks */
        } nonGuestParams;
    };
} t_FmMacsecParams;

/**************************************************************************//**
 @Function      FM_MACSEC_Config

 @Description   Creates descriptor for the FM MACSEC module;

                The routine returns a handle (descriptor) to the FM MACSEC object;
                This descriptor must be passed as first parameter to all other
                FM MACSEC function calls;

                No actual initialization or configuration of FM MACSEC hardware is
                done by this routine.

 @Param[in]     p_FmMacsecParam     Pointer to data structure of parameters.

 @Retval        Handle to FM MACSEC object, or NULL for Failure.
*//***************************************************************************/
t_Handle FM_MACSEC_Config(t_FmMacsecParams *p_FmMacsecParam);

/**************************************************************************//**
 @Function      FM_MACSEC_Init

 @Description   Initializes the FM MACSEC module.

 @Param[in]     h_FmMacsec      FM MACSEC module descriptor.

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
t_Error FM_MACSEC_Init(t_Handle h_FmMacsec);

/**************************************************************************//**
 @Function      FM_MACSEC_Free

 @Description   Frees all resources that were assigned to FM MACSEC module;

                Calling this routine invalidates the descriptor.

 @Param[in]     h_FmMacsec      FM MACSEC module descriptor.

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
t_Error FM_MACSEC_Free(t_Handle h_FmMacsec);


/**************************************************************************//**
 @Group         FM_MACSEC_advanced_init_grp    FM-MACSEC Advanced Configuration Unit

 @Description   Configuration functions used to change default values.

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Description   enum for unknown sci frame treatment
*//***************************************************************************/
typedef enum e_FmMacsecUnknownSciFrameTreatment {
    e_FM_MACSEC_UNKNOWN_SCI_FRAME_TREATMENT_DISCARD_BOTH = 0,                                               /**< Controlled port - Strict mode */
    e_FM_MACSEC_UNKNOWN_SCI_FRAME_TREATMENT_DISCARD_UNCONTROLLED_DELIVER_OR_DISCARD_CONTROLLED,             /**< If C bit clear deliver on controlled port, else discard
                                                                                                                 Controlled port - Check or Disable mode */
    e_FM_MACSEC_UNKNOWN_SCI_FRAME_TREATMENT_DELIVER_UNCONTROLLED_DISCARD_CONTROLLED,                        /**< Controlled port - Strict mode */
    e_FM_MACSEC_UNKNOWN_SCI_FRAME_TREATMENT_DELIVER_OR_DISCARD_UNCONTROLLED_DELIVER_OR_DISCARD_CONTROLLED   /**< If C bit set deliver on uncontrolled port and discard on controlled port,
                                                                                                                 else discard on uncontrolled port and deliver on controlled port
                                                                                                                 Controlled port - Check or Disable mode */
} e_FmMacsecUnknownSciFrameTreatment;

/**************************************************************************//**
 @Description   enum for untag frame treatment
*//***************************************************************************/
typedef enum e_FmMacsecUntagFrameTreatment {
    e_FM_MACSEC_UNTAG_FRAME_TREATMENT_DELIVER_UNCONTROLLED_DISCARD_CONTROLLED = 0,                    /**< Controlled port - Strict mode */
    e_FM_MACSEC_UNTAG_FRAME_TREATMENT_DISCARD_BOTH,                                                   /**< Controlled port - Strict mode */
    e_FM_MACSEC_UNTAG_FRAME_TREATMENT_DISCARD_UNCONTROLLED_DELIVER_CONTROLLED_UNMODIFIED              /**< Controlled port - Strict mode */
} e_FmMacsecUntagFrameTreatment;

/**************************************************************************//**
 @Function      FM_MACSEC_ConfigUnknownSciFrameTreatment

 @Description   Change the treatment for received frames with unknown sci from its default
                configuration [DEFAULT_unknownSciFrameTreatment].

 @Param[in]     h_FmMacsec      FM MACSEC module descriptor.
 @Param[in]     treatMode       The selected mode.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Config() and before FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_ConfigUnknownSciFrameTreatment(t_Handle h_FmMacsec, e_FmMacsecUnknownSciFrameTreatment treatMode);

/**************************************************************************//**
 @Function      FM_MACSEC_ConfigInvalidTagsFrameTreatment

 @Description   Change the treatment for received frames with invalid tags or
                a zero value PN or an invalid ICV from its default configuration
                [DEFAULT_invalidTagsFrameTreatment].

 @Param[in]     h_FmMacsec              FM MACSEC module descriptor.
 @Param[in]     deliverUncontrolled     If True deliver on the uncontrolled port, else discard;
                                        In both cases discard on the controlled port;
                                        this provide Strict, Check or Disable mode.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Config() and before FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_ConfigInvalidTagsFrameTreatment(t_Handle h_FmMacsec, bool deliverUncontrolled);

/**************************************************************************//**
 @Function      FM_MACSEC_ConfigEncryptWithNoChangedTextFrameTreatment

 @Description   Change the treatment for received frames with the Encryption bit
                set and the Changed Text bit clear from its default configuration
                [DEFAULT_encryptWithNoChangedTextFrameTreatment].

 @Param[in]     h_FmMacsec              FM MACSEC module descriptor.
 @Param[in]     discardUncontrolled     If True discard on the uncontrolled port, else deliver;
                                        In both cases discard on the controlled port;
                                        this provide Strict, Check or Disable mode.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Config() and before FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_ConfigEncryptWithNoChangedTextFrameTreatment(t_Handle h_FmMacsec, bool discardUncontrolled);

/**************************************************************************//**
 @Function      FM_MACSEC_ConfigChangedTextWithNoEncryptFrameTreatment

 @Description   Change the treatment for received frames with the Encryption bit
                clear and the Changed Text bit set from its default configuration
                [DEFAULT_changedTextWithNoEncryptFrameTreatment].

 @Param[in]     h_FmMacsec              FM MACSEC module descriptor.
 @Param[in]     deliverUncontrolled     If True deliver on the uncontrolled port, else discard;
                                        In both cases discard on the controlled port;
                                        this provide Strict, Check or Disable mode.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Config() and before FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_ConfigChangedTextWithNoEncryptFrameTreatment(t_Handle h_FmMacsec, bool deliverUncontrolled);

/**************************************************************************//**
 @Function      FM_MACSEC_ConfigUntagFrameTreatment

 @Description   Change the treatment for received frames without the MAC security tag (SecTAG)
                from its default configuration [DEFAULT_untagFrameTreatment].

 @Param[in]     h_FmMacsec     FM MACSEC module descriptor.
 @Param[in]     treatMode      The selected mode.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Config() and before FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_ConfigUntagFrameTreatment(t_Handle h_FmMacsec, e_FmMacsecUntagFrameTreatment treatMode);

/**************************************************************************//**
 @Function      FM_MACSEC_ConfigOnlyScbIsSetFrameTreatment

 @Description   Change the treatment for received frames with only SCB bit set
                from its default configuration [DEFAULT_onlyScbIsSetFrameTreatment].

 @Param[in]     h_FmMacsec              FM MACSEC module descriptor.
 @Param[in]     deliverUncontrolled     If True deliver on the uncontrolled port, else discard;
                                        In both cases discard on the controlled port;
                                        this provide Strict, Check or Disable mode.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Config() and before FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_ConfigOnlyScbIsSetFrameTreatment(t_Handle h_FmMacsec, bool deliverUncontrolled);

/**************************************************************************//**
 @Function      FM_MACSEC_ConfigPnExhaustionThreshold

 @Description   It's provide the ability to configure a PN exhaustion threshold;
                When the NextPn crosses this value an interrupt event
                is asserted to warn that the active SA should re-key.

 @Param[in]     h_FmMacsec     FM MACSEC module descriptor.
 @Param[in]     pnExhThr       If the threshold is reached, an interrupt event
                               is asserted to re-key.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Config() and before FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_ConfigPnExhaustionThreshold(t_Handle h_FmMacsec, uint32_t pnExhThr);

/**************************************************************************//**
 @Function      FM_MACSEC_ConfigKeysUnreadable

 @Description   Turn on privacy mode; All the keys and their hash values can't be read any more;
                Can not be cleared unless hard reset.

 @Param[in]     h_FmMacsec         FM MACSEC module descriptor.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Config() and before FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_ConfigKeysUnreadable(t_Handle h_FmMacsec);

/**************************************************************************//**
 @Function      FM_MACSEC_ConfigSectagWithoutSCI

 @Description   Promise that all generated Sectag will be without SCI included.

 @Param[in]     h_FmMacsec         FM MACSEC module descriptor.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Config() and before FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_ConfigSectagWithoutSCI(t_Handle h_FmMacsec);

/**************************************************************************//**
 @Function      FM_MACSEC_ConfigException

 @Description   Calling this routine changes the internal driver data base
                from its default selection of exceptions enablement;
                By default all exceptions are enabled.

 @Param[in]     h_FmMacsec      FM MACSEC module descriptor.
 @Param[in]     exception       The exception to be selected.
 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Config() and before FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_ConfigException(t_Handle h_FmMacsec, e_FmMacsecExceptions exception, bool enable);

/** @} */ /* end of FM_MACSEC_advanced_init_grp group */
/** @} */ /* end of FM_MACSEC_init_grp group */


/**************************************************************************//**
 @Group         FM_MACSEC_runtime_control_grp FM-MACSEC Runtime Control Data Unit

 @Description   FM MACSEC runtime control data unit API functions, definitions and enums.

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Function      FM_MACSEC_GetRevision

 @Description   Return MACSEC HW chip revision

 @Param[in]     h_FmMacsec         FM MACSEC module descriptor.
 @Param[out]    p_MacsecRevision   MACSEC revision as defined by the chip.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only after FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_GetRevision(t_Handle h_FmMacsec, uint32_t *p_MacsecRevision);

/**************************************************************************//**
 @Function      FM_MACSEC_Enable

 @Description   This routine should be called after MACSEC is initialized for enabling all
                MACSEC engines according to their existing configuration.

 @Param[in]     h_FmMacsec         FM MACSEC module descriptor.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Init() and when MACSEC is disabled.
*//***************************************************************************/
t_Error FM_MACSEC_Enable(t_Handle h_FmMacsec);

/**************************************************************************//**
 @Function      FM_MACSEC_Disable

 @Description   This routine may be called when MACSEC is enabled in order to
                disable all MACSEC engines; The MACSEC is working in bypass mode.

 @Param[in]     h_FmMacsec         FM MACSEC module descriptor.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Init() and when MACSEC is enabled.
*//***************************************************************************/
t_Error FM_MACSEC_Disable(t_Handle h_FmMacsec);

/**************************************************************************//**
 @Function      FM_MACSEC_SetException

 @Description   Calling this routine enables/disables the specified exception.

 @Param[in]     h_FmMacsec      FM MACSEC module descriptor.
 @Param[in]     exception       The exception to be selected.
 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SetException(t_Handle h_FmMacsec, e_FmMacsecExceptions exception, bool enable);

#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
/**************************************************************************//**
 @Function      FM_MACSEC_DumpRegs

 @Description   Dump internal registers.

 @Param[in]     h_FmMacsec  - FM MACSEC module descriptor.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only after FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_DumpRegs(t_Handle h_FmMacsec);
#endif /* (defined(DEBUG_ERRORS) && ... */

#ifdef VERIFICATION_SUPPORT
/********************* VERIFICATION ONLY ********************************/
/**************************************************************************//**
 @Function      FM_MACSEC_BackdoorSet

 @Description   Set register of the MACSEC memory map

 @Param[in]     h_FmMacsec          FM MACSEC module descriptor.
 @Param[out]    offset              Register offset.
 @Param[out]    value               Value to write.


 @Return        None

 @Cautions      Allowed only following FM_MACSEC_Init().
*//***************************************************************************/
t_Error FM_MACSEC_BackdoorSet(t_Handle h_FmMacsec, uint32_t offset, uint32_t value);

/**************************************************************************//**
 @Function      FM_MACSEC_BackdoorGet

 @Description   Read from register of the MACSEC memory map.

 @Param[in]     h_FmMacsec          FM MACSEC module descriptor.
 @Param[out]    offset              Register offset.

 @Return        Value read

 @Cautions      Allowed only following FM_MACSEC_Init().
*//***************************************************************************/
uint32_t FM_MACSEC_BackdoorGet(t_Handle h_FmMacsec, uint32_t offset);
#endif /* VERIFICATION_SUPPORT */

/** @} */ /* end of FM_MACSEC_runtime_control_grp group */


/**************************************************************************//**
 @Group         FM_MACSEC_SECY_grp FM-MACSEC SecY

 @Description   FM-MACSEC SecY API functions, definitions and enums

 @{
*//***************************************************************************/

typedef uint8_t     macsecSAKey_t[32];
typedef uint64_t    macsecSCI_t;
typedef uint8_t     macsecAN_t;

/**************************************************************************//**
@Description   MACSEC SECY Cipher Suite
*//***************************************************************************/
typedef enum e_FmMacsecSecYCipherSuite {
    e_FM_MACSEC_SECY_GCM_AES_128 = 0,       /**< GCM-AES-128 */
#if (DPAA_VERSION >= 11)
    e_FM_MACSEC_SECY_GCM_AES_256            /**< GCM-AES-256 */
#endif /* (DPAA_VERSION >= 11) */
} e_FmMacsecSecYCipherSuite;

/**************************************************************************//**
 @Description   MACSEC SECY Exceptions
*//***************************************************************************/
typedef enum e_FmMacsecSecYExceptions {
    e_FM_MACSEC_SECY_EX_FRAME_DISCARDED     /**< Frame  Discarded */
} e_FmMacsecSecYExceptions;

/**************************************************************************//**
 @Description   MACSEC SECY Events
*//***************************************************************************/
typedef enum e_FmMacsecSecYEvents {
    e_FM_MACSEC_SECY_EV_NEXT_PN             /**< Next Packet Number exhaustion threshold reached */
} e_FmMacsecSecYEvents;

/**************************************************************************//**
 @Collection   MACSEC SECY Frame Discarded Descriptor error
*//***************************************************************************/
typedef uint8_t    macsecTxScFrameDiscardedErrSelect_t; /**< typedef for defining Frame Discarded Descriptor errors */

#define FM_MACSEC_SECY_TX_SC_FRM_DISCAR_ERR_NEXT_PN_ZERO              0x8000  /**< NextPn == 0 */
#define FM_MACSEC_SECY_TX_SC_FRM_DISCAR_ERR_SC_DISBALE                0x4000  /**< SC is disable */
/* @} */

/**************************************************************************//**
 @Function      t_FmMacsecSecYExceptionsCallback

 @Description   Exceptions user callback routine, will be called upon an
                exception passing the exception identification.

 @Param[in]     h_App       A handle to an application layer object; This handle
                            will be passed by the driver upon calling this callback.
 @Param[in]     exception   The exception.
*//***************************************************************************/
typedef void (t_FmMacsecSecYExceptionsCallback) ( t_Handle                  h_App,
                                                  e_FmMacsecSecYExceptions  exception);

/**************************************************************************//**
 @Function      t_FmMacsecSecYEventsCallback

 @Description   Events user callback routine, will be called upon an
                event passing the event identification.

 @Param[in]     h_App       A handle to an application layer object; This handle
                            will be passed by the driver upon calling this callback.
 @Param[in]     event       The event.
*//***************************************************************************/
typedef void (t_FmMacsecSecYEventsCallback) ( t_Handle                  h_App,
                                              e_FmMacsecSecYEvents      event);

/**************************************************************************//**
 @Description   RFC2863 MIB
*//***************************************************************************/
typedef struct t_MIBStatistics {
    uint64_t  ifInOctets;              /**< Total number of byte received */
    uint64_t  ifInPkts;                /**< Total number of packets received */
    uint64_t  ifInMcastPkts;           /**< Total number of multicast frame received */
    uint64_t  ifInBcastPkts;           /**< Total number of broadcast frame received */
    uint64_t  ifInDiscards;            /**< Frames received, but discarded due to problems within the MAC RX :
                                               - InPktsNoTag,
                                               - InPktsLate,
                                               - InPktsOverrun */
    uint64_t  ifInErrors;              /**< Number of frames received with error:
                                               - InPktsBadTag,
                                               - InPktsNoSCI,
                                               - InPktsNotUsingSA
                                               - InPktsNotValid */
    uint64_t  ifOutOctets;             /**< Total number of byte sent */
    uint64_t  ifOutPkts;               /**< Total number of packets sent */
    uint64_t  ifOutMcastPkts;          /**< Total number of multicast frame sent */
    uint64_t  ifOutBcastPkts;          /**< Total number of multicast frame sent */
    uint64_t  ifOutDiscards;           /**< Frames received, but discarded due to problems within the MAC TX N/A! */
    uint64_t  ifOutErrors;             /**< Number of frames transmitted with error:
                                               - FIFO Overflow Error
                                               - FIFO Underflow Error
                                               - Other */
} t_MIBStatistics;

/**************************************************************************//**
 @Description   MACSEC SecY Rx SA Statistics
*//***************************************************************************/
typedef struct t_FmMacsecSecYRxSaStatistics {
    uint32_t            inPktsOK;               /**< The number of frames with resolved SCI, have passed all
                                                     frame validation frame validation with the validateFrame not set to disable */
    uint32_t            inPktsInvalid;          /**< The number of frames with resolved SCI, that have failed frame
                                                     validation with the validateFrame set to check */
    uint32_t            inPktsNotValid;         /**< The number of frames with resolved SCI, discarded on the controlled port,
                                                     that have failed frame validation with the validateFrame set to strict or the c bit is set */
    uint32_t            inPktsNotUsingSA;       /**< The number of frames received with resolved SCI and discarded on disabled or
                                                     not provisioned SA with validateFrame in the strict mode or the C bit is set */
    uint32_t            inPktsUnusedSA;         /**< The number of frames received with resolved SCI on disabled or not provisioned SA
                                                     with validateFrame not in the strict mode and the C bit is cleared */
} t_FmMacsecSecYRxSaStatistics;

/**************************************************************************//**
 @Description   MACSEC SecY Tx SA Statistics
*//***************************************************************************/
typedef struct t_FmMacsecSecYTxSaStatistics {
    uint64_t            outPktsProtected;       /**< The number of frames, that the user of the controlled port requested to
                                                     be transmitted, which were integrity protected */
    uint64_t            outPktsEncrypted;       /**< The number of frames, that the user of the controlled port requested to
                                                     be transmitted, which were confidentiality protected */
} t_FmMacsecSecYTxSaStatistics;

/**************************************************************************//**
 @Description   MACSEC SecY Rx SC Statistics
*//***************************************************************************/
typedef struct t_FmMacsecSecYRxScStatistics {
    uint64_t            inPktsUnchecked;        /**< The number of frames with resolved SCI, delivered to the user of a controlled port,
                                                     that are not validated with the validateFrame set to disable */
    uint64_t            inPktsDelayed;          /**< The number of frames with resolved SCI, delivered to the user of a controlled port,
                                                     that have their PN smaller than the lowest_PN with the validateFrame set to
                                                     disable or replayProtect disabled */
    uint64_t            inPktsLate;             /**< The number of frames with resolved SCI, discarded on the controlled port,
                                                     that have their PN smaller than the lowest_PN with the validateFrame set to
                                                     Check or Strict and replayProtect enabled */
    uint64_t            inPktsOK;               /**< The number of frames with resolved SCI, have passed all
                                                     frame validation frame validation with the validateFrame not set to disable */
    uint64_t            inPktsInvalid;          /**< The number of frames with resolved SCI, that have failed frame
                                                     validation with the validateFrame set to check */
    uint64_t            inPktsNotValid;         /**< The number of frames with resolved SCI, discarded on the controlled port,
                                                     that have failed frame validation with the validateFrame set to strict or the c bit is set */
    uint64_t            inPktsNotUsingSA;       /**< The number of frames received with resolved SCI and discarded on disabled or
                                                     not provisioned SA with validateFrame in the strict mode or the C bit is set */
    uint64_t            inPktsUnusedSA;         /**< The number of frames received with resolved SCI on disabled or not provisioned SA
                                                     with validateFrame not in the strict mode and the C bit is cleared */
} t_FmMacsecSecYRxScStatistics;

/**************************************************************************//**
 @Description   MACSEC SecY Tx SC Statistics
*//***************************************************************************/
typedef struct t_FmMacsecSecYTxScStatistics {
    uint64_t            outPktsProtected;       /**< The number of frames, that the user of the controlled port requested to
                                                     be transmitted, which were integrity protected */
    uint64_t            outPktsEncrypted;       /**< The number of frames, that the user of the controlled port requested to
                                                     be transmitted, which were confidentiality protected */
} t_FmMacsecSecYTxScStatistics;

/**************************************************************************//**
 @Description   MACSEC SecY Statistics
*//***************************************************************************/
typedef struct t_FmMacsecSecYStatistics {
    t_MIBStatistics     mibCtrlStatistics;      /**< Controlled port MIB statistics */
    t_MIBStatistics     mibNonCtrlStatistics;   /**< Uncontrolled port MIB statistics */
/* Frame verification statistics */
    uint64_t            inPktsUntagged;         /**< The number of received packets without the MAC security tag
                                                     (SecTAG) with validateFrames which is not in the strict mode */
    uint64_t            inPktsNoTag;            /**< The number of received packets discarded without the
                                                     MAC security tag (SecTAG) with validateFrames which is in the strict mode */
    uint64_t            inPktsBadTag;           /**< The number of received packets discarded with an invalid
                                                     SecTAG or a zero value PN or an invalid ICV */
    uint64_t            inPktsUnknownSCI;       /**< The number of received packets with unknown SCI with the
                                                     condition : validateFrames is not in the strict mode and the
                                                     C bit in the SecTAG is not set */
    uint64_t            inPktsNoSCI;            /**< The number of received packets discarded with unknown SCI
                                                     information with the condition : validateFrames is in the strict mode
                                                     or the C bit in the SecTAG is set */
    uint64_t            inPktsOverrun;          /**< The number of packets discarded because the number of
                                                     received packets exceeded the cryptographic performance capabilities */
/* Frame validation statistics */
    uint64_t            inOctetsValidated;      /**< The number of octets of plaintext recovered from received frames with
                                                     resolved SCI that were integrity protected but not encrypted */
    uint64_t            inOctetsDecrypted;      /**< The number of octets of plaintext recovered from received frames with
                                                     resolved SCI that were integrity protected and encrypted */
/* Frame generation statistics */
    uint64_t            outPktsUntagged;        /**< The number of frames, that the user of the controlled port requested to
                                                     be transmitted, with protectFrame false */
    uint64_t            outPktsTooLong;         /**< The number of frames, that the user of the controlled port requested to
                                                     be transmitted, discarded due to length being larger than Maximum Frame Length (MACSEC_MFL) */
/* Frame protection statistics */
    uint64_t            outOctetsProtected;     /**< The number of octets of User Data in transmitted frames that were
                                                     integrity protected but not encrypted */
    uint64_t            outOctetsEncrypted;     /**< The number of octets of User Data in transmitted frames that were
                                                     both integrity protected and encrypted */
} t_FmMacsecSecYStatistics;


/**************************************************************************//**
 @Description   MACSEC SecY SC Params
*//***************************************************************************/
typedef struct t_FmMacsecSecYSCParams {
    macsecSCI_t                 sci;            /**< The secure channel identification of the SC */
    e_FmMacsecSecYCipherSuite   cipherSuite;    /**< Cipher suite to be used for the SC */
} t_FmMacsecSecYSCParams;

/**************************************************************************//**
 @Group         FM_MACSEC_SECY_init_grp FM-MACSEC SecY Initialization Unit

 @Description   FM-MACSEC SecY Initialization Unit

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Description   enum for validate frames
*//***************************************************************************/
typedef enum e_FmMacsecValidFrameBehavior {
    e_FM_MACSEC_VALID_FRAME_BEHAVIOR_DISABLE = 0,   /**< disable the validation function */
    e_FM_MACSEC_VALID_FRAME_BEHAVIOR_CHECK,         /**< enable the validation function but only for checking
                                                         without filtering out invalid frames */
    e_FM_MACSEC_VALID_FRAME_BEHAVIOR_STRICT         /**< enable the validation function and also strictly filter
                                                         out those invalid frames */
} e_FmMacsecValidFrameBehavior;

/**************************************************************************//**
 @Description   enum for sci insertion
*//***************************************************************************/
typedef enum e_FmMacsecSciInsertionMode {
    e_FM_MACSEC_SCI_INSERTION_MODE_EXPLICIT_SECTAG = 0, /**< explicit sci in the sectag */
    e_FM_MACSEC_SCI_INSERTION_MODE_EXPLICIT_MAC_SA,     /**< mac sa is overwritten with the sci*/
    e_FM_MACSEC_SCI_INSERTION_MODE_IMPLICT_PTP          /**< implicit point-to-point sci (pre-shared) */
} e_FmMacsecSciInsertionMode;

/**************************************************************************//**
 @Description   FM MACSEC SecY config input
*//***************************************************************************/
typedef struct t_FmMacsecSecYParams {
    t_Handle                                    h_FmMacsec;             /**< A handle to the FM MACSEC object */
    t_FmMacsecSecYSCParams                      txScParams;             /**< Tx SC Params */
    uint32_t                                    numReceiveChannels;     /**< Number of receive channels dedicated to this SecY */
    t_FmMacsecSecYExceptionsCallback            *f_Exception;           /**< Callback routine to be called by the driver upon SecY exception */
    t_FmMacsecSecYEventsCallback                *f_Event;               /**< Callback routine to be called by the driver upon SecY event */
    t_Handle                                    h_App;                  /**< A handle to an application layer object; This handle will
                                                                             be passed by the driver upon calling the above callbacks */
} t_FmMacsecSecYParams;

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_Config

 @Description   Creates descriptor for the FM MACSEC SECY module;

                The routine returns a handle (descriptor) to the FM MACSEC SECY object;
                This descriptor must be passed as first parameter to all other
                FM MACSEC SECY function calls;
                No actual initialization or configuration of FM MACSEC SecY hardware is
                done by this routine.

 @Param[in]     p_FmMacsecSecYParam     Pointer to data structure of parameters.

 @Return        Handle to FM MACSEC SECY object, or NULL for Failure.
*//***************************************************************************/
t_Handle FM_MACSEC_SECY_Config(t_FmMacsecSecYParams *p_FmMacsecSecYParam);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_Init

 @Description   Initializes the FM MACSEC SECY module.

 @Param[in]     h_FmMacsecSecY  FM MACSEC SECY module descriptor.

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
t_Error FM_MACSEC_SECY_Init(t_Handle h_FmMacsecSecY);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_Free

 @Description   Frees all resources that were assigned to FM MACSEC SECY module.

                Calling this routine invalidates the descriptor.

 @Param[in]     h_FmMacsecSecY  FM MACSEC SECY module descriptor.

 @Return        E_OK on success; Error code otherwise.
*//***************************************************************************/
t_Error FM_MACSEC_SECY_Free(t_Handle h_FmMacsecSecY);

/**************************************************************************//**
 @Group         FM_MACSEC_SECY_advanced_init_grp  FM-MACSEC SecY Advanced Configuration Unit

 @Description   Configuration functions used to change default values.

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_ConfigSciInsertionMode

 @Description   Calling this routine changes the SCI-insertion-mode in the
                internal driver data base from its default configuration
                [DEFAULT_sciInsertionMode]

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     sciInsertionMode    Sci insertion mode

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Config() and before FM_MACSEC_SECY_Init();

*//***************************************************************************/
t_Error FM_MACSEC_SECY_ConfigSciInsertionMode(t_Handle h_FmMacsecSecY, e_FmMacsecSciInsertionMode sciInsertionMode);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_ConfigProtectFrames

 @Description   Calling this routine changes the protect-frame mode in the
                internal driver data base from its default configuration
                [DEFAULT_protectFrames]

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     protectFrames       If FALSE, frames are transmitted without modification

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Config() and before FM_MACSEC_SECY_Init();

*//***************************************************************************/
t_Error FM_MACSEC_SECY_ConfigProtectFrames(t_Handle h_FmMacsecSecY, bool protectFrames);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_ConfigReplayWindow

 @Description   Calling this routine changes the replay-window settings in the
                internal driver data base from its default configuration
                [DEFAULT_replayEnable], [DEFAULT_replayWindow]

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     replayProtect;      Replay protection function mode
 @Param[in]     replayWindow;       The size of the replay window

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Config() and before FM_MACSEC_SECY_Init();

*//***************************************************************************/
t_Error FM_MACSEC_SECY_ConfigReplayWindow(t_Handle h_FmMacsecSecY, bool replayProtect, uint32_t replayWindow);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_ConfigValidationMode

 @Description   Calling this routine changes the frame-validation-behavior mode
                in the internal driver data base from its default configuration
                [DEFAULT_validateFrames]

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     validateFrames      Validation function mode

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Config() and before FM_MACSEC_SECY_Init();

*//***************************************************************************/
t_Error FM_MACSEC_SECY_ConfigValidationMode(t_Handle h_FmMacsecSecY, e_FmMacsecValidFrameBehavior validateFrames);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_ConfigConfidentiality

 @Description   Calling this routine changes the confidentiality settings in the
                internal driver data base from its default configuration
                [DEFAULT_confidentialityEnable], [DEFAULT_confidentialityOffset]

 @Param[in]     h_FmMacsecSecY          FM MACSEC SECY module descriptor.
 @Param[in]     confidentialityEnable   TRUE  - confidentiality protection and integrity protection
                                        FALSE - no confidentiality protection, only integrity protection
 @Param[in]     confidentialityOffset   The number of initial octets of each MSDU without confidentiality protection
                                        common values are 0, 30, and 50

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Config() and before FM_MACSEC_SECY_Init();

*//***************************************************************************/
t_Error FM_MACSEC_SECY_ConfigConfidentiality(t_Handle h_FmMacsecSecY, bool confidentialityEnable, uint16_t confidentialityOffset);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_ConfigPointToPoint

 @Description   configure this SecY to work in point-to-point mode, means that
                it will have only one rx sc;

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Config() and before FM_MACSEC_SECY_Init();
                Can be called only once in a system; only the first secY that will call this
                routine will be able to operate in Point-To-Point mode.
*//***************************************************************************/
t_Error FM_MACSEC_SECY_ConfigPointToPoint(t_Handle h_FmMacsecSecY);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_ConfigException

 @Description   Calling this routine changes the internal driver data base
                from its default selection of exceptions enablement;
                By default all exceptions are enabled.

 @Param[in]     h_FmMacsecSecY  FM MACSEC SECY module descriptor.
 @Param[in]     exception       The exception to be selected.
 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Config() and before FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_ConfigException(t_Handle h_FmMacsecSecY, e_FmMacsecSecYExceptions exception, bool enable);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_ConfigEvent

 @Description   Calling this routine changes the internal driver data base
                from its default selection of events enablement;
                By default all events are enabled.

 @Param[in]     h_FmMacsecSecY  FM MACSEC SECY module descriptor.
 @Param[in]     event           The event to be selected.
 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Config() and before FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_ConfigEvent(t_Handle h_FmMacsecSecY, e_FmMacsecSecYEvents event, bool enable);

/** @} */ /* end of FM_MACSEC_SECY_advanced_init_grp group */
/** @} */ /* end of FM_MACSEC_SECY_init_grp group */


/**************************************************************************//**
 @Group         FM_MACSEC_SECY_runtime_control_grp FM-MACSEC SecY Runtime Control Unit

 @Description   FM MACSEC SECY Runtime control unit API functions, definitions and enums.

 @{
*//***************************************************************************/

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_CreateRxSc

 @Description   Create a receive secure channel.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     scParams            secure channel params.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Handle FM_MACSEC_SECY_CreateRxSc(t_Handle h_FmMacsecSecY, t_FmMacsecSecYSCParams *p_ScParams);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_DeleteRxSc

 @Description   Deleting an initialized secure channel.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                SC handle as returned by FM_MACSEC_SECY_CreateRxSc.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_CreateRxSc().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_DeleteRxSc(t_Handle h_FmMacsecSecY, t_Handle h_Sc);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_CreateRxSa

 @Description   Create a receive secure association for the secure channel;
                the SA cannot be used to receive frames until FM_MACSEC_SECY_RxSaEnableReceive is called.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                SC handle as returned by FM_MACSEC_SECY_CreateRxSc.
 @Param[in]     an                  association number represent the SA.
 @Param[in]     lowestPn            the lowest acceptable PN value for a received frame.
 @Param[in]     key                 the desired key for this SA.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_CreateRxSc().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_CreateRxSa(t_Handle h_FmMacsecSecY, t_Handle h_Sc, macsecAN_t an, uint32_t lowestPn, macsecSAKey_t key);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_DeleteRxSa

 @Description   Deleting an initialized secure association.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                SC handle as returned by FM_MACSEC_SECY_CreateRxSc.
 @Param[in]     an                  association number represent the SA.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_DeleteRxSa(t_Handle h_FmMacsecSecY, t_Handle h_Sc, macsecAN_t an);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_RxSaEnableReceive

 @Description   Enabling the SA to receive frames.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                SC handle as returned by FM_MACSEC_SECY_CreateRxSc.
 @Param[in]     an                  association number represent the SA.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_CreateRxSa().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_RxSaEnableReceive(t_Handle h_FmMacsecSecY, t_Handle h_Sc, macsecAN_t an);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_RxSaDisableReceive

 @Description   Disabling the SA from receive frames.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                SC handle as returned by FM_MACSEC_SECY_CreateRxSc.
 @Param[in]     an                  association number represent the SA.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_CreateRxSa().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_RxSaDisableReceive(t_Handle h_FmMacsecSecY, t_Handle h_Sc, macsecAN_t an);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_RxSaUpdateNextPn

 @Description   Update the next packet number expected on RX;
                The value of nextPN shall be set to the greater of its existing value and the
                supplied of updtNextPN (802.1AE-2006 10.7.15).

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                SC handle as returned by FM_MACSEC_SECY_CreateRxSc.
 @Param[in]     an                  association number represent the SA.
 @Param[in]     updtNextPN          the next PN value for a received frame.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_CreateRxSa().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_RxSaUpdateNextPn(t_Handle h_FmMacsecSecY, t_Handle h_Sc, macsecAN_t an, uint32_t updtNextPN);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_RxSaUpdateLowestPn

 @Description   Update the lowest packet number expected on RX;
                The value of lowestPN shall be set to the greater of its existing value and the
                supplied of updtLowestPN (802.1AE-2006 10.7.15).

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                SC handle as returned by FM_MACSEC_SECY_CreateRxSc.
 @Param[in]     an                  association number represent the SA.
 @Param[in]     updtLowestPN        the lowest PN acceptable value for a received frame.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_CreateRxSa().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_RxSaUpdateLowestPn(t_Handle h_FmMacsecSecY, t_Handle h_Sc, macsecAN_t an, uint32_t updtLowestPN);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_RxSaModifyKey

 @Description   Modify the current key of the SA with a new one.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                SC handle as returned by FM_MACSEC_SECY_CreateRxSc.
 @Param[in]     an                  association number represent the SA.
 @Param[in]     key                 new key to replace the current key.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_CreateRxSa().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_RxSaModifyKey(t_Handle h_FmMacsecSecY, t_Handle h_Sc, macsecAN_t an, macsecSAKey_t key);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_CreateTxSa

 @Description   Create a transmit secure association for the secure channel;
                the SA cannot be used to transmit frames until FM_MACSEC_SECY_TxSaSetActivate is called;
                Only one SA can be active at a time.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     an                  association number represent the SA.
 @Param[in]     key                 the desired key for this SA.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_CreateTxSa(t_Handle h_FmMacsecSecY, macsecAN_t an, macsecSAKey_t key);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_DeleteTxSa

 @Description   Deleting an initialized secure association.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     an                  association number represent the SA.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_DeleteTxSa(t_Handle h_FmMacsecSecY, macsecAN_t an);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_TxSaModifyKey

 @Description   Modify the key of the inactive SA with a new one.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     nextActiveAn        association number represent the next SA to be activated.
 @Param[in]     key                 new key to replace the current key.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_TxSaModifyKey(t_Handle h_FmMacsecSecY, macsecAN_t nextActiveAn, macsecSAKey_t key);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_TxSaSetActive

 @Description   Set this SA to the active SA to be used on TX for SC;
                only one SA can be active at a time.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     an                  association number represent the SA.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_TxSaSetActive(t_Handle h_FmMacsecSecY, macsecAN_t an);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_TxSaGetActive

 @Description   Get the active SA that being used for TX.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[out]    p_An                the active an.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_TxSaGetActive(t_Handle h_FmMacsecSecY, macsecAN_t *p_An);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_GetStatistics

 @Description   get all statistics counters.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     p_Statistics        Structure with statistics.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_GetStatistics(t_Handle h_FmMacsecSecY, t_FmMacsecSecYStatistics *p_Statistics);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_RxScGetStatistics

 @Description   get all statistics counters.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                Rx Sc handle.
 @Param[in]     p_Statistics        Structure with statistics.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_RxScGetStatistics(t_Handle h_FmMacsecSecY, t_Handle h_Sc, t_FmMacsecSecYRxScStatistics *p_Statistics);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_RxSaGetStatistics

 @Description   get all statistics counters

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                Rx Sc handle.
 @Param[in]     an                  association number represent the SA.
 @Param[in]     p_Statistics        Structure with statistics.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_RxSaGetStatistics(t_Handle h_FmMacsecSecY, t_Handle h_Sc, macsecAN_t an, t_FmMacsecSecYRxSaStatistics *p_Statistics);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_TxScGetStatistics

 @Description   get all statistics counters.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     p_Statistics        Structure with statistics.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_TxScGetStatistics(t_Handle h_FmMacsecSecY, t_FmMacsecSecYTxScStatistics *p_Statistics);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_TxSaGetStatistics

 @Description   get all statistics counters.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     an                  association number represent the SA.
 @Param[in]     p_Statistics        Structure with statistics.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_TxSaGetStatistics(t_Handle h_FmMacsecSecY, macsecAN_t an, t_FmMacsecSecYTxSaStatistics *p_Statistics);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_SetException

 @Description   Calling this routine enables/disables the specified exception.

 @Param[in]     h_FmMacsecSecY  FM MACSEC SECY module descriptor.
 @Param[in]     exception       The exception to be selected.
 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_SetException(t_Handle h_FmMacsecSecY, e_FmMacsecExceptions exception, bool enable);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_SetEvent

 @Description   Calling this routine enables/disables the specified event.

 @Param[in]     h_FmMacsecSecY  FM MACSEC SECY module descriptor.
 @Param[in]     event           The event to be selected.
 @Param[in]     enable          TRUE to enable interrupt, FALSE to mask it.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Config() and before FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_SetEvent(t_Handle h_FmMacsecSecY, e_FmMacsecSecYEvents event, bool enable);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_GetRxScPhysId

 @Description   return the physical id of the Secure Channel.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[in]     h_Sc                SC handle as returned by FM_MACSEC_SECY_CreateRxSc.
 @Param[out]    p_ScPhysId          the SC physical id.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_CreateRxSc().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_GetRxScPhysId(t_Handle h_FmMacsecSecY, t_Handle h_Sc, uint32_t *p_ScPhysId);

/**************************************************************************//**
 @Function      FM_MACSEC_SECY_GetTxScPhysId

 @Description   return the physical id of the Secure Channel.

 @Param[in]     h_FmMacsecSecY      FM MACSEC SECY module descriptor.
 @Param[out]    p_ScPhysId          the SC physical id.

 @Return        E_OK on success; Error code otherwise.

 @Cautions      Allowed only following FM_MACSEC_SECY_Init().
*//***************************************************************************/
t_Error FM_MACSEC_SECY_GetTxScPhysId(t_Handle h_FmMacsecSecY, uint32_t *p_ScPhysId);

/** @} */ /* end of FM_MACSEC_SECY_runtime_control_grp group */
/** @} */ /* end of FM_MACSEC_SECY_grp group */
/** @} */ /* end of FM_MACSEC_grp group */
/** @} */ /* end of FM_grp group */


#endif /* __FM_MACSEC_EXT_H */