16349Sqs148142 /* 26349Sqs148142 * CDDL HEADER START 36349Sqs148142 * 46349Sqs148142 * The contents of this file are subject to the terms of the 56349Sqs148142 * Common Development and Distribution License (the "License"). 66349Sqs148142 * You may not use this file except in compliance with the License. 76349Sqs148142 * 86349Sqs148142 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 96349Sqs148142 * or http://www.opensolaris.org/os/licensing. 106349Sqs148142 * See the License for the specific language governing permissions 116349Sqs148142 * and limitations under the License. 126349Sqs148142 * 136349Sqs148142 * When distributing Covered Code, include this CDDL HEADER in each 146349Sqs148142 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 156349Sqs148142 * If applicable, add the following below this CDDL HEADER, with the 166349Sqs148142 * fields enclosed by brackets "[]" replaced with your own identifying 176349Sqs148142 * information: Portions Copyright [yyyy] [name of copyright owner] 186349Sqs148142 * 196349Sqs148142 * CDDL HEADER END 206349Sqs148142 */ 21*11257SMichael.Speer@Sun.COM 226349Sqs148142 /* 23*11257SMichael.Speer@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 246349Sqs148142 * Use is subject to license terms. 256349Sqs148142 */ 266349Sqs148142 276349Sqs148142 #ifndef _SYS_HXGE_HXGE_COMMON_H 286349Sqs148142 #define _SYS_HXGE_HXGE_COMMON_H 296349Sqs148142 306349Sqs148142 #include <sys/types.h> 316349Sqs148142 #include <hxge_defs.h> 326349Sqs148142 #include <hxge_pfc.h> 336349Sqs148142 #include <hxge_common_impl.h> 346349Sqs148142 356349Sqs148142 #ifdef __cplusplus 366349Sqs148142 extern "C" { 376349Sqs148142 #endif 386349Sqs148142 396349Sqs148142 #define HXGE_DMA_START B_TRUE 406349Sqs148142 #define HXGE_DMA_STOP B_FALSE 416349Sqs148142 #define HXGE_TIMER_RESO 2 426349Sqs148142 #define HXGE_TIMER_LDG 2 436349Sqs148142 446349Sqs148142 /* 456349Sqs148142 * Receive and Transmit DMA definitions 466349Sqs148142 */ 476349Sqs148142 #ifdef _DMA_USES_VIRTADDR 486349Sqs148142 #define HXGE_DMA_BLOCK 1 496349Sqs148142 #else 506349Sqs148142 #define HXGE_DMA_BLOCK (64 * 64) 516349Sqs148142 #endif 526349Sqs148142 537584SQiyan.Sun@Sun.COM #define HXGE_RBR_RBB_MIN 128 54*11257SMichael.Speer@Sun.COM #define HXGE_RBR_RBB_MAX ((64 * 128) - 1) 55*11257SMichael.Speer@Sun.COM #if defined(__sparc) 56*11257SMichael.Speer@Sun.COM #define HXGE_RBR_RBB_DEFAULT 1536 /* Number of RBR Blocks */ 57*11257SMichael.Speer@Sun.COM #else 587584SQiyan.Sun@Sun.COM #define HXGE_RBR_RBB_DEFAULT 2048 /* Number of RBR Blocks */ 59*11257SMichael.Speer@Sun.COM #endif 606349Sqs148142 #define HXGE_RCR_MIN (HXGE_RBR_RBB_MIN * 2) 617584SQiyan.Sun@Sun.COM #define HXGE_RCR_MAX 65504 /* 2^16 - 32 */ 626349Sqs148142 63*11257SMichael.Speer@Sun.COM /* 64*11257SMichael.Speer@Sun.COM * 4096/256 for x86 and 8192 / 256 for Sparc 65*11257SMichael.Speer@Sun.COM * NOTE: RCR Ring Size should *not* enable bit 19 of the address. 66*11257SMichael.Speer@Sun.COM */ 67*11257SMichael.Speer@Sun.COM #if defined(__sparc) 68*11257SMichael.Speer@Sun.COM #define HXGE_RCR_DEFAULT (HXGE_RBR_RBB_DEFAULT * 32) 69*11257SMichael.Speer@Sun.COM #else 708366SQiyan.Sun@Sun.COM #define HXGE_RCR_DEFAULT (HXGE_RBR_RBB_DEFAULT * 16) 71*11257SMichael.Speer@Sun.COM #endif 726349Sqs148142 737584SQiyan.Sun@Sun.COM #define HXGE_TX_RING_DEFAULT 2048 74*11257SMichael.Speer@Sun.COM #define HXGE_TX_RING_MAX ((64 * 128) - 1) 756349Sqs148142 76*11257SMichael.Speer@Sun.COM #define RBR_BKSIZE_4K 0 77*11257SMichael.Speer@Sun.COM #define RBR_BKSIZE_8K 1 78*11257SMichael.Speer@Sun.COM #define RBR_BKSIZE_4K_BYTES (4 * 1024) 796349Sqs148142 80*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ2_2K 0 81*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ2_4K 1 82*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ2_2K_BYTES (2 * 1024) 83*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ2_4K_BYTES (4 * 1024) 846349Sqs148142 85*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ1_1K 0 86*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ1_2K 1 87*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ1_1K_BYTES 1024 88*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ1_2K_BYTES (2 * 1024) 896349Sqs148142 90*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ0_256B 0 91*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ0_512B 1 92*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ0_1K 2 93*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ0_256_BYTES 256 94*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ0_512_BYTES 512 95*11257SMichael.Speer@Sun.COM #define RBR_BUFSZ0_1K_BYTES 1024 966349Sqs148142 976349Sqs148142 /* 986349Sqs148142 * VLAN table configuration 996349Sqs148142 */ 1006349Sqs148142 typedef struct hxge_mv_cfg { 1016349Sqs148142 uint8_t flag; /* 0:unconfigure 1:configured */ 1026349Sqs148142 } hxge_mv_cfg_t, *p_hxge_mv_cfg_t; 1036349Sqs148142 1046349Sqs148142 typedef struct hxge_param_map { 1056349Sqs148142 #if defined(_BIG_ENDIAN) 1066349Sqs148142 uint32_t rsrvd2:2; /* [30:31] rsrvd */ 1076349Sqs148142 uint32_t remove:1; /* [29] Remove */ 1086349Sqs148142 uint32_t pref:1; /* [28] preference */ 1096349Sqs148142 uint32_t rsrv:4; /* [27:24] preference */ 1106349Sqs148142 uint32_t map_to:8; /* [23:16] map to resource */ 1116349Sqs148142 uint32_t param_id:16; /* [15:0] Param ID */ 1126349Sqs148142 #else 1136349Sqs148142 uint32_t param_id:16; /* [15:0] Param ID */ 1146349Sqs148142 uint32_t map_to:8; /* [23:16] map to resource */ 1156349Sqs148142 uint32_t rsrv:4; /* [27:24] preference */ 1166349Sqs148142 uint32_t pref:1; /* [28] preference */ 1176349Sqs148142 uint32_t remove:1; /* [29] Remove */ 1186349Sqs148142 uint32_t rsrvd2:2; /* [30:31] rsrvd */ 1196349Sqs148142 #endif 1206349Sqs148142 } hxge_param_map_t, *p_hxge_param_map_t; 1216349Sqs148142 1226349Sqs148142 typedef struct hxge_hw_pt_cfg { 1236349Sqs148142 uint32_t start_tdc; /* start TDC (0 - 3) */ 1246349Sqs148142 uint32_t max_tdcs; /* max TDC in sequence */ 1256349Sqs148142 uint32_t start_rdc; /* start RDC (0 - 3) */ 1266349Sqs148142 uint32_t max_rdcs; /* max rdc in sequence */ 1276349Sqs148142 uint32_t rx_full_header; /* select the header flag */ 1286349Sqs148142 uint32_t start_ldg; /* starting logical group # */ 1296349Sqs148142 uint32_t max_ldgs; /* max logical device group */ 1306349Sqs148142 uint32_t max_ldvs; /* max logical devices */ 1316349Sqs148142 } hxge_hw_pt_cfg_t, *p_hxge_hw_pt_cfg_t; 1326349Sqs148142 1336349Sqs148142 /* per port configuration */ 1346349Sqs148142 typedef struct hxge_dma_pt_cfg { 1356349Sqs148142 hxge_hw_pt_cfg_t hw_config; /* hardware configuration */ 1366349Sqs148142 1376349Sqs148142 uint32_t alloc_buf_size; 1386349Sqs148142 uint32_t rbr_size; 1396349Sqs148142 uint32_t rcr_size; 1406349Sqs148142 } hxge_dma_pt_cfg_t, *p_hxge_dma_pt_cfg_t; 1416349Sqs148142 1426349Sqs148142 /* classification configuration */ 1436349Sqs148142 typedef struct hxge_class_pt_cfg { 1446349Sqs148142 /* VLAN table */ 1456349Sqs148142 hxge_mv_cfg_t vlan_tbl[VLAN_ID_MAX + 1]; 1466349Sqs148142 /* class config value */ 1476349Sqs148142 uint32_t init_hash; 1486349Sqs148142 uint32_t class_cfg[TCAM_CLASS_MAX]; 1496349Sqs148142 } hxge_class_pt_cfg_t, *p_hxge_class_pt_cfg_t; 1506349Sqs148142 1516349Sqs148142 typedef struct hxge_hw_list { 1526349Sqs148142 struct hxge_hw_list *next; 1536349Sqs148142 hxge_os_mutex_t hxge_cfg_lock; 1546349Sqs148142 hxge_os_mutex_t hxge_tcam_lock; 1556349Sqs148142 hxge_os_mutex_t hxge_vlan_lock; 1566349Sqs148142 1576349Sqs148142 hxge_dev_info_t *parent_devp; 1586349Sqs148142 struct _hxge_t *hxge_p; 1596349Sqs148142 uint32_t ndevs; 1606349Sqs148142 uint32_t flags; 1616349Sqs148142 uint32_t magic; 1626349Sqs148142 } hxge_hw_list_t, *p_hxge_hw_list_t; 1636349Sqs148142 1646349Sqs148142 #ifdef __cplusplus 1656349Sqs148142 } 1666349Sqs148142 #endif 1676349Sqs148142 1686349Sqs148142 #endif /* _SYS_HXGE_HXGE_COMMON_H */ 169