summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/lnxwrp_fsl_fman.h
blob: c50031cfd032f4ea1a08b21da27bd309418ece1d (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
/*
 * Copyright 2008-2012 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		lnxwrp_fsl_fman.h

 @Description	Linux internal kernel API
*//***************************************************************************/

#ifndef __LNXWRP_FSL_FMAN_H
#define __LNXWRP_FSL_FMAN_H

#include <linux/types.h>
#include <linux/device.h>   /* struct device */
#include <linux/fsl_qman.h> /* struct qman_fq */
#include "dpaa_integration_ext.h"
#include "fm_port_ext.h"
#include "fm_mac_ext.h"
#include "fm_macsec_ext.h"
#include "fm_rtc_ext.h"

/**************************************************************************//**
 @Group		FM_LnxKern_grp Frame Manager Linux wrapper API

 @Description	FM API functions, definitions and enums.

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

/**************************************************************************//**
 @Group		FM_LnxKern_ctrl_grp Control Unit

 @Description	Control Unit

		Internal Kernel Control Unit API
 @{
*//***************************************************************************/

/*****************************************************************************/
/*                  Internal Linux kernel routines                           */
/*****************************************************************************/

/**************************************************************************//**
 @Description   MACSEC Exceptions wrapper
*//***************************************************************************/
typedef enum fm_macsec_exception {
	SINGLE_BIT_ECC = e_FM_MACSEC_EX_SINGLE_BIT_ECC,
	MULTI_BIT_ECC = e_FM_MACSEC_EX_MULTI_BIT_ECC
} fm_macsec_exception;

/**************************************************************************//**
 @Description   Unknown sci frame treatment wrapper
*//***************************************************************************/
typedef enum fm_macsec_unknown_sci_frame_treatment {
	SCI_DISCARD_BOTH = e_FM_MACSEC_UNKNOWN_SCI_FRAME_TREATMENT_DISCARD_BOTH,
	SCI_DISCARD_UNCTRL_DELIVER_DISCARD_CTRL = \
		e_FM_MACSEC_UNKNOWN_SCI_FRAME_TREATMENT_DISCARD_UNCONTROLLED_DELIVER_OR_DISCARD_CONTROLLED,
	SCI_DELIVER_UNCTRL_DISCARD_CTRL = \
		e_FM_MACSEC_UNKNOWN_SCI_FRAME_TREATMENT_DELIVER_UNCONTROLLED_DISCARD_CONTROLLED,
	SCI_DELIVER_DISCARD_UNCTRL_DELIVER_DISCARD_CTRL = \
		e_FM_MACSEC_UNKNOWN_SCI_FRAME_TREATMENT_DELIVER_OR_DISCARD_UNCONTROLLED_DELIVER_OR_DISCARD_CONTROLLED
} fm_macsec_unknown_sci_frame_treatment;

/**************************************************************************//**
 @Description   Untag frame treatment wrapper
*//***************************************************************************/
typedef enum fm_macsec_untag_frame_treatment {
	UNTAG_DELIVER_UNCTRL_DISCARD_CTRL = \
		e_FM_MACSEC_UNTAG_FRAME_TREATMENT_DELIVER_UNCONTROLLED_DISCARD_CONTROLLED,
	UNTAG_DISCARD_BOTH = e_FM_MACSEC_UNTAG_FRAME_TREATMENT_DISCARD_BOTH,
	UNTAG_DISCARD_UNCTRL_DELIVER_CTRL_UNMODIFIED = \
		e_FM_MACSEC_UNTAG_FRAME_TREATMENT_DISCARD_UNCONTROLLED_DELIVER_CONTROLLED_UNMODIFIED
} fm_macsec_untag_frame_treatment;

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

/**************************************************************************//**
 @Description   MACSEC SECY Exceptions wrapper
*//***************************************************************************/
typedef enum fm_macsec_secy_exception {
	SECY_EX_FRAME_DISCARDED = e_FM_MACSEC_SECY_EX_FRAME_DISCARDED
} fm_macsec_secy_exception;

/**************************************************************************//**
 @Description   MACSEC SECY Events wrapper
*//***************************************************************************/
typedef enum fm_macsec_secy_event {
	SECY_EV_NEXT_PN = e_FM_MACSEC_SECY_EV_NEXT_PN
} fm_macsec_secy_event;

/**************************************************************************//**
 @Description   Valid frame behaviors wrapper
*//***************************************************************************/
typedef enum fm_macsec_valid_frame_behavior {
	VALID_FRAME_BEHAVIOR_DISABLE = e_FM_MACSEC_VALID_FRAME_BEHAVIOR_DISABLE,
	VALID_FRAME_BEHAVIOR_CHECK = e_FM_MACSEC_VALID_FRAME_BEHAVIOR_CHECK,
	VALID_FRAME_BEHAVIOR_STRICT = e_FM_MACSEC_VALID_FRAME_BEHAVIOR_STRICT
} fm_macsec_valid_frame_behavior;

/**************************************************************************//**
 @Description   SCI insertion modes wrapper
*//***************************************************************************/
typedef enum fm_macsec_sci_insertion_mode {
	SCI_INSERTION_MODE_EXPLICIT_SECTAG = \
		e_FM_MACSEC_SCI_INSERTION_MODE_EXPLICIT_SECTAG,
	SCI_INSERTION_MODE_EXPLICIT_MAC_SA = \
		e_FM_MACSEC_SCI_INSERTION_MODE_EXPLICIT_MAC_SA,
	SCI_INSERTION_MODE_IMPLICT_PTP = e_FM_MACSEC_SCI_INSERTION_MODE_IMPLICT_PTP
} fm_macsec_sci_insertion_mode;

typedef macsecSAKey_t macsec_sa_key_t;
typedef macsecSCI_t macsec_sci_t;
typedef macsecAN_t macsec_an_t;
typedef t_Handle handle_t;

/**************************************************************************//**
 @Function      fm_macsec_secy_exception_callback wrapper
 @Description   Exceptions user callback routine, will be called upon an
                exception passing the exception identification.
 @Param[in]     app_h       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 (fm_macsec_secy_exception_callback) (handle_t app_h,
				fm_macsec_secy_exception exception);

/**************************************************************************//**
 @Function      fm_macsec_secy_event_callback wrapper
 @Description   Events user callback routine, will be called upon an
                event passing the event identification.
 @Param[in]     app_h       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 (fm_macsec_secy_event_callback) (handle_t app_h,
				fm_macsec_secy_event event);

/**************************************************************************//**
 @Function      fm_macsec_exception_callback wrapper
 @Description   Exceptions user callback routine, will be called upon an
                exception passing the exception identification.
 @Param[in]     app_h       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 (fm_macsec_exception_callback) (handle_t app_h,
				fm_macsec_exception exception);

/**************************************************************************//**
 @Description   MACSEC SecY SC Params wrapper
*//***************************************************************************/
struct fm_macsec_secy_sc_params {
	macsec_sci_t sci;
	fm_macsec_secy_cipher_suite cipher_suite;
};

/**************************************************************************//**
 @Description   FM MACSEC SecY config input wrapper
*//***************************************************************************/
struct fm_macsec_secy_params {
	handle_t fm_macsec_h;
	struct fm_macsec_secy_sc_params tx_sc_params;
	uint32_t num_receive_channels;
	fm_macsec_secy_exception_callback *exception_f;
	fm_macsec_secy_event_callback *event_f;
	handle_t app_h;
};

/**************************************************************************//**
 @Description   FM MACSEC config input wrapper
*//***************************************************************************/
struct fm_macsec_params {
	handle_t fm_h;
	bool guest_mode;

	union {
		struct {
			uint8_t fm_mac_id;
		} guest_params;

		struct {
			uintptr_t base_addr;
			handle_t fm_mac_h;
			fm_macsec_exception_callback *exception_f;
			handle_t app_h;
		} non_guest_params;
	};

};

/**************************************************************************//**
 @Description	FM device opaque structure used for type checking
*//***************************************************************************/
struct fm;

/**************************************************************************//**
 @Description	FM MAC device opaque structure used for type checking
*//***************************************************************************/
struct fm_mac_dev;

/**************************************************************************//**
 @Description	FM MACSEC device opaque structure used for type checking
*//***************************************************************************/
struct fm_macsec_dev;
struct fm_macsec_secy_dev;

/**************************************************************************//**
 @Description	A structure ..,
*//***************************************************************************/
struct fm_port;

typedef int (*alloc_pcd_fqids)(struct device *dev, uint32_t num,
			       uint8_t alignment, uint32_t *base_fqid);

typedef int (*free_pcd_fqids)(struct device *dev, uint32_t base_fqid);

struct fm_port_pcd_param {
	alloc_pcd_fqids	 cba;
	free_pcd_fqids	 cbf;
	struct device	*dev;
};

/**************************************************************************//**
 @Description	A structure of information about each of the external
		buffer pools used by the port,
*//***************************************************************************/
struct fm_port_pool_param {
	uint8_t		id;		/**< External buffer pool id */
	uint16_t	size;		/**< External buffer pool buffer size */
};

/**************************************************************************//**
 @Description   structure for additional port parameters
*//***************************************************************************/
struct fm_port_params {
	uint32_t errq;	    /**< Error Queue Id. */
	uint32_t defq;	    /**< For Tx and HC - Default Confirmation queue,
				 0 means no Tx conf for processed frames.
				 For Rx and OP - default Rx queue. */
	uint8_t	num_pools;  /**< Number of pools use by this port */
	struct fm_port_pool_param pool_param[FM_PORT_MAX_NUM_OF_EXT_POOLS];
			    /**< Parameters for each pool */
	uint16_t priv_data_size;  /**< Area that user may save for his own
				       need (E.g. save the SKB) */
	bool parse_results; /**< Put the parser-results in the Rx/Tx buffer */
	bool hash_results;  /**< Put the hash-results in the Rx/Tx buffer */
	bool time_stamp;    /**< Put the time-stamp in the Rx/Tx buffer */
	bool frag_enable;   /**< Fragmentation support, for OP only */
	uint16_t data_align;  /**< value for selecting a data alignment (must be a power of 2);
                               if write optimization is used, must be >= 16. */
	uint8_t manip_extra_space;  /**< Maximum extra size needed (insertion-size minus removal-size);
                                     Note that this field impacts the size of the buffer-prefix
                                     (i.e. it pushes the data offset); */
};

/**************************************************************************//**
 @Function	fm_bind

 @Description	Bind to a specific FM device.

 @Param[in]	fm_dev	- the OF handle of the FM device.

 @Return	A handle of the FM device.

 @Cautions	Allowed only after the port was created.
*//***************************************************************************/
struct fm *fm_bind(struct device *fm_dev);

/**************************************************************************//**
 @Function	fm_unbind

 @Description	Un-bind from a specific FM device.

 @Param[in]	fm	- A handle of the FM device.

 @Cautions	Allowed only after the port was created.
*//***************************************************************************/
void fm_unbind(struct fm *fm);

void *fm_get_handle(struct fm *fm);
void *fm_get_rtc_handle(struct fm *fm);
struct resource *fm_get_mem_region(struct fm *fm);

/**************************************************************************//**
 @Function	fm_port_bind

 @Description	Bind to a specific FM-port device (may be Rx or Tx port).

 @Param[in]	fm_port_dev - the OF handle of the FM port device.

 @Return	A handle of the FM port device.

 @Cautions	Allowed only after the port was created.
*//***************************************************************************/
struct fm_port *fm_port_bind(struct device *fm_port_dev);

/**************************************************************************//**
 @Function	fm_port_unbind

 @Description	Un-bind from a specific FM-port device (may be Rx or Tx port).

 @Param[in]	port	- A handle of the FM port device.

 @Cautions	Allowed only after the port was created.
*//***************************************************************************/
void fm_port_unbind(struct fm_port *port);

/**************************************************************************//**
 @Function	fm_set_rx_port_params

 @Description	Configure parameters for a specific Rx FM-port device.

 @Param[in]	port	- A handle of the FM port device.
 @Param[in]	params	- Rx port parameters

 @Cautions	Allowed only after the port is binded.
*//***************************************************************************/
void fm_set_rx_port_params(struct fm_port *port,
			   struct fm_port_params *params);

/**************************************************************************//**
 @Function	fm_port_pcd_bind

 @Description	Bind as a listener on a port PCD.

 @Param[in]	port	- A handle of the FM port device.
 @Param[in]	params	- PCD port parameters

 @Cautions	Allowed only after the port is binded.
*//***************************************************************************/
void fm_port_pcd_bind (struct fm_port *port, struct fm_port_pcd_param *params);

/**************************************************************************//**
 @Function	fm_port_get_buff_layout_ext_params

 @Description	Get data_align and manip_extra_space from the device tree
                chosen node if applied.
                This function will only update these two parameters.
                When this port has no such parameters in the device tree
                values will be set to 0.

 @Param[in]	port	- A handle of the FM port device.
 @Param[in]	params	- PCD port parameters

 @Cautions	Allowed only after the port is binded.
*//***************************************************************************/
void fm_port_get_buff_layout_ext_params(struct fm_port *port, struct fm_port_params *params);

/**************************************************************************//**
 @Function	fm_get_tx_port_channel

 @Description	Get qman-channel number for this Tx port.

 @Param[in]	port	- A handle of the FM port device.

 @Return	qman-channel number for this Tx port.

 @Cautions	Allowed only after the port is binded.
*//***************************************************************************/
uint16_t fm_get_tx_port_channel(struct fm_port *port);

/**************************************************************************//**
 @Function	fm_set_tx_port_params

 @Description	Configure parameters for a specific Tx FM-port device

 @Param[in]	port	- A handle of the FM port device.
 @Param[in]	params	- Tx port parameters

 @Cautions	Allowed only after the port is binded.
*//***************************************************************************/
void fm_set_tx_port_params(struct fm_port *port, struct fm_port_params *params);


/**************************************************************************//**
 @Function	fm_mac_set_handle

 @Description	Set mac handle

 @Param[in]	h_lnx_wrp_fm_dev - A handle of the LnxWrp FM device.
 @Param[in]	h_fm_mac	 - A handle of the LnxWrp FM MAC device.
 @Param[in]	mac_id		 - MAC id.
*//***************************************************************************/
void fm_mac_set_handle(t_Handle h_lnx_wrp_fm_dev, t_Handle h_fm_mac,
		       int mac_id);

/**************************************************************************//**
 @Function	fm_port_enable

 @Description	Enable specific FM-port device (may be Rx or Tx port).

 @Param[in]	port	- A handle of the FM port device.

 @Cautions	Allowed only after the port is initialized.
*//***************************************************************************/
int fm_port_enable(struct fm_port *port);

/**************************************************************************//**
 @Function	fm_port_disable

 @Description	Disable specific FM-port device (may be Rx or Tx port).

 @Param[in]	port	- A handle of the FM port device.

 @Cautions	Allowed only after the port is initialized.
*//***************************************************************************/
int fm_port_disable(struct fm_port *port);

void *fm_port_get_handle(const struct fm_port *port);

u64 *fm_port_get_buffer_time_stamp(const struct fm_port *port,
		const void *data);

/**************************************************************************//**
 @Function	fm_port_get_base_address

 @Description	Get base address of this port. Useful for accessing
		port-specific registers (i.e., not common ones).

 @Param[in]	port		- A handle of the FM port device.

 @Param[out]	base_addr	- The port's base addr (virtual address).
*//***************************************************************************/
void fm_port_get_base_addr(const struct fm_port *port, uint64_t *base_addr);

/**************************************************************************//**
 @Function	fm_mutex_lock

 @Description   Lock function required before any FMD/LLD call.
*//***************************************************************************/
void fm_mutex_lock(void);

/**************************************************************************//**
 @Function	fm_mutex_unlock

 @Description   Unlock function required after any FMD/LLD call.
*//***************************************************************************/
void fm_mutex_unlock(void);

/**************************************************************************//**
 @Function	fm_get_max_frm

 @Description   Get the maximum frame size
*//***************************************************************************/
int fm_get_max_frm(void);

/**************************************************************************//**
 @Function	fm_get_rx_extra_headroom

 @Description   Get the extra headroom size
*//***************************************************************************/
int fm_get_rx_extra_headroom(void);

/**************************************************************************//**
@Function     fm_port_set_rate_limit

@Description  Configure Shaper parameter on FM-port device (Tx port).

@Param[in]    port   - A handle of the FM port device.
@Param[in]    max_burst_size - Value of maximum burst size allowed.
@Param[in]    rate_limit     - The required rate value.

@Cautions     Allowed only after the port is initialized.
*//***************************************************************************/
int fm_port_set_rate_limit(struct fm_port *port,
                           uint16_t max_burst_size,
                           uint32_t rate_limit);
/**************************************************************************//**
@Function     fm_port_set_rate_limit

@Description  Delete Shaper configuration on FM-port device (Tx port).

@Param[in]    port   - A handle of the FM port device.

@Cautions     Allowed only after the port is initialized.
*//***************************************************************************/
int fm_port_del_rate_limit(struct fm_port *port);

struct   auto_res_tables_sizes
{
	uint16_t   max_num_of_arp_entries;
	uint16_t   max_num_of_echo_ipv4_entries;
	uint16_t   max_num_of_ndp_entries;
	uint16_t   max_num_of_echo_ipv6_entries;
	uint16_t   max_num_of_snmp_ipv4_entries;
	uint16_t   max_num_of_snmp_ipv6_entries;
	uint16_t   max_num_of_snmp_oid_entries;
	uint16_t   max_num_of_snmp_char; /* total amount of character needed
		for the snmp table */
	uint16_t   max_num_of_ip_prot_filtering;
	uint16_t   max_num_of_tcp_port_filtering;
	uint16_t   max_num_of_udp_port_filtering;
};
/* ARP */
struct   auto_res_arp_entry
{
	uint32_t  ip_address;
	uint8_t   mac[6];
	bool      is_vlan;
	uint16_t  vid;
};
struct   auto_res_arp_info
{
	uint8_t                     table_size;
	struct auto_res_arp_entry   *auto_res_table;
	bool                        enable_conflict_detection; /* when TRUE
		Conflict Detection will be checked and wake the host if
		needed */
};

/* NDP */
struct   auto_res_ndp_entry
{
	uint32_t  ip_address[4];
	uint8_t   mac[6];
	bool      is_vlan;
	uint16_t  vid;
};
struct   auto_res_ndp_info
{
	uint32_t                    multicast_group;
	uint8_t                     table_size_assigned;
	struct auto_res_ndp_entry   *auto_res_table_assigned; /* This list
		refer to solicitation IP addresses. Note that all IP adresses
		must be from the same multicast group. This will be checked and
		if not operation will fail. */
	uint8_t                     table_size_tmp;
	struct auto_res_ndp_entry   *auto_res_table_tmp;      /* This list
		refer to temp IP addresses. Note that all temp IP adresses must
		be from the same multicast group. This will be checked and if
		not operation will fail. */

	bool                        enable_conflict_detection; /* when TRUE
		Conflict Detection will be checked and wake the host if
		needed */
};

/* ICMP ECHO */
struct   auto_res_echo_ipv4_info
{
	uint8_t                     table_size;
	struct auto_res_arp_entry  *auto_res_table;
};

struct   auto_res_echo_ipv6_info
{
	uint8_t                     table_size;
	struct auto_res_ndp_entry  *auto_res_table;
};

/* SNMP */
struct   auto_res_snmp_entry
{
	uint16_t     oidSize;
	uint8_t      *oidVal; /* only the oid string */
	uint16_t     resSize;
	uint8_t      *resVal; /* resVal will be the entire reply,
				i.e. "Type|Length|Value" */
};

/**************************************************************************//**
 @Description   Deep Sleep Auto Response SNMP IPv4 Addresses Table Entry
                Refer to the FMan Controller spec for more details.
*//***************************************************************************/
struct auto_res_snmp_ipv4addr_tbl_entry
{
	uint32_t ipv4addr; /*!< 32 bit IPv4 Address. */
	bool      is_vlan;
	uint16_t vid;   /*!< 12 bits VLAN ID. The 4 left-most bits should be cleared                      */
			/*!< This field should be 0x0000 for an entry with no VLAN tag or a null VLAN ID. */
};

/**************************************************************************//**
 @Description   Deep Sleep Auto Response SNMP IPv6 Addresses Table Entry
                Refer to the FMan Controller spec for more details.
*//***************************************************************************/
struct auto_res_snmp_ipv6addr_tbl_entry
{
	uint32_t ipv6Addr[4];  /*!< 4 * 32 bit IPv6 Address.                                                     */
	bool      isVlan;
	uint16_t vid;       /*!< 12 bits VLAN ID. The 4 left-most bits should be cleared                      */
			/*!< This field should be 0x0000 for an entry with no VLAN tag or a null VLAN ID. */
};

struct   auto_res_snmp_info
{
	uint16_t control;                          /**< Control bits [0-15]. */
	uint16_t max_snmp_msg_length;              /**< Maximal allowed SNMP message length. */
	uint16_t num_ipv4_addresses;               /**< Number of entries in IPv4 addresses table. */
	uint16_t num_ipv6_addresses;               /**< Number of entries in IPv6 addresses table. */
	struct auto_res_snmp_ipv4addr_tbl_entry *ipv4addr_tbl; /**< Pointer to IPv4 addresses table. */
	struct auto_res_snmp_ipv6addr_tbl_entry *ipv6addr_tbl; /**< Pointer to IPv6 addresses table. */
	char                        *community_read_write_string;
	char                        *community_read_only_string;
	struct auto_res_snmp_entry  *oid_table;
	uint32_t                     oid_table_size;
	uint32_t                    *statistics;
};

/* Filtering */
struct   auto_res_port_filtering_entry
{
	uint16_t    src_port;
	uint16_t    dst_port;
	uint16_t    src_port_mask;
	uint16_t    dst_port_mask;
};
struct   auto_res_filtering_info
{
	/* IP protocol filtering parameters */
	uint8_t     ip_prot_table_size;
	uint8_t     *ip_prot_table_ptr;
	bool        ip_prot_pass_on_hit;  /* when TRUE, miss in the table will
		cause the packet to be droped, hit will pass the packet to
		UDP/TCP filters if needed and if not to the classification
		tree. If the classification tree will pass the packet to a
		queue it will cause a wake interupt. When FALSE it the other
		way around. */
	/* UDP port filtering parameters */
	uint8_t     udp_ports_table_size;
	struct auto_res_port_filtering_entry *udp_ports_table_ptr;
	bool        udp_port_pass_on_hit; /* when TRUE, miss in the table will
		cause the packet to be droped, hit will pass the packet to
		classification tree. If the classification tree will pass the
		packet to a queue it will cause a wake interupt. When FALSE it
		the other way around. */
    /* TCP port filtering parameters */
	uint16_t    tcp_flags_mask;
	uint8_t     tcp_ports_table_size;
	struct auto_res_port_filtering_entry *tcp_ports_table_ptr;
	bool        tcp_port_pass_on_hit; /* when TRUE, miss in the table will
		cause the packet to be droped, hit will pass the packet to
		classification tree. If the classification tree will pass the
		packet to a queue it will cause a wake interupt. When FALSE it
		the other way around. */
};

struct auto_res_port_params
{
	t_Handle                            h_FmPortTx;
	struct   auto_res_arp_info          *p_auto_res_arp_info;
	struct   auto_res_echo_ipv4_info    *p_auto_res_echo_ipv4_info;
	struct   auto_res_ndp_info          *p_auto_res_ndp_info;
	struct   auto_res_echo_ipv6_info    *p_auto_res_echo_ipv6_info;
	struct   auto_res_snmp_info         *p_auto_res_snmp_info;
	struct   auto_res_filtering_info    *p_auto_res_filtering_info;
};

struct auto_res_port_stats
{
    uint32_t arp_ar_cnt;
    uint32_t echo_icmpv4_ar_cnt;
    uint32_t ndp_ar_cnt;
    uint32_t echo_icmpv6_ar_cnt;
};

int fm_port_config_autores_for_deepsleep_support(struct fm_port *port,
	struct auto_res_tables_sizes *params);

int fm_port_enter_autores_for_deepsleep(struct fm_port *port,
	struct auto_res_port_params *params);

void fm_port_exit_auto_res_for_deep_sleep(struct fm_port *port_rx,
	struct fm_port *port_tx);

bool fm_port_is_in_auto_res_mode(struct fm_port *port);

struct auto_res_tables_sizes *fm_port_get_autores_maxsize(
	struct fm_port *port);

int fm_port_get_autores_stats(struct fm_port *port, struct auto_res_port_stats
	*stats);

int fm_port_resume(struct fm_port *port);

int fm_port_suspend(struct fm_port *port);

#ifdef CONFIG_FMAN_PFC
/**************************************************************************//**
@Function     fm_port_set_pfc_priorities_mapping_to_qman_wq

@Description  Associate a QMan Work Queue with a PFC priority on this
		FM-port device (Tx port).

@Param[in]    port   - A handle of the FM port device.

@Param[in]    prio   - The PFC priority.

@Param[in]    wq   - The Work Queue associated with the PFC priority.

@Cautions     Allowed only after the port is initialized.
*//***************************************************************************/
int fm_port_set_pfc_priorities_mapping_to_qman_wq(struct fm_port *port,
		uint8_t prio, uint8_t wq);
#endif

/**************************************************************************//**
@Function     fm_mac_set_exception

@Description  Set MAC exception state.

@Param[in]    fm_mac_dev   - A handle of the FM MAC device.
@Param[in]    exception    - FM MAC exception type.
@Param[in]    enable       - new state.

*//***************************************************************************/
int fm_mac_set_exception(struct fm_mac_dev *fm_mac_dev,
		e_FmMacExceptions exception, bool enable);

int fm_mac_free(struct fm_mac_dev *fm_mac_dev);

struct fm_mac_dev *fm_mac_config(t_FmMacParams *params);

int fm_mac_config_max_frame_length(struct fm_mac_dev *fm_mac_dev,
		int len);

int fm_mac_config_pad_and_crc(struct fm_mac_dev *fm_mac_dev, bool enable);

int fm_mac_config_half_duplex(struct fm_mac_dev *fm_mac_dev, bool enable);

int fm_mac_config_reset_on_init(struct fm_mac_dev *fm_mac_dev, bool enable);

int fm_mac_init(struct fm_mac_dev *fm_mac_dev);

int fm_mac_get_version(struct fm_mac_dev *fm_mac_dev, uint32_t *version);

int fm_mac_enable(struct fm_mac_dev *fm_mac_dev);

int fm_mac_disable(struct fm_mac_dev *fm_mac_dev);

int fm_mac_resume(struct fm_mac_dev *fm_mac_dev);

int fm_mac_set_promiscuous(struct fm_mac_dev *fm_mac_dev,
		bool enable);

int fm_mac_remove_hash_mac_addr(struct fm_mac_dev *fm_mac_dev,
		t_EnetAddr *mac_addr);

int fm_mac_add_hash_mac_addr(struct fm_mac_dev *fm_mac_dev,
		t_EnetAddr *mac_addr);

int fm_mac_modify_mac_addr(struct fm_mac_dev *fm_mac_dev,
					 uint8_t *addr);

int fm_mac_adjust_link(struct fm_mac_dev *fm_mac_dev,
		bool link, int speed, bool duplex);

int fm_mac_enable_1588_time_stamp(struct fm_mac_dev *fm_mac_dev);

int fm_mac_disable_1588_time_stamp(struct fm_mac_dev *fm_mac_dev);

int fm_mac_set_rx_pause_frames(
		struct fm_mac_dev *fm_mac_dev, bool en);

int fm_mac_set_tx_pause_frames(struct fm_mac_dev *fm_mac_dev,
					     bool en);

int fm_rtc_enable(struct fm *fm_dev);

int fm_rtc_disable(struct fm *fm_dev);

int fm_rtc_get_cnt(struct fm *fm_dev, uint64_t *ts);

int fm_rtc_set_cnt(struct fm *fm_dev, uint64_t ts);

int fm_rtc_get_drift(struct fm *fm_dev, uint32_t *drift);

int fm_rtc_set_drift(struct fm *fm_dev, uint32_t drift);

int fm_rtc_set_alarm(struct fm *fm_dev, uint32_t id,
		uint64_t time);

int fm_rtc_set_fiper(struct fm *fm_dev, uint32_t id,
		uint64_t fiper);

int fm_mac_set_wol(struct fm_port *port, struct fm_mac_dev *fm_mac_dev,
			bool en);

/**************************************************************************//**
@Function     fm_macsec_set_exception

@Description  Set MACSEC exception state.

@Param[in]    fm_macsec_dev   - A handle of the FM MACSEC device.
@Param[in]    exception    - FM MACSEC exception type.
@Param[in]    enable       - new state.

*//***************************************************************************/

int fm_macsec_set_exception(struct fm_macsec_dev *fm_macsec_dev,
			fm_macsec_exception exception, bool enable);
int fm_macsec_free(struct fm_macsec_dev *fm_macsec_dev);
struct fm_macsec_dev *fm_macsec_config(struct fm_macsec_params *fm_params);
int fm_macsec_init(struct fm_macsec_dev *fm_macsec_dev);
int fm_macsec_config_unknown_sci_frame_treatment(struct fm_macsec_dev
				*fm_macsec_dev,
				fm_macsec_unknown_sci_frame_treatment treat_mode);
int fm_macsec_config_invalid_tags_frame_treatment(struct fm_macsec_dev *fm_macsec_dev,
				bool deliver_uncontrolled);
int fm_macsec_config_kay_frame_treatment(struct fm_macsec_dev *fm_macsec_dev,
				bool discard_uncontrolled);
int fm_macsec_config_untag_frame_treatment(struct fm_macsec_dev *fm_macsec_dev,
				    fm_macsec_untag_frame_treatment treat_mode);
int fm_macsec_config_pn_exhaustion_threshold(struct fm_macsec_dev *fm_macsec_dev,
					uint32_t pnExhThr);
int fm_macsec_config_keys_unreadable(struct fm_macsec_dev *fm_macsec_dev);
int fm_macsec_config_sectag_without_sci(struct fm_macsec_dev *fm_macsec_dev);
int fm_macsec_config_exception(struct fm_macsec_dev *fm_macsec_dev,
			    fm_macsec_exception exception, bool enable);
int fm_macsec_get_revision(struct fm_macsec_dev *fm_macsec_dev,
			    int *macsec_revision);
int fm_macsec_enable(struct fm_macsec_dev *fm_macsec_dev);
int fm_macsec_disable(struct fm_macsec_dev *fm_macsec_dev);


int fm_macsec_secy_config_exception(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				    fm_macsec_secy_exception exception,
				    bool enable);
int fm_macsec_secy_free(struct fm_macsec_secy_dev *fm_macsec_secy_dev);
struct fm_macsec_secy_dev *fm_macsec_secy_config(struct fm_macsec_secy_params *secy_params);
int fm_macsec_secy_init(struct fm_macsec_secy_dev *fm_macsec_secy_dev);
int fm_macsec_secy_config_sci_insertion_mode(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				fm_macsec_sci_insertion_mode sci_insertion_mode);
int fm_macsec_secy_config_protect_frames(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				bool protect_frames);
int fm_macsec_secy_config_replay_window(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				bool replay_protect, uint32_t replay_window);
int fm_macsec_secy_config_validation_mode(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				fm_macsec_valid_frame_behavior validate_frames);
int fm_macsec_secy_config_confidentiality(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				bool confidentiality_enable,
				uint32_t confidentiality_offset);
int fm_macsec_secy_config_point_to_point(struct fm_macsec_secy_dev *fm_macsec_secy_dev);
int fm_macsec_secy_config_event(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				    fm_macsec_secy_event event,
				    bool enable);
struct rx_sc_dev *fm_macsec_secy_create_rxsc(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				struct fm_macsec_secy_sc_params *params);
int fm_macsec_secy_delete_rxsc(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				struct rx_sc_dev *sc);
int fm_macsec_secy_create_rx_sa(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				struct rx_sc_dev *sc, macsec_an_t an,
				uint32_t lowest_pn, macsec_sa_key_t key);
int fm_macsec_secy_delete_rx_sa(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				struct rx_sc_dev *sc, macsec_an_t an);
int fm_macsec_secy_rxsa_enable_receive(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
					struct rx_sc_dev *sc,
					macsec_an_t an);
int fm_macsec_secy_rxsa_disable_receive(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
					struct rx_sc_dev *sc,
					macsec_an_t an);
int fm_macsec_secy_rxsa_update_next_pn(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
					struct rx_sc_dev *sc,
					macsec_an_t an, uint32_t updt_next_pn);
int fm_macsec_secy_rxsa_update_lowest_pn(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
					struct rx_sc_dev *sc,
					macsec_an_t an, uint32_t updt_lowest_pn);
int fm_macsec_secy_rxsa_modify_key(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
					struct rx_sc_dev *sc,
					macsec_an_t an, macsec_sa_key_t key);
int fm_macsec_secy_create_tx_sa(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				macsec_an_t an, macsec_sa_key_t key);
int fm_macsec_secy_delete_tx_sa(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				macsec_an_t an);
int fm_macsec_secy_txsa_modify_key(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
					macsec_an_t next_active_an,
					macsec_sa_key_t key);
int fm_macsec_secy_txsa_set_active(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
					macsec_an_t an);
int fm_macsec_secy_txsa_get_active(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
					macsec_an_t *p_an);
int fm_macsec_secy_get_rxsc_phys_id(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				struct rx_sc_dev *sc, uint32_t *sc_phys_id);
int fm_macsec_secy_get_txsc_phys_id(struct fm_macsec_secy_dev *fm_macsec_secy_dev,
				    uint32_t *sc_phys_id);

/** @} */ /* end of FM_LnxKern_ctrl_grp group */
/** @} */ /* end of FM_LnxKern_grp group */

/* default values for initializing PTP 1588 timer clock */
#define DPA_PTP_NOMINAL_FREQ_PERIOD_SHIFT 2 /* power of 2 for better performance */
#define DPA_PTP_NOMINAL_FREQ_PERIOD_NS (1 << DPA_PTP_NOMINAL_FREQ_PERIOD_SHIFT) /* 4ns,250MHz */

#endif /* __LNXWRP_FSL_FMAN_H */