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