13859Sml29623 /* 23859Sml29623 * CDDL HEADER START 33859Sml29623 * 43859Sml29623 * The contents of this file are subject to the terms of the 53859Sml29623 * Common Development and Distribution License (the "License"). 63859Sml29623 * You may not use this file except in compliance with the License. 73859Sml29623 * 83859Sml29623 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 93859Sml29623 * or http://www.opensolaris.org/os/licensing. 103859Sml29623 * See the License for the specific language governing permissions 113859Sml29623 * and limitations under the License. 123859Sml29623 * 133859Sml29623 * When distributing Covered Code, include this CDDL HEADER in each 143859Sml29623 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 153859Sml29623 * If applicable, add the following below this CDDL HEADER, with the 163859Sml29623 * fields enclosed by brackets "[]" replaced with your own identifying 173859Sml29623 * information: Portions Copyright [yyyy] [name of copyright owner] 183859Sml29623 * 193859Sml29623 * CDDL HEADER END 203859Sml29623 */ 213859Sml29623 /* 22*11304SJanie.Lu@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 233859Sml29623 * Use is subject to license terms. 243859Sml29623 */ 253859Sml29623 263859Sml29623 #ifndef _SYS_NXGE_NXGE_FFLP_HW_H 273859Sml29623 #define _SYS_NXGE_NXGE_FFLP_HW_H 283859Sml29623 293859Sml29623 #ifdef __cplusplus 303859Sml29623 extern "C" { 313859Sml29623 #endif 323859Sml29623 333859Sml29623 #include <nxge_defs.h> 343859Sml29623 358275SEric Cheng 363859Sml29623 /* FZC_FFLP Offsets */ 373859Sml29623 #define FFLP_ENET_VLAN_TBL_REG (FZC_FFLP + 0x00000) 383859Sml29623 397812SMichael.Speer@Sun.COM /* defines for FFLP_ENET_VLAN_TBL */ 403859Sml29623 #define ENET_VLAN_TBL_VLANRDCTBLN0_MASK 0x0000000000000003ULL 413859Sml29623 #define ENET_VLAN_TBL_VLANRDCTBLN0_SHIFT 0 423859Sml29623 #define ENET_VLAN_TBL_VPR0_MASK 0x00000000000000008ULL 433859Sml29623 #define ENET_VLAN_TBL_VPR0_SHIFT 3 443859Sml29623 453859Sml29623 #define ENET_VLAN_TBL_VLANRDCTBLN1_MASK 0x0000000000000030ULL 463859Sml29623 #define ENET_VLAN_TBL_VLANRDCTBLN1_SHIFT 4 473859Sml29623 #define ENET_VLAN_TBL_VPR1_MASK 0x00000000000000080ULL 483859Sml29623 #define ENET_VLAN_TBL_VPR1_SHIFT 7 493859Sml29623 503859Sml29623 #define ENET_VLAN_TBL_VLANRDCTBLN2_MASK 0x0000000000000300ULL 513859Sml29623 #define ENET_VLAN_TBL_VLANRDCTBLN2_SHIFT 8 523859Sml29623 #define ENET_VLAN_TBL_VPR2_MASK 0x00000000000000800ULL 533859Sml29623 #define ENET_VLAN_TBL_VPR2_SHIFT 11 543859Sml29623 553859Sml29623 #define ENET_VLAN_TBL_VLANRDCTBLN3_MASK 0x0000000000003000ULL 563859Sml29623 #define ENET_VLAN_TBL_VLANRDCTBLN3_SHIFT 12 573859Sml29623 #define ENET_VLAN_TBL_VPR3_MASK 0x0000000000008000ULL 583859Sml29623 #define ENET_VLAN_TBL_VPR3_SHIFT 15 593859Sml29623 603859Sml29623 #define ENET_VLAN_TBL_PARITY0_MASK 0x0000000000010000ULL 613859Sml29623 #define ENET_VLAN_TBL_PARITY0_SHIFT 16 623859Sml29623 #define ENET_VLAN_TBL_PARITY1_MASK 0x0000000000020000ULL 633859Sml29623 #define ENET_VLAN_TBL_PARITY1_SHIFT 17 643859Sml29623 653859Sml29623 typedef union _fflp_enet_vlan_tbl_t { 663859Sml29623 uint64_t value; 673859Sml29623 struct { 683859Sml29623 #if defined(_BIG_ENDIAN) 693859Sml29623 uint32_t hdw; 703859Sml29623 #endif 713859Sml29623 struct { 723859Sml29623 #ifdef _BIT_FIELDS_HTOL 733859Sml29623 uint32_t rsrvd:14; 743859Sml29623 uint32_t parity1:1; 753859Sml29623 uint32_t parity0:1; 763859Sml29623 uint32_t vpr3:1; 773859Sml29623 uint32_t vlanrdctbln3:3; 783859Sml29623 uint32_t vpr2:1; 793859Sml29623 uint32_t vlanrdctbln2:3; 803859Sml29623 uint32_t vpr1:1; 813859Sml29623 uint32_t vlanrdctbln1:3; 823859Sml29623 uint32_t vpr0:1; 833859Sml29623 uint32_t vlanrdctbln0:3; 843859Sml29623 #else 853859Sml29623 uint32_t vlanrdctbln0:3; 863859Sml29623 uint32_t vpr0:1; 873859Sml29623 uint32_t vlanrdctbln1:3; 883859Sml29623 uint32_t vpr1:1; 893859Sml29623 uint32_t vlanrdctbln2:3; 903859Sml29623 uint32_t vpr2:1; 913859Sml29623 uint32_t vlanrdctbln3:3; 923859Sml29623 uint32_t vpr3:1; 933859Sml29623 uint32_t parity0:1; 943859Sml29623 uint32_t parity1:1; 953859Sml29623 uint32_t rsrvd:14; 963859Sml29623 #endif 973859Sml29623 } ldw; 983859Sml29623 #ifndef _BIG_ENDIAN 993859Sml29623 uint32_t hdw; 1003859Sml29623 #endif 1013859Sml29623 } bits; 1023859Sml29623 } fflp_enet_vlan_tbl_t, *p_fflp_enet_vlan_tbl_t; 1033859Sml29623 1043859Sml29623 #define FFLP_TCAM_CLS_BASE_OFFSET (FZC_FFLP + 0x20000) 1053859Sml29623 #define FFLP_L2_CLS_ENET1_REG (FZC_FFLP + 0x20000) 1063859Sml29623 #define FFLP_L2_CLS_ENET2_REG (FZC_FFLP + 0x20008) 1073859Sml29623 1083859Sml29623 typedef union _tcam_class_prg_ether_t { 1093859Sml29623 #define TCAM_ENET_USR_CLASS_ENABLE 0x1 1103859Sml29623 #define TCAM_ENET_USR_CLASS_DISABLE 0x0 1113859Sml29623 1123859Sml29623 uint64_t value; 1133859Sml29623 struct { 1143859Sml29623 #ifdef _BIG_ENDIAN 1153859Sml29623 uint32_t hdw; 1163859Sml29623 #endif 1173859Sml29623 struct { 1183859Sml29623 #ifdef _BIT_FIELDS_HTOL 1193859Sml29623 uint32_t rsrvd:15; 1203859Sml29623 uint32_t valid:1; 1213859Sml29623 uint32_t etype:16; 1223859Sml29623 #else 1233859Sml29623 uint32_t etype:16; 1243859Sml29623 uint32_t valid:1; 1253859Sml29623 uint32_t rsrvd:15; 1263859Sml29623 #endif 1273859Sml29623 } ldw; 1283859Sml29623 #ifndef _BIG_ENDIAN 1293859Sml29623 uint32_t hdw; 1303859Sml29623 #endif 1313859Sml29623 } bits; 1323859Sml29623 } tcam_class_prg_ether_t, *p_tcam_class_prg_ether_t; 1333859Sml29623 1343859Sml29623 #define FFLP_L3_CLS_IP_U4_REG (FZC_FFLP + 0x20010) 1353859Sml29623 #define FFLP_L3_CLS_IP_U5_REG (FZC_FFLP + 0x20018) 1363859Sml29623 #define FFLP_L3_CLS_IP_U6_REG (FZC_FFLP + 0x20020) 1373859Sml29623 #define FFLP_L3_CLS_IP_U7_REG (FZC_FFLP + 0x20028) 1383859Sml29623 1393859Sml29623 typedef union _tcam_class_prg_ip_t { 1403859Sml29623 #define TCAM_IP_USR_CLASS_ENABLE 0x1 1413859Sml29623 #define TCAM_IP_USR_CLASS_DISABLE 0x0 1423859Sml29623 1433859Sml29623 uint64_t value; 1443859Sml29623 struct { 1453859Sml29623 #if defined(_BIG_ENDIAN) 1463859Sml29623 uint32_t hdw; 1473859Sml29623 #endif 1483859Sml29623 struct { 1493859Sml29623 #ifdef _BIT_FIELDS_HTOL 1503859Sml29623 uint32_t rsrvd:6; 1513859Sml29623 uint32_t valid:1; 1523859Sml29623 uint32_t ipver:1; 1533859Sml29623 uint32_t pid:8; 1543859Sml29623 uint32_t tosmask:8; 1553859Sml29623 uint32_t tos:8; 1563859Sml29623 #else 1573859Sml29623 uint32_t tos:8; 1583859Sml29623 uint32_t tosmask:8; 1593859Sml29623 uint32_t pid:8; 1603859Sml29623 uint32_t ipver:1; 1613859Sml29623 uint32_t valid:1; 1623859Sml29623 uint32_t rsrvd:6; 1633859Sml29623 #endif 1643859Sml29623 } ldw; 1653859Sml29623 #ifndef _BIG_ENDIAN 1663859Sml29623 uint32_t hdw; 1673859Sml29623 #endif 1683859Sml29623 } bits; 1693859Sml29623 } tcam_class_prg_ip_t, *p_tcam_class_prg_ip_t; 170*11304SJanie.Lu@Sun.COM 171*11304SJanie.Lu@Sun.COM /* 172*11304SJanie.Lu@Sun.COM * New fields added to the L3 programmable class register for RF-NIU 173*11304SJanie.Lu@Sun.COM * and Neptune-L. 174*11304SJanie.Lu@Sun.COM */ 175*11304SJanie.Lu@Sun.COM #define L3_UCLS_TOS_SH 0 176*11304SJanie.Lu@Sun.COM #define L3_UCLS_TOS_MSK 0xff 177*11304SJanie.Lu@Sun.COM #define L3_UCLS_TOSM_SH 8 178*11304SJanie.Lu@Sun.COM #define L3_UCLS_TOSM_MSK 0xff 179*11304SJanie.Lu@Sun.COM #define L3_UCLS_PID_SH 16 180*11304SJanie.Lu@Sun.COM #define L3_UCLS_PID_MSK 0xff 181*11304SJanie.Lu@Sun.COM #define L3_UCLS_VALID_SH 25 182*11304SJanie.Lu@Sun.COM #define L3_UCLS_VALID_MSK 0x01 183*11304SJanie.Lu@Sun.COM #define L3_UCLS_L4B23_SEL_SH 26 184*11304SJanie.Lu@Sun.COM #define L3_UCLS_L4B23_SEL_MSK 0x01 185*11304SJanie.Lu@Sun.COM #define L3_UCLS_L4B23_VAL_SH 27 186*11304SJanie.Lu@Sun.COM #define L3_UCLS_L4B23_VAL_MSK 0xffff 187*11304SJanie.Lu@Sun.COM #define L3_UCLS_L4B0_MASK_SH 43 188*11304SJanie.Lu@Sun.COM #define L3_UCLS_L4B0_MASK_MSK 0xff 189*11304SJanie.Lu@Sun.COM #define L3_UCLS_L4B0_VAL_SH 51 190*11304SJanie.Lu@Sun.COM #define L3_UCLS_L4B0_VAL_MSK 0xff 191*11304SJanie.Lu@Sun.COM #define L3_UCLS_L4_MODE_SH 59 192*11304SJanie.Lu@Sun.COM #define L3_UCLS_L4_MODE_MSK 0x01 1933859Sml29623 /* define the classes which use the above structure */ 1943859Sml29623 1953859Sml29623 typedef enum fflp_tcam_class { 1963859Sml29623 TCAM_CLASS_INVALID = 0, 1973859Sml29623 TCAM_CLASS_DUMMY = 1, 1983859Sml29623 TCAM_CLASS_ETYPE_1 = 2, 1993859Sml29623 TCAM_CLASS_ETYPE_2, 2003859Sml29623 TCAM_CLASS_IP_USER_4, 2013859Sml29623 TCAM_CLASS_IP_USER_5, 2023859Sml29623 TCAM_CLASS_IP_USER_6, 2033859Sml29623 TCAM_CLASS_IP_USER_7, 2043859Sml29623 TCAM_CLASS_TCP_IPV4, 2053859Sml29623 TCAM_CLASS_UDP_IPV4, 2063859Sml29623 TCAM_CLASS_AH_ESP_IPV4, 2073859Sml29623 TCAM_CLASS_SCTP_IPV4, 2083859Sml29623 TCAM_CLASS_TCP_IPV6, 2093859Sml29623 TCAM_CLASS_UDP_IPV6, 2103859Sml29623 TCAM_CLASS_AH_ESP_IPV6, 2113859Sml29623 TCAM_CLASS_SCTP_IPV6, 2123859Sml29623 TCAM_CLASS_ARP, 2133859Sml29623 TCAM_CLASS_RARP, 2143859Sml29623 TCAM_CLASS_DUMMY_12, 2153859Sml29623 TCAM_CLASS_DUMMY_13, 2163859Sml29623 TCAM_CLASS_DUMMY_14, 2173859Sml29623 TCAM_CLASS_DUMMY_15, 218*11304SJanie.Lu@Sun.COM TCAM_CLASS_IPV6_FRAG = 0x1F 2193859Sml29623 } tcam_class_t; 2203859Sml29623 221*11304SJanie.Lu@Sun.COM #define TCAM_CLASS_MAX TCAM_CLASS_IPV6_FRAG 222*11304SJanie.Lu@Sun.COM 2233859Sml29623 /* 2243859Sml29623 * Specify how to build TCAM key for L3 2253859Sml29623 * IP Classes. Both User configured and 2263859Sml29623 * hardwired IP services are included. 2273859Sml29623 * These are the supported 12 classes. 2283859Sml29623 */ 2293859Sml29623 #define FFLP_TCAM_KEY_BASE_OFFSET (FZC_FFLP + 0x20030) 2303859Sml29623 #define FFLP_TCAM_KEY_IP_USR4_REG (FZC_FFLP + 0x20030) 2313859Sml29623 #define FFLP_TCAM_KEY_IP_USR5_REG (FZC_FFLP + 0x20038) 2323859Sml29623 #define FFLP_TCAM_KEY_IP_USR6_REG (FZC_FFLP + 0x20040) 2333859Sml29623 #define FFLP_TCAM_KEY_IP_USR7_REG (FZC_FFLP + 0x20048) 2343859Sml29623 #define FFLP_TCAM_KEY_IP4_TCP_REG (FZC_FFLP + 0x20050) 2353859Sml29623 #define FFLP_TCAM_KEY_IP4_UDP_REG (FZC_FFLP + 0x20058) 2363859Sml29623 #define FFLP_TCAM_KEY_IP4_AH_ESP_REG (FZC_FFLP + 0x20060) 2373859Sml29623 #define FFLP_TCAM_KEY_IP4_SCTP_REG (FZC_FFLP + 0x20068) 2383859Sml29623 #define FFLP_TCAM_KEY_IP6_TCP_REG (FZC_FFLP + 0x20070) 2393859Sml29623 #define FFLP_TCAM_KEY_IP6_UDP_REG (FZC_FFLP + 0x20078) 2403859Sml29623 #define FFLP_TCAM_KEY_IP6_AH_ESP_REG (FZC_FFLP + 0x20080) 2413859Sml29623 #define FFLP_TCAM_KEY_IP6_SCTP_REG (FZC_FFLP + 0x20088) 2423859Sml29623 2433859Sml29623 2443859Sml29623 typedef union _tcam_class_key_ip_t { 2453859Sml29623 uint64_t value; 2463859Sml29623 struct { 2473859Sml29623 #if defined(_BIG_ENDIAN) 2483859Sml29623 uint32_t hdw; 2493859Sml29623 #endif 2503859Sml29623 struct { 2513859Sml29623 #ifdef _BIT_FIELDS_HTOL 2523859Sml29623 uint32_t rsrvd2:28; 2533859Sml29623 uint32_t discard:1; 2543859Sml29623 uint32_t tsel:1; 2553859Sml29623 uint32_t rsrvd:1; 2563859Sml29623 uint32_t ipaddr:1; 2573859Sml29623 #else 2583859Sml29623 uint32_t ipaddr:1; 2593859Sml29623 uint32_t rsrvd:1; 2603859Sml29623 uint32_t tsel:1; 2613859Sml29623 uint32_t discard:1; 2623859Sml29623 uint32_t rsrvd2:28; 2633859Sml29623 #endif 2643859Sml29623 } ldw; 2653859Sml29623 #ifndef _BIG_ENDIAN 2663859Sml29623 uint32_t hdw; 2673859Sml29623 #endif 2683859Sml29623 } bits; 2693859Sml29623 } tcam_class_key_ip_t, *p_tcam_class_key_ip_t; 2703859Sml29623 2713859Sml29623 2723859Sml29623 2733859Sml29623 #define FFLP_TCAM_KEY_0_REG (FZC_FFLP + 0x20090) 2743859Sml29623 #define FFLP_TCAM_KEY_1_REG (FZC_FFLP + 0x20098) 2753859Sml29623 #define FFLP_TCAM_KEY_2_REG (FZC_FFLP + 0x200A0) 2763859Sml29623 #define FFLP_TCAM_KEY_3_REG (FZC_FFLP + 0x200A8) 2773859Sml29623 #define FFLP_TCAM_MASK_0_REG (FZC_FFLP + 0x200B0) 2783859Sml29623 #define FFLP_TCAM_MASK_1_REG (FZC_FFLP + 0x200B8) 2793859Sml29623 #define FFLP_TCAM_MASK_2_REG (FZC_FFLP + 0x200C0) 2803859Sml29623 #define FFLP_TCAM_MASK_3_REG (FZC_FFLP + 0x200C8) 2813859Sml29623 2823859Sml29623 #define FFLP_TCAM_CTL_REG (FZC_FFLP + 0x200D0) 2833859Sml29623 2843859Sml29623 /* bit defines for FFLP_TCAM_CTL register */ 2853859Sml29623 #define TCAM_CTL_TCAM_WR 0x0ULL 2863859Sml29623 #define TCAM_CTL_TCAM_RD 0x040000ULL 2873859Sml29623 #define TCAM_CTL_TCAM_CMP 0x080000ULL 2883859Sml29623 #define TCAM_CTL_RAM_WR 0x100000ULL 2893859Sml29623 #define TCAM_CTL_RAM_RD 0x140000ULL 2903859Sml29623 #define TCAM_CTL_RWC_STAT 0x0020000ULL 2913859Sml29623 #define TCAM_CTL_RWC_MATCH 0x0010000ULL 2923859Sml29623 2933859Sml29623 2943859Sml29623 typedef union _tcam_ctl_t { 2953859Sml29623 #define TCAM_CTL_RWC_TCAM_WR 0x0 2963859Sml29623 #define TCAM_CTL_RWC_TCAM_RD 0x1 2973859Sml29623 #define TCAM_CTL_RWC_TCAM_CMP 0x2 2983859Sml29623 #define TCAM_CTL_RWC_RAM_WR 0x4 2993859Sml29623 #define TCAM_CTL_RWC_RAM_RD 0x5 3003859Sml29623 #define TCAM_CTL_RWC_RWC_STAT 0x1 3013859Sml29623 #define TCAM_CTL_RWC_RWC_MATCH 0x1 3023859Sml29623 3033859Sml29623 uint64_t value; 3043859Sml29623 struct { 3053859Sml29623 #if defined(_BIG_ENDIAN) 3063859Sml29623 uint32_t hdw; 3073859Sml29623 #endif 3083859Sml29623 struct { 3093859Sml29623 #ifdef _BIT_FIELDS_HTOL 3103859Sml29623 uint32_t rsrvd2:11; 3113859Sml29623 uint32_t rwc:3; 3123859Sml29623 uint32_t stat:1; 3133859Sml29623 uint32_t match:1; 3143859Sml29623 uint32_t rsrvd:6; 3153859Sml29623 uint32_t location:10; 3163859Sml29623 #else 3173859Sml29623 uint32_t location:10; 3183859Sml29623 uint32_t rsrvd:6; 3193859Sml29623 uint32_t match:1; 3203859Sml29623 uint32_t stat:1; 3213859Sml29623 uint32_t rwc:3; 3223859Sml29623 uint32_t rsrvd2:11; 3233859Sml29623 #endif 3243859Sml29623 } ldw; 3253859Sml29623 #ifndef _BIG_ENDIAN 3263859Sml29623 uint32_t hdw; 3273859Sml29623 #endif 3283859Sml29623 } bits; 3293859Sml29623 } tcam_ctl_t, *p_tcam_ctl_t; 3303859Sml29623 3313859Sml29623 3323859Sml29623 3333859Sml29623 /* Bit defines for TCAM ASC RAM */ 3343859Sml29623 3353859Sml29623 3363859Sml29623 typedef union _tcam_res_t { 3373859Sml29623 uint64_t value; 3383859Sml29623 struct { 3393859Sml29623 #if defined(_BIG_ENDIAN) 3403859Sml29623 struct { 3413859Sml29623 uint32_t rsrvd:22; 3423859Sml29623 uint32_t syndrome:10; 3433859Sml29623 } hdw; 3443859Sml29623 #endif 3453859Sml29623 struct { 3463859Sml29623 #ifdef _BIT_FIELDS_HTOL 3473859Sml29623 uint32_t syndrome:6; 3483859Sml29623 uint32_t zfid:12; 3493859Sml29623 uint32_t v4_ecc_ck:1; 3503859Sml29623 uint32_t disc:1; 3513859Sml29623 uint32_t tres:2; 3523859Sml29623 uint32_t rdctbl:3; 3533859Sml29623 uint32_t offset:5; 3543859Sml29623 uint32_t zfld:1; 3553859Sml29623 uint32_t age:1; 3563859Sml29623 #else 3573859Sml29623 uint32_t age:1; 3583859Sml29623 uint32_t zfld:1; 3593859Sml29623 uint32_t offset:5; 3603859Sml29623 uint32_t rdctbl:3; 3613859Sml29623 uint32_t tres:2; 3623859Sml29623 uint32_t disc:1; 3633859Sml29623 uint32_t v4_ecc_ck:1; 3643859Sml29623 uint32_t zfid:12; 3653859Sml29623 uint32_t syndrome:6; 3663859Sml29623 #endif 3673859Sml29623 } ldw; 3683859Sml29623 #ifndef _BIG_ENDIAN 3693859Sml29623 struct { 3703859Sml29623 uint32_t syndrome:10; 3713859Sml29623 uint32_t rsrvd:22; 3723859Sml29623 } hdw; 3733859Sml29623 #endif 3743859Sml29623 } bits; 3753859Sml29623 } tcam_res_t, *p_tcam_res_t; 3763859Sml29623 3773859Sml29623 3783859Sml29623 3793859Sml29623 #define TCAM_ASC_DATA_AGE 0x0000000000000001ULL 3803859Sml29623 #define TCAM_ASC_DATA_AGE_SHIFT 0x0 3813859Sml29623 #define TCAM_ASC_DATA_ZFVLD 0x0000000000000002ULL 3823859Sml29623 #define TCAM_ASC_DATA_ZFVLD_SHIFT 1 3833859Sml29623 3843859Sml29623 #define TCAM_ASC_DATA_OFFSET_MASK 0x000000000000007CULL 3853859Sml29623 #define TCAM_ASC_DATA_OFFSET_SHIFT 2 3863859Sml29623 3873859Sml29623 #define TCAM_ASC_DATA_RDCTBL_MASK 0x0000000000000038ULL 3883859Sml29623 #define TCAM_ASC_DATA_RDCTBL_SHIFT 7 3893859Sml29623 #define TCAM_ASC_DATA_TRES_MASK 0x0000000000000C00ULL 3903859Sml29623 #define TRES_CONT_USE_L2RDC 0x00 3913859Sml29623 #define TRES_TERM_USE_OFFSET 0x01 3923859Sml29623 #define TRES_CONT_OVRD_L2RDC 0x02 3933859Sml29623 #define TRES_TERM_OVRD_L2RDC 0x03 3943859Sml29623 3953859Sml29623 #define TCAM_ASC_DATA_TRES_SHIFT 10 3963859Sml29623 #define TCAM_TRES_CONT_USE_L2RDC \ 3973859Sml29623 (0x0000000000000000ULL << TCAM_ASC_DATA_TRES_SHIFT) 3983859Sml29623 #define TCAM_TRES_TERM_USE_OFFSET \ 3993859Sml29623 (0x0000000000000001ULL << TCAM_ASC_DATA_TRES_SHIFT) 4003859Sml29623 #define TCAM_TRES_CONT_OVRD_L2RDC \ 4013859Sml29623 (0x0000000000000002ULL << TCAM_ASC_DATA_TRES_SHIFT) 4023859Sml29623 #define TCAM_TRES_TERM_OVRD_L2RDC \ 4033859Sml29623 (0x0000000000000003ULL << TCAM_ASC_DATA_TRES_SHIFT) 4043859Sml29623 4053859Sml29623 #define TCAM_ASC_DATA_DISC_MASK 0x0000000000001000ULL 4063859Sml29623 #define TCAM_ASC_DATA_DISC_SHIFT 12 4073859Sml29623 #define TCAM_ASC_DATA_V4_ECC_OK_MASK 0x0000000000002000ULL 4083859Sml29623 #define TCAM_ASC_DATA_V4_ECC_OK_SHIFT 13 4093859Sml29623 #define TCAM_ASC_DATA_V4_ECC_OK \ 4103859Sml29623 (0x0000000000000001ULL << TCAM_ASC_DATA_V4_ECC_OK_MASK_SHIFT) 4113859Sml29623 4123859Sml29623 #define TCAM_ASC_DATA_ZFID_MASK 0x0000000003FF3000ULL 4133859Sml29623 #define TCAM_ASC_DATA_ZFID_SHIFT 14 4143859Sml29623 #define TCAM_ASC_DATA_ZFID(value) \ 4153859Sml29623 ((value & TCAM_ASC_DATA_ZFID_MASK) >> TCAM_ASC_DATA_ZFID_SHIFT) 4163859Sml29623 4173859Sml29623 #define TCAM_ASC_DATA_SYNDR_MASK 0x000003FFF3000000ULL 4183859Sml29623 #define TCAM_ASC_DATA_SYNDR_SHIFT 26 4193859Sml29623 #define TCAM_ASC_DATA_SYNDR(value) \ 4203859Sml29623 ((value & TCAM_ASC_DATA_SYNDR_MASK) >> TCAM_ASC_DATA_SYNDR_SHIFT) 4213859Sml29623 4223859Sml29623 4233859Sml29623 /* error registers */ 4243859Sml29623 4253859Sml29623 #define FFLP_VLAN_PAR_ERR_REG (FZC_FFLP + 0x08000) 4263859Sml29623 4273859Sml29623 typedef union _vlan_par_err_t { 4283859Sml29623 uint64_t value; 4293859Sml29623 struct { 4303859Sml29623 #if defined(_BIG_ENDIAN) 4313859Sml29623 uint32_t hdw; 4323859Sml29623 #endif 4333859Sml29623 struct { 4343859Sml29623 #ifdef _BIT_FIELDS_HTOL 4353859Sml29623 uint32_t err:1; 4363859Sml29623 uint32_t m_err:1; 4373859Sml29623 uint32_t addr:12; 4383859Sml29623 uint32_t data:18; 4393859Sml29623 #else 4403859Sml29623 uint32_t data:18; 4413859Sml29623 uint32_t addr:12; 4423859Sml29623 uint32_t m_err:1; 4433859Sml29623 uint32_t err:1; 4443859Sml29623 #endif 4453859Sml29623 } ldw; 4463859Sml29623 #ifndef _BIG_ENDIAN 4473859Sml29623 uint32_t hdw; 4483859Sml29623 #endif 4493859Sml29623 } bits; 4503859Sml29623 } vlan_par_err_t, *p_vlan_par_err_t; 4513859Sml29623 4523859Sml29623 4533859Sml29623 #define FFLP_TCAM_ERR_REG (FZC_FFLP + 0x200D8) 4543859Sml29623 4553859Sml29623 typedef union _tcam_err_t { 4563859Sml29623 uint64_t value; 4573859Sml29623 struct { 4583859Sml29623 #if defined(_BIG_ENDIAN) 4593859Sml29623 uint32_t hdw; 4603859Sml29623 #endif 4613859Sml29623 struct { 4623859Sml29623 #ifdef _BIT_FIELDS_HTOL 4633859Sml29623 uint32_t err:1; 4643859Sml29623 uint32_t p_ecc:1; 4653859Sml29623 uint32_t mult:1; 4663859Sml29623 uint32_t rsrvd:5; 4673859Sml29623 uint32_t addr:8; 4683859Sml29623 uint32_t syndrome:16; 4693859Sml29623 #else 4703859Sml29623 uint32_t syndrome:16; 4713859Sml29623 uint32_t addr:8; 4723859Sml29623 uint32_t rsrvd:5; 4733859Sml29623 uint32_t mult:1; 4743859Sml29623 uint32_t p_ecc:1; 4753859Sml29623 uint32_t err:1; 4763859Sml29623 #endif 4773859Sml29623 } ldw; 4783859Sml29623 #ifndef _BIG_ENDIAN 4793859Sml29623 uint32_t hdw; 4803859Sml29623 #endif 4813859Sml29623 } bits; 4823859Sml29623 } tcam_err_t, *p_tcam_err_t; 4833859Sml29623 4843859Sml29623 4853859Sml29623 #define TCAM_ERR_SYNDROME_MASK 0x000000000000FFFFULL 4863859Sml29623 #define TCAM_ERR_MULT_SHIFT 29 4873859Sml29623 #define TCAM_ERR_MULT 0x0000000020000000ULL 4883859Sml29623 #define TCAM_ERR_P_ECC 0x0000000040000000ULL 4893859Sml29623 #define TCAM_ERR_ERR 0x0000000080000000ULL 4903859Sml29623 4913859Sml29623 #define HASH_LKUP_ERR_LOG1_REG (FZC_FFLP + 0x200E0) 4923859Sml29623 #define HASH_LKUP_ERR_LOG2_REG (FZC_FFLP + 0x200E8) 4933859Sml29623 4943859Sml29623 4953859Sml29623 4963859Sml29623 typedef union _hash_lookup_err_log1_t { 4973859Sml29623 uint64_t value; 4983859Sml29623 struct { 4993859Sml29623 #if defined(_BIG_ENDIAN) 5003859Sml29623 uint32_t hdw; 5013859Sml29623 #endif 5023859Sml29623 struct { 5033859Sml29623 #ifdef _BIT_FIELDS_HTOL 5043859Sml29623 uint32_t rsrvd:28; 5053859Sml29623 uint32_t ecc_err:1; 5063859Sml29623 uint32_t mult_lk:1; 5073859Sml29623 uint32_t cu:1; 5083859Sml29623 uint32_t mult_bit:1; 5093859Sml29623 #else 5103859Sml29623 uint32_t mult_bit:1; 5113859Sml29623 uint32_t cu:1; 5123859Sml29623 uint32_t mult_lk:1; 5133859Sml29623 uint32_t ecc_err:1; 5143859Sml29623 uint32_t rsrvd:28; 5153859Sml29623 #endif 5163859Sml29623 } ldw; 5173859Sml29623 #ifndef _BIG_ENDIAN 5183859Sml29623 uint32_t hdw; 5193859Sml29623 #endif 5203859Sml29623 } bits; 5213859Sml29623 } hash_lookup_err_log1_t, *p_hash_lookup_err_log1_t; 5223859Sml29623 5233859Sml29623 5243859Sml29623 5253859Sml29623 typedef union _hash_lookup_err_log2_t { 5263859Sml29623 uint64_t value; 5273859Sml29623 struct { 5283859Sml29623 #if defined(_BIG_ENDIAN) 5293859Sml29623 uint32_t hdw; 5303859Sml29623 #endif 5313859Sml29623 struct { 5323859Sml29623 #ifdef _BIT_FIELDS_HTOL 5333859Sml29623 uint32_t rsrvd:1; 5343859Sml29623 uint32_t h1:20; 5353859Sml29623 uint32_t subarea:3; 5363859Sml29623 uint32_t syndrome:8; 5373859Sml29623 #else 5383859Sml29623 uint32_t syndrome:8; 5393859Sml29623 uint32_t subarea:3; 5403859Sml29623 uint32_t h1:20; 5413859Sml29623 uint32_t rsrvd:1; 5423859Sml29623 #endif 5433859Sml29623 } ldw; 5443859Sml29623 #ifndef _BIG_ENDIAN 5453859Sml29623 uint32_t hdw; 5463859Sml29623 #endif 5473859Sml29623 } bits; 5483859Sml29623 } hash_lookup_err_log2_t, *p_hash_lookup_err_log2_t; 5493859Sml29623 5503859Sml29623 5513859Sml29623 5523859Sml29623 #define FFLP_FCRAM_ERR_TST0_REG (FZC_FFLP + 0x20128) 5533859Sml29623 5543859Sml29623 typedef union _fcram_err_tst0_t { 5553859Sml29623 uint64_t value; 5563859Sml29623 struct { 5573859Sml29623 #if defined(_BIG_ENDIAN) 5583859Sml29623 uint32_t hdw; 5593859Sml29623 #endif 5603859Sml29623 struct { 5613859Sml29623 #ifdef _BIT_FIELDS_HTOL 5623859Sml29623 uint32_t rsrvd:24; 5633859Sml29623 uint32_t syndrome_mask:8; 5643859Sml29623 #else 5653859Sml29623 uint32_t syndrome_mask:10; 5663859Sml29623 uint32_t rsrvd:24; 5673859Sml29623 #endif 5683859Sml29623 } ldw; 5693859Sml29623 #ifndef _BIG_ENDIAN 5703859Sml29623 uint32_t hdw; 5713859Sml29623 #endif 5723859Sml29623 } bits; 5733859Sml29623 } fcram_err_tst0_t, *p_fcram_err_tst0_t; 5743859Sml29623 5753859Sml29623 5763859Sml29623 #define FFLP_FCRAM_ERR_TST1_REG (FZC_FFLP + 0x20130) 5773859Sml29623 #define FFLP_FCRAM_ERR_TST2_REG (FZC_FFLP + 0x20138) 5783859Sml29623 5793859Sml29623 typedef union _fcram_err_tst_t { 5803859Sml29623 uint64_t value; 5813859Sml29623 struct { 5823859Sml29623 #if defined(_BIG_ENDIAN) 5833859Sml29623 struct { 5843859Sml29623 uint32_t dat; 5853859Sml29623 } hdw; 5863859Sml29623 #endif 5873859Sml29623 struct { 5883859Sml29623 uint32_t dat; 5893859Sml29623 } ldw; 5903859Sml29623 #ifndef _BIG_ENDIAN 5913859Sml29623 struct { 5923859Sml29623 uint32_t dat; 5933859Sml29623 } hdw; 5943859Sml29623 #endif 5953859Sml29623 } bits; 5963859Sml29623 } fcram_err_tst1_t, *p_fcram_err_tst1_t, 5973859Sml29623 fcram_err_tst2_t, *p_fcram_err_tst2_t, 5983859Sml29623 fcram_err_data_t, *p_fcram_err_data_t; 5993859Sml29623 6003859Sml29623 6013859Sml29623 6023859Sml29623 #define FFLP_ERR_MSK_REG (FZC_FFLP + 0x20140) 6033859Sml29623 6043859Sml29623 typedef union _fflp_err_mask_t { 6053859Sml29623 uint64_t value; 6063859Sml29623 struct { 6073859Sml29623 #if defined(_BIG_ENDIAN) 6083859Sml29623 uint32_t hdw; 6093859Sml29623 #endif 6103859Sml29623 struct { 6113859Sml29623 #ifdef _BIT_FIELDS_HTOL 6123859Sml29623 uint32_t rsrvd:21; 6133859Sml29623 uint32_t hash_tbl_dat:8; 6143859Sml29623 uint32_t hash_tbl_lkup:1; 6153859Sml29623 uint32_t tcam:1; 6163859Sml29623 uint32_t vlan:1; 6173859Sml29623 #else 6183859Sml29623 uint32_t vlan:1; 6193859Sml29623 uint32_t tcam:1; 6203859Sml29623 uint32_t hash_tbl_lkup:1; 6213859Sml29623 uint32_t hash_tbl_dat:8; 6223859Sml29623 uint32_t rsrvd:21; 6233859Sml29623 #endif 6243859Sml29623 } ldw; 6253859Sml29623 #ifndef _BIG_ENDIAN 6263859Sml29623 uint32_t hdw; 6273859Sml29623 #endif 6283859Sml29623 } bits; 6293859Sml29623 } fflp_err_mask_t, *p_fflp_err_mask_t; 6303859Sml29623 6313859Sml29623 #define FFLP_ERR_VLAN_MASK 0x00000001ULL 6323859Sml29623 #define FFLP_ERR_VLAN 0x00000001ULL 6333859Sml29623 #define FFLP_ERR_VLAN_SHIFT 0x0 6343859Sml29623 6353859Sml29623 #define FFLP_ERR_TCAM_MASK 0x00000002ULL 6363859Sml29623 #define FFLP_ERR_TCAM 0x00000001ULL 6373859Sml29623 #define FFLP_ERR_TCAM_SHIFT 0x1 6383859Sml29623 6393859Sml29623 #define FFLP_ERR_HASH_TBL_LKUP_MASK 0x00000004ULL 6403859Sml29623 #define FFLP_ERR_HASH_TBL_LKUP 0x00000001ULL 6413859Sml29623 #define FFLP_ERR_HASH_TBL_LKUP_SHIFT 0x2 6423859Sml29623 6433859Sml29623 #define FFLP_ERR_HASH_TBL_DAT_MASK 0x00000007F8ULL 6443859Sml29623 #define FFLP_ERR_HASH_TBL_DAT 0x0000000FFULL 6453859Sml29623 #define FFLP_ERR_HASH_TBL_DAT_SHIFT 0x3 6463859Sml29623 6473859Sml29623 #define FFLP_ERR_MASK_ALL (FFLP_ERR_VLAN_MASK | FFLP_ERR_TCAM_MASK | \ 6483859Sml29623 FFLP_ERR_HASH_TBL_LKUP_MASK | \ 6493859Sml29623 FFLP_ERR_HASH_TBL_DAT_MASK) 6503859Sml29623 6513859Sml29623 6523859Sml29623 #define FFLP_CFG_1_REG (FZC_FFLP + 0x20100) 6533859Sml29623 6543859Sml29623 typedef union _fflp_cfg_1_t { 6553859Sml29623 uint64_t value; 6563859Sml29623 struct { 6573859Sml29623 #if defined(_BIG_ENDIAN) 6583859Sml29623 uint32_t hdw; 6593859Sml29623 #endif 6603859Sml29623 struct { 6613859Sml29623 #ifdef _BIT_FIELDS_HTOL 6623859Sml29623 uint32_t rsrvd:5; 6633859Sml29623 uint32_t tcam_disable:1; 6643859Sml29623 uint32_t pio_dbg_sel:3; 6653859Sml29623 uint32_t pio_fio_rst:1; 6663859Sml29623 uint32_t pio_fio_lat:2; 6673859Sml29623 uint32_t camlatency:4; 6683859Sml29623 uint32_t camratio:4; 6693859Sml29623 uint32_t fcramratio:4; 6703859Sml29623 uint32_t fcramoutdr:4; 6713859Sml29623 uint32_t fcramqs:1; 6723859Sml29623 uint32_t errordis:1; 6733859Sml29623 uint32_t fflpinitdone:1; 6743859Sml29623 uint32_t llcsnap:1; 6753859Sml29623 #else 6763859Sml29623 uint32_t llcsnap:1; 6773859Sml29623 uint32_t fflpinitdone:1; 6783859Sml29623 uint32_t errordis:1; 6793859Sml29623 uint32_t fcramqs:1; 6803859Sml29623 uint32_t fcramoutdr:4; 6813859Sml29623 uint32_t fcramratio:4; 6823859Sml29623 uint32_t camratio:4; 6833859Sml29623 uint32_t camlatency:4; 6843859Sml29623 uint32_t pio_fio_lat:2; 6853859Sml29623 uint32_t pio_fio_rst:1; 6863859Sml29623 uint32_t pio_dbg_sel:3; 6873859Sml29623 uint32_t tcam_disable:1; 6883859Sml29623 uint32_t rsrvd:5; 6893859Sml29623 #endif 6903859Sml29623 } ldw; 6913859Sml29623 #ifndef _BIG_ENDIAN 6923859Sml29623 uint32_t hdw; 6933859Sml29623 #endif 6943859Sml29623 } bits; 6953859Sml29623 } fflp_cfg_1_t, *p_fflp_cfg_1_t; 6963859Sml29623 6973859Sml29623 6983859Sml29623 typedef enum fflp_fcram_output_drive { 6993859Sml29623 FCRAM_OUTDR_NORMAL = 0x0, 7003859Sml29623 FCRAM_OUTDR_STRONG = 0x5, 7013859Sml29623 FCRAM_OUTDR_WEAK = 0xa 7023859Sml29623 } fflp_fcram_output_drive_t; 7033859Sml29623 7043859Sml29623 7053859Sml29623 typedef enum fflp_fcram_qs { 7063859Sml29623 FCRAM_QS_MODE_QS = 0x0, 7073859Sml29623 FCRAM_QS_MODE_FREE = 0x1 7083859Sml29623 } fflp_fcram_qs_t; 7093859Sml29623 7103859Sml29623 #define FCRAM_PIO_HIGH_PRI 0xf 7113859Sml29623 #define FCRAM_PIO_MED_PRI 0xa 7123859Sml29623 #define FCRAM_LOOKUP_HIGH_PRI 0x0 7133859Sml29623 #define FCRAM_LOOKUP_HIGH_PRI 0x0 7143859Sml29623 #define FCRAM_IO_DEFAULT_PRI FCRAM_PIO_MED_PRI 7153859Sml29623 7163859Sml29623 #define TCAM_PIO_HIGH_PRI 0xf 7173859Sml29623 #define TCAM_PIO_MED_PRI 0xa 7183859Sml29623 #define TCAM_LOOKUP_HIGH_PRI 0x0 7193859Sml29623 #define TCAM_LOOKUP_HIGH_PRI 0x0 7203859Sml29623 #define TCAM_IO_DEFAULT_PRI TCAM_PIO_MED_PRI 7213859Sml29623 7223859Sml29623 #define TCAM_DEFAULT_LATENCY 0x4 7233859Sml29623 7243859Sml29623 7253859Sml29623 #define FFLP_DBG_TRAIN_VCT_REG (FZC_FFLP + 0x20148) 7263859Sml29623 7273859Sml29623 typedef union _fflp_dbg_train_vct_t { 7283859Sml29623 uint64_t value; 7293859Sml29623 struct { 7303859Sml29623 #if defined(_BIG_ENDIAN) 7313859Sml29623 uint32_t hdw; 7323859Sml29623 #endif 7333859Sml29623 struct { 7343859Sml29623 #ifdef _BIT_FIELDS_HTOL 7353859Sml29623 uint32_t vector; 7363859Sml29623 #else 7373859Sml29623 uint32_t vector; 7383859Sml29623 #endif 7393859Sml29623 } ldw; 7403859Sml29623 #ifndef _BIG_ENDIAN 7413859Sml29623 uint32_t hdw; 7423859Sml29623 #endif 7433859Sml29623 } bits; 7443859Sml29623 } fflp_dbg_train_vct_t, *p_fflp_dbg_train_vct_t; 7453859Sml29623 7463859Sml29623 7473859Sml29623 7483859Sml29623 #define FFLP_TCP_CFLAG_MSK_REG (FZC_FFLP + 0x20108) 7493859Sml29623 7503859Sml29623 typedef union _tcp_cflag_mask_t { 7513859Sml29623 uint64_t value; 7523859Sml29623 struct { 7533859Sml29623 #if defined(_BIG_ENDIAN) 7543859Sml29623 uint32_t hdw; 7553859Sml29623 #endif 7563859Sml29623 struct { 7573859Sml29623 #ifdef _BIT_FIELDS_HTOL 7583859Sml29623 uint32_t rsrvd:20; 7593859Sml29623 uint32_t mask:12; 7603859Sml29623 #else 7613859Sml29623 uint32_t mask:12; 7623859Sml29623 uint32_t rsrvd:20; 7633859Sml29623 #endif 7643859Sml29623 } ldw; 7653859Sml29623 #ifndef _BIG_ENDIAN 7663859Sml29623 uint32_t hdw; 7673859Sml29623 #endif 7683859Sml29623 } bits; 7693859Sml29623 } tcp_cflag_mask_t, *p_tcp_cflag_mask_t; 7703859Sml29623 7713859Sml29623 7723859Sml29623 7733859Sml29623 #define FFLP_FCRAM_REF_TMR_REG (FZC_FFLP + 0x20110) 7743859Sml29623 7753859Sml29623 7763859Sml29623 typedef union _fcram_ref_tmr_t { 7773859Sml29623 #define FCRAM_REFRESH_DEFAULT_MAX_TIME 0x200 7783859Sml29623 #define FCRAM_REFRESH_DEFAULT_MIN_TIME 0x200 7793859Sml29623 #define FCRAM_REFRESH_DEFAULT_SYS_TIME 0x200 7803859Sml29623 #define FCRAM_REFRESH_MAX_TICK 39 /* usecs */ 7813859Sml29623 #define FCRAM_REFRESH_MIN_TICK 400 /* nsecs */ 7823859Sml29623 7833859Sml29623 uint64_t value; 7843859Sml29623 struct { 7853859Sml29623 #if defined(_BIG_ENDIAN) 7863859Sml29623 uint32_t hdw; 7873859Sml29623 #endif 7883859Sml29623 struct { 7893859Sml29623 #ifdef _BIT_FIELDS_HTOL 7903859Sml29623 uint32_t max:16; 7913859Sml29623 uint32_t min:16; 7923859Sml29623 #else 7933859Sml29623 uint32_t min:16; 7943859Sml29623 uint32_t max:16; 7953859Sml29623 #endif 7963859Sml29623 } ldw; 7973859Sml29623 #ifndef _BIG_ENDIAN 7983859Sml29623 uint32_t hdw; 7993859Sml29623 #endif 8003859Sml29623 } bits; 8013859Sml29623 } fcram_ref_tmr_t, *p_fcram_ref_tmr_t; 8023859Sml29623 8033859Sml29623 8043859Sml29623 8053859Sml29623 8063859Sml29623 #define FFLP_FCRAM_FIO_ADDR_REG (FZC_FFLP + 0x20118) 8073859Sml29623 8083859Sml29623 typedef union _fcram_fio_addr_t { 8093859Sml29623 uint64_t value; 8103859Sml29623 struct { 8113859Sml29623 #if defined(_BIG_ENDIAN) 8123859Sml29623 uint32_t hdw; 8133859Sml29623 #endif 8143859Sml29623 struct { 8153859Sml29623 #ifdef _BIT_FIELDS_HTOL 8163859Sml29623 uint32_t rsrvd:22; 8173859Sml29623 uint32_t addr:10; 8183859Sml29623 #else 8193859Sml29623 uint32_t addr:10; 8203859Sml29623 uint32_t rsrvd:22; 8213859Sml29623 #endif 8223859Sml29623 } ldw; 8233859Sml29623 #ifndef _BIG_ENDIAN 8243859Sml29623 uint32_t hdw; 8253859Sml29623 #endif 8263859Sml29623 } bits; 8273859Sml29623 } fcram_fio_addr_t, *p_fcram_fio_addr_t; 8283859Sml29623 8293859Sml29623 8303859Sml29623 #define FFLP_FCRAM_FIO_DAT_REG (FZC_FFLP + 0x20120) 8313859Sml29623 8323859Sml29623 typedef union _fcram_fio_dat_t { 8333859Sml29623 uint64_t value; 8343859Sml29623 struct { 8353859Sml29623 #if defined(_BIG_ENDIAN) 8363859Sml29623 uint32_t hdw; 8373859Sml29623 #endif 8383859Sml29623 struct { 8393859Sml29623 #ifdef _BIT_FIELDS_HTOL 8403859Sml29623 uint32_t rsrvd:22; 8413859Sml29623 uint32_t addr:10; 8423859Sml29623 #else 8433859Sml29623 uint32_t addr:10; 8443859Sml29623 uint32_t rsrvd:22; 8453859Sml29623 #endif 8463859Sml29623 } ldw; 8473859Sml29623 #ifndef _BIG_ENDIAN 8483859Sml29623 uint32_t hdw; 8493859Sml29623 #endif 8503859Sml29623 } bits; 8513859Sml29623 } fcram_fio_dat_t, *p_fcram_fio_dat_t; 8523859Sml29623 8533859Sml29623 8543859Sml29623 #define FFLP_FCRAM_PHY_RD_LAT_REG (FZC_FFLP + 0x20150) 8553859Sml29623 8563859Sml29623 typedef union _fcram_phy_rd_lat_t { 8573859Sml29623 uint64_t value; 8583859Sml29623 struct { 8593859Sml29623 #if defined(_BIG_ENDIAN) 8603859Sml29623 uint32_t hdw; 8613859Sml29623 #endif 8623859Sml29623 struct { 8633859Sml29623 #ifdef _BIT_FIELDS_HTOL 8643859Sml29623 uint32_t rsrvd:24; 8653859Sml29623 uint32_t lat:8; 8663859Sml29623 #else 8673859Sml29623 uint32_t lat:8; 8683859Sml29623 uint32_t rsrvd:24; 8693859Sml29623 #endif 8703859Sml29623 } ldw; 8713859Sml29623 #ifndef _BIG_ENDIAN 8723859Sml29623 uint32_t hdw; 8733859Sml29623 #endif 8743859Sml29623 } bits; 8753859Sml29623 } fcram_phy_rd_lat_t, *p_fcram_phy_rd_lat_t; 8763859Sml29623 8773859Sml29623 8783859Sml29623 /* 8793859Sml29623 * Specify how to build a flow key for IP 8803859Sml29623 * classes, both programmable and hardwired 8813859Sml29623 */ 8823859Sml29623 #define FFLP_FLOW_KEY_BASE_OFFSET (FZC_FFLP + 0x40000) 8833859Sml29623 #define FFLP_FLOW_KEY_IP_USR4_REG (FZC_FFLP + 0x40000) 8843859Sml29623 #define FFLP_FLOW_KEY_IP_USR5_REG (FZC_FFLP + 0x40008) 8853859Sml29623 #define FFLP_FLOW_KEY_IP_USR6_REG (FZC_FFLP + 0x40010) 8863859Sml29623 #define FFLP_FLOW_KEY_IP_USR7_REG (FZC_FFLP + 0x40018) 8873859Sml29623 #define FFLP_FLOW_KEY_IP4_TCP_REG (FZC_FFLP + 0x40020) 8883859Sml29623 #define FFLP_FLOW_KEY_IP4_UDP_REG (FZC_FFLP + 0x40028) 8893859Sml29623 #define FFLP_FLOW_KEY_IP4_AH_ESP_REG (FZC_FFLP + 0x40030) 8903859Sml29623 #define FFLP_FLOW_KEY_IP4_SCTP_REG (FZC_FFLP + 0x40038) 8913859Sml29623 #define FFLP_FLOW_KEY_IP6_TCP_REG (FZC_FFLP + 0x40040) 8923859Sml29623 #define FFLP_FLOW_KEY_IP6_UDP_REG (FZC_FFLP + 0x40048) 8933859Sml29623 #define FFLP_FLOW_KEY_IP6_AH_ESP_REG (FZC_FFLP + 0x40050) 8943859Sml29623 #define FFLP_FLOW_KEY_IP6_SCTP_REG (FZC_FFLP + 0x40058) 895*11304SJanie.Lu@Sun.COM /* 896*11304SJanie.Lu@Sun.COM * New FLOW KEY register added for IPV6 Fragments for RF-NIU 897*11304SJanie.Lu@Sun.COM * and Neptune-L. 898*11304SJanie.Lu@Sun.COM */ 899*11304SJanie.Lu@Sun.COM #define FFLP_FLOW_KEY_IP6_FRAG_REG (FZC_FFLP + 0x400B0) 900*11304SJanie.Lu@Sun.COM 901*11304SJanie.Lu@Sun.COM #define FL_KEY_USR_L4XOR_MSK 0x03ff 9023859Sml29623 9033859Sml29623 typedef union _flow_class_key_ip_t { 9043859Sml29623 uint64_t value; 9053859Sml29623 struct { 9063859Sml29623 #if defined(_BIG_ENDIAN) 9073859Sml29623 uint32_t hdw; 9083859Sml29623 #endif 9093859Sml29623 struct { 9103859Sml29623 #ifdef _BIT_FIELDS_HTOL 911*11304SJanie.Lu@Sun.COM uint32_t rsrvd2:10; 912*11304SJanie.Lu@Sun.COM /* These bits added for L3 programmable classes in RF-NIU and Neptune-L */ 913*11304SJanie.Lu@Sun.COM uint32_t l4_xor:10; 914*11304SJanie.Lu@Sun.COM uint32_t l4_mode:1; 915*11304SJanie.Lu@Sun.COM /* This bit added for SNORT support in RF-NIU and Neptune-L */ 916*11304SJanie.Lu@Sun.COM uint32_t sym:1; 9173859Sml29623 uint32_t port:1; 9183859Sml29623 uint32_t l2da:1; 9193859Sml29623 uint32_t vlan:1; 9203859Sml29623 uint32_t ipsa:1; 9213859Sml29623 uint32_t ipda:1; 9223859Sml29623 uint32_t proto:1; 9233859Sml29623 uint32_t l4_0:2; 9243859Sml29623 uint32_t l4_1:2; 9253859Sml29623 #else 9263859Sml29623 uint32_t l4_1:2; 9273859Sml29623 uint32_t l4_0:2; 9283859Sml29623 uint32_t proto:1; 9293859Sml29623 uint32_t ipda:1; 9303859Sml29623 uint32_t ipsa:1; 9313859Sml29623 uint32_t vlan:1; 9323859Sml29623 uint32_t l2da:1; 9333859Sml29623 uint32_t port:1; 934*11304SJanie.Lu@Sun.COM uint32_t sym:1; 935*11304SJanie.Lu@Sun.COM uint32_t l4_mode:1; 936*11304SJanie.Lu@Sun.COM uint32_t l4_xor:10; 937*11304SJanie.Lu@Sun.COM uint32_t rsrvd2:10; 9383859Sml29623 #endif 9393859Sml29623 } ldw; 9403859Sml29623 #ifndef _BIG_ENDIAN 9413859Sml29623 uint32_t hdw; 9423859Sml29623 #endif 9433859Sml29623 } bits; 9443859Sml29623 } flow_class_key_ip_t, *p_flow_class_key_ip_t; 9453859Sml29623 9463859Sml29623 #define FFLP_H1POLY_REG (FZC_FFLP + 0x40060) 9473859Sml29623 9483859Sml29623 9493859Sml29623 typedef union _hash_h1poly_t { 9503859Sml29623 uint64_t value; 9513859Sml29623 struct { 9523859Sml29623 #if defined(_BIG_ENDIAN) 9533859Sml29623 uint32_t hdw; 9543859Sml29623 #endif 9553859Sml29623 struct { 9563859Sml29623 uint32_t init_value; 9573859Sml29623 } ldw; 9583859Sml29623 #ifndef _BIG_ENDIAN 9593859Sml29623 uint32_t hdw; 9603859Sml29623 #endif 9613859Sml29623 } bits; 9623859Sml29623 } hash_h1poly_t, *p_hash_h1poly_t; 9633859Sml29623 9643859Sml29623 #define FFLP_H2POLY_REG (FZC_FFLP + 0x40068) 9653859Sml29623 9663859Sml29623 typedef union _hash_h2poly_t { 9673859Sml29623 uint64_t value; 9683859Sml29623 struct { 9693859Sml29623 #if defined(_BIG_ENDIAN) 9703859Sml29623 uint32_t hdw; 9713859Sml29623 #endif 9723859Sml29623 struct { 9733859Sml29623 #ifdef _BIT_FIELDS_HTOL 9743859Sml29623 uint32_t rsrvd:16; 9753859Sml29623 uint32_t init_value:16; 9763859Sml29623 #else 9773859Sml29623 uint32_t init_value:16; 9783859Sml29623 uint32_t rsrvd:16; 9793859Sml29623 #endif 9803859Sml29623 } ldw; 9813859Sml29623 #ifndef _BIG_ENDIAN 9823859Sml29623 uint32_t hdw; 9833859Sml29623 #endif 9843859Sml29623 } bits; 9853859Sml29623 } hash_h2poly_t, *p_hash_h2poly_t; 9863859Sml29623 9873859Sml29623 #define FFLP_FLW_PRT_SEL_REG (FZC_FFLP + 0x40070) 9883859Sml29623 9893859Sml29623 9903859Sml29623 typedef union _flow_prt_sel_t { 9913859Sml29623 #define FFLP_FCRAM_MAX_PARTITION 8 9923859Sml29623 uint64_t value; 9933859Sml29623 struct { 9943859Sml29623 #if defined(_BIG_ENDIAN) 9953859Sml29623 uint32_t hdw; 9963859Sml29623 #endif 9973859Sml29623 struct { 9983859Sml29623 #ifdef _BIT_FIELDS_HTOL 9993859Sml29623 uint32_t rsrvd3:15; 10003859Sml29623 uint32_t ext:1; 10013859Sml29623 uint32_t rsrvd2:3; 10023859Sml29623 uint32_t mask:5; 10033859Sml29623 uint32_t rsrvd:3; 10043859Sml29623 uint32_t base:5; 10053859Sml29623 #else 10063859Sml29623 uint32_t base:5; 10073859Sml29623 uint32_t rsrvd:3; 10083859Sml29623 uint32_t mask:5; 10093859Sml29623 uint32_t rsrvd2:3; 10103859Sml29623 uint32_t ext:1; 10113859Sml29623 uint32_t rsrvd3:15; 10123859Sml29623 #endif 10133859Sml29623 } ldw; 10143859Sml29623 #ifndef _BIG_ENDIAN 10153859Sml29623 uint32_t hdw; 10163859Sml29623 #endif 10173859Sml29623 } bits; 10183859Sml29623 } flow_prt_sel_t, *p_flow_prt_sel_t; 10193859Sml29623 10203859Sml29623 10213859Sml29623 10223859Sml29623 /* FFLP Offsets */ 10233859Sml29623 10243859Sml29623 10253859Sml29623 #define FFLP_HASH_TBL_ADDR_REG (FFLP + 0x00000) 10263859Sml29623 10273859Sml29623 typedef union _hash_tbl_addr_t { 10283859Sml29623 uint64_t value; 10293859Sml29623 struct { 10303859Sml29623 #if defined(_BIG_ENDIAN) 10313859Sml29623 uint32_t hdw; 10323859Sml29623 #endif 10333859Sml29623 struct { 10343859Sml29623 #ifdef _BIT_FIELDS_HTOL 10353859Sml29623 uint32_t rsrvd:8; 10363859Sml29623 uint32_t autoinc:1; 10373859Sml29623 uint32_t addr:23; 10383859Sml29623 #else 10393859Sml29623 uint32_t addr:23; 10403859Sml29623 uint32_t autoinc:1; 10413859Sml29623 uint32_t rsrvd:8; 10423859Sml29623 #endif 10433859Sml29623 } ldw; 10443859Sml29623 #ifndef _BIG_ENDIAN 10453859Sml29623 uint32_t hdw; 10463859Sml29623 #endif 10473859Sml29623 } bits; 10483859Sml29623 } hash_tbl_addr_t, *p_hash_tbl_addr_t; 10493859Sml29623 10503859Sml29623 10513859Sml29623 #define FFLP_HASH_TBL_DATA_REG (FFLP + 0x00008) 10523859Sml29623 10533859Sml29623 typedef union _hash_tbl_data_t { 10543859Sml29623 uint64_t value; 10553859Sml29623 struct { 10563859Sml29623 #ifdef _BIG_ENDIAN 10573859Sml29623 uint32_t hdw; 10583859Sml29623 uint32_t ldw; 10593859Sml29623 #else 10603859Sml29623 uint32_t ldw; 10613859Sml29623 uint32_t hdw; 10623859Sml29623 #endif 10633859Sml29623 } bits; 10643859Sml29623 } hash_tbl_data_t, *p_hash_tbl_data_t; 10653859Sml29623 10663859Sml29623 10673859Sml29623 #define FFLP_HASH_TBL_DATA_LOG_REG (FFLP + 0x00010) 10683859Sml29623 10693859Sml29623 10703859Sml29623 typedef union _hash_tbl_data_log_t { 10713859Sml29623 uint64_t value; 10723859Sml29623 struct { 10733859Sml29623 #if defined(_BIG_ENDIAN) 10743859Sml29623 uint32_t hdw; 10753859Sml29623 #endif 10763859Sml29623 struct { 10773859Sml29623 #ifdef _BIT_FIELDS_HTOL 10783859Sml29623 uint32_t pio_err:1; 10793859Sml29623 uint32_t fcram_addr:23; 10803859Sml29623 uint32_t syndrome:8; 10813859Sml29623 #else 10823859Sml29623 uint32_t syndrome:8; 10833859Sml29623 uint32_t fcram_addr:23; 10843859Sml29623 uint32_t pio_err:1; 10853859Sml29623 #endif 10863859Sml29623 } ldw; 10873859Sml29623 #ifndef _BIG_ENDIAN 10883859Sml29623 uint32_t hdw; 10893859Sml29623 #endif 10903859Sml29623 } bits; 10913859Sml29623 } hash_tbl_data_log_t, *p_hash_tbl_data_log_t; 10923859Sml29623 10933859Sml29623 10943859Sml29623 10953859Sml29623 #define REG_PIO_WRITE64(handle, offset, value) \ 10963859Sml29623 NXGE_REG_WR64((handle), (offset), (value)) 10973859Sml29623 #define REG_PIO_READ64(handle, offset, val_p) \ 10983859Sml29623 NXGE_REG_RD64((handle), (offset), (val_p)) 10993859Sml29623 11003859Sml29623 11013859Sml29623 #define WRITE_TCAM_REG_CTL(handle, ctl) \ 11023859Sml29623 REG_PIO_WRITE64(handle, FFLP_TCAM_CTL_REG, ctl) 11033859Sml29623 11043859Sml29623 #define READ_TCAM_REG_CTL(handle, val_p) \ 11053859Sml29623 REG_PIO_READ64(handle, FFLP_TCAM_CTL_REG, val_p) 11063859Sml29623 11073859Sml29623 11083859Sml29623 #define WRITE_TCAM_REG_KEY0(handle, key) \ 11093859Sml29623 REG_PIO_WRITE64(handle, FFLP_TCAM_KEY_0_REG, key) 11103859Sml29623 #define WRITE_TCAM_REG_KEY1(handle, key) \ 11113859Sml29623 REG_PIO_WRITE64(handle, FFLP_TCAM_KEY_1_REG, key) 11123859Sml29623 #define WRITE_TCAM_REG_KEY2(handle, key) \ 11133859Sml29623 REG_PIO_WRITE64(handle, FFLP_TCAM_KEY_2_REG, key) 11143859Sml29623 #define WRITE_TCAM_REG_KEY3(handle, key) \ 11153859Sml29623 REG_PIO_WRITE64(handle, FFLP_TCAM_KEY_3_REG, key) 11163859Sml29623 #define WRITE_TCAM_REG_MASK0(handle, mask) \ 11173859Sml29623 REG_PIO_WRITE64(handle, FFLP_TCAM_MASK_0_REG, mask) 11183859Sml29623 #define WRITE_TCAM_REG_MASK1(handle, mask) \ 11193859Sml29623 REG_PIO_WRITE64(handle, FFLP_TCAM_MASK_1_REG, mask) 11203859Sml29623 #define WRITE_TCAM_REG_MASK2(handle, mask) \ 11213859Sml29623 REG_PIO_WRITE64(handle, FFLP_TCAM_MASK_2_REG, mask) 11223859Sml29623 #define WRITE_TCAM_REG_MASK3(handle, mask) \ 11233859Sml29623 REG_PIO_WRITE64(handle, FFLP_TCAM_MASK_3_REG, mask) 11243859Sml29623 11253859Sml29623 #define READ_TCAM_REG_KEY0(handle, val_p) \ 11263859Sml29623 REG_PIO_READ64(handle, FFLP_TCAM_KEY_0_REG, val_p) 11273859Sml29623 #define READ_TCAM_REG_KEY1(handle, val_p) \ 11283859Sml29623 REG_PIO_READ64(handle, FFLP_TCAM_KEY_1_REG, val_p) 11293859Sml29623 #define READ_TCAM_REG_KEY2(handle, val_p) \ 11303859Sml29623 REG_PIO_READ64(handle, FFLP_TCAM_KEY_2_REG, val_p) 11313859Sml29623 #define READ_TCAM_REG_KEY3(handle, val_p) \ 11323859Sml29623 REG_PIO_READ64(handle, FFLP_TCAM_KEY_3_REG, val_p) 11333859Sml29623 #define READ_TCAM_REG_MASK0(handle, val_p) \ 11343859Sml29623 REG_PIO_READ64(handle, FFLP_TCAM_MASK_0_REG, val_p) 11353859Sml29623 #define READ_TCAM_REG_MASK1(handle, val_p) \ 11363859Sml29623 REG_PIO_READ64(handle, FFLP_TCAM_MASK_1_REG, val_p) 11373859Sml29623 #define READ_TCAM_REG_MASK2(handle, val_p) \ 11383859Sml29623 REG_PIO_READ64(handle, FFLP_TCAM_MASK_2_REG, val_p) 11393859Sml29623 #define READ_TCAM_REG_MASK3(handle, val_p) \ 11403859Sml29623 REG_PIO_READ64(handle, FFLP_TCAM_MASK_3_REG, val_p) 11413859Sml29623 11423859Sml29623 11433859Sml29623 11443859Sml29623 11453859Sml29623 typedef struct tcam_ipv4 { 11463859Sml29623 #if defined(_BIG_ENDIAN) 11473859Sml29623 uint32_t reserved6; /* 255 : 224 */ 11483859Sml29623 uint32_t reserved5 : 24; /* 223 : 200 */ 11493859Sml29623 uint32_t cls_code : 5; /* 199 : 195 */ 11503859Sml29623 uint32_t reserved4 : 3; /* 194 : 192 */ 11513859Sml29623 uint32_t l2rd_tbl_num : 5; /* 191: 187 */ 11523859Sml29623 uint32_t noport : 1; /* 186 */ 11533859Sml29623 uint32_t reserved3 : 26; /* 185: 160 */ 11543859Sml29623 uint32_t reserved2; /* 159: 128 */ 11553859Sml29623 uint32_t reserved : 16; /* 127 : 112 */ 11563859Sml29623 uint32_t tos : 8; /* 111 : 104 */ 11573859Sml29623 uint32_t proto : 8; /* 103 : 96 */ 11583859Sml29623 uint32_t l4_port_spi; /* 95 : 64 */ 11593859Sml29623 uint32_t ip_src; /* 63 : 32 */ 11603859Sml29623 uint32_t ip_dest; /* 31 : 0 */ 11613859Sml29623 #else 11623859Sml29623 uint32_t ip_dest; /* 31 : 0 */ 11633859Sml29623 uint32_t ip_src; /* 63 : 32 */ 11643859Sml29623 uint32_t l4_port_spi; /* 95 : 64 */ 11653859Sml29623 uint32_t proto : 8; /* 103 : 96 */ 11663859Sml29623 uint32_t tos : 8; /* 111 : 104 */ 11673859Sml29623 uint32_t reserved : 16; /* 127 : 112 */ 11683859Sml29623 uint32_t reserved2; /* 159: 128 */ 11693859Sml29623 uint32_t reserved3 : 26; /* 185: 160 */ 11703859Sml29623 uint32_t noport : 1; /* 186 */ 11713859Sml29623 uint32_t l2rd_tbl_num : 5; /* 191: 187 */ 11723859Sml29623 uint32_t reserved4 : 3; /* 194 : 192 */ 11733859Sml29623 uint32_t cls_code : 5; /* 199 : 195 */ 11743859Sml29623 uint32_t reserved5 : 24; /* 223 : 200 */ 11753859Sml29623 uint32_t reserved6; /* 255 : 224 */ 11763859Sml29623 #endif 11773859Sml29623 } tcam_ipv4_t; 11783859Sml29623 11793859Sml29623 11803859Sml29623 11813859Sml29623 typedef struct tcam_reg { 11823859Sml29623 #if defined(_BIG_ENDIAN) 11833859Sml29623 uint64_t reg0; 11843859Sml29623 uint64_t reg1; 11853859Sml29623 uint64_t reg2; 11863859Sml29623 uint64_t reg3; 11873859Sml29623 #else 11883859Sml29623 uint64_t reg3; 11893859Sml29623 uint64_t reg2; 11903859Sml29623 uint64_t reg1; 11913859Sml29623 uint64_t reg0; 11923859Sml29623 #endif 11933859Sml29623 } tcam_reg_t; 11943859Sml29623 11953859Sml29623 11963859Sml29623 typedef struct tcam_ether { 11973859Sml29623 #if defined(_BIG_ENDIAN) 11983859Sml29623 uint8_t reserved3[7]; /* 255 : 200 */ 11993859Sml29623 uint8_t cls_code : 5; /* 199 : 195 */ 12003859Sml29623 uint8_t reserved2 : 3; /* 194 : 192 */ 12013859Sml29623 uint8_t ethframe[11]; /* 191 : 104 */ 12023859Sml29623 uint8_t reserved[13]; /* 103 : 0 */ 12033859Sml29623 #else 12043859Sml29623 uint8_t reserved[13]; /* 103 : 0 */ 12053859Sml29623 uint8_t ethframe[11]; /* 191 : 104 */ 12063859Sml29623 uint8_t reserved2 : 3; /* 194 : 192 */ 12073859Sml29623 uint8_t cls_code : 5; /* 199 : 195 */ 12083859Sml29623 uint8_t reserved3[7]; /* 255 : 200 */ 12093859Sml29623 #endif 12103859Sml29623 } tcam_ether_t; 12113859Sml29623 12123859Sml29623 12133859Sml29623 typedef struct tcam_ipv6 { 12143859Sml29623 #if defined(_BIG_ENDIAN) 12153859Sml29623 uint32_t reserved4; /* 255 : 224 */ 12163859Sml29623 uint32_t reserved3 : 24; /* 223 : 200 */ 12173859Sml29623 uint32_t cls_code : 5; /* 199 : 195 */ 12183859Sml29623 uint32_t reserved2 : 3; /* 194 : 192 */ 12193859Sml29623 uint32_t l2rd_tbl_num : 5; /* 191: 187 */ 12203859Sml29623 uint32_t noport : 1; /* 186 */ 12213859Sml29623 uint32_t reserved : 10; /* 185 : 176 */ 12223859Sml29623 uint32_t tos : 8; /* 175 : 168 */ 12233859Sml29623 uint32_t nxt_hdr : 8; /* 167 : 160 */ 12243859Sml29623 uint32_t l4_port_spi; /* 159 : 128 */ 12253859Sml29623 uint32_t ip_addr[4]; /* 127 : 0 */ 12263859Sml29623 #else 12273859Sml29623 uint32_t ip_addr[4]; /* 127 : 0 */ 12283859Sml29623 uint32_t l4_port_spi; /* 159 : 128 */ 12293859Sml29623 uint32_t nxt_hdr : 8; /* 167 : 160 */ 12303859Sml29623 uint32_t tos : 8; /* 175 : 168 */ 12313859Sml29623 uint32_t reserved : 10; /* 185 : 176 */ 12323859Sml29623 uint32_t noport : 1; /* 186 */ 12333859Sml29623 uint32_t l2rd_tbl_num : 5; /* 191: 187 */ 12343859Sml29623 uint32_t reserved2 : 3; /* 194 : 192 */ 12353859Sml29623 uint32_t cls_code : 5; /* 199 : 195 */ 12363859Sml29623 uint32_t reserved3 : 24; /* 223 : 200 */ 12373859Sml29623 uint32_t reserved4; /* 255 : 224 */ 12383859Sml29623 #endif 12393859Sml29623 } tcam_ipv6_t; 12403859Sml29623 12413859Sml29623 12423859Sml29623 typedef struct tcam_entry { 12433859Sml29623 union _tcam_entry { 12443859Sml29623 tcam_reg_t regs_e; 12453859Sml29623 tcam_ether_t ether_e; 12463859Sml29623 tcam_ipv4_t ipv4_e; 12473859Sml29623 tcam_ipv6_t ipv6_e; 12483859Sml29623 } key, mask; 12493859Sml29623 tcam_res_t match_action; 12503859Sml29623 } tcam_entry_t; 12513859Sml29623 12523859Sml29623 12533859Sml29623 #define key_reg0 key.regs_e.reg0 12543859Sml29623 #define key_reg1 key.regs_e.reg1 12553859Sml29623 #define key_reg2 key.regs_e.reg2 12563859Sml29623 #define key_reg3 key.regs_e.reg3 12573859Sml29623 #define mask_reg0 mask.regs_e.reg0 12583859Sml29623 #define mask_reg1 mask.regs_e.reg1 12593859Sml29623 #define mask_reg2 mask.regs_e.reg2 12603859Sml29623 #define mask_reg3 mask.regs_e.reg3 12613859Sml29623 12623859Sml29623 12633859Sml29623 #define key0 key.regs_e.reg0 12643859Sml29623 #define key1 key.regs_e.reg1 12653859Sml29623 #define key2 key.regs_e.reg2 12663859Sml29623 #define key3 key.regs_e.reg3 12673859Sml29623 #define mask0 mask.regs_e.reg0 12683859Sml29623 #define mask1 mask.regs_e.reg1 12693859Sml29623 #define mask2 mask.regs_e.reg2 12703859Sml29623 #define mask3 mask.regs_e.reg3 12713859Sml29623 12723859Sml29623 12733859Sml29623 #define ip4_src_key key.ipv4_e.ip_src 12743859Sml29623 #define ip4_dest_key key.ipv4_e.ip_dest 12753859Sml29623 #define ip4_proto_key key.ipv4_e.proto 12763859Sml29623 #define ip4_port_key key.ipv4_e.l4_port_spi 12773859Sml29623 #define ip4_tos_key key.ipv4_e.tos 12783859Sml29623 #define ip4_noport_key key.ipv4_e.noport 12793859Sml29623 #define ip4_nrdc_key key.ipv4_e.l2rdc_tbl_num 12803859Sml29623 #define ip4_class_key key.ipv4_e.cls_code 12813859Sml29623 12823859Sml29623 #define ip4_src_mask mask.ipv4_e.ip_src 12833859Sml29623 #define ip4_dest_mask mask.ipv4_e.ip_dest 12843859Sml29623 #define ip4_proto_mask mask.ipv4_e.proto 12853859Sml29623 #define ip4_port_mask mask.ipv4_e.l4_port_spi 12863859Sml29623 #define ip4_tos_mask mask.ipv4_e.tos 12873859Sml29623 #define ip4_nrdc_mask mask.ipv4_e.l2rdc_tbl_num 12883859Sml29623 #define ip4_noport_mask mask.ipv4_e.noport 12893859Sml29623 #define ip4_class_mask mask.ipv4_e.cls_code 12903859Sml29623 12913859Sml29623 12923859Sml29623 #define ip6_ip_addr_key key.ipv6_e.ip_addr 12933859Sml29623 #define ip6_port_key key.ipv6_e.l4_port_spi 12943859Sml29623 #define ip6_nxt_hdr_key key.ipv6_e.nxt_hdr 12953859Sml29623 #define ip6_tos_key key.ipv6_e.tos 12963859Sml29623 #define ip6_nrdc_key key.ipv6_e.l2rdc_tbl_num 12973859Sml29623 #define ip6_noport_key key.ipv6_e.noport 12983859Sml29623 #define ip6_class_key key.ipv6_e.cls_code 12993859Sml29623 13003859Sml29623 13013859Sml29623 #define ip6_ip_addr_mask mask.ipv6_e.ip_addr 13023859Sml29623 #define ip6_port_mask mask.ipv6_e.l4_port_spi 13033859Sml29623 #define ip6_nxt_hdr_mask mask.ipv6_e.nxt_hdr 13043859Sml29623 #define ip6_tos_mask mask.ipv6_e.tos 13053859Sml29623 #define ip6_nrdc_mask mask.ipv6_e.l2rdc_tbl_num 13063859Sml29623 #define ip6_noport_mask mask.ipv6_e.noport 13073859Sml29623 #define ip6_class_mask mask.ipv6_e.cls_code 13083859Sml29623 13093859Sml29623 #define ether_class_key key.ether_e.cls_code 13103859Sml29623 #define ether_ethframe_key key.ether_e.ethframe 13113859Sml29623 #define ether_class_mask mask.ether_e.cls_code 13123859Sml29623 #define ether_ethframe_mask mask.ether_e.ethframe 13133859Sml29623 13143859Sml29623 13153859Sml29623 /* 13163859Sml29623 * flow template structure 13173859Sml29623 * The flow header is passed through the hash function 13183859Sml29623 * which generates the H1 (and the H2 ) hash value. 13193859Sml29623 * Hash computation is started at the 22 zeros. 13203859Sml29623 * 13213859Sml29623 * Since this structure uses the ip address fields, 13223859Sml29623 * /usr/include/netinet/in.h has to be included 13233859Sml29623 * before this header file. 13243859Sml29623 * Need to move these includes to impl files ... 13253859Sml29623 */ 13268275SEric Cheng 13273859Sml29623 #include <netinet/in.h> 13283859Sml29623 13293859Sml29623 typedef union flow_template { 13303859Sml29623 13313859Sml29623 struct { 13323859Sml29623 #if defined(_BIG_ENDIAN) 13333859Sml29623 uint32_t l4_0:16; /* src port */ 13343859Sml29623 uint32_t l4_1:16; /* dest Port */ 13353859Sml29623 13363859Sml29623 uint32_t pid:8; 13373859Sml29623 uint32_t port:2; 13383859Sml29623 uint32_t zeros:22; /* 0 */ 13393859Sml29623 13403859Sml29623 union { 13413859Sml29623 struct { 13423859Sml29623 struct in6_addr daddr; 13433859Sml29623 struct in6_addr saddr; 13443859Sml29623 } ip6_addr; 13453859Sml29623 13463859Sml29623 struct { 13473859Sml29623 uint32_t rsrvd1; 13483859Sml29623 struct in_addr daddr; 13493859Sml29623 uint32_t rsrvd2[3]; 13503859Sml29623 struct in_addr saddr; 13513859Sml29623 uint32_t rsrvd5[2]; 13523859Sml29623 } ip4_addr; 13533859Sml29623 } ipaddr; 13543859Sml29623 13553859Sml29623 union { 13563859Sml29623 uint64_t l2_info; 13573859Sml29623 struct { 13583859Sml29623 uint32_t vlan_valid : 4; 13593859Sml29623 uint32_t l2da_1 : 28; 13603859Sml29623 uint32_t l2da_0 : 20; 13613859Sml29623 uint32_t vlanid : 12; 13623859Sml29623 13633859Sml29623 }l2_bits; 13643859Sml29623 }l2; 13653859Sml29623 #else 13663859Sml29623 13673859Sml29623 uint32_t l4_1:16; /* dest Port */ 13683859Sml29623 uint32_t l4_0:16; /* src port */ 13693859Sml29623 13703859Sml29623 uint32_t zeros:22; /* 0 */ 13713859Sml29623 uint32_t port:2; 13723859Sml29623 uint32_t pid:8; 13733859Sml29623 13743859Sml29623 union { 13753859Sml29623 struct { 13763859Sml29623 struct in6_addr daddr; 13773859Sml29623 struct in6_addr saddr; 13783859Sml29623 } ip6_addr; 13793859Sml29623 13803859Sml29623 struct { 13813859Sml29623 uint32_t rsrvd1; 13823859Sml29623 struct in_addr daddr; 13833859Sml29623 uint32_t rsrvd2[3]; 13843859Sml29623 struct in_addr saddr; 13853859Sml29623 uint32_t rsrvd5[2]; 13863859Sml29623 } ip4_addr; 13873859Sml29623 } ipaddr; 13883859Sml29623 13893859Sml29623 union { 13903859Sml29623 uint64_t l2_info; 13913859Sml29623 struct { 13923859Sml29623 13933859Sml29623 uint32_t l2da_1 : 28; 13943859Sml29623 uint32_t vlan_valid : 4; 13953859Sml29623 13963859Sml29623 uint32_t vlanid : 12; 13973859Sml29623 uint32_t l2da_0 : 20; 13983859Sml29623 }l2_bits; 13993859Sml29623 }l2; 14003859Sml29623 #endif 14013859Sml29623 } bits; 14023859Sml29623 14033859Sml29623 } flow_template_t; 14043859Sml29623 14053859Sml29623 14063859Sml29623 14073859Sml29623 #define ip4_saddr bits.ipaddr.ip4_addr.saddr.s_addr 14083859Sml29623 #define ip4_daddr bits.ipaddr.ip4_addr.daddr.s_addr 14093859Sml29623 14103859Sml29623 #define ip_src_port bits.l4_0 14113859Sml29623 #define ip_dst_port bits.l4_1 14123859Sml29623 #define ip_proto bits.pid 14133859Sml29623 14143859Sml29623 #define ip6_saddr bits.ipaddr.ip6_addr.saddr 14153859Sml29623 #define ip6_daddr bits.ipaddr.ip6_addr.daddr 14163859Sml29623 14173859Sml29623 14183859Sml29623 14193859Sml29623 14203859Sml29623 typedef struct _flow_key_cfg_t { 1421*11304SJanie.Lu@Sun.COM uint32_t rsrvd:11; 1422*11304SJanie.Lu@Sun.COM /* The following 3 bit fields added for RF-NIU and Neptune-L */ 1423*11304SJanie.Lu@Sun.COM uint32_t l4_xor_sel:10; 1424*11304SJanie.Lu@Sun.COM uint32_t use_l4_md:1; 1425*11304SJanie.Lu@Sun.COM uint32_t use_sym:1; 14263859Sml29623 uint32_t use_portnum:1; 14273859Sml29623 uint32_t use_l2da:1; 14283859Sml29623 uint32_t use_vlan:1; 14293859Sml29623 uint32_t use_saddr:1; 14303859Sml29623 uint32_t use_daddr:1; 14313859Sml29623 uint32_t use_sport:1; 14323859Sml29623 uint32_t use_dport:1; 14333859Sml29623 uint32_t use_proto:1; 14343859Sml29623 uint32_t ip_opts_exist:1; 14353859Sml29623 } flow_key_cfg_t; 14363859Sml29623 14373859Sml29623 14383859Sml29623 typedef struct _tcam_key_cfg_t { 14393859Sml29623 uint32_t rsrvd:28; 14403859Sml29623 uint32_t use_ip_daddr:1; 14413859Sml29623 uint32_t use_ip_saddr:1; 14423859Sml29623 uint32_t lookup_enable:1; 14433859Sml29623 uint32_t discard:1; 14443859Sml29623 } tcam_key_cfg_t; 14453859Sml29623 14463859Sml29623 14473859Sml29623 14483859Sml29623 /* 14493859Sml29623 * FCRAM Entry Formats 14503859Sml29623 * 14513859Sml29623 * ip6 and ip4 entries, the first 64 bits layouts are identical 14523859Sml29623 * optimistic entry has only 64 bit layout 14533859Sml29623 * The first three bits, fmt, ext and valid are the same 14543859Sml29623 * accoross all the entries 14553859Sml29623 */ 14563859Sml29623 14573859Sml29623 typedef union hash_optim { 14583859Sml29623 uint64_t value; 14593859Sml29623 struct _bits { 14603859Sml29623 #if defined(_BIG_ENDIAN) 14613859Sml29623 uint32_t fmt : 1; /* 63 set to zero */ 14623859Sml29623 uint32_t ext : 1; /* 62 set to zero */ 14633859Sml29623 uint32_t valid : 1; /* 61 */ 14643859Sml29623 uint32_t rdc_offset : 5; /* 60 : 56 */ 14653859Sml29623 uint32_t h2 : 16; /* 55 : 40 */ 14663859Sml29623 uint32_t rsrvd : 8; /* 32 : 32 */ 14673859Sml29623 uint32_t usr_info; /* 31 : 0 */ 14683859Sml29623 #else 14693859Sml29623 uint32_t usr_info; /* 31 : 0 */ 14703859Sml29623 uint32_t rsrvd : 8; /* 39 : 32 */ 14713859Sml29623 uint32_t h2 : 16; /* 55 : 40 */ 14723859Sml29623 uint32_t rdc_offset : 5; /* 60 : 56 */ 14733859Sml29623 uint32_t valid : 1; /* 61 */ 14743859Sml29623 uint32_t ext : 1; /* 62 set to zero */ 14753859Sml29623 uint32_t fmt : 1; /* 63 set to zero */ 14763859Sml29623 #endif 14773859Sml29623 } bits; 14783859Sml29623 } hash_optim_t; 14793859Sml29623 14803859Sml29623 14813859Sml29623 typedef union _hash_hdr { 14823859Sml29623 uint64_t value; 14833859Sml29623 struct _exact_hdr { 14843859Sml29623 #if defined(_BIG_ENDIAN) 14853859Sml29623 uint32_t fmt : 1; /* 63 1 for ipv6, 0 for ipv4 */ 14863859Sml29623 uint32_t ext : 1; /* 62 set to 1 */ 14873859Sml29623 uint32_t valid : 1; /* 61 */ 14883859Sml29623 uint32_t rsrvd : 1; /* 60 */ 14893859Sml29623 uint32_t l2da_1 : 28; /* 59 : 32 */ 14903859Sml29623 uint32_t l2da_0 : 20; /* 31 : 12 */ 14913859Sml29623 uint32_t vlan : 12; /* 12 : 0 */ 14923859Sml29623 #else 14933859Sml29623 uint32_t vlan : 12; /* 12 : 0 */ 14943859Sml29623 uint32_t l2da_0 : 20; /* 31 : 12 */ 14953859Sml29623 uint32_t l2da_1 : 28; /* 59 : 32 */ 14963859Sml29623 uint32_t rsrvd : 1; /* 60 */ 14973859Sml29623 uint32_t valid : 1; /* 61 */ 14983859Sml29623 uint32_t ext : 1; /* 62 set to 1 */ 14993859Sml29623 uint32_t fmt : 1; /* 63 1 for ipv6, 0 for ipv4 */ 15003859Sml29623 #endif 15013859Sml29623 } exact_hdr; 15023859Sml29623 hash_optim_t optim_hdr; 15033859Sml29623 } hash_hdr_t; 15043859Sml29623 15053859Sml29623 15063859Sml29623 15073859Sml29623 typedef union _hash_ports { 15083859Sml29623 uint64_t value; 15093859Sml29623 struct _ports_bits { 15103859Sml29623 #if defined(_BIG_ENDIAN) 15113859Sml29623 uint32_t ip_dport : 16; /* 63 : 48 */ 15123859Sml29623 uint32_t ip_sport : 16; /* 47 : 32 */ 15133859Sml29623 uint32_t proto : 8; /* 31 : 24 */ 15143859Sml29623 uint32_t port : 2; /* 23 : 22 */ 15153859Sml29623 uint32_t rsrvd : 22; /* 21 : 0 */ 15163859Sml29623 #else 15173859Sml29623 uint32_t rsrvd : 22; /* 21 : 0 */ 15183859Sml29623 uint32_t port : 2; /* 23 : 22 */ 15193859Sml29623 uint32_t proto : 8; /* 31 : 24 */ 15203859Sml29623 uint32_t ip_sport : 16; /* 47 : 32 */ 15213859Sml29623 uint32_t ip_dport : 16; /* 63 : 48 */ 15223859Sml29623 #endif 15233859Sml29623 } ports_bits; 15243859Sml29623 } hash_ports_t; 15253859Sml29623 15263859Sml29623 15273859Sml29623 15283859Sml29623 typedef union _hash_match_action { 15293859Sml29623 uint64_t value; 15303859Sml29623 struct _action_bits { 15313859Sml29623 #if defined(_BIG_ENDIAN) 15323859Sml29623 uint32_t rsrvd2 : 3; /* 63 : 61 */ 15333859Sml29623 uint32_t rdc_offset : 5; /* 60 : 56 */ 15343859Sml29623 uint32_t zfvld : 1; /* 55 */ 15353859Sml29623 uint32_t rsrvd : 3; /* 54 : 52 */ 15363859Sml29623 uint32_t zfid : 12; /* 51 : 40 */ 15373859Sml29623 uint32_t _rsrvd : 8; /* 39 : 32 */ 15383859Sml29623 uint32_t usr_info; /* 31 : 0 */ 15393859Sml29623 #else 15403859Sml29623 uint32_t usr_info; /* 31 : 0 */ 15413859Sml29623 uint32_t _rsrvd : 8; /* 39 : 32 */ 15423859Sml29623 uint32_t zfid : 12; /* 51 : 40 */ 15433859Sml29623 uint32_t rsrvd : 3; /* 54 : 52 */ 15443859Sml29623 uint32_t zfvld : 1; /* 55 */ 15453859Sml29623 uint32_t rdc_offset : 5; /* 60 : 56 */ 15463859Sml29623 uint32_t rsrvd2 : 1; /* 63 : 61 */ 15473859Sml29623 #endif 15483859Sml29623 } action_bits; 15493859Sml29623 } hash_match_action_t; 15503859Sml29623 15513859Sml29623 15523859Sml29623 typedef struct _ipaddr6 { 15533859Sml29623 struct in6_addr saddr; 15543859Sml29623 struct in6_addr daddr; 15553859Sml29623 } ip6_addr_t; 15563859Sml29623 15573859Sml29623 15583859Sml29623 typedef struct _ipaddr4 { 15593859Sml29623 #if defined(_BIG_ENDIAN) 15603859Sml29623 struct in_addr saddr; 15613859Sml29623 struct in_addr daddr; 15623859Sml29623 #else 15633859Sml29623 struct in_addr daddr; 15643859Sml29623 struct in_addr saddr; 15653859Sml29623 #endif 15663859Sml29623 } ip4_addr_t; 15673859Sml29623 15683859Sml29623 15693859Sml29623 /* ipv4 has 32 byte layout */ 15703859Sml29623 15713859Sml29623 typedef struct hash_ipv4 { 15723859Sml29623 hash_hdr_t hdr; 15733859Sml29623 ip4_addr_t ip_addr; 15743859Sml29623 hash_ports_t proto_ports; 15753859Sml29623 hash_match_action_t action; 15763859Sml29623 } hash_ipv4_t; 15773859Sml29623 15783859Sml29623 15793859Sml29623 /* ipv4 has 56 byte layout */ 15803859Sml29623 typedef struct hash_ipv6 { 15813859Sml29623 hash_hdr_t hdr; 15823859Sml29623 ip6_addr_t ip_addr; 15833859Sml29623 hash_ports_t proto_ports; 15843859Sml29623 hash_match_action_t action; 15853859Sml29623 } hash_ipv6_t; 15863859Sml29623 15873859Sml29623 15883859Sml29623 15893859Sml29623 typedef union fcram_entry { 15903859Sml29623 uint64_t value[8]; 15913859Sml29623 hash_tbl_data_t dreg[8]; 15923859Sml29623 hash_ipv6_t ipv6_entry; 15933859Sml29623 hash_ipv4_t ipv4_entry; 15943859Sml29623 hash_optim_t optim_entry; 15953859Sml29623 } fcram_entry_t; 15963859Sml29623 15973859Sml29623 15983859Sml29623 15993859Sml29623 #define hash_hdr_fmt ipv4_entry.hdr.exact_hdr.fmt 16003859Sml29623 #define hash_hdr_ext ipv4_entry.hdr.exact_hdr.ext 16013859Sml29623 #define hash_hdr_valid ipv4_entry.hdr.exact_hdr.valid 16023859Sml29623 16033859Sml29623 #define HASH_ENTRY_EXACT(fc) \ 16043859Sml29623 (fc->ipv4_entry.hdr.exact_hdr.ext == 1) 16053859Sml29623 #define HASH_ENTRY_OPTIM(fc) \ 16063859Sml29623 ((fc->ipv4_entry.hdr.exact_hdr.ext == 0) && \ 16073859Sml29623 (fc->ipv6_entry.hdr.exact_hdr.fmt == 0)) 16083859Sml29623 #define HASH_ENTRY_EXACT_IP6(fc) \ 16093859Sml29623 ((fc->ipv6_entry.hdr.exact_hdr.fmt == 1) && \ 16103859Sml29623 (fc->ipv4_entry.hdr.exact_hdr.ext == 1)) 16113859Sml29623 16123859Sml29623 #define HASH_ENTRY_EXACT_IP4(fc) \ 16133859Sml29623 ((fc->ipv6_entry.hdr.exact_hdr.fmt == 0) && \ 16143859Sml29623 (fc->ipv4_entry.hdr.exact_hdr.ext == 1)) 16153859Sml29623 16163859Sml29623 #define HASH_ENTRY_TYPE(fc) \ 16173859Sml29623 (fc->ipv4_entry.hdr.exact_hdr.ext | \ 16183859Sml29623 (fc->ipv4_entry.hdr.exact_hdr.fmt << 1)) 16193859Sml29623 16203859Sml29623 16213859Sml29623 16223859Sml29623 typedef enum fcram_entry_format { 16233859Sml29623 FCRAM_ENTRY_OPTIM = 0x0, 16243859Sml29623 FCRAM_ENTRY_EX_IP4 = 0x2, 16253859Sml29623 FCRAM_ENTRY_EX_IP6 = 0x3, 16263859Sml29623 FCRAM_ENTRY_UNKOWN = 0x1 16273859Sml29623 } fcram_entry_format_t; 16283859Sml29623 16293859Sml29623 16303859Sml29623 #define HASH_ENTRY_TYPE_OPTIM FCRAM_ENTRY_OPTIM 16313859Sml29623 #define HASH_ENTRY_TYPE_OPTIM_IP4 FCRAM_ENTRY_OPTIM 16323859Sml29623 #define HASH_ENTRY_TYPE_OPTIM_IP4 FCRAM_ENTRY_OPTIM 16333859Sml29623 #define HASH_ENTRY_TYPE_EX_IP4 FCRAM_ENTRY_EX_IP4 16343859Sml29623 #define HASH_ENTRY_TYPE_EX_IP6 FCRAM_ENTRY_EX_IP6 16353859Sml29623 16363859Sml29623 16373859Sml29623 16383859Sml29623 16393859Sml29623 /* error xxx formats */ 16403859Sml29623 16413859Sml29623 16423859Sml29623 typedef struct _hash_lookup_err_log { 16433859Sml29623 uint32_t rsrvd:28; 16443859Sml29623 uint32_t lookup_err:1; 16453859Sml29623 uint32_t ecc_err:1; 16463859Sml29623 uint32_t uncor_err:1; 16473859Sml29623 uint32_t multi_lkup:1; 16483859Sml29623 uint32_t multi_bit:1; 16493859Sml29623 uint32_t subarea:3; 16503859Sml29623 uint32_t syndrome:8; 16513859Sml29623 uint32_t h1:20; 16523859Sml29623 } hash_lookup_err_log_t, *p_hash_lookup_err_log_t; 16533859Sml29623 16543859Sml29623 16553859Sml29623 16563859Sml29623 typedef struct _hash_pio_err_log { 16573859Sml29623 uint32_t rsrvd:32; 16583859Sml29623 uint32_t pio_err:1; 16593859Sml29623 uint32_t syndrome:8; 16603859Sml29623 uint32_t addr:23; 16613859Sml29623 } hash_pio_err_log_t, *p_hash_pio_err_log_t; 16623859Sml29623 16633859Sml29623 16643859Sml29623 16653859Sml29623 typedef struct _tcam_err_log { 16663859Sml29623 uint32_t rsrvd:2; 16673859Sml29623 uint32_t tcam_err:1; 16683859Sml29623 uint32_t parity_err:1; 16693859Sml29623 uint32_t ecc_err:1; 16703859Sml29623 uint32_t multi_lkup:1; 16713859Sml29623 uint32_t location:8; 16723859Sml29623 uint32_t syndrome:16; 16733859Sml29623 } tcam_err_log_t, *p_tcam_err_log_t; 16743859Sml29623 16753859Sml29623 16763859Sml29623 typedef struct _vlan_tbl_err_log { 16773859Sml29623 uint32_t rsrvd:32; 16783859Sml29623 uint32_t err:1; 16793859Sml29623 uint32_t multi:1; 16803859Sml29623 uint32_t addr:12; 16813859Sml29623 uint32_t data:18; 16823859Sml29623 } vlan_tbl_err_log_t, *p_vlan_tbl_err_log_t; 16833859Sml29623 16843859Sml29623 16853859Sml29623 #define NEPTUNE_TCAM_SIZE 0x100 16863859Sml29623 #define NIU_TCAM_SIZE 0x80 16873859Sml29623 #define FCRAM_SIZE 0x100000 16883859Sml29623 16893859Sml29623 #ifdef __cplusplus 16903859Sml29623 } 16913859Sml29623 #endif 16923859Sml29623 16933859Sml29623 #endif /* _SYS_NXGE_NXGE_FFLP_HW_H */ 1694