16f45ec7bSml29623 /* 26f45ec7bSml29623 * CDDL HEADER START 36f45ec7bSml29623 * 46f45ec7bSml29623 * The contents of this file are subject to the terms of the 56f45ec7bSml29623 * Common Development and Distribution License (the "License"). 66f45ec7bSml29623 * You may not use this file except in compliance with the License. 76f45ec7bSml29623 * 86f45ec7bSml29623 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 96f45ec7bSml29623 * or http://www.opensolaris.org/os/licensing. 106f45ec7bSml29623 * See the License for the specific language governing permissions 116f45ec7bSml29623 * and limitations under the License. 126f45ec7bSml29623 * 136f45ec7bSml29623 * When distributing Covered Code, include this CDDL HEADER in each 146f45ec7bSml29623 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 156f45ec7bSml29623 * If applicable, add the following below this CDDL HEADER, with the 166f45ec7bSml29623 * fields enclosed by brackets "[]" replaced with your own identifying 176f45ec7bSml29623 * information: Portions Copyright [yyyy] [name of copyright owner] 186f45ec7bSml29623 * 196f45ec7bSml29623 * CDDL HEADER END 206f45ec7bSml29623 */ 216f45ec7bSml29623 /* 22*4df55fdeSJanie Lu * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 236f45ec7bSml29623 * Use is subject to license terms. 246f45ec7bSml29623 */ 256f45ec7bSml29623 266f45ec7bSml29623 #ifndef _SYS_NXGE_NXGE_COMMON_H 276f45ec7bSml29623 #define _SYS_NXGE_NXGE_COMMON_H 286f45ec7bSml29623 296f45ec7bSml29623 #ifdef __cplusplus 306f45ec7bSml29623 extern "C" { 316f45ec7bSml29623 #endif 326f45ec7bSml29623 336f45ec7bSml29623 #define NXGE_DMA_START B_TRUE 346f45ec7bSml29623 #define NXGE_DMA_STOP B_FALSE 356f45ec7bSml29623 366f45ec7bSml29623 /* 376f45ec7bSml29623 * Default DMA configurations. 386f45ec7bSml29623 */ 396f45ec7bSml29623 #define NXGE_RDMA_PER_NIU_PORT (NXGE_MAX_RDCS/NXGE_PORTS_NIU) 406f45ec7bSml29623 #define NXGE_TDMA_PER_NIU_PORT (NXGE_MAX_TDCS_NIU/NXGE_PORTS_NIU) 416f45ec7bSml29623 #define NXGE_RDMA_PER_NEP_PORT (NXGE_MAX_RDCS/NXGE_PORTS_NEPTUNE) 426f45ec7bSml29623 #define NXGE_TDMA_PER_NEP_PORT (NXGE_MAX_TDCS/NXGE_PORTS_NEPTUNE) 436f45ec7bSml29623 #define NXGE_RDCGRP_PER_NIU_PORT (NXGE_MAX_RDC_GROUPS/NXGE_PORTS_NIU) 446f45ec7bSml29623 #define NXGE_RDCGRP_PER_NEP_PORT (NXGE_MAX_RDC_GROUPS/NXGE_PORTS_NEPTUNE) 456f45ec7bSml29623 466f45ec7bSml29623 #define NXGE_TIMER_RESO 2 476f45ec7bSml29623 486f45ec7bSml29623 #define NXGE_TIMER_LDG 2 496f45ec7bSml29623 506f45ec7bSml29623 /* 516f45ec7bSml29623 * Receive and Transmit DMA definitions 526f45ec7bSml29623 */ 536f45ec7bSml29623 #if defined(sun4v) && defined(NIU_LP_WORKAROUND) 546f45ec7bSml29623 /* 556f45ec7bSml29623 * N2/NIU: Maximum descriptors if we need to call 566f45ec7bSml29623 * Hypervisor to set up the logical pages 576f45ec7bSml29623 * and the driver must use contiguous memory. 586f45ec7bSml29623 */ 596f45ec7bSml29623 #define NXGE_NIU_MAX_ENTRY (1 << 9) /* 512 */ 606f45ec7bSml29623 #define NXGE_NIU_CONTIG_RBR_MAX (NXGE_NIU_MAX_ENTRY) 616f45ec7bSml29623 #define NXGE_NIU_CONTIG_RCR_MAX (NXGE_NIU_MAX_ENTRY) 626f45ec7bSml29623 #define NXGE_NIU_CONTIG_TX_MAX (NXGE_NIU_MAX_ENTRY) 636f45ec7bSml29623 #endif 646f45ec7bSml29623 656f45ec7bSml29623 #ifdef _DMA_USES_VIRTADDR 666f45ec7bSml29623 #ifdef NIU_PA_WORKAROUND 676f45ec7bSml29623 #define NXGE_DMA_BLOCK (16 * 64 * 4) 686f45ec7bSml29623 #else 696f45ec7bSml29623 #define NXGE_DMA_BLOCK 1 706f45ec7bSml29623 #endif 716f45ec7bSml29623 #else 726f45ec7bSml29623 #define NXGE_DMA_BLOCK (64 * 64) 736f45ec7bSml29623 #endif 746f45ec7bSml29623 756f45ec7bSml29623 #define NXGE_RBR_RBB_MIN (128) 766f45ec7bSml29623 #define NXGE_RBR_RBB_MAX (64 * 128 -1) 776f45ec7bSml29623 786f45ec7bSml29623 #if defined(sun4v) && defined(NIU_LP_WORKAROUND) 796f45ec7bSml29623 #define NXGE_RBR_RBB_DEFAULT 512 806f45ec7bSml29623 #define NXGE_RBR_SPARE 0 816f45ec7bSml29623 #else 823e82a89eSmisaki #if defined(__i386) 833e82a89eSmisaki #define NXGE_RBR_RBB_DEFAULT 256 843e82a89eSmisaki #else 856f45ec7bSml29623 #define NXGE_RBR_RBB_DEFAULT (64 * 16) /* x86 hello */ 863e82a89eSmisaki #endif 876f45ec7bSml29623 #define NXGE_RBR_SPARE 0 886f45ec7bSml29623 #endif 896f45ec7bSml29623 906f45ec7bSml29623 916f45ec7bSml29623 #define NXGE_RCR_MIN (NXGE_RBR_RBB_MIN * 2) 926f45ec7bSml29623 936f45ec7bSml29623 #if defined(sun4v) && defined(NIU_LP_WORKAROUND) 9430ac2e7bSml29623 #define NXGE_RCR_MAX (8192) 956f45ec7bSml29623 #define NXGE_RCR_DEFAULT (512) 966f45ec7bSml29623 #define NXGE_TX_RING_DEFAULT (512) 976f45ec7bSml29623 #else 986f45ec7bSml29623 #ifndef NIU_PA_WORKAROUND 996f45ec7bSml29623 #define NXGE_RCR_MAX (65355) /* MAX hardware supported */ 1006f45ec7bSml29623 #if defined(_BIG_ENDIAN) 1016f45ec7bSml29623 #define NXGE_RCR_DEFAULT (NXGE_RBR_RBB_DEFAULT * 8) 1026f45ec7bSml29623 #else 1036f45ec7bSml29623 #ifdef USE_RX_BIG_BUF 1046f45ec7bSml29623 #define NXGE_RCR_DEFAULT (NXGE_RBR_RBB_DEFAULT * 8) 1056f45ec7bSml29623 #else 1066f45ec7bSml29623 #define NXGE_RCR_DEFAULT (NXGE_RBR_RBB_DEFAULT * 4) 1076f45ec7bSml29623 #endif 1086f45ec7bSml29623 #endif 1093e82a89eSmisaki #if defined(__i386) 1103e82a89eSmisaki #define NXGE_TX_RING_DEFAULT (256) 1113e82a89eSmisaki #else 1126f45ec7bSml29623 #define NXGE_TX_RING_DEFAULT (1024) 1133e82a89eSmisaki #endif 1146f45ec7bSml29623 #define NXGE_TX_RING_MAX (64 * 128 - 1) 1156f45ec7bSml29623 #else 1163e82a89eSmisaki #if defined(__i386) 1173e82a89eSmisaki #define NXGE_RCR_DEFAULT (256) 1183e82a89eSmisaki #define NXGE_TX_RING_DEFAULT (256) 1193e82a89eSmisaki #else 1206f45ec7bSml29623 #define NXGE_RCR_DEFAULT (512) 1216f45ec7bSml29623 #define NXGE_TX_RING_DEFAULT (512) 1223e82a89eSmisaki #endif 1236f45ec7bSml29623 #define NXGE_RCR_MAX (1024) 1246f45ec7bSml29623 #define NXGE_TX_RING_MAX (1024) 1256f45ec7bSml29623 #endif 1266f45ec7bSml29623 #endif 1276f45ec7bSml29623 1286f45ec7bSml29623 #define NXGE_TX_RECLAIM 32 1296f45ec7bSml29623 1306f45ec7bSml29623 /* per receive DMA channel configuration data structure */ 1316f45ec7bSml29623 typedef struct nxge_rdc_cfg { 1326f45ec7bSml29623 uint32_t flag; /* 0: not configured, 1: configured */ 1336f45ec7bSml29623 struct nxge_hw_list *nxge_hw_p; 1346f45ec7bSml29623 uint32_t partition_id; 1356f45ec7bSml29623 uint32_t port; /* function number */ 1366f45ec7bSml29623 uint32_t rx_group_id; 1376f45ec7bSml29623 1386f45ec7bSml29623 /* Partitioning, DMC function zero. */ 1396f45ec7bSml29623 uint32_t rx_log_page_vld_page0; /* TRUE or FALSE */ 1406f45ec7bSml29623 uint32_t rx_log_page_vld_page1; /* TRUE or FALSE */ 1416f45ec7bSml29623 uint64_t rx_log_mask1; 1426f45ec7bSml29623 uint64_t rx_log_value1; 1436f45ec7bSml29623 uint64_t rx_log_mask2; 1446f45ec7bSml29623 uint64_t rx_log_value2; 1456f45ec7bSml29623 uint64_t rx_log_page_relo1; 1466f45ec7bSml29623 uint64_t rx_log_page_relo2; 1476f45ec7bSml29623 uint64_t rx_log_page_hdl; 1486f45ec7bSml29623 1496f45ec7bSml29623 /* WRED parameters, DMC function zero */ 1506f45ec7bSml29623 uint32_t red_enable; 1516f45ec7bSml29623 1526f45ec7bSml29623 uint32_t thre_syn; 1536f45ec7bSml29623 uint32_t win_syn; 1546f45ec7bSml29623 uint32_t threshold; 1556f45ec7bSml29623 uint32_t win_non_syn; 1566f45ec7bSml29623 1576f45ec7bSml29623 /* RXDMA configuration, DMC */ 1586f45ec7bSml29623 char *rdc_mbaddr_p; /* mailbox address */ 1596f45ec7bSml29623 uint32_t min_flag; /* TRUE for 18 bytes header */ 1606f45ec7bSml29623 1616f45ec7bSml29623 /* Software Reserved Packet Buffer Offset, DMC */ 1626f45ec7bSml29623 uint32_t sw_offset; 1636f45ec7bSml29623 1646f45ec7bSml29623 /* RBR Configuration A */ 1656f45ec7bSml29623 uint64_t rbr_staddr; /* starting address of RBR */ 1666f45ec7bSml29623 uint32_t rbr_nblks; /* # of RBR entries */ 1676f45ec7bSml29623 uint32_t rbr_len; /* # of RBR entries in 64B lines */ 1686f45ec7bSml29623 1696f45ec7bSml29623 /* RBR Configuration B */ 1706f45ec7bSml29623 uint32_t bksize; /* Block size is fixed. */ 1716f45ec7bSml29623 #define RBR_BKSIZE_4K 0 1726f45ec7bSml29623 #define RBR_BKSIZE_4K_BYTES (4 * 1024) 1736f45ec7bSml29623 #define RBR_BKSIZE_8K 1 1746f45ec7bSml29623 #define RBR_BKSIZE_8K_BYTES (8 * 1024) 1756f45ec7bSml29623 #define RBR_BKSIZE_16K 2 1766f45ec7bSml29623 #define RBR_BKSIZE_16K_BYTES (16 * 1024) 1776f45ec7bSml29623 #define RBR_BKSIZE_32K 3 1786f45ec7bSml29623 #define RBR_BKSIZE_32K_BYTES (32 * 1024) 1796f45ec7bSml29623 1806f45ec7bSml29623 uint32_t bufsz2; 1816f45ec7bSml29623 #define RBR_BUFSZ2_2K 0 1826f45ec7bSml29623 #define RBR_BUFSZ2_2K_BYTES (2 * 1024) 1836f45ec7bSml29623 #define RBR_BUFSZ2_4K 1 1846f45ec7bSml29623 #define RBR_BUFSZ2_4K_BYTES (4 * 1024) 1856f45ec7bSml29623 #define RBR_BUFSZ2_8K 2 1866f45ec7bSml29623 #define RBR_BUFSZ2_8K_BYTES (8 * 1024) 1876f45ec7bSml29623 #define RBR_BUFSZ2_16K 3 1886f45ec7bSml29623 #define RBR_BUFSZ2_16K_BYTES (16 * 1024) 1896f45ec7bSml29623 1906f45ec7bSml29623 uint32_t bufsz1; 1916f45ec7bSml29623 #define RBR_BUFSZ1_1K 0 1926f45ec7bSml29623 #define RBR_BUFSZ1_1K_BYTES 1024 1936f45ec7bSml29623 #define RBR_BUFSZ1_2K 1 1946f45ec7bSml29623 #define RBR_BUFSZ1_2K_BYTES (2 * 1024) 1956f45ec7bSml29623 #define RBR_BUFSZ1_4K 2 1966f45ec7bSml29623 #define RBR_BUFSZ1_4K_BYTES (4 * 1024) 1976f45ec7bSml29623 #define RBR_BUFSZ1_8K 3 1986f45ec7bSml29623 #define RBR_BUFSZ1_8K_BYTES (8 * 1024) 1996f45ec7bSml29623 2006f45ec7bSml29623 uint32_t bufsz0; 2016f45ec7bSml29623 #define RBR_BUFSZ0_256B 0 2026f45ec7bSml29623 #define RBR_BUFSZ0_256_BYTES 256 2036f45ec7bSml29623 #define RBR_BUFSZ0_512B 1 2046f45ec7bSml29623 #define RBR_BUFSZ0_512B_BYTES 512 2056f45ec7bSml29623 #define RBR_BUFSZ0_1K 2 2066f45ec7bSml29623 #define RBR_BUFSZ0_1K_BYTES (1024) 2076f45ec7bSml29623 #define RBR_BUFSZ0_2K 3 2086f45ec7bSml29623 #define RBR_BUFSZ0_2K_BYTES (2 * 1024) 2096f45ec7bSml29623 2106f45ec7bSml29623 /* Receive buffers added by the software */ 2116f45ec7bSml29623 uint32_t bkadd; /* maximum size is 1 million */ 2126f45ec7bSml29623 2136f45ec7bSml29623 /* Receive Completion Ring Configuration A */ 2146f45ec7bSml29623 uint32_t rcr_len; /* # of 64B blocks, each RCR is 8B */ 2156f45ec7bSml29623 uint64_t rcr_staddr; 2166f45ec7bSml29623 2176f45ec7bSml29623 /* Receive Completion Ring Configuration B */ 2186f45ec7bSml29623 uint32_t pthres; /* packet threshold */ 2196f45ec7bSml29623 uint32_t entout; /* enable timeout */ 2206f45ec7bSml29623 uint32_t timeout; /* timeout value */ 2216f45ec7bSml29623 2226f45ec7bSml29623 /* Logical Device Group Number */ 2236f45ec7bSml29623 uint16_t rx_ldg; 2246f45ec7bSml29623 uint16_t rx_ld_state_flags; 2256f45ec7bSml29623 2266f45ec7bSml29623 /* Receive DMA Channel Event Mask */ 2276f45ec7bSml29623 uint64_t rx_dma_ent_mask; 2286f45ec7bSml29623 2296f45ec7bSml29623 /* 32 bit (set to 1) or 64 bit (set to 0) addressing mode */ 2306f45ec7bSml29623 uint32_t rx_addr_md; 2316f45ec7bSml29623 } nxge_rdc_cfg_t, *p_nxge_rdc_cfg_t; 2326f45ec7bSml29623 2336f45ec7bSml29623 /* 2346f45ec7bSml29623 * Per Transmit DMA Channel Configuration Data Structure (32 TDC) 2356f45ec7bSml29623 */ 2366f45ec7bSml29623 typedef struct nxge_tdc_cfg { 2376f45ec7bSml29623 uint32_t flag; /* 0: not configured 1: configured */ 2386f45ec7bSml29623 struct nxge_hw_list *nxge_hw_p; 2396f45ec7bSml29623 uint32_t port; /* function number */ 2406f45ec7bSml29623 /* partitioning, DMC function zero (All 0s for non-partitioning) */ 2416f45ec7bSml29623 uint32_t tx_log_page_vld_page0; /* TRUE or FALSE */ 2426f45ec7bSml29623 uint32_t tx_log_page_vld_page1; /* TRUE or FALSE */ 2436f45ec7bSml29623 uint64_t tx_log_mask1; 2446f45ec7bSml29623 uint64_t tx_log_value1; 2456f45ec7bSml29623 uint64_t tx_log_mask2; 2466f45ec7bSml29623 uint64_t tx_log_value2; 2476f45ec7bSml29623 uint64_t tx_log_page_relo1; 2486f45ec7bSml29623 uint64_t tx_log_page_relo2; 2496f45ec7bSml29623 uint64_t tx_log_page_hdl; 2506f45ec7bSml29623 2516f45ec7bSml29623 /* Transmit Ring Configuration */ 2526f45ec7bSml29623 uint64_t tx_staddr; 2536f45ec7bSml29623 uint64_t tx_rng_len; /* in 64 B Blocks */ 2546f45ec7bSml29623 #define TX_MAX_BUF_SIZE 4096 2556f45ec7bSml29623 2566f45ec7bSml29623 /* TXDMA configuration, DMC */ 2576f45ec7bSml29623 char *tdc_mbaddr_p; /* mailbox address */ 2586f45ec7bSml29623 2596f45ec7bSml29623 /* Logical Device Group Number */ 2606f45ec7bSml29623 uint16_t tx_ldg; 2616f45ec7bSml29623 uint16_t tx_ld_state_flags; 2626f45ec7bSml29623 2636f45ec7bSml29623 /* TXDMA event flags */ 2646f45ec7bSml29623 uint64_t tx_event_mask; 2656f45ec7bSml29623 2666f45ec7bSml29623 /* Transmit threshold before reclamation */ 2676f45ec7bSml29623 uint32_t tx_rng_threshold; 2686f45ec7bSml29623 #define TX_RING_THRESHOLD (TX_DEFAULT_MAX_GPS/4) 2696f45ec7bSml29623 #define TX_RING_JUMBO_THRESHOLD (TX_DEFAULT_JUMBO_MAX_GPS/4) 2706f45ec7bSml29623 2716f45ec7bSml29623 /* For reclaim: a wrap-around counter (packets transmitted) */ 2726f45ec7bSml29623 uint32_t tx_pkt_cnt; 2736f45ec7bSml29623 /* last packet with the mark bit set */ 2746f45ec7bSml29623 uint32_t tx_lastmark; 2756f45ec7bSml29623 } nxge_tdc_cfg_t, *p_nxge_tdc_cfg_t; 2766f45ec7bSml29623 2776f45ec7bSml29623 #define RDC_TABLE_ENTRY_METHOD_SEQ 0 2786f45ec7bSml29623 #define RDC_TABLE_ENTRY_METHOD_REP 1 2796f45ec7bSml29623 280da14cebeSEric Cheng /* per transmit DMA channel table group data structure */ 281da14cebeSEric Cheng typedef struct nxge_tdc_grp { 282da14cebeSEric Cheng uint32_t start_tdc; /* assume assigned in sequence */ 283da14cebeSEric Cheng uint8_t max_tdcs; 284da14cebeSEric Cheng dc_map_t map; 285da14cebeSEric Cheng uint8_t grp_index; /* nxge_t.tx_set.group[grp_index] */ 286da14cebeSEric Cheng } nxge_tdc_grp_t, *p_nxge_tdc_grp_t; 287da14cebeSEric Cheng 2886f45ec7bSml29623 /* per receive DMA channel table group data structure */ 2896f45ec7bSml29623 typedef struct nxge_rdc_grp { 290da14cebeSEric Cheng boolean_t flag; /* 0: not configured 1: configured */ 2916f45ec7bSml29623 uint8_t port; 292da14cebeSEric Cheng uint32_t start_rdc; /* assume assigned in sequence */ 2936f45ec7bSml29623 uint8_t max_rdcs; 2946f45ec7bSml29623 uint8_t def_rdc; 295678453a8Sspeer dc_map_t map; 2966f45ec7bSml29623 uint16_t config_method; 297da14cebeSEric Cheng uint8_t grp_index; /* nxge_t.rx_set.group[grp_index] */ 2986f45ec7bSml29623 } nxge_rdc_grp_t, *p_nxge_rdc_grp_t; 2996f45ec7bSml29623 300678453a8Sspeer #define RDC_MAP_IN(map, rdc) \ 301678453a8Sspeer (map |= (1 << rdc)) 302678453a8Sspeer 303678453a8Sspeer #define RDC_MAP_OUT(map, rdc) \ 304678453a8Sspeer (map &= (~(1 << rdc))) 305678453a8Sspeer 3066f45ec7bSml29623 /* Common RDC and TDC configuration of DMC */ 3076f45ec7bSml29623 typedef struct _nxge_dma_common_cfg_t { 3086f45ec7bSml29623 uint16_t rdc_red_ran_init; /* RED initial seed value */ 3096f45ec7bSml29623 3106f45ec7bSml29623 /* Transmit Ring */ 3116f45ec7bSml29623 } nxge_dma_common_cfg_t, *p_nxge_dma_common_cfg_t; 3126f45ec7bSml29623 3136f45ec7bSml29623 /* 3146f45ec7bSml29623 * VLAN and MAC table configurations: 3156f45ec7bSml29623 * Each VLAN ID should belong to at most one RDC group. 3166f45ec7bSml29623 * Each port could own multiple RDC groups. 3176f45ec7bSml29623 * Each MAC should belong to one RDC group. 3186f45ec7bSml29623 */ 3196f45ec7bSml29623 typedef struct nxge_mv_cfg { 3206f45ec7bSml29623 uint8_t flag; /* 0:unconfigure 1:configured */ 3216f45ec7bSml29623 uint8_t rdctbl; /* RDC channel table group */ 3226f45ec7bSml29623 uint8_t mpr_npr; /* MAC and VLAN preference */ 3236f45ec7bSml29623 } nxge_mv_cfg_t, *p_nxge_mv_cfg_t; 3246f45ec7bSml29623 3256f45ec7bSml29623 typedef struct nxge_param_map { 3266f45ec7bSml29623 #if defined(_BIG_ENDIAN) 3276f45ec7bSml29623 uint32_t rsrvd2:2; /* [30:31] rsrvd */ 3286f45ec7bSml29623 uint32_t remove:1; /* [29] Remove */ 3296f45ec7bSml29623 uint32_t pref:1; /* [28] preference */ 3306f45ec7bSml29623 uint32_t rsrv:4; /* [27:24] preference */ 3316f45ec7bSml29623 uint32_t map_to:8; /* [23:16] map to resource */ 3326f45ec7bSml29623 uint32_t param_id:16; /* [15:0] Param ID */ 3336f45ec7bSml29623 #else 3346f45ec7bSml29623 uint32_t param_id:16; /* [15:0] Param ID */ 3356f45ec7bSml29623 uint32_t map_to:8; /* [23:16] map to resource */ 3366f45ec7bSml29623 uint32_t rsrv:4; /* [27:24] preference */ 3376f45ec7bSml29623 uint32_t pref:1; /* [28] preference */ 3386f45ec7bSml29623 uint32_t remove:1; /* [29] Remove */ 3396f45ec7bSml29623 uint32_t rsrvd2:2; /* [30:31] rsrvd */ 3406f45ec7bSml29623 #endif 3416f45ec7bSml29623 } nxge_param_map_t, *p_nxge_param_map_t; 3426f45ec7bSml29623 3436f45ec7bSml29623 typedef struct nxge_rcr_param { 3446f45ec7bSml29623 #if defined(_BIG_ENDIAN) 3456f45ec7bSml29623 uint32_t rsrvd2:2; /* [30:31] rsrvd */ 3466f45ec7bSml29623 uint32_t remove:1; /* [29] Remove */ 3476f45ec7bSml29623 uint32_t rsrv:5; /* [28:24] preference */ 3486f45ec7bSml29623 uint32_t rdc:8; /* [23:16] rdc # */ 3496f45ec7bSml29623 uint32_t cfg_val:16; /* [15:0] interrupt parameter */ 3506f45ec7bSml29623 #else 3516f45ec7bSml29623 uint32_t cfg_val:16; /* [15:0] interrupt parameter */ 3526f45ec7bSml29623 uint32_t rdc:8; /* [23:16] rdc # */ 3536f45ec7bSml29623 uint32_t rsrv:5; /* [28:24] preference */ 3546f45ec7bSml29623 uint32_t remove:1; /* [29] Remove */ 3556f45ec7bSml29623 uint32_t rsrvd2:2; /* [30:31] rsrvd */ 3566f45ec7bSml29623 #endif 3576f45ec7bSml29623 } nxge_rcr_param_t, *p_nxge_rcr_param_t; 3586f45ec7bSml29623 359678453a8Sspeer /* 360678453a8Sspeer * These are the properties of the TxDMA channels for this 361678453a8Sspeer * port (instance). 362678453a8Sspeer * <start> is the index of the first TDC that is being managed 363678453a8Sspeer * by this port. 364678453a8Sspeer * <count> is the number of TDCs being managed by this port. 365678453a8Sspeer * <owned> is the number of TDCs currently being utilized by this port. 366678453a8Sspeer * 367678453a8Sspeer * <owned> may be less than <count> in hybrid I/O systems. 368678453a8Sspeer */ 369678453a8Sspeer typedef struct { 370678453a8Sspeer int start; /* start TDC (0 - 31) */ 371678453a8Sspeer int count; /* 8 - 32 */ 372678453a8Sspeer int owned; /* 1 - count */ 373678453a8Sspeer } tdc_cfg_t; 374678453a8Sspeer 3756f45ec7bSml29623 /* Needs to have entries in the ndd table */ 3766f45ec7bSml29623 /* 3776f45ec7bSml29623 * Hardware properties created by fcode. 3786f45ec7bSml29623 * In order for those properties visible to the user 3796f45ec7bSml29623 * command ndd, we need to add the following properties 3806f45ec7bSml29623 * to the ndd defined parameter array and data structures. 3816f45ec7bSml29623 * 3826f45ec7bSml29623 * Use default static configuration for x86. 3836f45ec7bSml29623 */ 3846f45ec7bSml29623 typedef struct nxge_hw_pt_cfg { 3856f45ec7bSml29623 uint32_t function_number; /* function number */ 386678453a8Sspeer tdc_cfg_t tdc; 3876f45ec7bSml29623 uint32_t start_rdc; /* start RDC (0 - 31) */ 3886f45ec7bSml29623 uint32_t max_rdcs; /* max rdc in sequence */ 3896f45ec7bSml29623 uint32_t ninterrupts; /* obp interrupts(mac/mif/syserr) */ 3906f45ec7bSml29623 uint32_t mac_ldvid; 3916f45ec7bSml29623 uint32_t mif_ldvid; 3926f45ec7bSml29623 uint32_t ser_ldvid; 3936f45ec7bSml29623 uint32_t def_rdc; /* default RDC */ 3946f45ec7bSml29623 uint32_t drr_wt; /* port DRR weight */ 3956f45ec7bSml29623 uint32_t max_grpids; /* max group ID */ 396678453a8Sspeer uint32_t grpids[NXGE_MAX_RDCS]; /* RDC group IDs */ 3976f45ec7bSml29623 uint32_t max_rdc_grpids; /* max RDC group ID */ 3986f45ec7bSml29623 uint32_t start_ldg; /* starting logical group # */ 3996f45ec7bSml29623 uint32_t max_ldgs; /* max logical device group */ 4006f45ec7bSml29623 uint32_t max_ldvs; /* max logical devices */ 4016f45ec7bSml29623 uint32_t start_mac_entry; /* where to put the first mac */ 4026f45ec7bSml29623 uint32_t max_macs; /* the max mac entry allowed */ 4036f45ec7bSml29623 uint32_t mac_pref; /* preference over VLAN */ 404da14cebeSEric Cheng uint32_t def_mac_txdma_grpid; /* default TDC group ID */ 4056f45ec7bSml29623 uint32_t def_mac_rxdma_grpid; /* default RDC group ID */ 4066f45ec7bSml29623 uint32_t vlan_pref; /* preference over MAC */ 4076f45ec7bSml29623 4086f45ec7bSml29623 /* Expand if we have more hardware or default configurations */ 4096f45ec7bSml29623 uint16_t ldg[NXGE_INT_MAX_LDG]; 4106f45ec7bSml29623 uint16_t ldg_chn_start; 4116f45ec7bSml29623 } nxge_hw_pt_cfg_t, *p_nxge_hw_pt_cfg_t; 4126f45ec7bSml29623 4136f45ec7bSml29623 4146f45ec7bSml29623 /* per port configuration */ 4156f45ec7bSml29623 typedef struct nxge_dma_pt_cfg { 4166f45ec7bSml29623 uint8_t mac_port; /* MAC port (function) */ 4176f45ec7bSml29623 nxge_hw_pt_cfg_t hw_config; /* hardware configuration */ 4186f45ec7bSml29623 4196f45ec7bSml29623 uint32_t alloc_buf_size; 4206f45ec7bSml29623 uint32_t rbr_size; 4216f45ec7bSml29623 uint32_t rcr_size; 4226f45ec7bSml29623 4236f45ec7bSml29623 /* 4246f45ec7bSml29623 * Configuration for hardware initialization based on the 4256f45ec7bSml29623 * hardware properties or the default properties. 4266f45ec7bSml29623 */ 4276f45ec7bSml29623 uint32_t tx_dma_map; /* Transmit DMA channel bit map */ 4286f45ec7bSml29623 429da14cebeSEric Cheng /* Transmit DMA channel: device wise */ 430da14cebeSEric Cheng nxge_tdc_grp_t tdc_grps[NXGE_MAX_TDC_GROUPS]; 431da14cebeSEric Cheng 4326f45ec7bSml29623 /* Receive DMA channel */ 4336f45ec7bSml29623 nxge_rdc_grp_t rdc_grps[NXGE_MAX_RDC_GROUPS]; 4346f45ec7bSml29623 4356f45ec7bSml29623 uint16_t rcr_timeout[NXGE_MAX_RDCS]; 4366f45ec7bSml29623 uint16_t rcr_threshold[NXGE_MAX_RDCS]; 4376f45ec7bSml29623 uint8_t rcr_full_header; 4386f45ec7bSml29623 uint16_t rx_drr_weight; 4396f45ec7bSml29623 4406f45ec7bSml29623 /* Add more stuff later */ 4416f45ec7bSml29623 } nxge_dma_pt_cfg_t, *p_nxge_dma_pt_cfg_t; 4426f45ec7bSml29623 4436f45ec7bSml29623 /* classification configuration */ 4446f45ec7bSml29623 typedef struct nxge_class_pt_cfg { 4456f45ec7bSml29623 4466f45ec7bSml29623 /* MAC table */ 4476f45ec7bSml29623 nxge_mv_cfg_t mac_host_info[NXGE_MAX_MACS]; 4486f45ec7bSml29623 4496f45ec7bSml29623 /* VLAN table */ 4506f45ec7bSml29623 nxge_mv_cfg_t vlan_tbl[NXGE_MAX_VLANS]; 4516f45ec7bSml29623 /* class config value */ 4526f45ec7bSml29623 uint32_t init_h1; 4536f45ec7bSml29623 uint16_t init_h2; 4546f45ec7bSml29623 uint8_t mcast_rdcgrp; 4556f45ec7bSml29623 uint8_t mac_rdcgrp; 4566f45ec7bSml29623 uint32_t class_cfg[TCAM_CLASS_MAX]; 4576f45ec7bSml29623 } nxge_class_pt_cfg_t, *p_nxge_class_pt_cfg_t; 4586f45ec7bSml29623 4596f45ec7bSml29623 /* per Neptune sharable resources among ports */ 4606f45ec7bSml29623 typedef struct nxge_common { 4616f45ec7bSml29623 uint32_t partition_id; 4626f45ec7bSml29623 boolean_t mode32; 4636f45ec7bSml29623 /* DMA Channels: RDC and TDC */ 4646f45ec7bSml29623 nxge_rdc_cfg_t rdc_config[NXGE_MAX_RDCS]; 4656f45ec7bSml29623 nxge_tdc_cfg_t tdc_config[NXGE_MAX_TDCS]; 4666f45ec7bSml29623 nxge_dma_common_cfg_t dma_common_config; 4676f45ec7bSml29623 4686f45ec7bSml29623 uint32_t timer_res; 4696f45ec7bSml29623 boolean_t ld_sys_error_set; 4706f45ec7bSml29623 uint8_t sys_error_owner; 4716f45ec7bSml29623 4726f45ec7bSml29623 /* Layer 2/3/4 */ 4736f45ec7bSml29623 uint16_t class2_etype; 4746f45ec7bSml29623 uint16_t class3_etype; 4756f45ec7bSml29623 4766f45ec7bSml29623 /* FCRAM (hashing) */ 4776f45ec7bSml29623 uint32_t hash1_initval; 4786f45ec7bSml29623 uint32_t hash2_initval; 4796f45ec7bSml29623 } nxge_common_t, *p_nxge_common_t; 4806f45ec7bSml29623 4816f45ec7bSml29623 /* 4826f45ec7bSml29623 * Partition (logical domain) configuration per Neptune/NIU. 4836f45ec7bSml29623 */ 4846f45ec7bSml29623 typedef struct nxge_part_cfg { 4856f45ec7bSml29623 uint32_t rdc_grpbits; /* RDC group bit masks */ 4866f45ec7bSml29623 uint32_t tdc_bitmap; /* bounded TDC */ 4876f45ec7bSml29623 nxge_dma_pt_cfg_t pt_config[NXGE_MAX_PORTS]; 4886f45ec7bSml29623 4896f45ec7bSml29623 /* Flow Classification Partition (flow partition select register) */ 4906f45ec7bSml29623 uint8_t hash_lookup; /* external lookup is available */ 4916f45ec7bSml29623 uint8_t base_mask; /* select bits in base_h1 to replace */ 4926f45ec7bSml29623 /* bits [19:15} in Hash 1. */ 4936f45ec7bSml29623 uint8_t base_h1; /* value to replace Hash 1 [19:15]. */ 4946f45ec7bSml29623 4956f45ec7bSml29623 /* Add more here */ 4966f45ec7bSml29623 uint32_t attributes; /* permission and attribute bits */ 4976f45ec7bSml29623 #define FZC_SERVICE_ENTITY 0x01 4986f45ec7bSml29623 #define FZC_READ_WRITE 0x02 4996f45ec7bSml29623 #define FZC_READ_ONLY 0x04 5006f45ec7bSml29623 } nxge_part_cfg_t, *p_nxge_part_cfg_t; 5016f45ec7bSml29623 502*4df55fdeSJanie Lu typedef struct nxge_usr_l3_cls { 503*4df55fdeSJanie Lu uint64_t cls; 504*4df55fdeSJanie Lu uint16_t tcam_ref_cnt; 505*4df55fdeSJanie Lu uint8_t pid; 506*4df55fdeSJanie Lu uint8_t flow_pkt_type; 507*4df55fdeSJanie Lu uint8_t valid; 508*4df55fdeSJanie Lu } nxge_usr_l3_cls_t, *p_nxge_usr_l3_cls_t; 509*4df55fdeSJanie Lu 5106f45ec7bSml29623 typedef struct nxge_hw_list { 5116f45ec7bSml29623 struct nxge_hw_list *next; 5126f45ec7bSml29623 nxge_os_mutex_t nxge_cfg_lock; 5136f45ec7bSml29623 nxge_os_mutex_t nxge_tcam_lock; 5146f45ec7bSml29623 nxge_os_mutex_t nxge_vlan_lock; 5156f45ec7bSml29623 nxge_os_mutex_t nxge_mdio_lock; 5166f45ec7bSml29623 5176f45ec7bSml29623 nxge_dev_info_t *parent_devp; 5187308e162SMichael Speer #if defined(sun4v) 5197308e162SMichael Speer /* 5207308e162SMichael Speer * With Hybrid I/O, a VR (virtualization region) is the moral 5217308e162SMichael Speer * equivalent of a device function as seen in the service domain. 5227308e162SMichael Speer * And, a guest domain can map up to 8 VRs for a single NIU for both 5237308e162SMichael Speer * of the physical ports. Hence, need space for up to the maximum 5247308e162SMichael Speer * number of VRs (functions) for the guest domain driver. 5257308e162SMichael Speer * 5267308e162SMichael Speer * For non-sun4v platforms, NXGE_MAX_PORTS provides the correct 5277308e162SMichael Speer * number of functions for the device. For sun4v platforms, 5287308e162SMichael Speer * NXGE_MAX_FUNCTIONS will be defined by the number of 5297308e162SMichael Speer * VRs that the guest domain can map. 5307308e162SMichael Speer * 5317308e162SMichael Speer * NOTE: This solution only works for one NIU and will need to 5327308e162SMichael Speer * revisit this for KT-NIU. 5337308e162SMichael Speer */ 5347308e162SMichael Speer #define NXGE_MAX_GUEST_FUNCTIONS 8 5357308e162SMichael Speer #define NXGE_MAX_FUNCTIONS NXGE_MAX_GUEST_FUNCTIONS 5367308e162SMichael Speer #else 5377308e162SMichael Speer #define NXGE_MAX_FUNCTIONS NXGE_MAX_PORTS 5387308e162SMichael Speer #endif 5397308e162SMichael Speer struct _nxge_t *nxge_p[NXGE_MAX_FUNCTIONS]; 5406f45ec7bSml29623 uint32_t ndevs; 5416f45ec7bSml29623 uint32_t flags; 5426f45ec7bSml29623 uint32_t magic; 54359ac0c16Sdavemq uint32_t niu_type; 54459ac0c16Sdavemq uint32_t platform_type; 5452d17280bSsbehera uint8_t xcvr_addr[NXGE_MAX_PORTS]; 546678453a8Sspeer uintptr_t hio; 547*4df55fdeSJanie Lu void *tcam; 548*4df55fdeSJanie Lu uint32_t tcam_size; 549*4df55fdeSJanie Lu uint64_t tcam_l2_prog_cls[NXGE_L2_PROG_CLS]; 550*4df55fdeSJanie Lu nxge_usr_l3_cls_t tcam_l3_prog_cls[NXGE_L3_PROG_CLS]; 5516f45ec7bSml29623 } nxge_hw_list_t, *p_nxge_hw_list_t; 5526f45ec7bSml29623 5536f45ec7bSml29623 #ifdef __cplusplus 5546f45ec7bSml29623 } 5556f45ec7bSml29623 #endif 5566f45ec7bSml29623 5576f45ec7bSml29623 #endif /* _SYS_NXGE_NXGE_COMMON_H */ 558