1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _NPI_FFLP_H 27 #define _NPI_FFLP_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 36 #include <npi.h> 37 #include <nxge_fflp_hw.h> 38 #include <nxge_fflp.h> 39 40 41 typedef uint8_t part_id_t; 42 typedef uint8_t tcam_location_t; 43 typedef uint16_t vlan_id_t; 44 45 typedef enum _tcam_op { 46 TCAM_RWC_STAT = 0x1, 47 TCAM_RWC_MATCH = 0x2 48 } tcam_op_t; 49 50 51 #define NPI_TCAM_COMP_NO_MATCH 0x8000000000000ULL 52 53 /* 54 * NPI FFLP ERROR Codes 55 */ 56 57 #define NPI_FFLP_BLK_CODE FFLP_BLK_ID << 8 58 #define NPI_FFLP_ERROR (NPI_FAILURE | NPI_FFLP_BLK_CODE) 59 #define NPI_TCAM_ERROR 0x10 60 #define NPI_FCRAM_ERROR 0x20 61 #define NPI_GEN_FFLP 0x30 62 #define NPI_FFLP_SW_PARAM_ERROR 0x40 63 #define NPI_FFLP_HW_ERROR 0x80 64 65 66 #define NPI_FFLP_RESET_ERROR (NPI_FFLP_ERROR | NPI_GEN_FFLP | RESET_FAILED) 67 #define NPI_FFLP_RDC_TABLE_INVALID (NPI_FFLP_ERROR | RDC_TAB_INVALID) 68 #define NPI_FFLP_VLAN_INVALID (NPI_FFLP_ERROR | VLAN_INVALID) 69 #define NPI_FFLP_PORT_INVALID (NPI_FFLP_ERROR | PORT_INVALID) 70 #define NPI_FFLP_TCAM_RD_ERROR \ 71 (NPI_FFLP_ERROR | NPI_TCAM_ERROR | READ_FAILED) 72 #define NPI_FFLP_TCAM_WR_ERROR \ 73 (NPI_FFLP_ERROR | NPI_TCAM_ERROR | WRITE_FAILED) 74 #define NPI_FFLP_TCAM_LOC_INVALID \ 75 (NPI_FFLP_ERROR | NPI_TCAM_ERROR | LOCATION_INVALID) 76 #define NPI_FFLP_ASC_RAM_RD_ERROR \ 77 (NPI_FFLP_ERROR | NPI_TCAM_ERROR | READ_FAILED) 78 #define NPI_FFLP_ASC_RAM_WR_ERROR \ 79 (NPI_FFLP_ERROR | NPI_TCAM_ERROR | WRITE_FAILED) 80 #define NPI_FFLP_FCRAM_READ_ERROR \ 81 (NPI_FFLP_ERROR | NPI_FCRAM_ERROR | READ_FAILED) 82 #define NPI_FFLP_FCRAM_WR_ERROR \ 83 (NPI_FFLP_ERROR | NPI_FCRAM_ERROR | WRITE_FAILED) 84 #define NPI_FFLP_FCRAM_PART_INVALID \ 85 (NPI_FFLP_ERROR | NPI_FCRAM_ERROR | RDC_TAB_INVALID) 86 #define NPI_FFLP_FCRAM_LOC_INVALID \ 87 (NPI_FFLP_ERROR | NPI_FCRAM_ERROR | LOCATION_INVALID) 88 89 #define TCAM_CLASS_INVALID \ 90 (NPI_FFLP_SW_PARAM_ERROR | 0xb) 91 /* have only 0xc, 0xd, 0xe and 0xf left for sw error codes */ 92 #define NPI_FFLP_TCAM_CLASS_INVALID \ 93 (NPI_FFLP_ERROR | NPI_TCAM_ERROR | TCAM_CLASS_INVALID) 94 #define NPI_FFLP_TCAM_HW_ERROR \ 95 (NPI_FFLP_ERROR | NPI_FFLP_HW_ERROR | NPI_TCAM_ERROR) 96 #define NPI_FFLP_FCRAM_HW_ERROR \ 97 (NPI_FFLP_ERROR | NPI_FFLP_HW_ERROR | NPI_FCRAM_ERROR) 98 99 100 /* 101 * FFLP NPI defined event masks (mapped to the hardware defined masks). 102 */ 103 typedef enum _fflp_event_mask_cfg_e { 104 CFG_FFLP_ENT_MSK_VLAN_MASK = FFLP_ERR_VLAN_MASK, 105 CFG_FFLP_ENT_MSK_TCAM_MASK = FFLP_ERR_TCAM_MASK, 106 CFG_FFLP_ENT_MSK_HASH_TBL_LKUP_MASK = FFLP_ERR_HASH_TBL_LKUP_MASK, 107 CFG_FFLP_ENT_MSK_HASH_TBL_DAT_MASK = FFLP_ERR_HASH_TBL_DAT_MASK, 108 109 CFG_FFLP_MASK_ALL = (FFLP_ERR_VLAN_MASK | FFLP_ERR_TCAM_MASK | 110 FFLP_ERR_HASH_TBL_LKUP_MASK | 111 FFLP_ERR_HASH_TBL_DAT_MASK) 112 } fflp_event_mask_cfg_t; 113 114 115 /* FFLP FCRAM Related Functions */ 116 /* The following are FCRAM datapath functions */ 117 118 /* 119 * npi_fflp_fcram_entry_write () 120 * Populates an FCRAM entry 121 * Inputs: 122 * handle: opaque handle interpreted by the underlying OS 123 * partid: Partition ID 124 * location: Index to the FCRAM. 125 * Corresponds to last 20 bits of H1 value 126 * fcram_ptr: Pointer to the FCRAM contents to be used for writing 127 * format: Entry Format. Determines the size of the write. 128 * FCRAM_ENTRY_OPTIM: 8 bytes (a 64 bit write) 129 * FCRAM_ENTRY_EX_IP4: 32 bytes (4 X 64 bit write) 130 * FCRAM_ENTRY_EX_IP6: 56 bytes (7 X 64 bit write) 131 * 132 * Return: 133 * NPI_SUCCESS 134 * NPI_FAILURE 135 * NPI_HW_ERR 136 * NPI_SW_ERR 137 * 138 */ 139 140 npi_status_t npi_fflp_fcram_entry_write(npi_handle_t, part_id_t, 141 uint32_t, fcram_entry_t *, 142 fcram_entry_format_t); 143 144 /* 145 * npi_fflp_fcram_entry_read () 146 * Reads an FCRAM entry 147 * Inputs: 148 * handle: opaque handle interpreted by the underlying OS 149 * partid: Partition ID 150 * location: Index to the FCRAM. 151 * Corresponds to last 20 bits of H1 value 152 * fcram_ptr: Pointer to the FCRAM contents to be updated 153 * format: Entry Format. Determines the size of the read. 154 * FCRAM_ENTRY_OPTIM: 8 bytes (a 64 bit read) 155 * FCRAM_ENTRY_EX_IP4: 32 bytes (4 X 64 bit read ) 156 * FCRAM_ENTRY_EX_IP6: 56 bytes (7 X 64 bit read ) 157 * 158 * Return: 159 * NPI_SUCCESS 160 * NPI_FAILURE 161 * NPI_HW_ERR 162 * NPI_SW_ERR 163 */ 164 165 npi_status_t npi_fflp_fcram_entry_read(npi_handle_t, part_id_t, 166 uint32_t, fcram_entry_t *, 167 fcram_entry_format_t); 168 169 /* 170 * npi_fflp_fcram_entry_invalidate () 171 * Invalidate FCRAM entry at the given location 172 * Inputs: 173 * handle: opaque handle interpreted by the underlying OS 174 * partid: Partition ID 175 * location: location of the FCRAM/hash entry. 176 * 177 * Return: 178 * NPI_SUCCESS 179 * NPI_FAILURE 180 * NPI_HW_ERR 181 * NPI_SW_ERR 182 * 183 */ 184 185 npi_status_t 186 npi_fflp_fcram_entry_invalidate(npi_handle_t, part_id_t, 187 uint32_t); 188 189 /* 190 * npi_fflp_fcram_subarea_write () 191 * Writes to FCRAM entry subarea i.e the 8 bytes within the 64 bytes pointed by 192 * last 20 bits of H1. Effectively, this accesses specific 8 bytes within the 193 * hash table bucket. 194 * 195 * |-----------------| <-- H1 196 * | subarea 0 | 197 * |_________________| 198 * | Subarea 1 | 199 * |_________________| 200 * | ....... | 201 * |_________________| 202 * | Subarea 7 | 203 * |_________________| 204 * 205 * Inputs: 206 * handle: opaque handle interpreted by the underlying OS 207 * partid: Partition ID 208 * location: location of the subarea. It is derived from: 209 * Bucket = [19:15][14:0] (20 bits of H1) 210 * location = (Bucket << 3 ) + subarea * 8 211 * = [22:18][17:3] || subarea * 8 212 * data: Data 213 * Return: 214 * NPI_SUCCESS 215 * NPI_FAILURE 216 * NPI_HW_ERR 217 * NPI_SW_ERR 218 * 219 */ 220 221 222 npi_status_t npi_fflp_fcram_subarea_write(npi_handle_t, part_id_t, 223 uint32_t, uint64_t); 224 /* 225 * npi_fflp_fcram_subarea_read () 226 * Reads an FCRAM entry subarea i.e the 8 bytes within the 64 bytes pointed by 227 * last 20 bits of H1. Effectively, this accesses specific 8 bytes within the 228 * hash table bucket. 229 * 230 * H1--> |-----------------| 231 * | subarea 0 | 232 * |_________________| 233 * | Subarea 1 | 234 * |_________________| 235 * | ....... | 236 * |_________________| 237 * | Subarea 7 | 238 * |_________________| 239 * 240 * Inputs: 241 * handle: opaque handle interpreted by the underlying OS 242 * partid: Partition ID 243 * location: location of the subarea. It is derived from: 244 * Bucket = [19:15][14:0] (20 bits of H1) 245 * location = (Bucket << 3 ) + subarea * 8 246 * = [22:18][17:3] || subarea * 8 247 * data: ptr do write subarea contents to. 248 * 249 * Return: 250 * NPI_SUCCESS 251 * NPI_FAILURE 252 * NPI_HW_ERR 253 * NPI_SW_ERR 254 * 255 */ 256 257 npi_status_t npi_fflp_fcram_subarea_read (npi_handle_t, 258 part_id_t, uint32_t, uint64_t *); 259 260 261 /* The following are zero function fflp configuration functions */ 262 /* 263 * npi_fflp_fcram_config_partition() 264 * Partitions and configures the FCRAM 265 * 266 * Input 267 * partid partition ID 268 * Corresponds to the RDC table 269 * part_size Size of the partition 270 * 271 * Return: 272 * NPI_SUCCESS 273 * NPI_FAILURE 274 * NPI_HW_ERR 275 * NPI_SW_ERR 276 * 277 */ 278 npi_status_t npi_fflp_cfg_fcram_partition(npi_handle_t, part_id_t, 279 uint8_t, uint8_t); 280 281 /* 282 * npi_fflp_fcram_partition_enable 283 * Enable previously configured FCRAM partition 284 * 285 * Input 286 * partid partition ID 287 * Corresponds to the RDC table 288 * 289 * Return 290 * 0 Successful 291 * Non zero error code Enable failed, and reason. 292 * 293 */ 294 npi_status_t npi_fflp_cfg_fcram_partition_enable(npi_handle_t, 295 part_id_t); 296 297 /* 298 * npi_fflp_fcram_partition_disable 299 * Disable previously configured FCRAM partition 300 * 301 * Input 302 * partid partition ID 303 * Corresponds to the RDC table 304 * 305 * Return: 306 * NPI_SUCCESS 307 * NPI_FAILURE 308 * NPI_HW_ERR 309 * NPI_SW_ERR 310 * 311 */ 312 313 npi_status_t npi_fflp_cfg_fcram_partition_disable(npi_handle_t, 314 part_id_t); 315 316 317 /* 318 * npi_fflp_cfg_fcram_reset 319 * Initializes the FCRAM reset sequence (including FFLP). 320 * 321 * Input 322 * strength: FCRAM Drive strength 323 * strong, weak or normal 324 * HW recommended value: 325 * qs: FCRAM QS mode selection 326 * qs mode or free running 327 * HW recommended value is: 328 * 329 * Return: 330 * NPI_SUCCESS 331 * NPI_FAILURE 332 * NPI_HW_ERR 333 * NPI_SW_ERR 334 * 335 */ 336 337 npi_status_t npi_fflp_cfg_fcram_reset(npi_handle_t, 338 fflp_fcram_output_drive_t, 339 fflp_fcram_qs_t); 340 341 342 343 /* 344 * npi_fflp_cfg_tcam_reset 345 * Initializes the FFLP reset sequence 346 * Doesn't configure the FCRAM params. 347 * 348 * Input 349 * 350 * Return: 351 * NPI_SUCCESS 352 * NPI_FAILURE 353 * NPI_HW_ERR 354 * NPI_SW_ERR 355 * 356 */ 357 358 npi_status_t npi_fflp_cfg_tcam_reset(npi_handle_t); 359 360 /* 361 * npi_fflp_cfg_tcam_enable 362 * Enables the TCAM function 363 * 364 * Input 365 * 366 * Return: 367 * NPI_SUCCESS 368 * NPI_FAILURE 369 * NPI_HW_ERR 370 * NPI_SW_ERR 371 * 372 */ 373 374 npi_status_t npi_fflp_cfg_tcam_enable(npi_handle_t); 375 376 /* 377 * npi_fflp_cfg_tcam_disable 378 * Enables the TCAM function 379 * 380 * Input 381 * 382 * Return: 383 * NPI_SUCCESS 384 * NPI_FAILURE 385 * NPI_HW_ERR 386 * NPI_SW_ERR 387 * 388 */ 389 390 npi_status_t npi_fflp_cfg_tcam_disable(npi_handle_t); 391 392 393 /* 394 * npi_fflp_cfg_cam_errorcheck_disable 395 * Disables FCRAM and TCAM error checking 396 * 397 * Input 398 * 399 * 400 * Return: 401 * NPI_SUCCESS 402 * NPI_FAILURE 403 * NPI_HW_ERR 404 * NPI_SW_ERR 405 * 406 */ 407 408 npi_status_t npi_fflp_cfg_cam_errorcheck_disable(npi_handle_t); 409 410 /* 411 * npi_fflp_cfg_cam_errorcheck_enable 412 * Enables FCRAM and TCAM error checking 413 * 414 * Input 415 * 416 * 417 * Return 418 * 0 Successful 419 * Non zero error code Enable failed, and reason. 420 * 421 */ 422 npi_status_t npi_fflp_cfg_cam_errorcheck_enable(npi_handle_t); 423 424 425 /* 426 * npi_fflp_cfg_llcsnap_enable 427 * Enables input parser llcsnap recognition 428 * 429 * Input 430 * 431 * 432 * Return: 433 * NPI_SUCCESS 434 * NPI_FAILURE 435 * NPI_HW_ERR 436 * NPI_SW_ERR 437 * 438 * 439 */ 440 npi_status_t npi_fflp_cfg_llcsnap_enable(npi_handle_t); 441 442 /* 443 * npi_fflp_cam_llcsnap_disable 444 * Disables input parser llcsnap recognition 445 * 446 * Input 447 * 448 * 449 * Return: 450 * NPI_SUCCESS 451 * NPI_FAILURE 452 * NPI_HW_ERR 453 * NPI_SW_ERR 454 * 455 * 456 */ 457 458 npi_status_t npi_fflp_cfg_llcsnap_disable(npi_handle_t); 459 460 /* 461 * npi_fflp_config_fcram_refresh 462 * Set FCRAM min and max refresh time. 463 * 464 * Input 465 * min_time Minimum Refresh time count 466 * max_time maximum Refresh Time count 467 * sys_time System Clock rate 468 * 469 * The counters are 16 bit counters. The maximum refresh time is 470 * 3.9us/clock cycle. The minimum is 400ns/clock cycle. 471 * Clock cycle is the FCRAM clock cycle????? 472 * If the cycle is FCRAM clock cycle, then sys_time parameter 473 * is not needed as there wont be configuration variation due to 474 * system clock cycle. 475 * 476 * Return: 477 * NPI_SUCCESS 478 * NPI_FAILURE 479 * NPI_HW_ERR 480 * NPI_SW_ERR 481 * 482 */ 483 484 npi_status_t npi_fflp_cfg_fcram_refresh_time(npi_handle_t, 485 uint32_t, uint32_t, uint32_t); 486 487 488 /* 489 * npi_fflp_cfg_fcram_access () 490 * 491 * Sets the ratio between the FCRAM pio and lookup access 492 * Input: 493 * access_ratio: 0 Lookup has the highest priority 494 * 15 PIO has maximum possible priority 495 * 496 */ 497 498 npi_status_t npi_fflp_cfg_fcram_access(npi_handle_t, 499 uint8_t); 500 501 502 /* 503 * npi_fflp_cfg_tcam_access () 504 * 505 * Sets the ratio between the TCAM pio and lookup access 506 * Input: 507 * access_ratio: 0 Lookup has the highest priority 508 * 15 PIO has maximum possible priority 509 * 510 */ 511 512 npi_status_t npi_fflp_cfg_tcam_access(npi_handle_t, uint8_t); 513 514 515 /* 516 * npi_fflp_hash_lookup_err_report 517 * Reports hash table (fcram) lookup errors 518 * 519 * Input 520 * status Pointer to return Error bits 521 * 522 * 523 * Return: 524 * NPI_SUCCESS 525 * NPI_FAILURE 526 * NPI_HW_ERR 527 * NPI_SW_ERR 528 * 529 */ 530 531 npi_status_t npi_fflp_fcram_get_lookup_err_log(npi_handle_t, 532 hash_lookup_err_log_t *); 533 534 535 536 /* 537 * npi_fflp_fcram_get_pio_err_log 538 * Reports hash table PIO read errors. 539 * 540 * Input 541 * partid: partition ID 542 * err_stat pointer to return Error bits 543 * 544 * Return: 545 * NPI_SUCCESS 546 * NPI_FAILURE 547 * NPI_HW_ERR 548 * NPI_SW_ERR 549 * 550 */ 551 npi_status_t npi_fflp_fcram_get_pio_err_log(npi_handle_t, 552 part_id_t, hash_pio_err_log_t *); 553 554 555 /* 556 * npi_fflp_fcram_clr_pio_err_log 557 * Clears FCRAM PIO error status for the partition. 558 * If there are TCAM errors as indicated by err bit set by HW, 559 * then the SW will clear it by clearing the bit. 560 * 561 * Input 562 * partid: partition ID 563 * 564 * 565 * Return 566 * NPI_SUCCESS Success 567 * 568 * 569 */ 570 571 npi_status_t npi_fflp_fcram_clr_pio_err_log(npi_handle_t, 572 part_id_t); 573 574 575 576 /* 577 * npi_fflp_fcram_err_data_test 578 * Tests the FCRAM error detection logic. 579 * The error detection logic for the datapath is tested. 580 * bits [63:0] are set to select the data bits to be xored 581 * 582 * Input 583 * data: data bits to select bits to be xored 584 * 585 * 586 * Return 587 * NPI_SUCCESS Success 588 * 589 * 590 */ 591 npi_status_t npi_fflp_fcram_err_data_test(npi_handle_t, fcram_err_data_t *); 592 593 594 /* 595 * npi_fflp_fcram_err_synd_test 596 * Tests the FCRAM error detection logic. 597 * The error detection logic for the syndrome is tested. 598 * tst0->synd (8bits) are set to select the syndrome bits 599 * to be XOR'ed 600 * 601 * Input 602 * syndrome_bits: Syndrome bits to select bits to be xor'ed 603 * 604 * 605 * Return 606 * NPI_SUCCESS Success 607 * 608 * 609 */ 610 npi_status_t npi_fflp_fcram_err_synd_test(npi_handle_t, uint8_t); 611 612 613 /* 614 * npi_fflp_cfg_vlan_table_clear 615 * Clears the vlan RDC table 616 * 617 * Input 618 * vlan_id VLAN ID 619 * 620 * Output 621 * 622 * NPI_SUCCESS Successful 623 * 624 */ 625 626 npi_status_t npi_fflp_cfg_vlan_table_clear(npi_handle_t, vlan_id_t); 627 628 /* 629 * npi_fflp_cfg_enet_vlan_table_assoc 630 * associates port vlan id to rdc table and sets the priority 631 * in respect to L2DA rdc table. 632 * 633 * Input 634 * mac_portn port number 635 * vlan_id VLAN ID 636 * rdc_table RDC Table # 637 * priority priority 638 * 1: vlan classification has higher priority 639 * 0: l2da classification has higher priority 640 * 641 * Return: 642 * NPI_SUCCESS 643 * NPI_FAILURE 644 * NPI_HW_ERR 645 * NPI_SW_ERR 646 * 647 */ 648 649 npi_status_t npi_fflp_cfg_enet_vlan_table_assoc(npi_handle_t, 650 uint8_t, vlan_id_t, 651 uint8_t, uint8_t); 652 653 654 /* 655 * npi_fflp_cfg_enet_vlan_table_set_pri 656 * sets the vlan based classification priority in respect to 657 * L2DA classification. 658 * 659 * Input 660 * mac_portn port number 661 * vlan_id VLAN ID 662 * priority priority 663 * 1: vlan classification has higher priority 664 * 0: l2da classification has higher priority 665 * 666 * Return: 667 * NPI_SUCCESS 668 * NPI_FAILURE 669 * NPI_HW_ERR 670 * NPI_SW_ERR 671 * 672 */ 673 674 npi_status_t npi_fflp_cfg_enet_vlan_table_set_pri(npi_handle_t, 675 uint8_t, vlan_id_t, 676 uint8_t); 677 678 /* 679 * npi_fflp_cfg_enet_usr_cls_set() 680 * Configures a user configurable ethernet class 681 * 682 * Input 683 * class: Ethernet Class 684 * class (TCAM_CLASS_ETYPE or TCAM_CLASS_ETYPE_2) 685 * enet_type: 16 bit Ethernet Type value, corresponding ethernet bytes 686 * [13:14] in the frame. 687 * 688 * by default, the class will be disabled until explicitly enabled. 689 * 690 * Return 691 * NPI_SUCCESS 692 * NPI_FAILURE 693 * NPI_HW_ERR 694 * NPI_SW_ERR 695 * 696 * 697 * 698 */ 699 700 npi_status_t npi_fflp_cfg_enet_usr_cls_set(npi_handle_t, 701 tcam_class_t, uint16_t); 702 703 /* 704 * npi_fflp_cfg_enet_usr_cls_enable() 705 * Enable previously configured TCAM user configurable Ethernet classes. 706 * 707 * Input 708 * class: Ethernet Class class 709 * (TCAM_CLASS_ETYPE or TCAM_CLASS_ETYPE_2) 710 * 711 * Return 712 * NPI_SUCCESS 713 * NPI_FAILURE 714 * NPI_HW_ERR 715 * NPI_SW_ERR 716 * 717 */ 718 719 npi_status_t npi_fflp_cfg_enet_usr_cls_enable(npi_handle_t, tcam_class_t); 720 721 /* 722 * npi_fflp_cfg_enet_usr_cls_disable() 723 * Disables previously configured TCAM user configurable Ethernet classes. 724 * 725 * Input 726 * class: Ethernet Class 727 * class = (TCAM_CLASS_ETYPE or TCAM_CLASS_ETYPE_2) 728 * 729 * Return 730 * NPI_SUCCESS 731 * NPI_FAILURE 732 * NPI_HW_ERR 733 * NPI_SW_ERR 734 * 735 */ 736 737 738 npi_status_t npi_fflp_cfg_enet_usr_cls_disable(npi_handle_t, tcam_class_t); 739 740 741 /* 742 * npi_fflp_cfg_ip_usr_cls_set() 743 * Configures the TCAM user configurable IP classes. 744 * 745 * Input 746 * class: IP Class 747 * (TCAM_CLASS_IP_USER_4 <= class <= TCAM_CLASS_IP_USER_7) 748 * tos: IP TOS bits 749 * tos_mask: IP TOS bits mask. bits with mask bits set will be used 750 * proto: IP Proto 751 * ver: IP Version 752 * by default, will the class is disabled until explicitly enabled 753 * 754 * Return 755 * NPI_SUCCESS 756 * NPI_FAILURE 757 * NPI_HW_ERR 758 * NPI_SW_ERR 759 * 760 */ 761 762 npi_status_t npi_fflp_cfg_ip_usr_cls_set(npi_handle_t, 763 tcam_class_t, 764 uint8_t, uint8_t, 765 uint8_t, uint8_t); 766 767 /* 768 * npi_fflp_cfg_ip_usr_cls_enable() 769 * Enable previously configured TCAM user configurable IP classes. 770 * 771 * Input 772 * class: IP Class 773 * (TCAM_CLASS_IP_USER_4 <= class <= TCAM_CLASS_IP_USER_7) 774 * 775 * Return 776 * NPI_SUCCESS 777 * NPI_FAILURE 778 * NPI_HW_ERR 779 * NPI_SW_ERR 780 * 781 */ 782 783 npi_status_t npi_fflp_cfg_ip_usr_cls_enable(npi_handle_t, tcam_class_t); 784 785 /* 786 * npi_fflp_cfg_ip_usr_cls_disable() 787 * Disables previously configured TCAM user configurable IP classes. 788 * 789 * Input 790 * class: IP Class 791 * (TCAM_CLASS_IP_USER_4 <= class <= TCAM_CLASS_IP_USER_7) 792 * 793 * Return 794 * NPI_SUCCESS 795 * NPI_FAILURE 796 * NPI_HW_ERR 797 * NPI_SW_ERR 798 * 799 */ 800 801 802 npi_status_t npi_fflp_cfg_ip_usr_cls_disable(npi_handle_t, tcam_class_t); 803 804 805 /* 806 * npi_fflp_cfg_ip_cls_tcam_key () 807 * 808 * Configures the TCAM key generation for the IP classes 809 * 810 * Input 811 * l3_class: IP class to configure key generation 812 * cfg: Configuration bits: 813 * discard: Discard all frames of this class 814 * use_ip_saddr: use ip src address (for ipv6) 815 * use_ip_daddr: use ip dest address (for ipv6) 816 * lookup_enable: Enable Lookup 817 * 818 * 819 * Return 820 * NPI_SUCCESS 821 * NPI_HW_ERR 822 * NPI_SW_ERR 823 * 824 */ 825 826 827 npi_status_t npi_fflp_cfg_ip_cls_tcam_key(npi_handle_t, 828 tcam_class_t, tcam_key_cfg_t *); 829 830 /* 831 * npi_fflp_cfg_ip_cls_flow_key () 832 * 833 * Configures the flow key generation for the IP classes 834 * Flow key is used to generate the H1 hash function value 835 * The fields used for the generation are configured using this 836 * NPI function. 837 * 838 * Input 839 * l3_class: IP class to configure flow key generation 840 * cfg: Configuration bits: 841 * use_proto: Use IP proto field 842 * use_dport: use l4 destination port 843 * use_sport: use l4 source port 844 * ip_opts_exist: IP Options Present 845 * use_daddr: use ip dest address 846 * use_saddr: use ip source address 847 * use_vlan: use VLAN ID 848 * use_l2da: use L2 Dest MAC Address 849 * use_portnum: use L2 virtual port number 850 * 851 * 852 * Return 853 * NPI_SUCCESS 854 * NPI_HW_ERR 855 * NPI_SW_ERR 856 * 857 */ 858 859 npi_status_t npi_fflp_cfg_ip_cls_flow_key(npi_handle_t, 860 tcam_class_t, flow_key_cfg_t *); 861 862 863 864 npi_status_t npi_fflp_cfg_ip_cls_flow_key_get(npi_handle_t, 865 tcam_class_t, 866 flow_key_cfg_t *); 867 868 869 npi_status_t npi_fflp_cfg_ip_cls_tcam_key_get(npi_handle_t, 870 tcam_class_t, tcam_key_cfg_t *); 871 /* 872 * npi_fflp_cfg_hash_h1poly() 873 * Initializes the H1 hash generation logic. 874 * 875 * Input 876 * init_value: The initial value (seed) 877 * 878 * Return 879 * NPI_SUCCESS 880 * NPI_FAILURE 881 * NPI_HW_ERR 882 * NPI_SW_ERR 883 * 884 */ 885 886 npi_status_t npi_fflp_cfg_hash_h1poly(npi_handle_t, uint32_t); 887 888 889 890 /* 891 * npi_fflp_cfg_hash_h2poly() 892 * Initializes the H2 hash generation logic. 893 * 894 * Input 895 * init_value: The initial value (seed) 896 * 897 * Return 898 * NPI_SUCCESS 899 * NPI_FAILURE 900 * NPI_HW_ERR 901 * NPI_SW_ERR 902 * 903 */ 904 905 npi_status_t npi_fflp_cfg_hash_h2poly(npi_handle_t, uint16_t); 906 907 908 /* 909 * Reset the fflp block (actually the FCRAM) 910 * Waits until reset is completed 911 * 912 * input 913 * strength fcram output drive strength: weak, normal or strong 914 * qs qs mode. Normal or free running 915 * 916 * return value 917 * NPI_SUCCESS 918 * NPI_SW_ERR 919 * NPI_HW_ERR 920 */ 921 922 npi_status_t npi_fflp_fcram_reset(npi_handle_t, 923 fflp_fcram_output_drive_t, 924 fflp_fcram_qs_t); 925 926 927 /* FFLP TCAM Related Functions */ 928 929 930 /* 931 * npi_fflp_tcam_entry_match() 932 * 933 * Tests for TCAM match of the tcam entry 934 * 935 * Input 936 * tcam_ptr 937 * 938 * Return 939 * NPI_SUCCESS 940 * NPI_SW_ERR 941 * NPI_HW_ERR 942 * 943 */ 944 945 int npi_fflp_tcam_entry_match(npi_handle_t, tcam_entry_t *); 946 947 /* 948 * npi_fflp_tcam_entry_write() 949 * 950 * writes a tcam entry at the TCAM location, location 951 * 952 * Input 953 * location 954 * tcam_ptr 955 * 956 * Return 957 * NPI_SUCCESS 958 * NPI_SW_ERR 959 * NPI_HW_ERR 960 * 961 */ 962 963 npi_status_t npi_fflp_tcam_entry_write(npi_handle_t, 964 tcam_location_t, 965 tcam_entry_t *); 966 967 /* 968 * npi_fflp_tcam_entry_read () 969 * 970 * Reads a tcam entry from the TCAM location, location 971 * 972 * Input: 973 * location 974 * tcam_ptr 975 * 976 * Return: 977 * NPI_SUCCESS 978 * NPI_HW_ERR 979 * NPI_SW_ERR 980 * 981 */ 982 983 984 npi_status_t npi_fflp_tcam_entry_read(npi_handle_t, 985 tcam_location_t, 986 tcam_entry_t *); 987 988 /* 989 * npi_fflp_tcam_entry_invalidate() 990 * 991 * invalidates entry at tcam location 992 * 993 * Input 994 * location 995 * 996 * Return 997 * NPI_SUCCESS 998 * NPI_SW_ERR 999 * NPI_HW_ERR 1000 * 1001 */ 1002 1003 npi_status_t npi_fflp_tcam_entry_invalidate(npi_handle_t, 1004 tcam_location_t); 1005 1006 1007 /* 1008 * npi_fflp_tcam_asc_ram_entry_write() 1009 * 1010 * writes a tcam associatedRAM at the TCAM location, location 1011 * 1012 * Input: 1013 * location tcam associatedRAM location 1014 * ram_data Value to write 1015 * 1016 * Return: 1017 * NPI_SUCCESS 1018 * NPI_HW_ERR 1019 * NPI_SW_ERR 1020 * 1021 */ 1022 1023 npi_status_t npi_fflp_tcam_asc_ram_entry_write(npi_handle_t, 1024 tcam_location_t, 1025 uint64_t); 1026 1027 1028 /* 1029 * npi_fflp_tcam_asc_ram_entry_read() 1030 * 1031 * reads a tcam associatedRAM content at the TCAM location, location 1032 * 1033 * Input: 1034 * location tcam associatedRAM location 1035 * ram_data ptr to return contents 1036 * 1037 * Return: 1038 * NPI_SUCCESS 1039 * NPI_HW_ERR 1040 * NPI_SW_ERR 1041 * 1042 */ 1043 1044 npi_status_t npi_fflp_tcam_asc_ram_entry_read(npi_handle_t, 1045 tcam_location_t, 1046 uint64_t *); 1047 1048 /* 1049 * npi_fflp_tcam_get_err_log 1050 * Reports TCAM PIO read and lookup errors. 1051 * If there are TCAM errors as indicated by err bit set by HW, 1052 * then the SW will clear it by clearing the bit. 1053 * 1054 * Input 1055 * err_stat: structure to report various TCAM errors. 1056 * will be updated if there are TCAM errors. 1057 * 1058 * 1059 * Return 1060 * NPI_SUCCESS Success 1061 * 1062 * 1063 */ 1064 npi_status_t npi_fflp_tcam_get_err_log(npi_handle_t, tcam_err_log_t *); 1065 1066 1067 1068 /* 1069 * npi_fflp_tcam_clr_err_log 1070 * Clears TCAM PIO read and lookup error status. 1071 * If there are TCAM errors as indicated by err bit set by HW, 1072 * then the SW will clear it by clearing the bit. 1073 * 1074 * Input 1075 * err_stat: structure to report various TCAM errors. 1076 * will be updated if there are TCAM errors. 1077 * 1078 * 1079 * Return 1080 * NPI_SUCCESS Success 1081 * 1082 * 1083 */ 1084 1085 npi_status_t npi_fflp_tcam_clr_err_log(npi_handle_t); 1086 1087 1088 1089 1090 1091 /* 1092 * npi_fflp_vlan_tbl_clr_err_log 1093 * Clears VLAN Table PIO error status. 1094 * If there are VLAN Table errors as indicated by err bit set by HW, 1095 * then the SW will clear it by clearing the bit. 1096 * 1097 * Input 1098 * err_stat: structure to report various VLAN Table errors. 1099 * will be updated if there are errors. 1100 * 1101 * 1102 * Return 1103 * NPI_SUCCESS Success 1104 * 1105 * 1106 */ 1107 1108 npi_status_t npi_fflp_vlan_tbl_clr_err_log(npi_handle_t); 1109 1110 1111 /* 1112 * npi_fflp_vlan_tbl_get_err_log 1113 * Reports VLAN Table errors. 1114 * If there are VLAN Table errors as indicated by err bit set by HW, 1115 * then the SW will clear it by clearing the bit. 1116 * 1117 * Input 1118 * err_stat: structure to report various VLAN table errors. 1119 * will be updated if there are errors. 1120 * 1121 * 1122 * Return 1123 * NPI_SUCCESS Success 1124 * 1125 * 1126 */ 1127 npi_status_t npi_fflp_vlan_tbl_get_err_log(npi_handle_t, 1128 vlan_tbl_err_log_t *); 1129 1130 1131 1132 1133 /* 1134 * npi_rxdma_event_mask_config(): 1135 * This function is called to operate on the event mask 1136 * register which is used for generating interrupts 1137 * and status register. 1138 * 1139 * Parameters: 1140 * handle - NPI handle 1141 * op_mode - OP_GET: get hardware event mask 1142 * OP_SET: set hardware interrupt event masks 1143 * channel - hardware RXDMA channel from 0 to 23. 1144 * cfgp - pointer to NPI defined event mask 1145 * enum data type. 1146 * Return: 1147 * NPI_SUCCESS - If set is complete successfully. 1148 * 1149 * Error: 1150 * NPI_FAILURE - 1151 * NPI_FFLP_ERROR | NPI_FFLP_SW_PARAM_ERROR 1152 * 1153 */ 1154 npi_status_t 1155 npi_fflp_event_mask_config(npi_handle_t, io_op_t, 1156 fflp_event_mask_cfg_t *); 1157 1158 npi_status_t npi_fflp_dump_regs(npi_handle_t); 1159 1160 1161 /* Error status read and clear functions */ 1162 1163 void npi_fflp_vlan_error_get(npi_handle_t, 1164 p_vlan_par_err_t); 1165 void npi_fflp_vlan_error_clear(npi_handle_t); 1166 void npi_fflp_tcam_error_get(npi_handle_t, 1167 p_tcam_err_t); 1168 void npi_fflp_tcam_error_clear(npi_handle_t); 1169 1170 void npi_fflp_fcram_error_get(npi_handle_t, 1171 p_hash_tbl_data_log_t, 1172 uint8_t); 1173 void npi_fflp_fcram_error_clear(npi_handle_t, uint8_t); 1174 1175 void npi_fflp_fcram_error_log1_get(npi_handle_t, 1176 p_hash_lookup_err_log1_t); 1177 1178 void npi_fflp_fcram_error_log2_get(npi_handle_t, 1179 p_hash_lookup_err_log2_t); 1180 1181 void npi_fflp_vlan_tbl_dump(npi_handle_t); 1182 1183 #ifdef __cplusplus 1184 } 1185 #endif 1186 1187 #endif /* _NPI_FFLP_H */ 1188