1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SYS_HXGE_HXGE_COMMON_H 27 #define _SYS_HXGE_HXGE_COMMON_H 28 29 #include <sys/types.h> 30 #include <hxge_defs.h> 31 #include <hxge_pfc.h> 32 #include <hxge_common_impl.h> 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 #define HXGE_DMA_START B_TRUE 39 #define HXGE_DMA_STOP B_FALSE 40 #define HXGE_TIMER_RESO 2 41 #define HXGE_TIMER_LDG 2 42 43 /* 44 * Receive and Transmit DMA definitions 45 */ 46 #ifdef _DMA_USES_VIRTADDR 47 #define HXGE_DMA_BLOCK 1 48 #else 49 #define HXGE_DMA_BLOCK (64 * 64) 50 #endif 51 52 #define HXGE_RBR_RBB_MIN 128 53 #define HXGE_RBR_RBB_MAX (64 * 128 -1) 54 #define HXGE_RBR_RBB_DEFAULT 2048 /* Number of RBR Blocks */ 55 #define HXGE_RCR_MIN (HXGE_RBR_RBB_MIN * 2) 56 #define HXGE_RCR_MAX 65504 /* 2^16 - 32 */ 57 58 #if defined(_BIG_ENDIAN) 59 #define HXGE_RCR_DEFAULT (HXGE_RBR_RBB_DEFAULT * 8) 60 #else /* _BIG_ENDIAN */ 61 #ifdef USE_RX_BIG_BUF 62 #define HXGE_RCR_DEFAULT (HXGE_RBR_RBB_DEFAULT * 8) 63 #else 64 #define HXGE_RCR_DEFAULT (HXGE_RBR_RBB_DEFAULT * 4) 65 #endif 66 #endif /* _BIG_ENDIAN */ 67 68 #define HXGE_TX_RING_DEFAULT 2048 69 #define HXGE_TX_RING_MAX (64 * 128 - 1) 70 71 #define RBR_BKSIZE_4K 0 72 #define RBR_BKSIZE_8K 1 73 #define RBR_BKSIZE_4K_BYTES (4 * 1024) 74 75 #define RBR_BUFSZ2_2K 0 76 #define RBR_BUFSZ2_4K 1 77 #define RBR_BUFSZ2_2K_BYTES (2 * 1024) 78 #define RBR_BUFSZ2_4K_BYTES (4 * 1024) 79 80 #define RBR_BUFSZ1_1K 0 81 #define RBR_BUFSZ1_2K 1 82 #define RBR_BUFSZ1_1K_BYTES 1024 83 #define RBR_BUFSZ1_2K_BYTES (2 * 1024) 84 85 #define RBR_BUFSZ0_256B 0 86 #define RBR_BUFSZ0_512B 1 87 #define RBR_BUFSZ0_1K 2 88 #define RBR_BUFSZ0_256_BYTES 256 89 #define RBR_BUFSZ0_512B_BYTES 512 90 #define RBR_BUFSZ0_1K_BYTES 1024 91 92 /* 93 * VLAN table configuration 94 */ 95 typedef struct hxge_mv_cfg { 96 uint8_t flag; /* 0:unconfigure 1:configured */ 97 } hxge_mv_cfg_t, *p_hxge_mv_cfg_t; 98 99 typedef struct hxge_param_map { 100 #if defined(_BIG_ENDIAN) 101 uint32_t rsrvd2:2; /* [30:31] rsrvd */ 102 uint32_t remove:1; /* [29] Remove */ 103 uint32_t pref:1; /* [28] preference */ 104 uint32_t rsrv:4; /* [27:24] preference */ 105 uint32_t map_to:8; /* [23:16] map to resource */ 106 uint32_t param_id:16; /* [15:0] Param ID */ 107 #else 108 uint32_t param_id:16; /* [15:0] Param ID */ 109 uint32_t map_to:8; /* [23:16] map to resource */ 110 uint32_t rsrv:4; /* [27:24] preference */ 111 uint32_t pref:1; /* [28] preference */ 112 uint32_t remove:1; /* [29] Remove */ 113 uint32_t rsrvd2:2; /* [30:31] rsrvd */ 114 #endif 115 } hxge_param_map_t, *p_hxge_param_map_t; 116 117 typedef struct hxge_hw_pt_cfg { 118 uint32_t start_tdc; /* start TDC (0 - 3) */ 119 uint32_t max_tdcs; /* max TDC in sequence */ 120 uint32_t start_rdc; /* start RDC (0 - 3) */ 121 uint32_t max_rdcs; /* max rdc in sequence */ 122 uint32_t rx_full_header; /* select the header flag */ 123 uint32_t start_ldg; /* starting logical group # */ 124 uint32_t max_ldgs; /* max logical device group */ 125 uint32_t max_ldvs; /* max logical devices */ 126 } hxge_hw_pt_cfg_t, *p_hxge_hw_pt_cfg_t; 127 128 /* per port configuration */ 129 typedef struct hxge_dma_pt_cfg { 130 hxge_hw_pt_cfg_t hw_config; /* hardware configuration */ 131 132 uint32_t alloc_buf_size; 133 uint32_t rbr_size; 134 uint32_t rcr_size; 135 } hxge_dma_pt_cfg_t, *p_hxge_dma_pt_cfg_t; 136 137 /* classification configuration */ 138 typedef struct hxge_class_pt_cfg { 139 /* VLAN table */ 140 hxge_mv_cfg_t vlan_tbl[VLAN_ID_MAX + 1]; 141 /* class config value */ 142 uint32_t init_hash; 143 uint32_t class_cfg[TCAM_CLASS_MAX]; 144 } hxge_class_pt_cfg_t, *p_hxge_class_pt_cfg_t; 145 146 typedef struct hxge_hw_list { 147 struct hxge_hw_list *next; 148 hxge_os_mutex_t hxge_cfg_lock; 149 hxge_os_mutex_t hxge_tcam_lock; 150 hxge_os_mutex_t hxge_vlan_lock; 151 152 hxge_dev_info_t *parent_devp; 153 struct _hxge_t *hxge_p; 154 uint32_t ndevs; 155 uint32_t flags; 156 uint32_t magic; 157 } hxge_hw_list_t, *p_hxge_hw_list_t; 158 159 #ifdef __cplusplus 160 } 161 #endif 162 163 #endif /* _SYS_HXGE_HXGE_COMMON_H */ 164