5113f6f70
김현기
kernel add
|
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
|
/*
* Keystone NetCP PA2 (Packet Accelerator) firmware interface header file
*
* Copyright (C) 2013-2015 Texas Instruments Incorporated
* Author : Murali Karicheri (ported to kernel 4.1.x)
*
* Other contributors: Hao Zhang (Initial version of the driver)
* Reece Pollack (Maintenance)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef KEYSTONE_PA2_FW_H
#define KEYSTONE_PA2_FW_H
/* PA Timer */
enum pa2_timerstamp_scaler_factor {
PA2_TIMESTAMP_SCALER_FACTOR_1 = -1,
PA2_TIMESTAMP_SCALER_FACTOR_2 = 0,
PA2_TIMESTAMP_SCALER_FACTOR_4,
PA2_TIMESTAMP_SCALER_FACTOR_8,
PA2_TIMESTAMP_SCALER_FACTOR_16,
PA2_TIMESTAMP_SCALER_FACTOR_32,
PA2_TIMESTAMP_SCALER_FACTOR_64,
PA2_TIMESTAMP_SCALER_FACTOR_128,
PA2_TIMESTAMP_SCALER_FACTOR_256,
PA2_TIMESTAMP_SCALER_FACTOR_512,
PA2_TIMESTAMP_SCALER_FACTOR_1024,
PA2_TIMESTAMP_SCALER_FACTOR_2048,
PA2_TIMESTAMP_SCALER_FACTOR_4096,
PA2_TIMESTAMP_SCALER_FACTOR_8192
};
#define PA2_SS_TIMER_CNTRL_REG_GO 0x1u
#define PA2_SS_TIMER_CNTRL_REG_MODE 0x2u
#define PA2_SS_TIMER_CNTRL_REG_PSE 0x8000u
#define PA2_SS_TIMER_CNTRL_REG_PRESCALE_SHIFT 0x2u
#define PA2_SYS_TIMESTAMP_ADDR_OFFSET 0xf0
/* PA Commands */
#define PA2FRM_MAX_CMD_SET_SIZE 124
/* Routed Packet Destinations */
/* Packet is discarded */
#define PA2_DEST_DISCARD 3
/* Packet remains in PA sub-system for more parsing and LUT1 classification */
#define PA2_DEST_CONTINUE_PARSE_LUT1 4
/* Packet remains in PA sub-system for more parsing and LUT2 classification */
#define PA2_DEST_CONTINUE_PARSE_LUT2 5
/* Packet is routed to host */
#define PA2_DEST_HOST 6
/* Packet is routed to EMAC */
#define PA2_DEST_EMAC 7
/* Packet is routed to SA */
#define PA2_DEST_SASS 8
/* Packet is routed to SRIO */
#define PA2_DEST_SRIO 9
/* Cascaded forwarding packet remains in PA sub-system for next LUT1 (IP)
* parsing. Those packets are expected to be delivered to QoS queues based
* on the VLAN/DSCP priority at the next stage so that some PASS actions
* such as IP reassembly and IP fragment exception route will be disabled.
*/
#define PA2_DEST_CASCADED_FORWARDING_LUT1 10
/* Packet is routed to SA through local DMA */
#define PA2_DEST_SASS_LOC_DMA 11
/* Packet is routed to Egress Flow Path */
#define PA2_DEST_EFLOW 12
/* Reseved destination for internal usage */
#define PA2_DEST_RES_1 20
/* Reseved destination for internal usage */
#define PA2_DEST_RES_2 21
/* Multi Route */
#define PA2_NO_MULTI_ROUTE -1
#define PA2_MAX_MULTI_ROUTE_SETS 32
#define PA2_MAX_MULTI_ROUTE_ENTRIES 8
#define PA2_MULTI_ROUTE_DESCRIPTOR_ONLY 0x01
#define PA2_MULTI_ROUTE_REPLACE_SWINFO 0x02
/* Egress FLOW Operation */
#define PA2_EF_OP_CONTROL_FLAG_FC_LOOKUP 0x0001
#define PA2_EF_OP_INFO_VALID_LVL1 0x0001
#define PA2_EF_OP_INFO_VALID_LVL2 0x0002
#define PA2_EF_OP_INFO_VALID_LVL3 0x0004
#define PA2_EF_OP_INFO_VALID_LVL4 0x0008
struct pa2_ef_op_info {
/* Specify Egress flow control flags as defined at
* paEfOpInfoCtrlFlags
*/
u16 ctrl_flags;
/* Specify valid parameters as defined at paEfOpInfoValidBit */
u16 valid_bitmap;
/* Specify egress flow level 1 record index */
u16 lvl1_index;
/* Specify egress flow level 2 record index */
u16 lvl2_index;
/* Specify egress flow level 3 record index */
u16 lvl3_index;
/* Specify egress flow level 4 record index */
u16 lvl4_index;
};
enum pa2_route_pri_info {
/* Route by using VLAN bits as pri */
PA2_ROUTE_PRIORITY_VLAN = 1,
/* Route by using DSCP bits as pri */
PA2_ROUTE_PRIORITY_DSCP,
/* Route by using EMAC port (interface) number as destination
* queue offset
*/
PA2_ROUTE_INTF,
/* Route by using EMAC port (interface) number as both destination
* queue and CPPI flow offset
*/
PA2_ROUTE_INTF_W_FLOW
};
/* EMAC Control */
#define PA2_EMAC_CTRL_PORT_MASK 0x0F
#define PA2_EMAC_CTRL_CRC_DISABLE 0x80
/* Custom Classification Types */
#define PA2_CUSTOM_TYPE_NONE 0
#define PA2_CUSTOM_TYPE_LUT1 1
#define PA2_CUSTOM_TYPE_LUT2 2
#define PA2_MAX_CUSTOM_TYPES_LUT1 4
#define PA2_MAX_CUSTOM_TYPES_LUT2 16
/* Command Transmit Packet Destinations */
/* Packet is sent to INGRESS0/PDSP0 */
#define PA2_CMD_TX_DEST_0 0
/* Packet is sent to INGRESS1/PDSP1 */
#define PA2_CMD_TX_DEST_1 1
/* Packet is sent to INGRESS2/PDSP2 */
#define PA2_CMD_TX_DEST_2 2
/* Packet is sent to INGRESS3/PDSP3 */
#define PA2_CMD_TX_DEST_3 3
/* Packet is sent to INGRESS4/PDSP4 */
#define PA2_CMD_TX_DEST_4 4
/* Packet is sent to POST/PDSP5 */
#define PA2_CMD_TX_DEST_5 5
/* Packet is sent to EGRESS0 */
#define PA2_CMD_TX_DEST_6 6
/* Packet is sent to EGRESS1 */
#define PA2_CMD_TX_DEST_7 7
/* Packet is sent to EGRESS2 */
#define PA2_CMD_TX_DEST_8 8
/* PA Command Codes */
#define PA2_CMD_NONE 0
#define PA2_CMD_NEXT_ROUTE 1
#define PA2_CMD_CRC_OP 2
#define PA2_CMD_COPY_DATA_TO_PSINFO 3
#define PA2_CMD_PATCH_DATA 4
#define PA2_CMD_TX_CHECKSUM 5
#define PA2_CMD_MULTI_ROUTE 6
#define PA2_CMD_REPORT_TX_TIMESTAMP 7
#define PA2_CMD_REMOVE_HEADER 8
#define PA2_CMD_REMOVE_TAIL 9
#define PA2_CMD_CMDSET 10
#define PA2_CMD_SA_PAYLOAD 11
#define PA2_CMD_IP_FRAGMENT 12
#define PA2_CMD_USR_STATS 13
#define PA2_CMD_CMDSET_AND_USR_STATS 14
#define PA2_CMD_PATCH_MSG_LEN 15
#define PA2_CMD_VERIFY_PKT_ERROR 16
#define PA2_CMD_SPLIT 17
#define PA2_CMD_EF_OP 18
struct pa_frm_forward_host {
/* Context returned as swInfo0 for matched packet */
u32 context;
/* Control bitmap, 1 for enable, 0 for disable
* /------------------------------------------------------------------\
* | 7 | | 2 | 1 | 0 |
* | Selection | |DSCP priority|VLAN priority| multiRoute |
* | 0: Priority Select| | | OR | |
* | 1: IF Dest Select | | |Flow IF Dest | |
* \------------------------------------------------------------------/
*/
/* True if multiple destination enabled */
u8 ctrl_bitmap;
/* Index of the multiple destination set */
u8 multi_idx;
/* PA PDSP number used as multi-route router */
u8 pa_pdsp_router;
/* use the bit 7:4, bit 7: Disable CRC, bit 6:4 port number (0/1/2),
* bit 3:0 errflags = 0
*/
u8 ps_flags;
/* optional simple command: 0 means no command */
u8 cmd[4];
}; /* 12 bytes */
#define PA2FRM_MULTIROUTE_ENABLE 0x1
#define PA2FRM_ROUTING_PRIORITY_DSCP_ENABLE 0x2
#define PA2FRM_ROUTING_PRIORITY_VLAN_ENABLE 0x4
/* 0: queue-based only; 1: queue- and flow-based */
#define PA2FRM_ROUTING_FLOW_IF_BASE_ENABLE 0x2
#define PA2FRM_ROUTING_IF_DEST_SELECT_ENABLE 0x80
/* Routing information used to forward packets to the Ethernet port */
struct pa2_frm_forward_eth {
/* use the bit 7:4 bit 7: Disable CRC, bit 6:4 port number (0/1/2),
* bit 3:0 errflags = 0
*/
u8 ps_flags;
u8 priority;
u16 rsvd2;
u32 rsvd3;
u8 cmd[4];
};
#define PA2FRM_ETH_PS_FLAGS_DISABLE_CRC 0x80
#define PA2FRM_ETH_PS_FLAGS_PORT_MASK PA2_EMAC_CTRL_PORT_MASK
#define PA2FRM_ETH_PS_FLAGS_PORT_SHIFT 0
/* Routing information used to forward packets within PA */
struct pa2_frm_forward_pa {
/* PDSP destination */
u8 pa_dest;
/* None, LUT1, LUT2 */
u8 custom_type;
/* Index of the custom type if LUT1 or LUT2 custom */
u8 custom_idx;
u8 flags;
u32 rsvd1;
u8 cmd[4];
};
#define PA2FRM_CASCADED_FORWARDING 0x01
/* Mark the entry per ACL rule */
#define PA2FRM_PA_CTRL_PKT_MARK 0x02
/* Indicate that the packet should be dropped after reassembly per ACL rule */
#define PA2FRM_PA_CTRL_PKT_DROP 0x04
/* Routing information used to forward packets in egress flow */
struct pa2_frm_forward_ef {
/* various control flags */
u8 ctrl_flags;
/* Egress record valid bit map, if flow cache lookup is not enabled */
u8 valid_bitmap;
/* reserved for alignment */
u16 rsvd1;
/* Egress Flow level one record index */
u8 lvl1_rec_idx;
/* Egress Flow level two record index */
u8 lvl2_rec_idx;
/* Egress Flow level three record index */
u8 lvl3_rec_idx;
/* Egress Flow level four record index */
u8 lvl4_rec_idx;
u32 rsvd2;
};
#define PA2FRM_EF_CTRL_FC_LOOKUP 0x01 /* Flow Cache lookup */
#define PA2FRM_EF_VALID_REC_LVL1 0x01
#define PA2FRM_EF_VALID_REC_LVL2 0x02
#define PA2FRM_EF_VALID_REC_LVL3 0x04
#define PA2FRM_EF_VALID_REC_LVL4 0x08
/* Routing information used to drop the packet */
struct pa2_frm_discard {
u32 rsvd1;
u32 rsvd2;
u8 cmd[4];
};
#define PA2FRM_CUSTOM_TYPE_NONE PA2_CUSTOM_TYPE_NONE
#define PA2FRM_CUSTOM_TYPE_LUT1 PA2_CUSTOM_TYPE_LUT1
#define PA2FRM_CUSTOM_TYPE_LUT2 PA2_CUSTOM_TYPE_LUT2
/* Routing information used to forward packets fromm PA sub-system to various
* destinations
*/
struct pa2_frm_forward {
u8 forward_type; /* Forwarding type as defined below */
u8 flow_id; /* PKTDMA flow Id, valid if forwarding via
* PKTDMA
*/
u16 queue; /* Destination queue number, valid if forwarding
* via PKTDMA
*/
union {
struct pa_frm_forward_host host; /* Host specific
* routing
* information
*/
struct pa2_frm_forward_eth eth; /* Ethernet specific
* routing
* information
*/
struct pa2_frm_forward_pa pa; /* PA internal routing
* information
*/
struct pa2_frm_forward_ef ef; /* PA Egress Flow
* information
*/
struct pa2_frm_discard discard; /* Discard specific
* routing
* information
*/
} u;
};
enum {
/* use PA2FRM_DEST_CDMA */
PA2FRM_FORWARD_TYPE_HOST = 0,
/* use PA2FRM_DEST_CDMA */
PA2FRM_FORWARD_TYPE_SA,
/* use pa.paDest */
PA2FRM_FORWARD_TYPE_PA,
/* use PA2FRM_DEST_ETH */
PA2FRM_FORWARD_TYPE_ETH,
/* use PA2FRM_DEST_CDMA */
PA2FRM_FORWARD_TYPE_SRIO,
/* use flowId as stream ID */
PA2FRM_FORWARD_TYPE_SA_DIRECT,
PA2FRM_FORWARD_TYPE_DISCARD,
PA2FRM_FORWARD_TYPE_EFLOW
};
/* LUT1 classification mode */
#define PA2FRM_LUT1_CLASS_NONE 0
#define PA2FRM_LUT1_CLASS_STANDARD 1
#define PA2FRM_LUT1_CLASS_IPV4 2
#define PA2FRM_LUT1_CLASS_IPV6 3
#define PA2FRM_LUT1_CLASS_IPSEC PA2FRM_LUT1_CLASS_IPV6
/* Care0 [31:30] */
#define PA2FRM_LUT1_CLASS_SHIFT 30
/* LUT1 Range mode for two range parameters */
/* Normal comparsion */
#define PA2FRM_LUT1_RANGE_MODE_NORMAL 0
/* Use RangeLo and RangeHi for range compare */
#define PA2FRM_LUT1_RANGE_MODE_RANGE 1
/* NOT comparison */
#define PA2FRM_LUT1_RANGE_MODE_NOT 2
/* Care0 [29:28]: Byte 42-43*/
#define PA2FRM_LUT1_CLASS_SHIFT0 28
/* Care0 [27:26]: Byte 44-45*/
#define PA2FRM_LUT1_CLASS_SHIFT1 26
/* LUT1 NOT operation for byte 41 */
/* Normal Comparsion */
#define PA2FRM_LUT1_CMP_OP_NORMAL 0
/* Not cpmpare (byte 41) */
#define PA2FRM_LUT1_CMP_OP_NOT 1
/* Care 0 [25]: Byte 41 */
#define PA2FRM_LUT1_CMP_OP_SHIFT 25
/* LUT1 Entries (MAC/SRIO/Custom) */
/* Layer 2 packet Type */
#define PA2FRM_L2_PKT_TYPE_MAC 0x80
#define PA2FRM_L2_PKT_TYPE_SRIO 0x40
#define PA2FRM_L2_PKT_TYPE_CUSTOM 0x20
/* Care0: [20:15] byte 4-9 */
#define PA2FRM_LUT1_VALID_DMAC_ALL 0x001F8000
#define PA2FRM_LUT1_VALID_DMAC_MINUS_BYTE5 0x001F0000
/* Care0: [14:9] byte 10-15 */
#define PA2FRM_LUT1_VALID_SMAC 0x00007E00
/* Care0: [8:7] byte 16-17 */
#define PA2FRM_LUT1_VALID_ETHERTYPE 0x00000180
/* Care0: [6:5] byte 18-19 */
#define PA2FRM_LUT1_VALID_SESSION_ID 0x00000060
/* Care0: [4:1] byte 20-23 */
#define PA2FRM_LUT1_VALID_MPLS 0x0000001E
/* Care0: [24:24] Byte 0 */
#define PA2FRM_LUT1_VALID_PKTFLAGS 0x01000000
/* Care0: [23:23] Byte 1 */
#define PA2FRM_LUT1_VALID_DMAC5 0x00800000
/* Care1: [20:19] Byte 36-37 */
#define PA2FRM_LUT1_VALID_VLANID1 0x00180000
/* Care1: [18:17] Byte 38-39 */
#define PA2FRM_LUT1_VALID_VLANID2 0x00060000
/* Care1: [16:16] Byte 40 */
#define PA2FRM_LUT1_VALID_PKTTYPE 0x00010000
/* Care1: [15:15] Byte 41 */
#define PA2FRM_LUT1_VALID_INPORT 0x00008000
/* Care1: [14:13] Byte 42-43 */
#define PA2FRM_LUT1_VALID_VLAN_PRI1 0x00006000
/* Care1: [12:11] Byte 44-45 */
#define PA2FRM_LUT1_VALID_VLAN_PRI2 0x00001800
/* Care1: [10: 9] Byte 46-47 */
#define PA2FRM_LUT1_VALID_SRC_VC 0x00000600
#define PA2FRM_MK_SRC_VC(pdsp, lut_index) (((pdsp) << 10) + (lut_index))
#define PA2FRM_GET_PDSPID_FROM_LINK(lnk) ((lnk) >> 10)
#define PA2FRM_GET_LUTIDX_FROM_LINK(lnk) ((lnk) & 0x3FF)
/* Add MAC entry to LUT1 */
struct pa2_frm_com_l1_mac {
/* LUT1 view 1 */
/* Destination mac */
u8 dmac[6];
/* Source mac */
u8 smac[6];
/* Ethernrt type, the field is also used for the previous match
* PDSP number
*/
u16 etype;
/* PPPoE session ID */
u16 session_id;
/* LUT1 view 2 */
/* MPLS label */
u32 mpls;
u32 rsvd2_2;
u32 rsvd2_3;
u32 rsvd2_4;
/* LUT1 view 3 */
/* Various packet flags */
u8 pkt_flags;
#define PA2FRM_MAC_FLAG_VLAN1 0x01
#define PA2FRM_MAC_FLAG_VLAN2 0x02
#define PA2FRM_MAC_FLAG_MCAST 0x04
#define PA2FRM_MAC_FLAG_BCAST 0x08
#define PA2FRM_MAC_FLAG_PPPOE 0x10
#define PA2FRM_MAC_FLAG_802p3 0x20
#define PA2FRM_MAC_FLAG_MPLS 0x40
/* Destination MAC address if bitMask is required */
u8 dst_mac5;
u16 rsvd4;
/* 12-bit ID of inner VLAN (0x8100) */
u16 vlan_id1;
/* 12-bit ID of outer VLAN */
u16 vlan_id2;
/* Common filed to indicate packet type */
u8 pkt_type;
/* One-base input EMAC port number */
u8 in_port;
/* 3-bit priority of inner VLAN (0x8100) */
u16 vlan_pri1;
/* 3-bit priority of outer VLAN */
u16 vlan_pri2;
/* virtual or physical link */
u16 src_vc;
};
struct pa2_frm_com_l1_custom {
/* LUT1 view 1 & 2 */
u8 match[32];
/* LUT1 view 3 - offset from start */
u32 rsvd3_1;
u32 rsvd3_2;
/* Common filed to indicate packet type */
u8 pkt_type;
u8 rsvd3_3;
u16 rsvd3_4;
u16 rsvd3_5;
/* virtual or physical link */
u16 src_vc;
};
struct pa2_frm_com_l1_ipv4 {
/* LUT1 view 1 */
/* Destination IP address */
u32 dst_ip;
/* Source IP address */
u32 src_ip;
u32 rsvd1_3;
u32 rsvd1_4;
/* LUT1 view 2 */
u32 rsvd2_1;
u32 rsvd2_2;
u32 rsvd2_3;
u32 rsvd2_4;
/* LUT1 view 3 */
/* Various packet flags */
u16 pkt_flags;
#define PA2FRM_IP_FLAG_IP_TYPE 0x8000
#define PA2FRM_IP_FLAG_V4 0x8000
#define PA2FRM_IP_FLAG_GRE 0x4000
#define PA2FRM_IP_FLAG_SCTP 0x2000
#define PA2FRM_IP_FLAG_TCP_DATA 0x1000
#define PA2FRM_IP_FLAG_OPTIONS 0x0800
#define PA2FRM_IP_FLAG_FRAG 0x0400
#define PA2FRM_IP_FLAG_CONTAIN_L4 0x0200
#define PA2FRM_IP_FLAG_HOP_LIMIT 0x0100
#define PA2FRM_IP_FLAG_IPSEC 0x0080
u8 dscp;
u8 rsvd3_1;
u32 rsvd3_2;
/* Common filed to indicate packet type */
u8 pkt_type;
/* Next Layer protocol */
u8 protocol;
/* Layer 4 source port number */
u16 src_port;
/* Layer 4 destination port number */
u16 dst_port;
/* virtual or physical link */
u16 src_vc;
};
struct pa2_frm_com_l1_ipv6 {
/* LUT1 view 1 */
/* Source IP address */
u32 src_ip0;
u32 src_ip1;
u32 src_ip2;
u32 src_ip3;
/* LUT1 view 2 */
/* Destination IP address */
u32 dst_ip0;
u32 dst_ip1;
u32 dst_ip2;
u32 dst_ip3;
/* LUT1 view 3 */
/* Various packet flags */
u16 pkt_flags;
#define PA2FRM_IP_FLAG_V6 0x4000
u8 dscp;
u8 rsvd8a;
/* 20-bit Flow Label in the header */
u32 flow_label;
/* Common filed to indicate packet type */
u8 pkt_type;
/* Next Layer protocol */
u8 protocol;
/* Layer 4 source port number */
u16 src_port;
/* Layer 4 destination port number */
u16 dst_port;
/* virtual or physical link */
u16 src_vc;
};
struct pa2_frm_com_l1_ipsec {
/* LUT1 view 1 */
u32 rsvd1_1;
u32 rsvd1_2;
u32 rsvd1_3;
u32 rsvd1_4;
/* LUT1 view 2 */
u32 rsvd2_1;
u32 rsvd2_2;
u32 rsvd2_3;
u32 rsvd2_4;
/* LUT1 view 3 */
/* Various packet flags */
u16 pkt_flags;
#define PA2FRM_IPSEC_FLAG_ESP 0x8000
#define PA2FRM_IPSEC_FLAG_AH 0x4000
u16 rsvd3_1;
/* SPI value */
u32 spi;
/* Common filed to indicate packet type */
u8 pkt_type;
u8 rsvd3_2;
u16 rsvd3_3;
u16 rsvd3_4;
/* virtual or physical link */
u16 src_vc;
};
enum {
PA2FRM_CONFIG_COMMAND_RSVD = 0,
PA2FRM_CONFIG_COMMAND_ADDREP_LUT1,
PA2FRM_CONFIG_COMMAND_DEL_LUT1,
PA2FRM_CONFIG_COMMAND_ADDREP_LUT2,
PA2FRM_CONFIG_COMMAND_DEL_LUT2,
PA2FRM_CONFIG_COMMAND_CONFIG_PA,
PA2FRM_CONFIG_COMMAND_REQ_STATS,
PA2FRM_CONFIG_COMMAND_REQ_VERSION,
PA2FRM_CONFIG_COMMAND_MULTI_ROUTE,
PA2FRM_CONFIG_COMMAND_CRC_ENGINE,
PA2FRM_CONFIG_COMMAND_CMD_SET,
PA2FRM_CONFIG_COMMAND_CMD_USR_STATS,
PA2FRM_CONFIG_COMMAND_CMD_SYS_CONFIG,
PA2FRM_CONFIG_COMMAND_CMD_MULTI_CMDS
};
/* Command magic value */
#define PA2FRM_CONFIG_COMMAND_SEC_BYTE 0xce
/* Command return values */
enum {
/* Must be 0 */
PA2FRM_COMMAND_RESULT_SUCCESS = 0,
/* Command magic value not found */
PA2FRM_COMMAND_RESULT_NO_COMMAND_MAGIC,
/* Invalid command identifier */
PA2FRM_COMMAND_RESULT_INVALID_CMD,
/* Add entry to LUT1 fails codes */
/* Invalid type, custom or standard IP/ethernet */
PA2FRM_COMMAND_RESULT_LUT1_TYPE_INVALID,
/* Invalid LUT1 index (0-63) or no free indices available */
PA2FRM_COMMAND_RESULT_LUT1_INDEX_INVALID,
/* Sent a match packet to q0 on c1 or c2 - this is illegal. */
PA2FRM_COMMAND_RESULT_LUT1_MATCH_DEST_INVALID,
/* Previous match fwd info was somewhere in chunk domain */
PA2FRM_COMMAND_RESULT_LUT1_NMATCH_INVALID,
/* Invalid combination found in the key value */
PA2FRM_COMMAND_RESULT_LUT1_INVALID_KEYS,
/* Lut 2 entry warnings since the lut can be configured without pdsp */
PA2FRM_COMMAND_RESULT_WARN_OVER_MAX_ENTRIES,
PA2FRM_COMMAND_RESULT_WARN_NEGATIVE_ENTRY_COUNT,
/* Lut 2 entry failures */
/* LUT2 had a lookup and pending config */
PA2FRM_COMMAND_RESULT_LUT2_ADD_BUSY,
/* Not enough room in stats request packet for the reply */
PA2FRM_COMMAND_RESULT_WARN_STATS_REPLY_SIZE,
/* Command sent to PDSP which couldn't handle it */
PA2FRM_COMMAND_RESULT_INVALID_DESTINATION,
/* Add/Delete/Read entries to multi route table */
/* Asked to use a free entry, but none found */
PA2FRM_COMMAND_RESULT_MULTI_ROUTE_NO_FREE_ENTRIES,
/* Illegal index value used */
PA2FRM_COMMAND_RESULT_MULTI_ROUTE_INVALID_IDX,
/* Illegal multi route mode used */
PA2FRM_COMMAND_RESULT_MULTI_ROUTE_INVALID_MODE,
/* Packet size didn't match command */
PA2FRM_COMMAND_RESULT_INVALID_PKT_SIZE,
/* Coustom and Command set index */
/* Illegal Custom LUT1 index value used */
PA2FRM_COMMAND_RESULT_INVALID_C1_CUSTOM_IDX,
/* Illegal Custom LUT2 index value used */
PA2FRM_COMMAND_RESULT_INVALID_C2_CUSTOM_IDX,
/* Illegal Custom Cmd Set index value used */
PA2FRM_COMMAND_RESULT_INVALID_CMDSET_IDX,
/* Illegal User Stats Configuration */
PA2FRM_COMMAND_RESULT_USR_STATS_INVALID_CONFIG
};
/* Destination (route) values */
/* Packets to Global CDMA */
#define PA2FRM_DEST_CDMA0 0
/* Packets to Local CDMA */
#define PA2FRM_DEST_CDMA1 1
/* Packets to Ethernet TX */
#define PA2FRM_DEST_ETHERNET1 2
/* Packets to Ethernet TX */
#define PA2FRM_DEST_ETHERNET2 3
/* Packets to Ethernet TX */
#define PA2FRM_DEST_ETHERNET3 4
/* Packets to Ethernet TX */
#define PA2FRM_DEST_ETHERNET4 5
/* Packets to Ethernet TX */
#define PA2FRM_DEST_ETHERNET5 6
/* Packets to Ethernet TX */
#define PA2FRM_DEST_ETHERNET6 7
/* Packets to Ethernet TX */
#define PA2FRM_DEST_ETHERNET7 8
/* Packets to Ethernet TX */
#define PA2FRM_DEST_ETHERNET8 9
/* Packets to Cluster Ingress 0 */
#define PA2FRM_DEST_INGRESS0 10
/* Packets to Cluster Ingress 1 */
#define PA2FRM_DEST_INGRESS1 11
/* Packets to Cluster Ingress 2 */
#define PA2FRM_DEST_INGRESS2 12
/* Packets to Cluster Ingress 3 */
#define PA2FRM_DEST_INGRESS3 13
/* Packets to Cluster Ingress 4 */
#define PA2FRM_DEST_INGRESS4 14
/* Packets to Cluster Post Processings */
#define PA2FRM_DEST_POST 15
/* Packets to Cluster Egress 0 */
#define PA2FRM_DEST_EGRESS0 16
/* Packets to Cluster Egress 1 */
#define PA2FRM_DEST_EGRESS1 17
/* Packets to Cluster Egress 2 */
#define PA2FRM_DEST_EGRESS2 18
/* Packets to Reasm Accelerator */
#define PA2FRM_DEST_REASM 19
/* Placeholder for model */
#define PA2FRM_DEST_ACE0 20
/* Placeholder for model */
#define PA2FRM_DEST_ACE1 21
/* Packets to Statsbloc */
#define PA2FRM_DEST_STATSBLOC 22
#define PA2FRM_DEST_PKTDMA PA2FRM_DEST_CDMA0
#define PA2FRM_DEST_PKTDMA_LOC PA2FRM_DEST_CDMA1
#define PA2FRM_DEST_ETH PA2FRM_DEST_ETHERNET1
#define PA2FRM_DEST_DISCARD 0xff
/* Assigning names based on PDSP functions */
#define PA2FRM_DEST_PA_C1_0 PA2FRM_DEST_INGRESS0
#define PA2FRM_DEST_PA_C1_1 PA2FRM_DEST_INGRESS1
#define PA2FRM_DEST_PA_C1_2 PA2FRM_DEST_INGRESS4
#define PA2FRM_DEST_PA_C2 PA2FRM_DEST_INGRESS4
#define PA2FRM_DEST_PA_M_0 PA2FRM_DEST_POST
#define PA2FRM_DEST_PA_M_1 PA2FRM_DEST_EGRESS2
/* The default queue for packets that arrive at the PA and don't match in
* classify1 (right at init time)
*/
#define PA2FRM_DEFAULT_INIT_Q 0x100
/* Ethertypes recognized by the firmware. */
#define PA2FRM_ETHERTYPE_IP 0x0800
#define PA2FRM_ETHERTYPE_IPV6 0x86dd
#define PA2FRM_ETHERTYPE_VLAN 0x8100
#define PA2FRM_ETHERTYPE_SPVLAN 0x88a8
#define PA2FRM_ETHERTYPE_MPLS 0x8847
#define PA2FRM_ETHERTYPE_MPLS_MULTI 0x8848
/* Next header type values */
#define PA2FRM_HDR_MAC 0
#define PA2FRM_HDR_VLAN 1
#define PA2FRM_HDR_MPLS 2
#define PA2FRM_HDR_IPV4 3
#define PA2FRM_HDR_IPV6 4
#define PA2FRM_HDR_IPV6_EXT_HOP 5
#define PA2FRM_HDR_IPV6_EXT_ROUTE 6
#define PA2FRM_HDR_IPV6_EXT_FRAG 7
#define PA2FRM_HDR_IPV6_EXT_DEST 8
#define PA2FRM_HDR_GRE 9
#define PA2FRM_HDR_ESP 10
#define PA2FRM_HDR_ESP_DECODED 11
#define PA2FRM_HDR_AUTH 12
#define PA2FRM_HDR_CUSTOM_C1 13
/* A contrived header type used with custom SRIO to force a parse after looking
* at only the RIO L0-L2
*/
#define PA2FRM_HDR_FORCE_LOOKUP 14
#define PA2FRM_HDR_SCTP 15
#define PA2FRM_HDR_UNKNOWN 16
#define PA2FRM_HDR_UDP 17
#define PA2FRM_HDR_UDP_LITE 18
#define PA2FRM_HDR_TCP 19
#define PA2FRM_HDR_GTPU 20
#define PA2FRM_HDR_ESP_DECODED_C2 21
#define PA2FRM_HDR_CUSTOM_C2 22
/* Command related definitions */
#define PA2FRM_CRC_FLAG_CRC_OFFSET_VALID 0x01
#define PA2FRM_CRC_FLAG_CRC_OFFSET_FROM_DESC 0x02
#define PA2FRM_CHKSUM_FALG_NEGATIVE 0x01
#define PA2_NEXT_ROUTE_PARAM_PRESENT 0x0001
#define PA2_NEXT_ROUTE_PROC_NEXT_CMD 0x0002
#define PA2_NEXT_ROUTE_PROC_MULTI_ROUTE 0x0004
/* PAFRM receive commands related definitions */
/* There are the following two groups of PAFRM receive commands:
* PAFRM short commands which can be used as part of the routing info
* PAFRM commands which can be used within a command set
*/
/* Dummy command */
#define PA2FRM_RX_CMD_NONE 0
/* short commands */
/* Execute a command set */
#define PA2FRM_RX_CMD_CMDSET 1
/* Insert up to two types at the current location */
#define PA2FRM_RX_CMD_INSERT 2
/* Increment the specific user-statistics chain */
#define PA2FRM_RX_CMD_USR_STATS 3
/* Increment User-defined Stats chain and execute the command set */
#define PA2FRM_RX_CMD_CMDSET_USR_STATS 4
/* command set commands */
/* Specify the next route */
#define PA2FRM_RX_CMD_NEXT_ROUTE 11
/* CRC generation or verification */
#define PA2FRM_RX_CMD_CRC_OP 12
/* Copy data to the PS Info section */
#define PA2FRM_RX_CMD_COPY_DATA 13
/* Insert or patch packet data at the specific location */
#define PA2FRM_RX_CMD_PATCH_DATA 14
/* Remove the parsed packet header */
#define PA2FRM_RX_CMD_REMOVE_HDR 15
/* Remove the parsed packet tail */
#define PA2FRM_RX_CMD_REMOVE_TAIL 16
/* Duplicate packet to multiple destinations */
#define PA2FRM_RX_CMD_MULTI_ROUTE 17
/* Verify packet error based on error flags */
#define PA2FRM_RX_CMD_VERIFY_PKT_ERROR 18
/* Payload splitting */
#define PA2FRM_RX_CMD_SPLIT 19
/* define LUT1 entry types */
/* MAC/IP/IPSEC/ACL/FC */
#define PA2FRM_COM_ADD_LUT1_STANDARD 0
/* SRIO */
#define PA2FRM_COM_ADD_LUT1_SRIO 1
/* Custom LUT1 */
#define PA2FRM_COM_ADD_LUT1_CUSTOM 2
/* Standard entry with virtual Link */
#define PA2FRM_COM_ADD_LUT1_VLINK 3
/* LUT1 Entries */
/* if PA2_LUT1_INDEX_LAST_FREE is used then when the command returns,
* the value of index will be replaced with the actual index used
*/
#define PA2FRM_HW_LUT1_ENTRIES 256
#define PA2FRM_LUT1_INDEX_LAST_FREE PA2FRM_HW_LUT1_ENTRIES
struct pa2_frm_cmd_add_lut1 {
/* LUT1 index. */
u16 index;
/* Custom or standard */
u8 type;
/* Valid only if type is custom */
u8 cust_index;
/* Virtual Link number if used */
u16 vlink_num;
/* entry statistics index (Flow Cache only) */
u16 stats_index;
/* LUT1 views */
union {
/* matching information for MAC/IP entry */
struct pa2_frm_com_l1_mac mac;
struct pa2_frm_com_l1_custom custom;
/* matching information for IPv4 entry*/
struct pa2_frm_com_l1_ipv4 ipv4;
/* matching information for IPv6 entry */
struct pa2_frm_com_l1_ipv6 ipv6;
/* matching information for IPSEC entry */
struct pa2_frm_com_l1_ipsec ipsec;
} u;
/* Command header */
/* Range High for bytes 44-45 */
u16 range1_hi;
/* Range High for bytes 42-43 */
u16 range0_hi;
/* Care Bits Word0 */
u32 cbwords0;
/* Care Bits Word1 */
u32 cbwords1;
/* BitMask for Bytes 0-1 */
u16 bit_mask;
/* Record priority "score", relative index */
u16 priority;
/* Routing information when a match is found */
struct pa2_frm_forward match;
/* Routing information when subsequent match fails - a fragmented
* packet orinner route
*/
struct pa2_frm_forward next_fail;
};
/* PA CRC Engine Instance Destinations */
enum pa2_crc_inst {
/* CRC Engine between Ingress0, CDE0 and CED1 */
PA2_CRC_INST_0_0 = 0,
/* CRC Engine between Ingress1, CDE0 and CED1 */
PA2_CRC_INST_1_0,
/* Engine between Ingress4, CDE0 and CED1 */
PA2_CRC_INST_4_0,
/* Engine between Post, CDE0 and CED1 */
PA2_CRC_INST_5_0,
/* Engine between Egress0, CDE0 and CED1 */
PA2_CRC_INST_6_0,
/* Engine between Egress0, CDE1 and CED2 */
PA2_CRC_INST_6_1,
PA2_CRC_INST_MAX
};
#define PARAM_CRC_TABLE_SIZE 16
enum pa2_crc_size {
/* 8-bit CRC */
PA2_CRC_SIZE_8 = 0,
/* 16-bit CRC */
PA2_CRC_SIZE_16,
/* 24-bit CRC */
PA2_CRC_SIZE_24,
/* 32-bit CRC */
PA2_CRC_SIZE_32
};
struct pa2_crc_config {
/* CRC configuration control info as defined below */
u16 ctrl_bits;
/* Set: Right shift CRC (b0 to b7), Clear: Left shift CRC (b7 to b0) */
#define PA2_CRC_CONFIG_RIGHT_SHIFT 0x0001
/* Set: a 'NOT' operation is applied to the final CRC result */
#define PA2_CRC_CONFIG_INVERSE_RESULT 0x0002
enum pa2_crc_size size;
/* CRC polynomial in the format
* of 0xabcdefgh. For example,
* x32+x28+x27+x26+x25+x23+x22+
* x20+x19+x18+x14+x13+x11+x10+
* x9+x8+x6+1 ==> 0x1EDC6F41
* x16+x15+x2+1 ==>0x80050000
*/
u32 polynomial;
/* CRC initial value */
u32 init_value;
};
struct pa2_frm_config_crc {
/* Control bit maps as defined below */
u8 ctrl_bitmap;
#define PARAM_CRC_CTRL_CRC_SIZE_MASK 0x3
#define PARAM_CRC_CTRL_LEFT_SHIFT 0x0
#define PARAM_CRC_CTRL_RIGHT_SHIFT 0x4
#define PARAM_CRC_CTRL_INV_RESULT 0x8
/* reserved for alignment */
u8 rsvd1;
/* reserved for alignment */
u16 rsvd2;
/* Initial value to use in the CRC calcualtion */
u32 init_val;
/* CRC table */
u32 crc_tbl[PARAM_CRC_TABLE_SIZE];
};
#define PA2FRM_CFG_CMD_STATUS_PROC 0
#define PA2FRM_CFG_CMD_STATUS_DONE 1
/* Commands to PA */
struct pa2_frm_command {
/* Command Status (used by firmware only) */
u8 status;
/* index of the first targeted PDSP in a cluster */
u8 pdsp_index;
/* Returned to the host, ignored on entry to the PASS */
u16 command_result;
/* Used by the host to identify command results */
u16 com_id;
/* Command value */
u8 command;
/* Magic value */
u8 magic;
/* Returned in swInfo to identify packet as a command */
u32 ret_context;
/* Specifies the queue number for the message reply. 0xffff
* to toss the reply
*/
u16 reply_queue;
/* Reply destination (host0, host1, discard are the only valid values)
*/
u8 reply_dest;
/* Flow ID used to assign packet at reply */
u8 flow_id;
/* First word of the command */
u32 cmd;
};
struct pa2_cmd_next_route {
/* Routing control information as defined at routeCtrlInfo */
u16 ctrl_bit_field;
/* Packet destination as defined at pktDest */
int dest;
/* For destination SRIO, specify the 5-bit packet type toward SRIO for
* destination EMAC, specify the EMAC control @ref emcOutputCtrlBits to
* the network
*/
u8 pkt_type_emac_ctrl;
/* For host, SA or SRIO destinations, specifies return free descriptor
* setup
*/
u8 flow_id;
/* For host, SA or SRIO destinations, specifies the dest queue */
u16 queue;
/* Placed in SwInfo0 for packets to host or SA */
u32 sw_info_0;
/* Placed in SwInfo1 for packets to the SA */
u32 sw_info_1;
/* Multi-route index. It is valid in the from-network direction only */
u16 multi_route_index;
/* Index of the first user-defined statistics to be updated. This
* optional parameter is valid in the to-network direction only
*/
u16 stats_index;
};
struct pa2_cmd_crc_op {
/* CRC operation control information as defined at @ref crcOpCtrlInfo */
u16 ctrl_bit_field;
/* Byte location, from SOP/Protocol Header, where the CRC computation
* begins if frame type is not specified Byte location, from
* SOP/Protocol header, where the specific frame header begins if frame
* type is specified In to-network direction:
* offset from SOP In from-network direction: offset from the
* current parsed header
*/
u16 start_offset;
/* Number of bytes covered by the CRC computation valid only if
* pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER is clear
*/
u16 len;
/* Payload length field offset in the custom header */
u16 len_offset;
/* Payload length field mask */
u16 len_mask;
/* Payload length adjustment: valid only if
* PA2_CRC_OP_PAYLOAD_LENGTH_IN_HEADER is set
*/
u16 len_adjust;
/* Offset from SOP/Protocol Header to the CRC field In to-network
* direction:
* offset from SOP In from-network direction: offset from
* the current parsed header
*/
u16 crc_offset;
/* Size of CRC in bytes */
u16 crc_size;
/* Frame type @ref crcFrameTypes, valid if PA2_CRC_OP_CRC_FRAME_TYPE
* is set
*/
u16 frame_yype;
/* CRC initial value */
u32 init_value;
};
/* Transmit checksum configuration
* pa_tx_chksum is used in the call to @ref Pa_formatTxRoute or @ref
* Pa_formatTxCmd to create a tx command header that instructs the packet
* accelerator sub-system to generate ones' complement checksums into network
* packets. The checksums are typically used for TCP and UDP payload checksums
* as well as IPv4 header checksums. In the case of TCP and UDP payload
* checksums the pseudo header checksum must be pre-calculated and provided,
* the sub-system does not calculate it.
*/
struct pa2_tx_chksum {
/* Byte location, from SOP, where the checksum calculation begins */
u16 start_offset;
/* Number of bytes covered by the checksum. Must be even */
u16 length_bytes;
/* Byte offset, from startOffset, to place the resulting checksum */
u16 result_offset;
/* Initial value of the checksum */
u16 initial_sum;
/* If TRUE, a computed value of 0 is written as -0 */
u16 negative_0;
};
struct pa2_cmd_copy {
/* Copy operation control information as defined at @ref copyCtrlInfo */
u16 ctrl_bit_field;
/* Offset from the start of current protocol header for the data copy
* to begin
*/
u16 src_offset;
/* Offset from the top of the PSInfo for the data to be copied to */
u16 dest_offset;
/* Number of bytes to be copied */
u16 num_bytes;
};
struct pa2_cmd_multi_route {
/* Multi-route set Index */
u16 index;
};
/* PATCH Command in to-netweok direction */
#define PA2_MAX_PATCH_BYTES 16
/* PATCH Command within a command set */
#define PA2_MAX_RX_PATCH_BYTES 32
#define PA2_PATCH_OP_INSERT 0x0001
#define PA2_PATCH_OP_MAC_HDR 0x0002
#define PA2_PATCH_OP_DELETE 0x0004
struct pa2_patch_info {
/* Patch operation control information as defined at @ref
* patchCtrlInfo
*/
u16 ctrl_bit_field;
/* The number of bytes to be patched */
u16 n_patch_bytes;
/* The number of patch bytes in the patch cmd, must be >= to nPatchBytes
* and a multiple of 4 bytes
*/
u16 total_patch_size;
/* Offset from the start of the packet for the patch to begin in the
* to-network direction Offset from the start of the current header
* for the patch to begin in the from-network direction
*/
u16 offset;
/* Pointer to the patch data */
u8 *patch_data;
};
/* pa_payload_info defines the packet payload information in the short format.
* It is required by the Security Accelerator sub-system (SASS)
*
* pa_payload_info defines the packet parsing information in terms of payload
* offset and payload length as described below
* SRTP: offset to the RTP header; RTP payload length including ICV
* IPSEC AH: offset to the Outer IP; IP payload length
* IPSEC ESP: offset to the ESP header; ESP papload length including ICV
*/
struct pa2_payload_info {
/* The offset to where the SA packet parsing starts */
u16 offset;
/* The total length of the protocal payload to be processed by SA */
u16 len;
/* Optional supplement data such as the 32-bit CountC for some 3GPP
* operation modes
*/
u32 sup_data;
};
/* The maximum number of command sets supported */
#define PA2_MAX_CMD_SETS 64
#define PA2_OK 0
#define PA2_ERR_CONFIG -10
#define PA2_INSUFFICIENT_CMD_BUFFER_SIZE -11
#define PA2_INVALID_CMD_REPLY_DEST -12
/* Command Set Command
*
* pa_cmd_set is used to specify the desired PA command set. The command set
* command instructs the PASS to execute a list of commands after a LUT1 or
* LUT2 match occurs. It is one of the command which can be embedded within
* the @ref paRouteInfo_t.
*/
struct pa2_cmd_set {
/*Command Set Index */
u16 index;
};
struct pa2_cmd_tx_timestamp {
/* Host queue for the tx timestamp reporting packet */
u16 dest_queue;
/* CPPI flow */
u16 flow_id;
/* 32 bit value returned in the descriptor */
u32 sw_info0;
};
struct pa2_cmd_ip_frag {
/* Offset to the IP header. */
u16 ip_offset;
/* Size of the maximum transmission unit (>= 68) */
u16 mtu_size;
};
struct pa2_cmd_usr_stats {
/* User-defined statistics index */
u16 index;
};
struct pa2_cmd_set_usr_stats {
/* Commad Set Index */
u16 set_index;
/* User-defined statistics index */
u16 stats_index;
};
struct pa2_cmd_info {
/* Specify the PA command code as defined at paCmdCode */
u16 cmd;
union {
/* Specify nextRoute command specific parameters */
struct pa2_cmd_next_route route;
/* Specify Tx Checksum command specific parameters */
struct pa2_tx_chksum chksum;
/* Specify CRC operation command specific parameters */
struct pa2_cmd_crc_op crc_op;
/* Specify Copy command specific parameters */
struct pa2_cmd_copy copy;
/* Specify Patch command specific parameters */
struct pa2_patch_info patch;
/* Specify the payload info required by SA */
struct pa2_payload_info payload;
/* Specify Command Set command specific parameters */
struct pa2_cmd_set cmd_set;
/* Specify Multi-route cmd specific parameters */
struct pa2_cmd_multi_route m_route;
/* Report Tx Timestamp command specific parameters */
struct pa2_cmd_tx_timestamp tx_ts;
/* Specify IP fragmentation command specific parameters */
struct pa2_cmd_ip_frag ip_frag;
/* User-defined stats command specific parameters */
struct pa2_cmd_usr_stats usr_stats;
struct pa2_cmd_set_usr_stats cmd_set_usr_stats;
} params;
};
struct pa2_route_info {
/* Packet destination as defined at pktDest */
int dest;
/* For host, SA or SRIO destinations, specifies CPPI flow which defines
* free queues are used for receiving packets
*/
u8 flow_id;
/* For host, SA or SRIO destinations, specifies the destination queue */
u16 queue;
int m_route_index;
/* For host, Multi-queue routing index
* (0 to (pa_MAX_MULTI_ROUTE_SETS - 1)) or pa_NO_MULTI_ROUTE if multi
* routing not used
*/
/* Placed in SwInfo0 for packets to host or SA; Placed in the PS Info
* for packets to SRIO
*/
u32 sw_info_0;
/* Placed in SwInfo1 for packets to the SA; Placed in the PS Info for
* packets to SRIO
*/
u32 sw_info_1;
int custom_type;
/* For CONTINUE_PARSE_LUT1/LUT2 only, specifies the custom type as
* defined at @ref customType
*/
/* For CONTINUE_PARSE_LUT1/LUT2 only, specifies the custom
* classification entry index
*/
u8 custom_index;
/* For destination SRIO, specify the 5-bit packet type toward SRIO
* For destination HOST, EMAC, specify the EMAC control
* emcOutputCtrlBits to the network
*/
u8 pkt_type_emac_ctrl;
/* Pointer to the Command info to be executed prior to the packet
* forwarding. Note only the following commands are supported within
* paRouteInfo_t - pa_CMD_PATCH_DATA (up to two bytes only) (LUT2 only)
* - pa_CMD_CMDSET
* - pa_CMD_USR_STATS
* - pa_CMD_CMDSET_AND_USR_STATS
*/
struct pa2_cmd_info *pcmd;
};
/* PA Route Info Valid Bit Definitions */
#define PA2_ROUTE_INFO_VALID_MROUTEINDEX BIT(0)
#define PA2_ROUTE_INFO_VALID_PKTTYPE_EMAC BIT(1)
#define PA2_ROUTE_INFO_VALID_PCMD BIT(2)
#define PA2_ROUTE_INFO_VALID_PRIORITY_TYPE BIT(3)
struct pa2_route_info2 {
/* 32-bit valid bitmap corresponding to each optional field as defined
* at paRouteInfoValidBits
*/
u32 valid_bitmap;
/* Packet destination as defined at pktDest */
int dest;
/* For host, SA or SRIO destinations, specifies CPPI flow which defines
* free queues are used for receiving packets
*/
u8 flow_id;
/* For host, SA or SRIO destinations, specifies the destination queue */
u16 queue;
int m_route_index;
/* For host, Multi-queue routing index
* (0 to (pa_MAX_MULTI_ROUTE_SETS - 1)) or pa_NO_MULTI_ROUTE if multi
* routing not used
*/
/* Placed in SwInfo0 for packets to host or SA; Placed in the PS Info
* for packets to SRIO
*/
u32 sw_info_0;
/* Placed in SwInfo1 for packets to the SA; Placed in the PS Info for
* packets to SRIO
*/
u32 sw_info_1;
/* For CONTINUE_PARSE_LUT1/LUT2 only, specifies the custom type as
* defined at @ref custom_type
*/
int custom_type;
/* For CONTINUE_PARSE_LUT1/LUT2 only, specifies the custom
* classification entry index
*/
u8 custom_index;
/* For destination SRIO, specify the 5-bit packet type toward SRIO
* For destination HOST, EMAC, specify the EMAC control
* emcOutputCtrlBits to the network
*/
u8 pkt_type_emac_ctrl;
/* Pointer to the Command info to be executed prior to the packet
* forwarding. Note only the following commands are
* supported within paRouteInfo_t
* - pa_CMD_PATCH_DATA (up to two bytes only) (LUT2 only)
* - pa_CMD_CMDSET
* - pa_CMD_USR_STATS
* - pa_CMD_CMDSET_AND_USR_STATS
*/
struct pa2_cmd_info *pcmd;
/* validBitMap[t3]: For Host only, specify priority-based and/or
* interfcae-based routing mode as defined at paRoutePriIntf_e
*/
u8 priority_type;
/* For EFLOW only, egress flow operation info (PAGG Gen2 only) */
struct pa2_ef_op_info *ef_op;
};
struct pa2_cmd_reply {
/* Packet destination, must be pa_DEST_HOST or PA2_DEST_DISCARD, see
* @ref pktDest
*/
int dest;
/* Value placed in swinfo0 in reply packet */
u32 reply_id;
/* Destination queue for destination PA2_DEST_HOST */
u16 queue;
u8 flow_id;
/* Flow ID used on command reply from PASS */
};
#define PAFRM_PKT_CAP_MAX_PORT 9
#define PAFRM_MAX_EMAC_PORT (PAFRM_PKT_CAP_MAX_PORT - 1)
enum {
DROUTE_MULTICAST, /* default multicast route */
DROUTE_BROADCAST, /* default broadcast route */
DROUTE_UNICAST, /* default unicast route */
DROUTE_N_MAX
};
struct pa_frm_def_route_info {
/* Control Bit Map
* b0: enable/disable route config for MC packets
* b1: enable/disable route config for BC packets
* b2: enable/disable route config for UC packets
* b3: Pre classification enabled for default route
* otherwise post classification for default route
*/
u8 ctrl_bit_map;
/* ingress port. This is zero based. 0 - for first ethernet
* slave port, 1 for second and so forth
*/
u8 port;
u16 rsvd;
struct pa2_frm_forward def_route[DROUTE_N_MAX];
};
/* Default route configuration */
struct pa2_frm_def_route_cfg {
u8 num_ports; /* number of ports to be configured */
u8 rsvd1;
u16 rsvd2;
struct pa_frm_def_route_info route_cfg[PAFRM_MAX_EMAC_PORT];
};
/* PA system configuration codes */
#define PAFRM_SYSTEM_CONFIG_CODE_DEFAULT_ROUTE 8
/* PA system configuration command struct. Used by
* PAFRM_CONFIG_COMMAND_SYS_CONFIG command
*/
struct pa2_frm_command_sys_config_pa {
/* system configuration code as defined below */
u8 cfg_code;
u8 rsvd1;
/* reserved for alignment */
u16 rsvd2;
union {
/* Default route configuration for interface */
struct pa2_frm_def_route_cfg def_route_cfg;
} u;
};
/* PA global configuration command struct. Used by
* PA2FRM_CONFIG_COMMAND_CONFIG_PA
*/
struct pa_frm_packet_ctrl_config {
u16 ctrl_bit_map;
u16 valid_bit_map;
/* Below fields are not used by linux driver. So keeping it as reseved
* for now for alignment and may be enhanced later as and when feature
* is required in linux.
*/
u32 rsvd[2];
};
struct pa2_frm_command_config_pa {
u16 valid_flag;
u16 rsvd2;
/* Below fields are not used by linux driver. So keeping it as reseved
* for now for alignment and may be enhanced later as and when feature
* is required in linux.
*/
u32 rsvd3[6];
struct pa_frm_packet_ctrl_config pkt_ctrl;
/* reserved because linux driver doesn't use the feature */
u32 rsvd4[12];
};
/* Definitions below is used for valid_flag field of packet control command.
* Ingress default route is to be enabled for Pre-classification. This
* requires PA_PKT_CTRL_EMAC_IF_INGRESS_DEFAULT_ROUTE with valid_flag set
* or reset at bit position below.
*/
#define PAFRM_COMMAND_CONFIG_VALID_PKT_CTRL BIT(6)
/* Definitions below are used for Pre-Classify feature enablement for BC and
* MC at the ingress
*/
/* Set/Clear: default route enable for multicast */
#define PA_EMAC_IF_DEF_ROUTE_MC_ENABLE BIT(0)
/* Set/Clear: default route enable for broadcast */
#define PA_EMAC_IF_DEF_ROUTE_BC_ENABLE BIT(1)
/* Set/Clear: default route for multicast pre classification enable */
#define PA_EMAC_IF_DEF_ROUTE_MC_PRE_CLASSIFY_ENABLE BIT(3)
/* Set/Clear: default route for broadcast pre classification enable */
#define PA_EMAC_IF_DEF_ROUTE_BC_PRE_CLASSIFY_ENABLE BIT(4)
/* Ingress default route enable/enable for mac interface */
#define PA_PKT_CTRL_EMAC_IF_INGRESS_DEFAULT_ROUTE BIT(7)
#endif /* KEYSTONE_PA2_FW_H */
|