summaryrefslogtreecommitdiff
path: root/include/linux/fsl_dpa_classifier.h
blob: 22d5f6eac61cb7c1ed884add515a127a030ee247 (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
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600

/* 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.
 */

/*
 * DPA Classifier Application Programming Interface.
 */

#ifndef __FSL_DPA_CLASSIFIER_H
#define __FSL_DPA_CLASSIFIER_H


/* DPA offloading layer includes */
#include "fsl_dpa_offload.h"


/* General definitions */

/* Maximum number of VLAN tags supported by the insert header manipulation */
#define DPA_CLS_HM_MAX_VLANs					6
/* Maximum number of MPLS labels supported by the insert header manipulation */
#define DPA_CLS_HM_MAX_MPLS_LABELS				6
/* Standard size of the DSCP-to-VPri mapping table */
#define DPA_CLS_HM_DSCP_TO_VLAN_TABLE_SIZE			32
/* Number of entries in the DSCP-to-VPri mapping table */
#define DPA_CLS_HM_DSCP_TO_VPRI_TABLE_SIZE			64


/* API functions, definitions and enums */

/* Table API */

/* DPA Classifier Table Types */
enum dpa_cls_tbl_type {
	DPA_CLS_TBL_HASH = 0,		/* HASH table */
	DPA_CLS_TBL_INDEXED,		/* Indexed table */
	DPA_CLS_TBL_EXACT_MATCH		/* Exact match table */
};

/* DPA Classifier Table Action Types */
enum dpa_cls_tbl_action_type {

	/* Unspecified action */
	DPA_CLS_TBL_ACTION_NONE = 0,

	/* Drop frame */
	DPA_CLS_TBL_ACTION_DROP,

	/* Send frame into a frame queue (enqueue) */
	DPA_CLS_TBL_ACTION_ENQ,

	/* Go to another table and re-classify the packet */
	DPA_CLS_TBL_ACTION_NEXT_TABLE,

	/* Send frames to a multicast group */
	DPA_CLS_TBL_ACTION_MCAST

};

/* DPA Classifier Table Entry Modification Types */
enum dpa_cls_tbl_modify_type {

	/*
	 * Modify the entry key. This modification is supported only on exact
	 * match tables.
	 */
	DPA_CLS_TBL_MODIFY_KEY = 0,

	/* Modify the entry action */
	DPA_CLS_TBL_MODIFY_ACTION,

	/*
	 * Modify the entry key and action. This modification is supported only
	 * on exact match tables.
	 */
	DPA_CLS_TBL_MODIFY_KEY_AND_ACTION
};

/* DPA Classifier Table Entry Management Types */
enum dpa_cls_tbl_entry_mgmt {
	/*
	 * Manage entries by key (shadow table). The shadow table consumes more
	 * RAM, but allows the user to do software lookups and refer to the
	 * table entries by their key as well as by their reference (Id)
	 */
	DPA_CLS_TBL_MANAGE_BY_KEY = 0,

	/*
	 * Manage entries by reference only (no shadow table). Saves memory and
	 * speeds up runtime operations, but the user cannot do software
	 * lookups and can only refer to the entries by their reference (Id)
	 */
	DPA_CLS_TBL_MANAGE_BY_REF,
};


/* DPA Classifier HASH table parameters */
struct dpa_cls_tbl_hash_params {

	/* Number of sets (buckets) of the HASH table */
	unsigned int	num_sets;

	/* Number of ways of the HASH table (capability to resolve conflicts) */
	unsigned int	max_ways;

	/* HASH offset */
	unsigned int	hash_offs;

	/* Key size in bytes */
	uint8_t		key_size;
};

/* DPA Classifier indexed table parameters */
struct dpa_cls_tbl_indexed_params {

	unsigned int	entries_cnt;	/* Number of entries in the table */
};

/* DPA Classifier exact match table parameters */
struct dpa_cls_tbl_exact_match_params {

	/* Number of entries in the table */
	unsigned int	entries_cnt;

	/* Key size in bytes */
	uint8_t		key_size;

	/* Use priorities for each entry in table if nonzero */
	bool		use_priorities;
};

/* DPA Classifier table parameters */
struct dpa_cls_tbl_params {
	/*
	 * Handle of the initial FM Cc node for this table
	 *
	 * This Cc node must be connected to a Cc tree.
	 */
	void					*cc_node;

	/*
	 * Handle to a FMan distribution to send frames to instead of
	 * enqueuing frames. If this handle is provided (not NULL) the enqueue
	 * action will only select the frame queue, but it will NOT actually
	 * enqueue the frame to the selected frame queue. Instead it will send
	 * the frame to the indicated distribution for further processing.
	 */
	void					*distribution;

	/*
	 * Handle to a FMan classification to send frames after distribution
	 */
	void                                    *classification;

	/* The type of the DPA Classifier table */
	enum dpa_cls_tbl_type			type;

	/* Table entry management mechanism for runtime */
	enum dpa_cls_tbl_entry_mgmt		entry_mgmt;

	union {
		/* Parameters for HASH table */
		struct dpa_cls_tbl_hash_params		hash_params;

		/* Parameters for indexed table */
		struct dpa_cls_tbl_indexed_params	indexed_params;

		/* Parameters for exact match table */
		struct dpa_cls_tbl_exact_match_params	exact_match_params;
	};

	/*
	 * Number of entries in the table which are pre-filled from the
	 * skeleton. The assumption is always that these entries are the first
	 * entries in the table and with the highest priority.
	 */
	unsigned int				prefilled_entries;
};

/* Policer parameters */
struct dpa_cls_tbl_policer_params {

	/* [True] if the default policer parameters will be overridden */
	bool		modify_policer_params;

	/* [True] if this policer profile is shared between ports; relevant
	 * only if [modify_policer_params] is set to [true]. */
	bool		shared_profile;

	/*
	 * This parameter should indicate the policer profile offset within the
	 * port's policer profiles or from the SHARED window; relevant only if
	 * [modify_policer_params] is set to [true].
	 */
	unsigned int	new_rel_profile_id;
};

/* Enqueue action parameters */
struct dpa_cls_tbl_enq_action_desc {

	/*
	 * Override the frame queue Id from KeyGen and use the one
	 * specified in this enqueue action descriptor if set to true
	 */
	bool					override_fqid;

	/*
	 * Id of the frame queue where to send the frames in case of
	 * rule hit.
	 */
	uint32_t				new_fqid;

	/*
	 * Pointer to the policer parameters. If NULL, no policing is
	 * applied during the enqueue.
	 */
	struct dpa_cls_tbl_policer_params	*policer_params;

	/*
	 * Descriptor of the header manipulation chain to use with this
	 * entry.
	 */
	int					hmd;

	/*
	 * New virtual storage profile Id. This parameter is mandatory when
	 * [override_fqid] is set to [true] and the port has virtual storage
	 * profiles defined. Otherwise it is not used.
	 */
	uint8_t					new_rel_vsp_id;
};

/* Action parameters to route to a new classifier table */
struct dpa_cls_tbl_next_table_desc {

	/*
	 * Descriptor of the next DPA Classifier table to continue
	 * classification with
	 */
	int		next_td;

	/*
	 * Descriptor of the header manipulation chain to use before sending
	 * the frames to the next table.
	 */
	int		hmd;
};

struct dpa_cls_tbl_mcast_group_desc {

	/*
	 * Descriptor of the multicast group to use with a specific table entry.
	 */
	int		grpd;

	/*
	 * Descriptor of the header manipulation chain that will be performed
	 * before sending the frames to the multicast group
	 */
	int		hmd;
};

/* DPA Classifier action descriptor */
struct dpa_cls_tbl_action {

	/*
	 * Action type specifier. Drop action doesn't require any
	 * further parameters
	 */
	enum dpa_cls_tbl_action_type	type;

	/* Enable statistics for this entry if nonzero */
	bool				enable_statistics;

	union {

		/* Specific parameters for enqueue action */
		struct dpa_cls_tbl_enq_action_desc	enq_params;

		/*
		 * Specific parameters for sending the frames to a new
		 * classifier table
		 */
		struct dpa_cls_tbl_next_table_desc	next_table_params;

		/*
		 * Specific parameters for sending the frame to a multicast
		 * group
		 */
		struct dpa_cls_tbl_mcast_group_desc	mcast_params;

	};
};

/* DPA Classifier entry modification parameters */
struct dpa_cls_tbl_entry_mod_params {

	/* The type of modification */
	enum dpa_cls_tbl_modify_type		type;

	/*
	 * The new key parameters to replace the existing key
	 * parameters of the entry. Ignored for modify types which
	 * do not refer to the key.
	 */
	struct dpa_offload_lookup_key		*key;

	/*
	 * The new action parameters to replace the existing action
	 * parameters of the entry. Ignored for modify types which
	 * do not refer to the action.
	 */
	struct dpa_cls_tbl_action		*action;
};

/* DPA Classifier table entry statistics */
struct dpa_cls_tbl_entry_stats {

	/* The total number of packets that have hit the entry */
	uint32_t	pkts;

	/* The total number of bytes that have hit the entry */
	uint32_t	bytes;
};


/*
 * Creates and initializes a DPA Classifier table using a FMan
 * coarse classification node. Depending on the type of table,
 * this call can result in MURAM allocation.
 *
 * Once the DPA Classifier takes control of a FMan Cc node, all
 * its management must be performed through this API. If
 * applications use different APIs to modify the Cc node's
 * properties in the same time while the DPA Classifier has
 * ownership of the node, unpredictable behavior and data
 * inconsistency can occur.
 */
int dpa_classif_table_create(const struct dpa_cls_tbl_params	*params,
				int				*td);

/*
 * Releases all resources associated with a DPA Classifier table
 * and destroys it.
 */
int dpa_classif_table_free(int td);

/* Modifies the action taken in case of lookup miss condition. */
int dpa_classif_table_modify_miss_action(int			td,
				const struct dpa_cls_tbl_action	*miss_action);

/*
 * Adds an entry (classification rule) in the specified DPA
 * Classifier table. If the MURAM for the table was pre-allocated,
 * this operation doesn't consume MURAM.
 *
 * The hardware currently doesn't support longest prefix match on
 * the exact match tables. If there are more entries in the
 * table that match the lookup (e.g. because of their mask) the
 * first one will always be returned by the hardware lookup.
 *
 * The priority parameter is meaningful only if [td] is an exact match table
 * with priority per entries. The priority value of the entry influences the
 * position of the entry in the table relative to the other entries. Entries
 * with lower priority values go to the top of the table. Priority values can
 * be negative. If two entries with the same priority are inserted in the
 * table, they will be positioned one after the other in the table, and the
 * older one first.
 */
int dpa_classif_table_insert_entry(int				td,
			const struct dpa_offload_lookup_key	*key,
			const struct dpa_cls_tbl_action		*action,
			int					priority,
			int					*entry_id);

/*
 * Modifies an entry in the specified DPA Classifier table. The
 * entry is identified by the lookup key. This function never
 * allocates new MURAM space.
 */
int dpa_classif_table_modify_entry_by_key(int			td,
		const struct dpa_offload_lookup_key		*key,
		const struct dpa_cls_tbl_entry_mod_params	*mod_params);

/*
 * Modifies an entry in the specified DPA Classifier table. The
 * entry is identified by its ref (Id). This function never
 * allocates new MURAM space.
 */
int dpa_classif_table_modify_entry_by_ref(int			td,
		int						entry_id,
		const struct dpa_cls_tbl_entry_mod_params	*mod_params);

/*
 * Removes an entry in the specified DPA Classifier table. The
 * entry is identified by the lookup key. If the MURAM for the
 * table was pre-allocated, this function doesn't free up any
 * MURAM space.
 */
int dpa_classif_table_delete_entry_by_key(int				td,
				const struct dpa_offload_lookup_key	*key);

/*
 * Removes an entry in the specified DPA Classifier table. The
 * entry is identified by its ref (Id). If the MURAM for the
 * table was pre-allocated, this function doesn't free up any
 * MURAM space.
 */
int dpa_classif_table_delete_entry_by_ref(int td, int entry_id);

/*
 * Performs a lookup in the specified table for an entry specified
 * by a key. If successful (i.e. the entry exists in that table)
 * the action descriptor for that entry is returned.
 *
 * Table lookup works only if entry management by key is selected
 * for the DPA Classifier table.
 *
 * This is not a hardware accelerated lookup. This lookup is
 * performed by the DPA Classifier in its internal shadow tables.
 * It is recommended to use this function with consideration.
 */
int dpa_classif_table_lookup_by_key(int				td,
			const struct dpa_offload_lookup_key	*key,
			struct dpa_cls_tbl_action		*action);

/*
 * Performs a lookup in the specified table for an entry specified
 * by its ref (Id). The action descriptor for that entry is
 * returned.
 *
 * Table lookup works only if entry management by key is selected
 * for the DPA Classifier table.
 */
int dpa_classif_table_lookup_by_ref(int				td,
				int				entry_id,
				struct dpa_cls_tbl_action	*action);

/*
 * Removes all the entries in a DPA Classifier Table. After this
 * operation is completed the entries cannot be recovered.
 */
int dpa_classif_table_flush(int td);

/*
 * Returns the statistics for a specified entry in a specified
 * table. The entry is identified by the lookup key.
 */
int dpa_classif_table_get_entry_stats_by_key(int			td,
				const struct dpa_offload_lookup_key	*key,
				struct dpa_cls_tbl_entry_stats		*stats);

/*
 * Returns the statistics for a specified entry in a specified
 * table. The entry is identified by its ref (pointer).
 */
int dpa_classif_table_get_entry_stats_by_ref(int		td,
				int				entry_id,
				struct dpa_cls_tbl_entry_stats	*stats);

/* Returns the miss statistics for the specified table. */
int dpa_classif_table_get_miss_stats(int			td,
				struct dpa_cls_tbl_entry_stats	*stats);


/* Returns the parameters of a classifier table. */
int dpa_classif_table_get_params(int td, struct dpa_cls_tbl_params *params);


/* Header Manipulation API */


/* Supported protocols for NAT header manipulations */
enum dpa_cls_hm_nat_proto {
	DPA_CLS_NAT_PROTO_UDP,
	DPA_CLS_NAT_PROTO_TCP,
	DPA_CLS_NAT_PROTO_ICMP,
	DPA_CLS_NAT_PROTO_LAST_ENTRY
};

/* NAT operation type */
enum dpa_cls_hm_nat_type {
	/* Traditional NAT */
	DPA_CLS_HM_NAT_TYPE_TRADITIONAL,

	/* NAT w/ protocol translation */
	DPA_CLS_HM_NAT_TYPE_NAT_PT,

	DPA_CLS_HM_NAT_TYPE_LAST_ENTRY
};

/*
 * Flag values indicating the possible fields to be updated with the
 * NAT header manipulation
 */
enum dpa_cls_hm_nat_flags {
	DPA_CLS_HM_NAT_UPDATE_SIP	= 0x01,
	DPA_CLS_HM_NAT_UPDATE_DIP	= 0x02,
	DPA_CLS_HM_NAT_UPDATE_SPORT	= 0x04,
	DPA_CLS_HM_NAT_UPDATE_DPORT	= 0x08
};

/* Type of protocol translation for NAT */
enum dpa_cls_hm_nat_pt_type {
	DPA_CLS_HM_NAT_PT_IPv6_TO_IPv4,
	DPA_CLS_HM_NAT_PT_IPv4_TO_IPv6
};

/*
 * Flag values indicating which attributes of the NAT header manipulation to
 * modify
 */
enum dpa_cls_hm_nat_modify_flags {
	DPA_CLS_HM_NAT_MOD_FLAGS	= 0x01,
	DPA_CLS_HM_NAT_MOD_SIP		= 0x02,
	DPA_CLS_HM_NAT_MOD_DIP		= 0x04,
	DPA_CLS_HM_NAT_MOD_SPORT	= 0x08,
	DPA_CLS_HM_NAT_MOD_DPORT	= 0x10,
	DPA_CLS_HM_NAT_MOD_IP_HDR	= 0x20
};

/* NAT header manipulation low level driver resources */
struct dpa_cls_hm_nat_resources {
	/*
	 * Handle to a header manipulation node which may combine a local
	 * IPv4/IPv6 update header manipulation with an IP protocol replace.
	 * This is a FMan driver header manipulation node handle and it is
	 * mandatory for the import to succeed.
	 */
	void	*l3_update_node;

	/*
	 * Handle to the local TCP/UDP update header manipulation node. This is
	 * a FMan driver header manipulation node handle and it is optional
	 * (can be NULL in case no L4 header updates are necessary for this NAT
	 * flow).
	 */
	void	*l4_update_node;
};

/* Traditional NAT parameters */
struct dpa_cls_hm_traditional_nat_params {
	/* New source IP address */
	struct dpa_offload_ip_address		sip;

	/* New destination IP address */
	struct dpa_offload_ip_address		dip;
};

/* NAT-PT parameters */
struct dpa_cls_hm_nat_pt_params {
	/*
	 * Specifies the protocol replacement for NAT-PT: either IPv4-to-IPv6
	 * or IPv6-to-IPv4
	 */
	enum dpa_cls_hm_nat_pt_type		type;

	union {
		/* New IPv4 header data to replace IPv6 with */
		struct ipv4_header		ipv4;

		/* New IPv6 header data to replace IPv4 with */
		struct ipv6_header		ipv6;
	} new_header;
};

/* Definition of a NAT related header manipulation */
struct dpa_cls_hm_nat_params {
	/*
	 * NAT operation flags specify which fields in the packet should be
	 * updated. This is a combination of the values in the
	 * dpa_cls_hm_nat_flags enum.
	 */
	int							flags;

	/* Protocol to perform NAT for */
	enum dpa_cls_hm_nat_proto				proto;

	/* Selects the flavor of NAT to configure */
	enum dpa_cls_hm_nat_type				type;


	union {
		/*
		 * Traditional NAT header manipulation parameters. Used only
		 * when traditional NAT is selected using the [type] attribute.
		 */
		struct dpa_cls_hm_traditional_nat_params	nat;

		/*
		 * NAT-PT header manipulation parameters. Used only when NAT-PT
		 * is selected using the [type] attribute.
		 */
		struct dpa_cls_hm_nat_pt_params			nat_pt;
	};

	/*
	 * New L4 protocol source port number; used when selected using the
	 * flags attribute.
	 */
	uint16_t						sport;

	/*
	 * New L4 protocol destination port number; used only when selected
	 * using the flags attribute
	 */
	uint16_t						dport;

	/*
	 * Handle to the low level driver PCD to use when creating the header
	 * manipulation object.
	 */
	void							*fm_pcd;

	/*
	 * Request re-parsing of the packet headers after this NAT.
	 */
	bool							reparse;
};

/* Output interface type for forwarding */
enum dpa_cls_hm_out_if_type {
	DPA_CLS_HM_IF_TYPE_ETHERNET,
	DPA_CLS_HM_IF_TYPE_PPPoE,
	DPA_CLS_HM_IF_TYPE_PPP,
	DPA_CLS_HM_IF_TYPE_LAST_ENTRY
};

/*
 * Flag values indicating which forwarding header manipulation attributes to
 * modify
 */
enum dpa_cls_hm_fwd_modify_flags {
	DPA_CLS_HM_FWD_MOD_ETH_MACSA		= 0x01,
	DPA_CLS_HM_FWD_MOD_ETH_MACDA		= 0x02,
	DPA_CLS_HM_FWD_MOD_PPPoE_HEADER		= 0x04,
	DPA_CLS_HM_FWD_MOD_PPP_PID		= 0x08,
	DPA_CLS_HM_FWD_MOD_IP_FRAG_MTU		= 0x10,
	DPA_CLS_HM_FWD_MOD_IP_FRAG_SCRATCH_BPID	= 0x20,
	DPA_CLS_HM_FWD_MOD_IP_FRAG_DF_ACTION	= 0x40
};

enum dpa_cls_hm_frag_df_action {
	DPA_CLS_HM_DF_ACTION_FRAG_ANYWAY,
	DPA_CLS_HM_DF_ACTION_DONT_FRAG,
	DPA_CLS_HM_DF_ACTION_DROP
};

/* IP fragmentation parameters */
struct dpa_cls_hm_ip_frag_params {
	/* Maximum Transfer Unit. Use zero to disable IP fragmentation. */
	uint16_t				mtu;

	/*
	 * Scratch buffer pool ID. This is necessary for the IP fragmentation
	 * on FMan v2 devices only. On FMan v3 or newer devices this parameter
	 * is ignored. It is also ignored if IP fragmentation is disabled.
	 */
	uint8_t					scratch_bpid;

	/* Specifies how to deal with packets with DF flag on */
	enum dpa_cls_hm_frag_df_action		df_action;
};

struct dpa_cls_hm_fwd_l2_param {
	/* New Ethernet destination MAC address to update the L2 header */
	uint8_t				macda[ETH_ALEN];

	/* New Ethernet source MAC address to update the L2 header */
	uint8_t				macsa[ETH_ALEN];
};

/* Forwarding header manipulation parameters for a PPPoE output interface */
struct dpa_cls_hm_fwd_pppoe_param {
	/* L2 header update parameters */
	struct dpa_cls_hm_fwd_l2_param		l2;

	/*
	 * PPPoE header to be inserted in the packets. The PPPoE payload length
	 * field is updated automatically (you can set it to zero).
	 */
	struct pppoe_header			pppoe_header;
};

/* Forwarding header manipulation parameters for a PPP output interface */
struct dpa_cls_hm_fwd_ppp_param {
	/* PPP PID value to use in the PPP header to be inserted */
	uint16_t				ppp_pid;
};

/* Forwarding header manipulation low level driver resources */
struct dpa_cls_hm_fwd_resources {
	/*
	 * Handle to the forwarding header manipulation node.
	 *
	 * In case of an Ethernet or a PPPoE output interface this is a local
	 * header replace header manipulation node (for Ethernet MAC addresses).
	 *
	 * In case of a PPP output interface this is a protocol specific header
	 * removal node (for Ethernet and VLAN tags) combined with an internal
	 * header insert.
	 *
	 * This is a FMan driver header manipulation node handle and it is
	 * mandatory for the import to succeed.
	 */
	void	*fwd_node;

	/*
	 * Handle to the PPPoE specific node. This is an internal protocol
	 * specific insert PPPoE header manipulation node. This is a FMan driver
	 * header manipulation node handle and it is optional (can be NULL in
	 * case the output interface type is not PPPoE).
	 */
	void	*pppoe_node;

	/*
	 * Handle to the IP fragmentation node. This is a FMan driver header
	 * manipulation node handle and it is optional (can be NULL in case no
	 * IP fragmentation is enabled for this IP forwarding flow).
	 */
	void	*ip_frag_node;
};

/* Forwarding header manipulation parameters */
struct dpa_cls_hm_fwd_params {
	/*
	 * Output interface type. Based on this selection the DPA Classifier
	 * decides which header manipulations are needed to perform forwarding.
	 */
	enum dpa_cls_hm_out_if_type			out_if_type;

	union {
		/* Necessary parameters for an Ethernet output interface */
		struct dpa_cls_hm_fwd_l2_param		eth;

		/* Necessary parameters for a PPPoE output interface */
		struct dpa_cls_hm_fwd_pppoe_param	pppoe;

		/* Necessary parameters for a PPP output interface */
		struct dpa_cls_hm_fwd_ppp_param		ppp;
	};

	/* Parameters related to optional IP fragmentation */
	struct dpa_cls_hm_ip_frag_params		ip_frag_params;

	/*
	 * Handle to the low level driver PCD to use when creating the header
	 * manipulation object.
	 */
	void						*fm_pcd;

	/*
	 * Request re-parsing of the packet headers after this forwarding
	 * header manipulation.
	 */
	bool						reparse;
};

/* Types of the remove header manipulation operations */
enum dpa_cls_hm_remove_type {
	DPA_CLS_HM_REMOVE_ETHERNET,	/* removes ETH and all QTags */
	DPA_CLS_HM_REMOVE_PPPoE,	/* removes ETH, all QTags and PPPoE */
	DPA_CLS_HM_REMOVE_PPP,
	DPA_CLS_HM_REMOVE_CUSTOM,	/* General remove */
	DPA_CLS_HM_REMOVE_LAST_ENTRY
};

/*
 * Flag values indicating which attributes of the remove header manipulation
 * to modify
 */
enum dpa_cls_hm_remove_modify_flags {
	DPA_CLS_HM_RM_MOD_TYPE		= 0x01,
	DPA_CLS_HM_RM_MOD_CUSTOM_OFFSET	= 0x02,
	DPA_CLS_HM_RM_MOD_CUSTOM_SIZE	= 0x04
};

/* General (custom) remove header manipulation parameters */
struct dpa_cls_hm_custom_rm_params {
	/*
	 * Offset in bytes, relative to the start of the packet, to start
	 * removing data from
	 */
	uint8_t						offset;

	/* The size in bytes of the section to remove */
	uint8_t						size;
};

/* Ingress remove header manipulation low level driver resources */
struct dpa_cls_hm_remove_resources {
	/*
	 * Handle to either a header removal node or a protocol specific header
	 * removal node (for Ethernet and all VLAN tags). This is a FMan driver
	 * header manipulation node handle and it is mandatory for the import
	 * to succeed.
	 */
	void	*remove_node;
};

/* Ingress (remove) header manipulation parameters */
struct dpa_cls_hm_remove_params {

	/*
	 * Selects the type of the remove header manipulation operation  to
	 * perform. Protocol specific header removals don't need any further
	 * parameters.
	 */
	enum dpa_cls_hm_remove_type			type;

	/*
	 * Parameters for the custom remove header manipulation. If [type] is
	 * anything else than "custom remove", these parameters are ignored
	 */
	struct dpa_cls_hm_custom_rm_params		custom;

	/*
	 * Handle to the low level driver PCD to use when creating the header
	 * manipulation object.
	 */
	void						*fm_pcd;

	/*
	 * Request re-parsing of the packet headers after this header remove.
	 */
	bool						reparse;
};

/* Types of insert header manipulation operations */
enum dpa_cls_hm_insert_type {
	DPA_CLS_HM_INSERT_ETHERNET,	/* Insert Ethernet + QTags */
	DPA_CLS_HM_INSERT_PPPoE,	/* Insert PPPoE, ETH and QTags */
	DPA_CLS_HM_INSERT_PPP,
	DPA_CLS_HM_INSERT_CUSTOM,	/* General insert */
	DPA_CLS_HM_INSERT_LAST_ENTRY
};

/*
 * Flag values indicating which attributes of the insert header manipulation
 * to modify
 */
enum dpa_cls_hm_insert_modify_flags {
	/* Ethernet and PPPoE insert group */
	DPA_CLS_HM_INS_MOD_ETH_HEADER		= 0x01,
	DPA_CLS_HM_INS_MOD_QTAGS		= 0x02,
	DPA_CLS_HM_INS_MOD_PPPoE_HEADER		= 0x04,

	/* PPP insert group */
	DPA_CLS_HM_INS_MOD_PPP_PID		= 0x08,

	/* Custom insert group */
	DPA_CLS_HM_INS_MOD_CUSTOM_OFFSET	= 0x10,
	DPA_CLS_HM_INS_MOD_CUSTOM_DATA		= 0x20
};

/* General insert parameters */
struct dpa_cls_hm_custom_ins_params {
	/*
	 * Offset in bytes relative to the start of the frame to insert new
	 * header at.
	 */
	uint8_t		offset;

	/* The size in bytes of the header to insert */
	uint8_t		size;

	/*
	 * The data buffer containing the header to insert. This buffer must be
	 * at least [size] bytes long
	 */
	const uint8_t	*data;
};

/* Egress insert header manipulation low level driver resources */
struct dpa_cls_hm_insert_resources {
	/*
	 * Handle to either an internal header insert or an internal protocol
	 * specific header insert node. This is a FMan driver header
	 * manipulation node handle and it is mandatory for the import to
	 * succeed.
	 */
	void	*insert_node;
};

/* Ethernet header insert params */
struct dpa_cls_hm_eth_ins_params {
	/* Ethernet header to insert */
	struct ethhdr				eth_header;

	/*
	 * Number of VLAN tags to insert. If zero, no VLAN tags will be inserted
	 * in the packet
	 */
	unsigned int				num_tags;

	/*
	 * Relevant only if [num_tags] is not zero. Contains an array with the
	 * data of the VLAN QTags to insert
	 */
	struct vlan_header			qtag[DPA_CLS_HM_MAX_VLANs];
};

/* PPPoE header insert params */
struct dpa_cls_hm_pppoe_ins_params {
	/*
	 * Parameters of the Ethernet header to insert together with PPPoE
	 * header
	 */
	struct dpa_cls_hm_eth_ins_params	eth;

	/* PPPoE header to insert */
	struct pppoe_header			pppoe_header;
};

/* Ethernet header insert params */
struct dpa_cls_hm_insert_params {
	/* Specifies the type of insert header manipulation */
	enum dpa_cls_hm_insert_type			type;

	union {
		/*
		 * Ethernet header insert parameters if type is "insert
		 * Ethernet"
		 */
		struct dpa_cls_hm_eth_ins_params	eth;

		/* PPPoE header insert parameters if type is "insert PPPoE" */
		struct dpa_cls_hm_pppoe_ins_params	pppoe;

		/*
		 * PPP PID value to use in the PPP header if type is "insert
		 * PPP"
		 */
		uint16_t				ppp_pid;

		/*
		 * Custom insert header manipulation operation parameters.
		 * These are relevant only if a custom insert header
		 * manipulation operation is selected.
		 */
		struct dpa_cls_hm_custom_ins_params	custom;
	};

	/*
	 * Handle to the low level driver PCD to use when creating the header
	 * manipulation object.
	 */
	void						*fm_pcd;

	/*
	 * Request re-parsing of the packet headers after this header insert.
	 */
	bool						reparse;
};

/* Update header manipulation op flags */
enum dpa_cls_hm_update_op_flags {
	DPA_CLS_HM_UPDATE_NONE			= 0,

	DPA_CLS_HM_UPDATE_IPv4_UPDATE		= 0x01,
	DPA_CLS_HM_UPDATE_IPv6_UPDATE		= 0x02,
	DPA_CLS_HM_UPDATE_UDP_TCP_UPDATE	= 0x04,

	DPA_CLS_HM_REPLACE_IPv4_BY_IPv6		= 0x08,
	DPA_CLS_HM_REPLACE_IPv6_BY_IPv4		= 0x10
};

/* Update header manipulation field flags */
enum dpa_cls_hm_l3_field_flags {
	DPA_CLS_HM_IP_UPDATE_IPSA		= 0x01,
	DPA_CLS_HM_IP_UPDATE_IPDA		= 0x02,
	DPA_CLS_HM_IP_UPDATE_TOS_TC		= 0x04,
	DPA_CLS_HM_IP_UPDATE_ID			= 0x08,
	DPA_CLS_HM_IP_UPDATE_TTL_HOPL_DECREMENT	= 0x10
};

/* L4 header update field flags */
enum dpa_cls_hm_l4_field_flags {
	DPA_CLS_HM_L4_UPDATE_SPORT		= 0x01,
	DPA_CLS_HM_L4_UPDATE_DPORT		= 0x02,
	DPA_CLS_HM_L4_UPDATE_CALCULATE_CKSUM	= 0x04
};

/*
 * Flag values indicating which attributes of the update header manipulation
 * to modify
 */
enum dpa_cls_hm_update_modify_flags {
	DPA_CLS_HM_UPDATE_MOD_IPHDR		= 0x0001,

	/* L3 protocol flags group */
	DPA_CLS_HM_UPDATE_MOD_SIP		= 0x0002,
	DPA_CLS_HM_UPDATE_MOD_DIP		= 0x0004,
	DPA_CLS_HM_UPDATE_MOD_TOS_TC		= 0x0008,
	DPA_CLS_HM_UPDATE_MOD_IP_ID		= 0x0010,
	DPA_CLS_HM_UPDATE_MOD_L3_FLAGS		= 0x0020,

	/* L4 protocol flags group */
	DPA_CLS_HM_UPDATE_MOD_SPORT		= 0x0040,
	DPA_CLS_HM_UPDATE_MOD_DPORT		= 0x0080,
	DPA_CLS_HM_UPDATE_MOD_L4_FLAGS		= 0x0100,

	DPA_CLS_HM_UPDATE_MOD_IP_FRAG_MTU	= 0x0200,
	DPA_CLS_HM_UPDATE_MOD_IP_FRAG_SCRATCH_BPID = 0x0400,
	DPA_CLS_HM_UPDATE_MOD_IP_FRAG_DF_ACTION = 0x0800
};

/* L3 protocols field update parameters */
struct dpa_cls_hm_l3_update_params {
	/* New source IP address */
	struct dpa_offload_ip_address		ipsa;

	/* New destination IP address */
	struct dpa_offload_ip_address		ipda;

	/* New TOS (for IPv4) or Traffic Class (for IPv6) */
	uint8_t					tos_tc;

	/*
	 * Initial IPv4 ID. This is used only if op_flags selected IPv4 update
	 */
	uint16_t				initial_id;

	/*
	 * A combination of flags designating the header fields to replace. The
	 * available options are defined in the dpa_cls_hm_l3_field_flags enum
	 */
	int					field_flags;
};

/* L4 protocols field update parameters */
struct dpa_cls_hm_l4_update_params {
	uint16_t	sport; /* new L4 source port value */
	uint16_t	dport; /* new L4 destination port value */

	/*
	 * A combination of flags designating the header fields to replace. The
	 * available options are defined in the dpa_cls_hm_l4_field_flags enum
	 */
	int		field_flags;
};

/* Egress update header manipulation low level driver resources */
struct dpa_cls_hm_update_resources {
	/*
	 * Handle to a header manipulation node with different header
	 * manipulations enabled, depending on the options selected in the
	 * parameters: local IPv4/IPv6 update header manipulation, a local
	 * TCP/UDP update header manipulation and an internal IP header replace.
	 * This is a FMan driver header manipulation node handle and it is
	 * optional (can be NULL in case no L3 or L4 field updates or header
	 * replace features are enabled for this flow)
	 */
	void	*update_node;

	/*
	 * Handle to the IP fragmentation node. This is a FMan driver header
	 * manipulation node handle and it is optional (can be NULL in case no
	 * IP fragmentation is enabled for this flow).
	 */
	void	*ip_frag_node;
};

/* Egress update header manipulation parameters */
struct dpa_cls_hm_update_params {
	/*
	 * Flags defining the header manipulation operations to perform. They
	 * are a combination of the flags defined in the
	 * dpa_cls_hm_update_op_flags enum.
	 */
	int						op_flags;

	union {
		/*
		 * IPv4 header data. This header is used for IPv6 to IPv4 header
		 * replace.
		 */
		struct ipv4_header			new_ipv4_hdr;

		/*
		 * IPv6 header data. This header is used for IPv4 to IPv6
		 * header replace.
		 */
		struct ipv6_header			new_ipv6_hdr;
	} replace;

	union {
		/*
		 * L3 protocol field values. This data is used for L3 protocol
		 * header updates
		 */
		struct dpa_cls_hm_l3_update_params	l3;

		/*
		 * L4 protocol field values. This data is used for L4 protocol
		 * header updates.
		 */
		struct dpa_cls_hm_l4_update_params	l4;
	} update;

	/*
	 * IP fragmentation parameters. This is an optional operation and can
	 * be disabled.
	 */
	struct dpa_cls_hm_ip_frag_params		ip_frag_params;

	/*
	 * Handle to the low level driver PCD to use when creating the header
	 * manipulation object.
	 */
	void						*fm_pcd;

	/*
	 * Request re-parsing of the packet headers after this header update.
	 */
	bool						reparse;
};

/* VLAN specific header manipulation operation types */
enum dpa_cls_hm_vlan_type {
	DPA_CLS_HM_VLAN_INGRESS,
	DPA_CLS_HM_VLAN_EGRESS,
	DPA_CLS_HM_VLAN_LAST_ENTRY
};

/* Types of supported VLAN update operations */
enum dpa_cls_hm_vlan_update_type {
	DPA_CLS_HM_VLAN_UPDATE_NONE,
	DPA_CLS_HM_VLAN_UPDATE_VPri,	/* manual VPri update */
	DPA_CLS_HM_VLAN_UPDATE_VPri_BY_DSCP,
	DPA_CLS_HM_VLAN_UPDATE_LAST_ENTRY
};

/* VLAN QTag identifier */
enum dpa_cls_hm_vlan_count {
	DPA_CLS_HM_VLAN_CNT_NONE,
	DPA_CLS_HM_VLAN_CNT_1QTAG,	/* outer QTag */
	DPA_CLS_HM_VLAN_CNT_2QTAGS,	/* outer most 2 QTags */
	DPA_CLS_HM_VLAN_CNT_3QTAGS,	/* outer most 3 QTags */
	DPA_CLS_HM_VLAN_CNT_4QTAGS,	/* outer most 4 QTags */
	DPA_CLS_HM_VLAN_CNT_5QTAGS,	/* outer most 5 QTags */
	DPA_CLS_HM_VLAN_CNT_6QTAGS,	/* outer most 6 QTags */
	DPA_CLS_HM_VLAN_CNT_ALL_QTAGS,
	DPA_CLS_HM_VLAN_CNT_LAST_ENTRY
};

/*
 * Flag values indicating which attributes of the VLAN specific header
 * manipulation to modify
 */
enum dpa_cls_hm_vlan_modify_flags {
	/* This flag cannot be combined with any other flags */
	DPA_CLS_HM_VLAN_MOD_INGRESS_NUM_QTAGS		= 0x01,

	DPA_CLS_HM_VLAN_MOD_EGRESS_QTAGS		= 0x02,
	DPA_CLS_HM_VLAN_MOD_EGRESS_UPDATE_OP		= 0x04,
	DPA_CLS_HM_VLAN_MOD_EGRESS_VPRI			= 0x08,
	DPA_CLS_HM_VLAN_MOD_EGRESS_DSCP_TO_VPRI_ARRAY	= 0x10
};

/* Ingress VLAN specific header manipulation parameters */
struct dpa_cls_hm_ingress_vlan_params {
	/* Number of VLAN tags to remove */
	enum dpa_cls_hm_vlan_count		num_tags;
};

/* Egress VLAN specific header manipulation parameters */
struct dpa_cls_hm_egress_vlan_params {
	enum dpa_cls_hm_vlan_update_type	update_op;

	/*
	 * Number of VLAN tags to insert. If zero, no VLAN tags will be
	 * inserted in the packet.
	 */
	unsigned int				num_tags;

	/*
	 * Relevant only if [num_tags] is not zero. Contains an array with the
	 * data of the VLAN tags to insert.
	 */
	struct vlan_header			qtag[DPA_CLS_HM_MAX_VLANs];

	union {
		/*
		 * New VPri field value if [update_flag] selects manual VPri
		 * update.
		 */
		uint8_t vpri;

		/*
		 * DSCP-to-VPri mapping table to use for VPri field update if
		 * [update_flag] selects VPri update by mapping to DSCP.
		 */
		uint8_t dscp_to_vpri[DPA_CLS_HM_DSCP_TO_VPRI_TABLE_SIZE];

	} update;
};

/* VLAN specific header manipulation low level resources */
struct dpa_cls_hm_vlan_resources {
	/*
	 * Handle to a header manipulation node with different operations
	 * depending on the selected type of VLAN specific header manipulation.
	 *
	 * In case of VLAN ingress header manipulation this is a VLAN protocol
	 * specific removal node.
	 *
	 * In case of VLAN egress header manipulation this is a header
	 * manipulation node which may combine an internal header insert (in
	 * case there are VLANs to insert) with a protocol specific VLAN update
	 * operation.
	 *
	 * This is a FMan driver header manipulation node handle and it is
	 * mandatory for the import to succeed.
	 */
	void	*vlan_node;
};

/* VLAN specific header manipulation parameters */
struct dpa_cls_hm_vlan_params {
	/* Selects the type of the VLAN specific header manipulation */
	enum dpa_cls_hm_vlan_type			type;

	union {
		/* Parameters for ingress VLAN header manipulations */
		struct dpa_cls_hm_ingress_vlan_params	ingress;

		/* Parameters for egress VLAN header manipulations */
		struct dpa_cls_hm_egress_vlan_params	egress;
	};

	/*
	 * Handle to the low level driver PCD to use when creating the header
	 * manipulation object.
	 */
	void						*fm_pcd;

	/*
	 * Request re-parsing of the packet headers after this VLAN header
	 * update.
	 */
	bool						reparse;
};

/* MPLS specific header manipulation operation types */
enum dpa_cls_hm_mpls_type {
	DPA_CLS_HM_MPLS_INSERT_LABELS,
	DPA_CLS_HM_MPLS_REMOVE_ALL_LABELS,
	DPA_CLS_HM_MPLS_LAST_ENTRY
};

/*
 * Flag values indicating which attributes of the MPLS specific header
 * manipulation to modify
 */
enum dpa_cls_hm_mpls_modify_flags {
	DPA_CLS_HM_MPLS_MOD_NUM_LABELS	= 0x01,
	DPA_CLS_HM_MPLS_MOD_HDR_ARRAY	= 0x02,
};

/* MPLS specific header manipulation low level driver resources */
struct dpa_cls_hm_mpls_resources {
	/*
	 * Handle to the protocol specific header insert (MPLS) or to the
	 * protocol specific header removal (MPLS) node. This is a FMan driver
	 * header manipulation node handle and it is mandatory for the import
	 * to succeed.
	 */
	void	*ins_rm_node;
};

/* MPLS specific header manipulation parameters */
struct dpa_cls_hm_mpls_params {
	/* Specifies the type of header manipulation */
	enum dpa_cls_hm_mpls_type	type;

	/*
	 * Stores the MPLS labels to insert if the operation type is "insert
	 * MPLS labels"
	 */
	struct mpls_header		mpls_hdr[DPA_CLS_HM_MAX_MPLS_LABELS];

	/*
	 * Number of MPLS labels to insert. This is relevant only if the
	 * operation type is "insert MPLS labels" */
	unsigned int			num_labels;

	/*
	 * Handle to the low level driver PCD to use when creating the header
	 * manipulation object.
	 */
	void				*fm_pcd;

	/*
	 * Request re-parsing of the packet headers after this MPLS header
	 * update.
	 */
	bool				reparse;
};


/*
 * Creates or imports a NAT type header manipulation object. If the function is
 * successful it returns at the [hmd] location the descriptor of the created
 * header manipulation object.
 *
 * If the [res] parameter is provided, the function will import the low level
 * driver resources specified therein rather than create them. In this case the
 * [fm_pcd] handle in the parameters structure is not used and can be provided
 * as NULL. When working in this mode the function doesn't allocate MURAM.
 */
int dpa_classif_set_nat_hm(const struct dpa_cls_hm_nat_params	*nat_params,
			int					next_hmd,
			int					*hmd,
			bool					chain_head,
			const struct dpa_cls_hm_nat_resources	*res);

/*
 * Modify the parameters of an existing NAT header manipulation.
 *
 * [modify_flags] is a combination of flags indicating which header manipulation
 * attributes to modify (and hence indicating which of the attributes in the
 * [new_nat_params] data structure are valid). Select the flag values from the
 * dpa_cls_hm_nat_modify_flags enum and combine them using the "or" logical
 * operand.
 */
int dpa_classif_modify_nat_hm(int hmd,
	const struct dpa_cls_hm_nat_params *new_nat_params, int modify_flags);

/*
 * Creates or imports a forwarding type header manipulation object. DPA
 * Classifier takes into account an Ethernet/IP frame to start with and,
 * depending on the selection of output interface type, it decides what header
 * manipulations are necessary.
 *
 * If the [res] parameter is provided, the function will import the low level
 * driver resources specified therein rather than create them. In this case the
 * [fm_pcd] handle in the parameters structure is not used and can be provided
 * as NULL. When working in this mode the function doesn't allocate MURAM.
 */
int dpa_classif_set_fwd_hm(const struct dpa_cls_hm_fwd_params	*fwd_params,
			int					next_hmd,
			int					*hmd,
			bool					chain_head,
			const struct dpa_cls_hm_fwd_resources	*res);

/*
 * Modify the parameters of an existing forwarding type header manipulation.
 *
 * [modify_flags] is a combination of flags indicating which header manipulation
 * attributes to modify (and hence indicating which of the attributes in the
 * [new_fwd_params] data structure are valid). Select the flag values from the
 * dpa_cls_hm_fwd_modify_flags enum and combine them using the "or" logical
 * operand.
 */
int dpa_classif_modify_fwd_hm(int hmd,
	const struct dpa_cls_hm_fwd_params *new_fwd_params, int modify_flags);

/* Creates or imports a remove type header manipulation object.
 *
 * If the [res] parameter is provided, the function will import the low level
 * driver resources specified therein rather than create them. In this case the
 * [fm_pcd] handle in the parameters structure is not used and can be provided
 * as NULL. When working in this mode the function doesn't allocate MURAM.
 */
int dpa_classif_set_remove_hm(const struct dpa_cls_hm_remove_params
	*remove_params, int next_hmd, int *hmd, bool chain_head,
	const struct dpa_cls_hm_remove_resources *res);

/*
 * Modify the parameters of an existing remove type header manipulation.
 *
 * [modify_flags] is a combination of flags indicating which header manipulation
 * attributes to modify (and hence indicating which of the attributes in the
 * [new_remove_params] data structure are valid). Select the flag values from
 * the dpa_cls_hm_remove_modify_flags enum and combine them using the "or"
 * logical operand.
 */
int dpa_classif_modify_remove_hm(int hmd,
	const struct dpa_cls_hm_remove_params *new_remove_params,
	int modify_flags);

/*
 * Creates or imports an insert type header manipulation object.
 *
 * If the [res] parameter is provided, the function will import the low level
 * driver resources specified therein rather than create them. In this case the
 * [fm_pcd] handle in the parameters structure is not used and can be provided
 * as NULL. When working in this mode the function doesn't allocate MURAM.
 */
int dpa_classif_set_insert_hm(const struct dpa_cls_hm_insert_params
	*insert_params, int next_hmd, int *hmd, bool chain_head,
	const struct dpa_cls_hm_insert_resources *res);

/*
 * Modify the parameters of an existing insert header manipulation.
 *
 * [modify_flags] is a combination of flags indicating which header manipulation
 * attributes to modify (and hence indicating which of the attributes in the
 * [new_insert_params] data structure are valid). Select the flag values from
 * the dpa_cls_hm_insert_modify_flags enum and combine them using the "or"
 * logical operand.
 */
int dpa_classif_modify_insert_hm(int hmd,
	const struct dpa_cls_hm_insert_params *new_insert_params,
	int modify_flags);

/*
 * Creates or imports an update type header manipulation object.
 *
 * If the [res] parameter is provided, the function will import the low level
 * driver resources specified therein rather than create them. In this case the
 * [fm_pcd] handle in the parameters structure is not used and can be provided
 * as NULL. When working in this mode the function doesn't allocate MURAM.
 */
int dpa_classif_set_update_hm(const struct dpa_cls_hm_update_params
	*update_params, int next_hmd, int *hmd, bool chain_head,
	const struct dpa_cls_hm_update_resources *res);

/*
 * Modify the parameters of an existing update header manipulation.
 *
 * [modify_flags] is a combination of flags indicating which header manipulation
 * attributes to modify (and hence indicating which of the attributes in the
 * [new_update_params] data structure are valid). Select the flag values from
 * the dpa_cls_hm_update_modify_flags enum and combine them using the "or"
 * logical operand.
 */
int dpa_classif_modify_update_hm(int hmd,
	const struct dpa_cls_hm_update_params *new_update_params,
	int modify_flags);

/*
 * Creates or imports a VLAN specific header manipulation (either ingress or
 * egress) object.
 *
 * If the [res] parameter is provided, the function will import the low level
 * driver resources specified therein rather than create them. In this case the
 * [fm_pcd] handle in the parameters structure is not used and can be provided
 * as NULL. When working in this mode the function doesn't allocate MURAM.
 */
int dpa_classif_set_vlan_hm(const struct dpa_cls_hm_vlan_params	*vlan_params,
			int					next_hmd,
			int					*hmd,
			bool					chain_head,
			const struct dpa_cls_hm_vlan_resources	*res);

/*
 * Modify the parameters of an existing VLAN specific header manipulation.
 *
 * [modify_flags] is a combination of flags indicating which header manipulation
 * attributes to modify (and hence indicating which of the attributes in the
 * [new_vlan_params] data structure are valid). Select the flag values from the
 * dpa_cls_hm_vlan_modify_flags enum and combine them using the "or" logical
 * operand.
 */
int dpa_classif_modify_vlan_hm(int hmd,
	const struct dpa_cls_hm_vlan_params *new_vlan_params, int modify_flags);

/*
 * Creates or imports a MPLS specific header manipulation object.
 *
 * If the [res] parameter is provided, the function will import the low level
 * driver resources specified therein rather than create them. In this case the
 * [fm_pcd] handle in the parameters structure is not used and can be provided
 * as NULL. When working in this mode the function doesn't allocate MURAM.
 */
int dpa_classif_set_mpls_hm(const struct dpa_cls_hm_mpls_params	*mpls_params,
			int					next_hmd,
			int					*hmd,
			bool					chain_head,
			const struct dpa_cls_hm_mpls_resources	*res);

/*
 * Modify the parameters of an existing MPLS specific header manipulation.
 *
 * [modify_flags] is a combination of flags indicating which header manipulation
 * attributes to modify (and hence indicating which of the attributes in the
 * [new_mpls_params] data structure are valid). Select the flag values from the
 * dpa_cls_hm_mpls_modify_flags enum and combine them using the "or" logical
 * operand.
 */
int dpa_classif_modify_mpls_hm(int hmd,
	const struct dpa_cls_hm_mpls_params *new_mpls_params, int modify_flags);

/*
 * Releases a header manipulation object and frees up all related resources
 * allocated for it. The header manipulation operations must be removed in the
 * reverse order they were created in (i.e. starting with the header
 * manipulation chain head and working towards the tail).
 */
int dpa_classif_free_hm(int hmd);


/*
 * Multicast API
 */

/*
 * Multicast group parameters
 */
struct dpa_cls_mcast_group_params {
	/*
	 * Maximum number of members in group
	 */
	uint8_t		max_members;

	/*
	 * Handle of the FM PCD that owns the Cc node that will
	 * point to the group
	 */
	void		*fm_pcd;

	/*
	 * Member parameters. A group must have at least
	 * one member
	 */
	struct		dpa_cls_tbl_enq_action_desc first_member_params;

	/*
	 * Number of members that already exist in the imported group
	 */
	unsigned int prefilled_members;

	/*
	 * External distribution handle. When provided, replicated frames
	 * are not enqueued to members' frame queues. They are sent to this
	 * distribution.
	 */
	void		*distribution;

	/*
	 * Handle to a FMan classification to send frames after distribution
	 */
	void		*classification;
};

/* Multicast group external resource */
struct dpa_cls_mcast_group_resources {
	/*
	 * Multicast group handle used when importing an external group node
	 */
	void	*group_node;
};

/*
 * Creates a multicast group with one member
 */
int dpa_classif_mcast_create_group(
		const struct dpa_cls_mcast_group_params *group_params,
		int *grpd,
		const struct dpa_cls_mcast_group_resources *res);

/*
 * Adds a new member to a multicast group
 */
int dpa_classif_mcast_add_member(int grpd,
		const struct dpa_cls_tbl_enq_action_desc *member_params,
		int *md);

/*
 * Removes a member from a multicast group
 */
int dpa_classif_mcast_remove_member(int grpd, int md);

/*
 * Removes an existing group
 */
int dpa_classif_mcast_free_group(int grpd);


#endif /* __FSL_DPA_CLASSIFIER_H */