Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: ip_ingress_classes.vr | |
4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | // | |
7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | // | |
9 | // This program is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; version 2 of the License. | |
12 | // | |
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | // | |
22 | // For the avoidance of doubt, and except that if any non-GPL license | |
23 | // choice is available it will apply instead, Sun elects to use only | |
24 | // the General Public License version 2 (GPLv2) at this time for any | |
25 | // software where a choice of GPL license versions is made | |
26 | // available with the language indicating that GPLv2 or any later version | |
27 | // may be used, or where a choice of which version of the GPL is applied is | |
28 | // otherwise unspecified. | |
29 | // | |
30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | // CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | // have any questions. | |
33 | // | |
34 | // ========== Copyright Header End ============================================ | |
35 | #include <vera_defines.vrh> | |
36 | ||
37 | #include "pcg_defines.vri" | |
38 | #include "pcg_types.vri" | |
39 | //#include "pcg_classes.vrh" | |
40 | #include "pack_db.vrh" | |
41 | //#include "pack_db_tasks.vrh" | |
42 | #include "flow_db.vrh" | |
43 | #include "flow_db_tasks.vrh" | |
44 | #include "pg_top_pp.vrh" | |
45 | //#include "pcg_lib.vrh" | |
46 | #include "pc_top_pp.vrh" | |
47 | ||
48 | // ----- CAM Key Database ----- | |
49 | class Cpkt_info | |
50 | { | |
51 | flow_desc flow; | |
52 | integer pkt_len; | |
53 | integer pkt_num; | |
54 | integer mac_prt; | |
55 | bit [7:0] protocol; | |
56 | bit [4:0] zcp_dma_chnl; | |
57 | bit [2:0] zcp_rdc_tbl_num; | |
58 | bit [4:0] zcp_rdc_tbl_offset; | |
59 | ||
60 | bit prog_class7_4_match; | |
61 | bit prog_class3_2_match; | |
62 | bit class_matched; | |
63 | bit asdata_disc; | |
64 | integer packet_class; | |
65 | bit [383:0] flow_key; | |
66 | ||
67 | //@@@@@@@ Control FIFO Fields @@@@@@@@@@@ | |
68 | //@@ B0 @@@ | |
69 | bit maccheck; | |
70 | //@@ B1 @@@ | |
71 | bit tzfvld; | |
72 | bit [1:0] tres; | |
73 | bit tcamhit; | |
74 | bit badip; | |
75 | bit noport; | |
76 | bit llcsnap; | |
77 | bit vlan; | |
78 | //@@ B2 @@@ | |
79 | bit [4:0] dma_num; | |
80 | bit [4:0] default_dma_num; // {B2[2:0],B4[7:6]} | |
81 | //@@ B3 @@@ | |
82 | bit [7:0] tcamm_index; | |
83 | //@@ B4 @@@ | |
84 | bit [2:0] hash_index; | |
85 | bit hzfvld; | |
86 | bit hash_exact_match; | |
87 | bit hash_hit; | |
88 | //@@ B5 @@@ | |
89 | bit tt_err; | |
90 | bit tt_succeed; | |
91 | //@@ B6 @@@ | |
92 | bit [11:0] zc_flow_id; // {B6[3:0],B7[7:0] | |
93 | bit solicited_event_bit; | |
94 | bit drop_pkt; | |
95 | bit fflp_hw_err; | |
96 | bit mac_promiscuous; | |
97 | //@@ B7 @@@ | |
98 | //##### if tt_succeed = 0 ##### | |
99 | //@@ B8 & B9 @@@ | |
100 | bit [15:0] hash_value2; | |
101 | //@@ B10 & B11 & B12 @@@ | |
102 | bit [19:0] hash_value1; | |
103 | //@@ B13, B14, B15, B16, B17 @@@ | |
104 | bit [39:0] user_data; | |
105 | //##### if tt_succeed = 1 ##### | |
106 | //@@ B8, B9 @@ | |
107 | bit [15:0] tt_hdr_len; | |
108 | //@@ B10, B11 @@@ | |
109 | bit [15:0] tcp_payload_len; | |
110 | //@@ B12, B13 @@@ | |
111 | bit [15:0] HoQ; | |
112 | //@@ B14, B15,B16 @@@ | |
113 | bit [23:0] first_byte_offset; | |
114 | //@@ B17 @@@ | |
115 | bit [4:0] win_buf_offset; | |
116 | bit [1:0] dmaw_type_1; | |
117 | bit reach_buf_end; | |
118 | //##### | |
119 | //@@ B18 @@@ | |
120 | bit [1:0] L4_protocol; | |
121 | bit [3:0] pkt_id; | |
122 | bit ip_version; | |
123 | //@@ B19 @@@ | |
124 | bit [4:0] zc_rdc; | |
125 | bit [1:0] dmaw_type; | |
126 | //@@ B20, B21 @@ | |
127 | bit [15:0] L3_pkt_len; | |
128 | //@@ B22 @@ | |
129 | bit [3:0] tcp_hdr_len; | |
130 | bit [3:0] ipv4_hdr_len; | |
131 | //@@ B23-B26 @@ | |
132 | bit [31:0] tcp_seq_num; | |
133 | ||
134 | ||
135 | ||
136 | ||
137 | ||
138 | ||
139 | ||
140 | ||
141 | ||
142 | ||
143 | task new() | |
144 | { | |
145 | // flow = new(); | |
146 | pkt_len = 0; | |
147 | pkt_num = 0; | |
148 | mac_prt = 0; | |
149 | protocol = 8'h0; | |
150 | zcp_dma_chnl = 5'h0; | |
151 | zcp_rdc_tbl_num = 3'h0; | |
152 | zcp_rdc_tbl_offset = 5'h0; | |
153 | prog_class7_4_match = 1'b0; | |
154 | prog_class3_2_match = 1'b0; | |
155 | class_matched = 1'b0; | |
156 | asdata_disc = 1'b0; | |
157 | packet_class = 0; | |
158 | flow_key = 384'h0; | |
159 | //@@@@@@@ Control FIFO Fields @@@@@@@@@@@ | |
160 | //@@ B0 @@@ | |
161 | maccheck = 0; | |
162 | //@@ B1 @@@ | |
163 | tzfvld = 0; | |
164 | tres = 0; | |
165 | tcamhit = 0; | |
166 | badip = 0; | |
167 | noport = 0; | |
168 | llcsnap = 0; | |
169 | vlan = 0; | |
170 | //@@ B2 @@@ | |
171 | dma_num = 0; | |
172 | default_dma_num = 0; // {B2[2:0],B4[7:6]} | |
173 | //@@ B3 @@@ | |
174 | tcamm_index = 0; | |
175 | //@@ B4 @@@ | |
176 | hash_index = 0; | |
177 | hzfvld = 0; | |
178 | hash_exact_match = 0; | |
179 | hash_hit = 0; | |
180 | //@@ B5 @@@ | |
181 | tt_err = 0; | |
182 | tt_succeed = 0; | |
183 | //@@ B6 @@@ | |
184 | zc_flow_id = 0; // {B6[3:0],B7[7:0]} | |
185 | solicited_event_bit = 0; | |
186 | drop_pkt = 0; | |
187 | fflp_hw_err = 0; | |
188 | mac_promiscuous = 0; | |
189 | //@@ B7 @@@ | |
190 | //##### if tt_succeed = 0 ##### | |
191 | //@@ B8 & B9 @@@ | |
192 | hash_value2 = 0; | |
193 | //@@ B10 & B11 & B12 @@@ | |
194 | hash_value1 = 0; | |
195 | //@@ B13, B14, B15, B16, B17 @@@ | |
196 | user_data = 0; | |
197 | //##### if tt_succeed = 1 ##### | |
198 | //@@ B8, B9 @@ | |
199 | tt_hdr_len = 0; | |
200 | //@@ B10, B11 @@@ | |
201 | tcp_payload_len = 0; | |
202 | //@@ B12, B13 @@@ | |
203 | HoQ = 0; | |
204 | //@@ B14, B15,B16 @@@ | |
205 | first_byte_offset = 0; | |
206 | //@@ B17 @@@ | |
207 | win_buf_offset = 0; | |
208 | dmaw_type_1 = 0; | |
209 | reach_buf_end = 0; | |
210 | //##### | |
211 | //@@ B18 @@@ | |
212 | L4_protocol = 0; | |
213 | pkt_id = 0; | |
214 | ip_version = 0; | |
215 | //@@ B19 @@@ | |
216 | zc_rdc = 0; | |
217 | dmaw_type = 0; | |
218 | //@@ B20, B21 @@ | |
219 | L3_pkt_len = 0; | |
220 | //@@ B22 @@ | |
221 | tcp_hdr_len = 0; | |
222 | ipv4_hdr_len = 0; | |
223 | //@@ B23-B26 @@ | |
224 | tcp_seq_num = 0; | |
225 | } | |
226 | } | |
227 | ||
228 | class ip_cam_db { | |
229 | ||
230 | bit [4:0] cls_code = 5'hx; // fflp class value | |
231 | bit [4:0] l2rdc_tbl_num = 5'h0; | |
232 | bit nop = 1'b0; // Fragmented or none tcp/udp | |
233 | bit [7:0] protocol = 8'h0; // IPV4 | |
234 | bit [7:0] next_header = 8'h0; // IPV6 | |
235 | bit [199:0] shadow_cam_key [256]; // Shadow of tcam key entries | |
236 | bit [199:0] shadow_cam_lmask[256]; // Shadow of tcam lmask entries | |
237 | bit [63:0] shadow_adata [256]; // Shadow of as_data entries | |
238 | ||
239 | bit [63:0] shadow_fflp_how_tcam_key_cls_C; | |
240 | bit [63:0] shadow_fflp_how_tcam_key_cls_D; | |
241 | bit [63:0] shadow_fflp_how_tcam_key_cls_E; | |
242 | bit [63:0] shadow_fflp_how_tcam_key_cls_F; | |
243 | ||
244 | task new() | |
245 | { | |
246 | integer i; | |
247 | ||
248 | cls_code = 5'hx; // fflp class value | |
249 | l2rdc_tbl_num = 5'b0; // from mac control wrd | |
250 | nop = 1'b0; // Fragmented or none tcp/udp | |
251 | protocol = 8'h0; // IPV4 | |
252 | next_header = 8'h0; // IPV6 | |
253 | ||
254 | shadow_fflp_how_tcam_key_cls_C = 64'hx; | |
255 | shadow_fflp_how_tcam_key_cls_D = 64'hx; | |
256 | shadow_fflp_how_tcam_key_cls_E = 64'hx; | |
257 | shadow_fflp_how_tcam_key_cls_F = 64'hx; | |
258 | ||
259 | for (i=0;i<256;i++) | |
260 | { | |
261 | shadow_cam_key[i] = 200'h0; | |
262 | shadow_cam_lmask[i] = 200'hff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff; | |
263 | shadow_adata [i] = 64'h0; | |
264 | } | |
265 | } | |
266 | } | |
267 | ||
268 | // ----- ASDATA Database ----- | |
269 | class ip_asdata_db | |
270 | { | |
271 | bit syndrome = 16'h0; | |
272 | bit [11:0] zfid = 12'h0; | |
273 | bit v4_ecc_ck = 1'b0; | |
274 | bit disc = 1'b0; | |
275 | bit [1:0] tres = 2'b00; | |
276 | bit [2:0] rdctbl = 3'h0; | |
277 | bit [4:0] offset = 5'h0; | |
278 | bit zfvld = 2'b00; | |
279 | bit age = 1'b0; | |
280 | ||
281 | task new() | |
282 | { | |
283 | syndrome = 16'h0; | |
284 | zfid = 12'h0; | |
285 | v4_ecc_ck = 1'b0; | |
286 | disc = 1'b0; | |
287 | tres = 2'b00; | |
288 | rdctbl = 3'h0; | |
289 | offset = 5'h0; | |
290 | zfvld = 1'b0; | |
291 | age = 1'b0; | |
292 | } | |
293 | } | |
294 | ||
295 | // ----- MAC Control Word Database ----- | |
296 | class ip_mac_db { | |
297 | bit [2:0] mac_port = 3'b000; | |
298 | bit [1:0] mac_speed = 2'b00; | |
299 | bit [47:0] mac_da = 48'h0; | |
300 | bit [2:0] mac_rdctblnum = 3'h0; | |
301 | bit mac_mpr = 1'b0; | |
302 | // bit ph_bit = 1'b0; | |
303 | ||
304 | task new() | |
305 | { | |
306 | mac_port = 3'b000; | |
307 | mac_speed = 2'b00; | |
308 | mac_da = 48'h00; | |
309 | mac_rdctblnum = 3'h0; | |
310 | mac_mpr = 1'b0; | |
311 | // ph_bit = 1'b0; | |
312 | } | |
313 | } | |
314 | ||
315 | // ----- FCRAM Database ----------- | |
316 | class ip_fcram_db { | |
317 | ||
318 | task new() | |
319 | { | |
320 | } | |
321 | } | |
322 | // ----- LB VLAN Table Database for N2 ------ | |
323 | class ip_vlan_db { | |
324 | bit parity1 = 1'b0; | |
325 | bit parity0 = 1'b0; | |
326 | bit vpr3 = 1'b0; | |
327 | bit [2:0] rdctblnum3 = 3'h0; | |
328 | bit vpr2 = 1'b0; | |
329 | bit [2:0] rdctblnum2 = 3'h0; | |
330 | bit vpr1 = 1'b0; | |
331 | bit [2:0] rdctblnum1 = 3'h0; | |
332 | bit vpr0 = 1'b0; | |
333 | bit [2:0] rdctblnum0 = 3'h0; | |
334 | ||
335 | task new() | |
336 | { | |
337 | parity1 = 1'b0; | |
338 | parity0 = 1'b0; | |
339 | vpr3 = 1'b0; | |
340 | rdctblnum3 = 3'h0; | |
341 | vpr2 = 1'b0; | |
342 | rdctblnum2 = 3'h0; | |
343 | vpr1 = 1'b0; | |
344 | rdctblnum1 = 3'h0; | |
345 | vpr0 = 1'b0; | |
346 | rdctblnum0 = 3'h0; | |
347 | } | |
348 | } | |
349 | ||
350 | ||
351 | /* | |
352 | // ----- general byte array ----- | |
353 | class byte_array { | |
354 | bit [7:0] val[]; | |
355 | } | |
356 | */ | |
357 | ||
358 | // ----- Node Descriptor ----- | |
359 | class node_desc_cl { | |
360 | bit [47:0] l2_addr; // L2 address for this station | |
361 | bit [15:0] tci; // Tag Control Information | |
362 | bit [31:0] ip_addr; // IPv4 address of this substation | |
363 | bit [128:0] ipv6_addr; // IPv6 address of this substation | |
364 | bit [7:0] tos =0; // TOS v4/Frame Class v6 | |
365 | bit [19:0] src_port; // Which ports may use this node as source | |
366 | bit [31:0] spi = 0; // Security Parameter Index for AH /ESP | |
367 | bit [7:0] nxthdr = 06; | |
368 | ||
369 | } | |
370 | ||
371 | // ----- TCP/UDP Ports Descriptor ----- | |
372 | class tup_descr_cl { | |
373 | bit [15:0] src_tcp_udp_port; // Source TCP/UDP Port | |
374 | bit [15:0] dst_tcp_udp_port; // Destination TCP/UDP Port | |
375 | ||
376 | } | |
377 | ||
378 | // ----- Frame Descriptor ----- | |
379 | class frame_desc_cl { | |
380 | bit [4:0] frame_type = 0; // Frame Type (bit 3: 0=IPv4 Header 1=IPv6 Header) | |
381 | // bit 4: 0=Tunneling off | |
382 | bit [1:0] tunnel_type = 0;// selects between different tunneling combinations | |
383 | // 00: IPv4/IPv4 (default) | |
384 | // 01: IPv4/IPv6 | |
385 | // 10: IPv6/IPv4 | |
386 | // 11: IPv6/IPv6 | |
387 | integer frame_class; // L3 IP class | |
388 | integer type; // L3 IP class type (-1 = auto: length or type from class); | |
389 | integer tpid; // L2 Tagged frames custopm TPID value (-1 = use default) | |
390 | integer class_mask; // Mask to be applied to class | |
391 | integer class_funct; // Mask Operation (0-AND, 1-OR) | |
392 | integer data_type; // Type of payload | |
393 | integer data_seed; // Seed for random data | |
394 | //integer data_length; // Length of payload (-1=make exactly 64 byte packets) | |
395 | integer header_length; // Header Length of the Packet | |
396 | ||
397 | task new() { | |
398 | frame_type = 0; | |
399 | tunnel_type = 0; | |
400 | frame_class = 0; | |
401 | type = -1; | |
402 | tpid = -1; | |
403 | class_mask = 0; | |
404 | class_funct = 0; | |
405 | data_type = 0; | |
406 | data_seed = 0; | |
407 | //data_length = 0; | |
408 | header_length = 0; | |
409 | } | |
410 | } | |
411 | ||
412 | ||
413 | // ----- TCP Tx Parameters ----- | |
414 | class tmt_param_cl { | |
415 | bit [31:0] adv_isn; | |
416 | bit [31:0] last_seqno; | |
417 | bit retr_timeout; //Initialize to zero | |
418 | bit [15:0] adv_window_size;//Initialize to zero | |
419 | ||
420 | task new() { | |
421 | retr_timeout = 0; | |
422 | adv_window_size = 0; | |
423 | last_seqno = 0; | |
424 | } | |
425 | ||
426 | ||
427 | } | |
428 | ||
429 | // ----- TCP Rx Parameters ----- | |
430 | class rcv_param_cl { | |
431 | bit [31:0] rcv_isn;//User Programs while Setting "SYN" | |
432 | bit [31:0] last_ackno; | |
433 | bit timeout; //Initialize to zero | |
434 | bit [15:0] rmt_window_size;//Initialize to zero | |
435 | ||
436 | task new() { | |
437 | timeout = 0; | |
438 | rmt_window_size = 0; | |
439 | } | |
440 | } | |
441 | ||
442 | ||
443 | // ----- TCP State Parameters ----- | |
444 | ||
445 | class tcp_state_cl { | |
446 | bit [5:0] tcp_flags; | |
447 | bit [3:0] tcp_st;//Initialise to zero now | |
448 | ||
449 | task new() { | |
450 | //tcp_flags = 6'b00_0010;//{(URG,ACK,PSH,RST,SYN,FIN} | |
451 | tcp_st = 0; | |
452 | } | |
453 | } | |
454 | ||
455 | // ----- TOP ip_db class ----- | |
456 | class ip_db_cl { | |
457 | ||
458 | frame_desc_cl ip_frame; | |
459 | node_desc_cl ip_src_node; | |
460 | node_desc_cl ip_dst_node; | |
461 | tup_descr_cl ip_tup; | |
462 | rcv_param_cl ip_rx_param; | |
463 | tmt_param_cl ip_tx_param; | |
464 | tcp_state_cl ip_fl_state; | |
465 | integer ip_flow_no; | |
466 | ||
467 | ip_cam_db ip_cam; | |
468 | ip_mac_db ip_mac; | |
469 | ip_asdata_db ip_asdata; | |
470 | ip_fcram_db ip_fcram; | |
471 | ip_vlan_db ip_vlan; | |
472 | ||
473 | bit prog_class7_4_matched; | |
474 | bit prog_class3_2_matched; | |
475 | bit [4:0] pkt_class; | |
476 | ||
477 | task new() { | |
478 | ||
479 | // ip_frame = new; | |
480 | // ip_src_node = new; | |
481 | // ip_dst_node = new; | |
482 | // ip_tup = new; | |
483 | // ip_rx_param = new; | |
484 | // ip_tx_param = new; | |
485 | // ip_fl_state = new; | |
486 | ||
487 | // ip_cam = new; | |
488 | // ip_mac = new; | |
489 | // ip_asdata = new; | |
490 | // ip_fcram = new; | |
491 | // ip_vlan = new; | |
492 | ||
493 | prog_class7_4_matched = 1'b0; | |
494 | prog_class3_2_matched = 1'b0; | |
495 | pkt_class = 5'h0; | |
496 | } | |
497 | } | |
498 | ||
499 |