1c869993eSxy /* 2c869993eSxy * CDDL HEADER START 3c869993eSxy * 4c869993eSxy * Copyright(c) 2007-2008 Intel Corporation. All rights reserved. 5c869993eSxy * The contents of this file are subject to the terms of the 6c869993eSxy * Common Development and Distribution License (the "License"). 7c869993eSxy * You may not use this file except in compliance with the License. 8c869993eSxy * 9c869993eSxy * You can obtain a copy of the license at: 10c869993eSxy * http://www.opensolaris.org/os/licensing. 11c869993eSxy * See the License for the specific language governing permissions 12c869993eSxy * and limitations under the License. 13c869993eSxy * 14c869993eSxy * When using or redistributing this file, you may do so under the 15c869993eSxy * License only. No other modification of this header is permitted. 16c869993eSxy * 17c869993eSxy * If applicable, add the following below this CDDL HEADER, with the 18c869993eSxy * fields enclosed by brackets "[]" replaced with your own identifying 19c869993eSxy * information: Portions Copyright [yyyy] [name of copyright owner] 20c869993eSxy * 21c869993eSxy * CDDL HEADER END 22c869993eSxy */ 23c869993eSxy 24c869993eSxy /* 25c869993eSxy * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 26c869993eSxy * Use is subject to license terms of the CDDL. 27c869993eSxy */ 28c869993eSxy 29c869993eSxy #ifndef _IGB_SW_H 30c869993eSxy #define _IGB_SW_H 31c869993eSxy 32c869993eSxy #pragma ident "%Z%%M% %I% %E% SMI" 33c869993eSxy 34c869993eSxy #ifdef __cplusplus 35c869993eSxy extern "C" { 36c869993eSxy #endif 37c869993eSxy 38c869993eSxy #include <sys/types.h> 39c869993eSxy #include <sys/conf.h> 40c869993eSxy #include <sys/debug.h> 41c869993eSxy #include <sys/stropts.h> 42c869993eSxy #include <sys/stream.h> 43c869993eSxy #include <sys/strsun.h> 44c869993eSxy #include <sys/strlog.h> 45c869993eSxy #include <sys/kmem.h> 46c869993eSxy #include <sys/stat.h> 47c869993eSxy #include <sys/kstat.h> 48c869993eSxy #include <sys/modctl.h> 49c869993eSxy #include <sys/errno.h> 50c869993eSxy #include <sys/dlpi.h> 51c869993eSxy #include <sys/mac.h> 52c869993eSxy #include <sys/mac_ether.h> 53c869993eSxy #include <sys/vlan.h> 54c869993eSxy #include <sys/ddi.h> 55c869993eSxy #include <sys/sunddi.h> 56c869993eSxy #include <sys/pci.h> 57c869993eSxy #include <sys/pcie.h> 58c869993eSxy #include <sys/sdt.h> 59c869993eSxy #include <sys/ethernet.h> 60c869993eSxy #include <sys/pattr.h> 61c869993eSxy #include <sys/strsubr.h> 62c869993eSxy #include <sys/netlb.h> 63c869993eSxy #include <sys/random.h> 64c869993eSxy #include <inet/common.h> 65c869993eSxy #include <inet/ip.h> 66c869993eSxy #include <inet/mi.h> 67c869993eSxy #include <inet/nd.h> 68*8bb4b220Sgl #include <sys/ddifm.h> 69*8bb4b220Sgl #include <sys/fm/protocol.h> 70*8bb4b220Sgl #include <sys/fm/util.h> 71*8bb4b220Sgl #include <sys/fm/io/ddi.h> 72c869993eSxy #include "igb_api.h" 73c869993eSxy #include "igb_82575.h" 74c869993eSxy 75c869993eSxy 76c869993eSxy #define MODULE_NAME "igb" /* module name */ 77c869993eSxy 78c869993eSxy #define IGB_SUCCESS DDI_SUCCESS 79c869993eSxy #define IGB_FAILURE DDI_FAILURE 80c869993eSxy 81c869993eSxy #define IGB_UNKNOWN 0x00 82c869993eSxy #define IGB_INITIALIZED 0x01 83c869993eSxy #define IGB_STARTED 0x02 84c869993eSxy #define IGB_SUSPENDED 0x04 85c869993eSxy 86c869993eSxy #define IGB_INTR_NONE 0 87c869993eSxy #define IGB_INTR_MSIX 1 88c869993eSxy #define IGB_INTR_MSI 2 89c869993eSxy #define IGB_INTR_LEGACY 3 90c869993eSxy 91c869993eSxy #define MAX_NUM_UNICAST_ADDRESSES E1000_RAR_ENTRIES 92c869993eSxy #define MAX_NUM_MULTICAST_ADDRESSES 256 93c869993eSxy #define MAX_NUM_EITR 10 94c869993eSxy #define MAX_COOKIE 16 95c869993eSxy #define MIN_NUM_TX_DESC 2 96c869993eSxy 97c869993eSxy /* 98c869993eSxy * Maximum values for user configurable parameters 99c869993eSxy */ 100c869993eSxy #define MAX_TX_QUEUE_NUM 4 101c869993eSxy #define MAX_RX_QUEUE_NUM 4 102c869993eSxy #define MAX_TX_RING_SIZE 4096 103c869993eSxy #define MAX_RX_RING_SIZE 4096 104c869993eSxy 105c869993eSxy #define MAX_MTU 9000 106c869993eSxy #define MAX_RX_LIMIT_PER_INTR 4096 107c869993eSxy #define MAX_RX_INTR_DELAY 65535 108c869993eSxy #define MAX_RX_INTR_ABS_DELAY 65535 109c869993eSxy #define MAX_TX_INTR_DELAY 65535 110c869993eSxy #define MAX_TX_INTR_ABS_DELAY 65535 111c869993eSxy #define MAX_INTR_THROTTLING 65535 112c869993eSxy 113c869993eSxy #define MAX_RX_COPY_THRESHOLD 9216 114c869993eSxy #define MAX_TX_COPY_THRESHOLD 9216 115c869993eSxy #define MAX_TX_RECYCLE_THRESHOLD DEFAULT_TX_RING_SIZE 116c869993eSxy #define MAX_TX_OVERLOAD_THRESHOLD DEFAULT_TX_RING_SIZE 117c869993eSxy #define MAX_TX_RESCHED_THRESHOLD DEFAULT_TX_RING_SIZE 118c869993eSxy 119c869993eSxy /* 120c869993eSxy * Minimum values for user configurable parameters 121c869993eSxy */ 122c869993eSxy #define MIN_TX_QUEUE_NUM 1 123c869993eSxy #define MIN_RX_QUEUE_NUM 1 124c869993eSxy #define MIN_TX_RING_SIZE 64 125c869993eSxy #define MIN_RX_RING_SIZE 64 126c869993eSxy 127c869993eSxy #define MIN_MTU ETHERMIN 128c869993eSxy #define MIN_RX_LIMIT_PER_INTR 16 129c869993eSxy #define MIN_RX_INTR_DELAY 0 130c869993eSxy #define MIN_RX_INTR_ABS_DELAY 0 131c869993eSxy #define MIN_TX_INTR_DELAY 0 132c869993eSxy #define MIN_TX_INTR_ABS_DELAY 0 133c869993eSxy #define MIN_INTR_THROTTLING 0 134c869993eSxy #define MIN_RX_COPY_THRESHOLD 0 135c869993eSxy #define MIN_TX_COPY_THRESHOLD 0 136c869993eSxy #define MIN_TX_RECYCLE_THRESHOLD MIN_NUM_TX_DESC 137c869993eSxy #define MIN_TX_OVERLOAD_THRESHOLD MIN_NUM_TX_DESC 138c869993eSxy #define MIN_TX_RESCHED_THRESHOLD MIN_NUM_TX_DESC 139c869993eSxy 140c869993eSxy /* 141c869993eSxy * Default values for user configurable parameters 142c869993eSxy */ 143c869993eSxy #define DEFAULT_TX_QUEUE_NUM 1 144c869993eSxy #define DEFAULT_RX_QUEUE_NUM 1 145c869993eSxy #define DEFAULT_TX_RING_SIZE 512 146c869993eSxy #define DEFAULT_RX_RING_SIZE 512 147c869993eSxy 148c869993eSxy #define DEFAULT_MTU ETHERMTU 149c869993eSxy #define DEFAULT_RX_LIMIT_PER_INTR 256 150c869993eSxy #define DEFAULT_RX_INTR_DELAY 0 151c869993eSxy #define DEFAULT_RX_INTR_ABS_DELAY 0 152c869993eSxy #define DEFAULT_TX_INTR_DELAY 300 153c869993eSxy #define DEFAULT_TX_INTR_ABS_DELAY 0 154c869993eSxy #define DEFAULT_INTR_THROTTLING 200 /* In unit of 256 nsec */ 155c869993eSxy #define DEFAULT_RX_COPY_THRESHOLD 128 156c869993eSxy #define DEFAULT_TX_COPY_THRESHOLD 512 157c869993eSxy #define DEFAULT_TX_RECYCLE_THRESHOLD MAX_COOKIE 158c869993eSxy #define DEFAULT_TX_OVERLOAD_THRESHOLD MIN_NUM_TX_DESC 159c869993eSxy #define DEFAULT_TX_RESCHED_THRESHOLD 128 160c869993eSxy 161c869993eSxy #define TX_DRAIN_TIME 200 162c869993eSxy #define RX_DRAIN_TIME 200 163c869993eSxy 164c869993eSxy #define STALL_WATCHDOG_TIMEOUT 8 /* 8 seconds */ 165c869993eSxy #define MAX_LINK_DOWN_TIMEOUT 8 /* 8 seconds */ 166c869993eSxy 167c869993eSxy /* 168c869993eSxy * Defined for IP header alignment. 169c869993eSxy */ 170c869993eSxy #define IPHDR_ALIGN_ROOM 2 171c869993eSxy 172c869993eSxy /* 173c869993eSxy * Bit flags for attach_progress 174c869993eSxy */ 175c869993eSxy #define ATTACH_PROGRESS_PCI_CONFIG 0x0001 /* PCI config setup */ 176c869993eSxy #define ATTACH_PROGRESS_REGS_MAP 0x0002 /* Registers mapped */ 177c869993eSxy #define ATTACH_PROGRESS_PROPS 0x0004 /* Properties initialized */ 178c869993eSxy #define ATTACH_PROGRESS_ALLOC_INTR 0x0008 /* Interrupts allocated */ 179c869993eSxy #define ATTACH_PROGRESS_ALLOC_RINGS 0x0010 /* Rings allocated */ 180c869993eSxy #define ATTACH_PROGRESS_ADD_INTR 0x0020 /* Intr handlers added */ 181c869993eSxy #define ATTACH_PROGRESS_LOCKS 0x0040 /* Locks initialized */ 182c869993eSxy #define ATTACH_PROGRESS_INIT 0x0080 /* Device initialized */ 183c869993eSxy #define ATTACH_PROGRESS_INIT_RINGS 0x0100 /* Rings initialized */ 184c869993eSxy #define ATTACH_PROGRESS_STATS 0x0200 /* Kstats created */ 185c869993eSxy #define ATTACH_PROGRESS_NDD 0x0400 /* NDD initialized */ 186c869993eSxy #define ATTACH_PROGRESS_MAC 0x0800 /* MAC registered */ 187c869993eSxy #define ATTACH_PROGRESS_ENABLE_INTR 0x1000 /* DDI interrupts enabled */ 188*8bb4b220Sgl #define ATTACH_PROGRESS_FMINIT 0x2000 /* FMA initialized */ 189c869993eSxy 190c869993eSxy 191c869993eSxy #define PROP_ADV_AUTONEG_CAP "adv_autoneg_cap" 192c869993eSxy #define PROP_ADV_1000FDX_CAP "adv_1000fdx_cap" 193c869993eSxy #define PROP_ADV_1000HDX_CAP "adv_1000hdx_cap" 194c869993eSxy #define PROP_ADV_100FDX_CAP "adv_100fdx_cap" 195c869993eSxy #define PROP_ADV_100HDX_CAP "adv_100hdx_cap" 196c869993eSxy #define PROP_ADV_10FDX_CAP "adv_10fdx_cap" 197c869993eSxy #define PROP_ADV_10HDX_CAP "adv_10hdx_cap" 198c869993eSxy #define PROP_DEFAULT_MTU "default_mtu" 199c869993eSxy #define PROP_FLOW_CONTROL "flow_control" 200c869993eSxy #define PROP_TX_QUEUE_NUM "tx_queue_number" 201c869993eSxy #define PROP_TX_RING_SIZE "tx_ring_size" 202c869993eSxy #define PROP_RX_QUEUE_NUM "rx_queue_number" 203c869993eSxy #define PROP_RX_RING_SIZE "rx_ring_size" 204c869993eSxy 205c869993eSxy #define PROP_INTR_FORCE "intr_force" 206c869993eSxy #define PROP_TX_HCKSUM_ENABLE "tx_hcksum_enable" 207c869993eSxy #define PROP_RX_HCKSUM_ENABLE "rx_hcksum_enable" 208c869993eSxy #define PROP_LSO_ENABLE "lso_enable" 209c869993eSxy #define PROP_TX_HEAD_WB_ENABLE "tx_head_wb_enable" 210c869993eSxy #define PROP_TX_COPY_THRESHOLD "tx_copy_threshold" 211c869993eSxy #define PROP_TX_RECYCLE_THRESHOLD "tx_recycle_threshold" 212c869993eSxy #define PROP_TX_OVERLOAD_THRESHOLD "tx_overload_threshold" 213c869993eSxy #define PROP_TX_RESCHED_THRESHOLD "tx_resched_threshold" 214c869993eSxy #define PROP_RX_COPY_THRESHOLD "rx_copy_threshold" 215c869993eSxy #define PROP_RX_LIMIT_PER_INTR "rx_limit_per_intr" 216c869993eSxy #define PROP_INTR_THROTTLING "intr_throttling" 217c869993eSxy 218c869993eSxy #define IGB_LB_NONE 0 219c869993eSxy #define IGB_LB_EXTERNAL 1 220c869993eSxy #define IGB_LB_INTERNAL_MAC 2 221c869993eSxy #define IGB_LB_INTERNAL_PHY 3 222c869993eSxy #define IGB_LB_INTERNAL_SERDES 4 223c869993eSxy 224c869993eSxy /* 225c869993eSxy * Shorthand for the NDD parameters 226c869993eSxy */ 227c869993eSxy #define param_autoneg_cap nd_params[PARAM_AUTONEG_CAP].val 228c869993eSxy #define param_pause_cap nd_params[PARAM_PAUSE_CAP].val 229c869993eSxy #define param_asym_pause_cap nd_params[PARAM_ASYM_PAUSE_CAP].val 230c869993eSxy #define param_1000fdx_cap nd_params[PARAM_1000FDX_CAP].val 231c869993eSxy #define param_1000hdx_cap nd_params[PARAM_1000HDX_CAP].val 232c869993eSxy #define param_100t4_cap nd_params[PARAM_100T4_CAP].val 233c869993eSxy #define param_100fdx_cap nd_params[PARAM_100FDX_CAP].val 234c869993eSxy #define param_100hdx_cap nd_params[PARAM_100HDX_CAP].val 235c869993eSxy #define param_10fdx_cap nd_params[PARAM_10FDX_CAP].val 236c869993eSxy #define param_10hdx_cap nd_params[PARAM_10HDX_CAP].val 237c869993eSxy #define param_rem_fault nd_params[PARAM_REM_FAULT].val 238c869993eSxy 239c869993eSxy #define param_adv_autoneg_cap nd_params[PARAM_ADV_AUTONEG_CAP].val 240c869993eSxy #define param_adv_pause_cap nd_params[PARAM_ADV_PAUSE_CAP].val 241c869993eSxy #define param_adv_asym_pause_cap nd_params[PARAM_ADV_ASYM_PAUSE_CAP].val 242c869993eSxy #define param_adv_1000fdx_cap nd_params[PARAM_ADV_1000FDX_CAP].val 243c869993eSxy #define param_adv_1000hdx_cap nd_params[PARAM_ADV_1000HDX_CAP].val 244c869993eSxy #define param_adv_100t4_cap nd_params[PARAM_ADV_100T4_CAP].val 245c869993eSxy #define param_adv_100fdx_cap nd_params[PARAM_ADV_100FDX_CAP].val 246c869993eSxy #define param_adv_100hdx_cap nd_params[PARAM_ADV_100HDX_CAP].val 247c869993eSxy #define param_adv_10fdx_cap nd_params[PARAM_ADV_10FDX_CAP].val 248c869993eSxy #define param_adv_10hdx_cap nd_params[PARAM_ADV_10HDX_CAP].val 249c869993eSxy #define param_adv_rem_fault nd_params[PARAM_ADV_REM_FAULT].val 250c869993eSxy 251c869993eSxy #define param_lp_autoneg_cap nd_params[PARAM_LP_AUTONEG_CAP].val 252c869993eSxy #define param_lp_pause_cap nd_params[PARAM_LP_PAUSE_CAP].val 253c869993eSxy #define param_lp_asym_pause_cap nd_params[PARAM_LP_ASYM_PAUSE_CAP].val 254c869993eSxy #define param_lp_1000fdx_cap nd_params[PARAM_LP_1000FDX_CAP].val 255c869993eSxy #define param_lp_1000hdx_cap nd_params[PARAM_LP_1000HDX_CAP].val 256c869993eSxy #define param_lp_100t4_cap nd_params[PARAM_LP_100T4_CAP].val 257c869993eSxy #define param_lp_100fdx_cap nd_params[PARAM_LP_100FDX_CAP].val 258c869993eSxy #define param_lp_100hdx_cap nd_params[PARAM_LP_100HDX_CAP].val 259c869993eSxy #define param_lp_10fdx_cap nd_params[PARAM_LP_10FDX_CAP].val 260c869993eSxy #define param_lp_10hdx_cap nd_params[PARAM_LP_10HDX_CAP].val 261c869993eSxy #define param_lp_rem_fault nd_params[PARAM_LP_REM_FAULT].val 262c869993eSxy 263c869993eSxy enum ioc_reply { 264c869993eSxy IOC_INVAL = -1, /* bad, NAK with EINVAL */ 265c869993eSxy IOC_DONE, /* OK, reply sent */ 266c869993eSxy IOC_ACK, /* OK, just send ACK */ 267c869993eSxy IOC_REPLY /* OK, just send reply */ 268c869993eSxy }; 269c869993eSxy 270c869993eSxy #define MBLK_LEN(mp) ((uintptr_t)(mp)->b_wptr - \ 271c869993eSxy (uintptr_t)(mp)->b_rptr) 272c869993eSxy 273c869993eSxy #define DMA_SYNC(area, flag) ((void) ddi_dma_sync((area)->dma_handle, \ 274c869993eSxy 0, 0, (flag))) 275c869993eSxy 276c869993eSxy /* 277c869993eSxy * Defined for ring index operations 278c869993eSxy * ASSERT(index < limit) 279c869993eSxy * ASSERT(step < limit) 280c869993eSxy * ASSERT(index1 < limit) 281c869993eSxy * ASSERT(index2 < limit) 282c869993eSxy */ 283c869993eSxy #define NEXT_INDEX(index, step, limit) (((index) + (step)) < (limit) ? \ 284c869993eSxy (index) + (step) : (index) + (step) - (limit)) 285c869993eSxy #define PREV_INDEX(index, step, limit) ((index) >= (step) ? \ 286c869993eSxy (index) - (step) : (index) + (limit) - (step)) 287c869993eSxy #define OFFSET(index1, index2, limit) ((index1) <= (index2) ? \ 288c869993eSxy (index2) - (index1) : (index2) + (limit) - (index1)) 289c869993eSxy 290c869993eSxy #define LINK_LIST_INIT(_LH) \ 291c869993eSxy (_LH)->head = (_LH)->tail = NULL 292c869993eSxy 293c869993eSxy #define LIST_GET_HEAD(_LH) ((single_link_t *)((_LH)->head)) 294c869993eSxy 295c869993eSxy #define LIST_POP_HEAD(_LH) \ 296c869993eSxy (single_link_t *)(_LH)->head; \ 297c869993eSxy { \ 298c869993eSxy if ((_LH)->head != NULL) { \ 299c869993eSxy (_LH)->head = (_LH)->head->link; \ 300c869993eSxy if ((_LH)->head == NULL) \ 301c869993eSxy (_LH)->tail = NULL; \ 302c869993eSxy } \ 303c869993eSxy } 304c869993eSxy 305c869993eSxy #define LIST_GET_TAIL(_LH) ((single_link_t *)((_LH)->tail)) 306c869993eSxy 307c869993eSxy #define LIST_PUSH_TAIL(_LH, _E) \ 308c869993eSxy if ((_LH)->tail != NULL) { \ 309c869993eSxy (_LH)->tail->link = (single_link_t *)(_E); \ 310c869993eSxy (_LH)->tail = (single_link_t *)(_E); \ 311c869993eSxy } else { \ 312c869993eSxy (_LH)->head = (_LH)->tail = (single_link_t *)(_E); \ 313c869993eSxy } \ 314c869993eSxy (_E)->link = NULL; 315c869993eSxy 316c869993eSxy #define LIST_GET_NEXT(_LH, _E) \ 317c869993eSxy (((_LH)->tail == (single_link_t *)(_E)) ? \ 318c869993eSxy NULL : ((single_link_t *)(_E))->link) 319c869993eSxy 320c869993eSxy 321c869993eSxy typedef struct single_link { 322c869993eSxy struct single_link *link; 323c869993eSxy } single_link_t; 324c869993eSxy 325c869993eSxy typedef struct link_list { 326c869993eSxy single_link_t *head; 327c869993eSxy single_link_t *tail; 328c869993eSxy } link_list_t; 329c869993eSxy 330c869993eSxy /* 331c869993eSxy * Property lookups 332c869993eSxy */ 333c869993eSxy #define IGB_PROP_EXISTS(d, n) ddi_prop_exists(DDI_DEV_T_ANY, (d), \ 334c869993eSxy DDI_PROP_DONTPASS, (n)) 335c869993eSxy #define IGB_PROP_GET_INT(d, n) ddi_prop_get_int(DDI_DEV_T_ANY, (d), \ 336c869993eSxy DDI_PROP_DONTPASS, (n), -1) 337c869993eSxy 338c869993eSxy 339c869993eSxy /* 340c869993eSxy * Named Data (ND) Parameter Management Structure 341c869993eSxy */ 342c869993eSxy typedef struct { 343c869993eSxy struct igb *private; 344c869993eSxy uint32_t info; 345c869993eSxy uint32_t min; 346c869993eSxy uint32_t max; 347c869993eSxy uint32_t val; 348c869993eSxy char *name; 349c869993eSxy } nd_param_t; 350c869993eSxy 351c869993eSxy /* 352c869993eSxy * NDD parameter indexes, divided into: 353c869993eSxy * 354c869993eSxy * read-only parameters describing the hardware's capabilities 355c869993eSxy * read-write parameters controlling the advertised capabilities 356c869993eSxy * read-only parameters describing the partner's capabilities 357c869993eSxy * read-write parameters controlling the force speed and duplex 358c869993eSxy * read-only parameters describing the link state 359c869993eSxy * read-only parameters describing the driver properties 360c869993eSxy * read-write parameters controlling the driver properties 361c869993eSxy */ 362c869993eSxy enum { 363c869993eSxy PARAM_AUTONEG_CAP, 364c869993eSxy PARAM_PAUSE_CAP, 365c869993eSxy PARAM_ASYM_PAUSE_CAP, 366c869993eSxy PARAM_1000FDX_CAP, 367c869993eSxy PARAM_1000HDX_CAP, 368c869993eSxy PARAM_100T4_CAP, 369c869993eSxy PARAM_100FDX_CAP, 370c869993eSxy PARAM_100HDX_CAP, 371c869993eSxy PARAM_10FDX_CAP, 372c869993eSxy PARAM_10HDX_CAP, 373c869993eSxy PARAM_REM_FAULT, 374c869993eSxy 375c869993eSxy PARAM_ADV_AUTONEG_CAP, 376c869993eSxy PARAM_ADV_PAUSE_CAP, 377c869993eSxy PARAM_ADV_ASYM_PAUSE_CAP, 378c869993eSxy PARAM_ADV_1000FDX_CAP, 379c869993eSxy PARAM_ADV_1000HDX_CAP, 380c869993eSxy PARAM_ADV_100T4_CAP, 381c869993eSxy PARAM_ADV_100FDX_CAP, 382c869993eSxy PARAM_ADV_100HDX_CAP, 383c869993eSxy PARAM_ADV_10FDX_CAP, 384c869993eSxy PARAM_ADV_10HDX_CAP, 385c869993eSxy PARAM_ADV_REM_FAULT, 386c869993eSxy 387c869993eSxy PARAM_LP_AUTONEG_CAP, 388c869993eSxy PARAM_LP_PAUSE_CAP, 389c869993eSxy PARAM_LP_ASYM_PAUSE_CAP, 390c869993eSxy PARAM_LP_1000FDX_CAP, 391c869993eSxy PARAM_LP_1000HDX_CAP, 392c869993eSxy PARAM_LP_100T4_CAP, 393c869993eSxy PARAM_LP_100FDX_CAP, 394c869993eSxy PARAM_LP_100HDX_CAP, 395c869993eSxy PARAM_LP_10FDX_CAP, 396c869993eSxy PARAM_LP_10HDX_CAP, 397c869993eSxy PARAM_LP_REM_FAULT, 398c869993eSxy 399c869993eSxy PARAM_LINK_STATUS, 400c869993eSxy PARAM_LINK_SPEED, 401c869993eSxy PARAM_LINK_DUPLEX, 402c869993eSxy 403c869993eSxy PARAM_COUNT 404c869993eSxy }; 405c869993eSxy 406c869993eSxy typedef union igb_ether_addr { 407c869993eSxy struct { 408c869993eSxy uint32_t high; 409c869993eSxy uint32_t low; 410c869993eSxy } reg; 411c869993eSxy struct { 412c869993eSxy uint8_t set; 413c869993eSxy uint8_t redundant; 414c869993eSxy uint8_t addr[ETHERADDRL]; 415c869993eSxy } mac; 416c869993eSxy } igb_ether_addr_t; 417c869993eSxy 418c869993eSxy typedef enum { 419c869993eSxy USE_NONE, 420c869993eSxy USE_COPY, 421c869993eSxy USE_DMA 422c869993eSxy } tx_type_t; 423c869993eSxy 424c869993eSxy typedef enum { 425c869993eSxy RCB_FREE, 426c869993eSxy RCB_SENDUP 427c869993eSxy } rcb_state_t; 428c869993eSxy 429c869993eSxy typedef struct hcksum_context { 430c869993eSxy uint32_t hcksum_flags; 431c869993eSxy uint32_t ip_hdr_len; 432c869993eSxy uint32_t mac_hdr_len; 433c869993eSxy uint32_t l4_proto; 434c869993eSxy } hcksum_context_t; 435c869993eSxy 436c869993eSxy /* Hold address/length of each DMA segment */ 437c869993eSxy typedef struct sw_desc { 438c869993eSxy uint64_t address; 439c869993eSxy size_t length; 440c869993eSxy } sw_desc_t; 441c869993eSxy 442c869993eSxy /* Handles and addresses of DMA buffer */ 443c869993eSxy typedef struct dma_buffer { 444c869993eSxy caddr_t address; /* Virtual address */ 445c869993eSxy uint64_t dma_address; /* DMA (Hardware) address */ 446c869993eSxy ddi_acc_handle_t acc_handle; /* Data access handle */ 447c869993eSxy ddi_dma_handle_t dma_handle; /* DMA handle */ 448c869993eSxy size_t size; /* Buffer size */ 449c869993eSxy size_t len; /* Data length in the buffer */ 450c869993eSxy } dma_buffer_t; 451c869993eSxy 452c869993eSxy /* 453c869993eSxy * Tx Control Block 454c869993eSxy */ 455c869993eSxy typedef struct tx_control_block { 456c869993eSxy single_link_t link; 457c869993eSxy uint32_t frag_num; 458c869993eSxy uint32_t desc_num; 459c869993eSxy mblk_t *mp; 460c869993eSxy tx_type_t tx_type; 461c869993eSxy ddi_dma_handle_t tx_dma_handle; 462c869993eSxy dma_buffer_t tx_buf; 463c869993eSxy sw_desc_t desc[MAX_COOKIE]; 464c869993eSxy } tx_control_block_t; 465c869993eSxy 466c869993eSxy /* 467c869993eSxy * RX Control Block 468c869993eSxy */ 469c869993eSxy typedef struct rx_control_block { 470c869993eSxy mblk_t *mp; 471c869993eSxy rcb_state_t state; 472c869993eSxy dma_buffer_t rx_buf; 473c869993eSxy frtn_t free_rtn; 474c869993eSxy struct igb_rx_ring *rx_ring; 475c869993eSxy } rx_control_block_t; 476c869993eSxy 477c869993eSxy /* 478c869993eSxy * Software Data Structure for Tx Ring 479c869993eSxy */ 480c869993eSxy typedef struct igb_tx_ring { 481c869993eSxy uint32_t index; /* Ring index */ 482c869993eSxy 483c869993eSxy /* 484c869993eSxy * Mutexes 485c869993eSxy */ 486c869993eSxy kmutex_t tx_lock; 487c869993eSxy kmutex_t recycle_lock; 488c869993eSxy kmutex_t tcb_head_lock; 489c869993eSxy kmutex_t tcb_tail_lock; 490c869993eSxy 491c869993eSxy /* 492c869993eSxy * Tx descriptor ring definitions 493c869993eSxy */ 494c869993eSxy dma_buffer_t tbd_area; 495c869993eSxy union e1000_adv_tx_desc *tbd_ring; 496c869993eSxy uint32_t tbd_head; /* Index of next tbd to recycle */ 497c869993eSxy uint32_t tbd_tail; /* Index of next tbd to transmit */ 498c869993eSxy uint32_t tbd_free; /* Number of free tbd */ 499c869993eSxy 500c869993eSxy /* 501c869993eSxy * Tx control block list definitions 502c869993eSxy */ 503c869993eSxy tx_control_block_t *tcb_area; 504c869993eSxy tx_control_block_t **work_list; 505c869993eSxy tx_control_block_t **free_list; 506c869993eSxy uint32_t tcb_head; /* Head index of free list */ 507c869993eSxy uint32_t tcb_tail; /* Tail index of free list */ 508c869993eSxy uint32_t tcb_free; /* Number of free tcb in free list */ 509c869993eSxy 510c869993eSxy uint32_t *tbd_head_wb; /* Head write-back */ 511c869993eSxy uint32_t (*tx_recycle)(struct igb_tx_ring *); 512c869993eSxy 513c869993eSxy /* 514c869993eSxy * TCP/UDP checksum offload 515c869993eSxy */ 516c869993eSxy hcksum_context_t hcksum_context; 517c869993eSxy 518c869993eSxy /* 519c869993eSxy * Tx ring settings and status 520c869993eSxy */ 521c869993eSxy uint32_t ring_size; /* Tx descriptor ring size */ 522c869993eSxy uint32_t free_list_size; /* Tx free list size */ 523c869993eSxy uint32_t copy_thresh; 524c869993eSxy uint32_t recycle_thresh; 525c869993eSxy uint32_t overload_thresh; 526c869993eSxy uint32_t resched_thresh; 527c869993eSxy 528c869993eSxy boolean_t reschedule; 529c869993eSxy uint32_t recycle_fail; 530c869993eSxy uint32_t stall_watchdog; 531c869993eSxy 532c869993eSxy #ifdef IGB_DEBUG 533c869993eSxy /* 534c869993eSxy * Debug statistics 535c869993eSxy */ 536c869993eSxy uint32_t stat_overload; 537c869993eSxy uint32_t stat_fail_no_tbd; 538c869993eSxy uint32_t stat_fail_no_tcb; 539c869993eSxy uint32_t stat_fail_dma_bind; 540c869993eSxy uint32_t stat_reschedule; 541c869993eSxy #endif 542c869993eSxy 543c869993eSxy /* 544c869993eSxy * Pointer to the igb struct 545c869993eSxy */ 546c869993eSxy struct igb *igb; 547c869993eSxy 548c869993eSxy } igb_tx_ring_t; 549c869993eSxy 550c869993eSxy /* 551c869993eSxy * Software Receive Ring 552c869993eSxy */ 553c869993eSxy typedef struct igb_rx_ring { 554c869993eSxy uint32_t index; /* Ring index */ 555c869993eSxy uint32_t intr_vector; /* Interrupt vector index */ 556c869993eSxy 557c869993eSxy /* 558c869993eSxy * Mutexes 559c869993eSxy */ 560c869993eSxy kmutex_t rx_lock; /* Rx access lock */ 561c869993eSxy kmutex_t recycle_lock; /* Recycle lock, for rcb_tail */ 562c869993eSxy 563c869993eSxy /* 564c869993eSxy * Rx descriptor ring definitions 565c869993eSxy */ 566c869993eSxy dma_buffer_t rbd_area; /* DMA buffer of rx desc ring */ 567c869993eSxy union e1000_adv_rx_desc *rbd_ring; /* Rx desc ring */ 568c869993eSxy uint32_t rbd_next; /* Index of next rx desc */ 569c869993eSxy 570c869993eSxy /* 571c869993eSxy * Rx control block list definitions 572c869993eSxy */ 573c869993eSxy rx_control_block_t *rcb_area; 574c869993eSxy rx_control_block_t **work_list; /* Work list of rcbs */ 575c869993eSxy rx_control_block_t **free_list; /* Free list of rcbs */ 576c869993eSxy uint32_t rcb_head; /* Index of next free rcb */ 577c869993eSxy uint32_t rcb_tail; /* Index to put recycled rcb */ 578c869993eSxy uint32_t rcb_free; /* Number of free rcbs */ 579c869993eSxy 580c869993eSxy /* 581c869993eSxy * Rx ring settings and status 582c869993eSxy */ 583c869993eSxy uint32_t ring_size; /* Rx descriptor ring size */ 584c869993eSxy uint32_t free_list_size; /* Rx free list size */ 585c869993eSxy uint32_t limit_per_intr; /* Max packets per interrupt */ 586c869993eSxy uint32_t copy_thresh; 587c869993eSxy 588c869993eSxy #ifdef IGB_DEBUG 589c869993eSxy /* 590c869993eSxy * Debug statistics 591c869993eSxy */ 592c869993eSxy uint32_t stat_frame_error; 593c869993eSxy uint32_t stat_cksum_error; 594c869993eSxy uint32_t stat_exceed_pkt; 595c869993eSxy #endif 596c869993eSxy 597c869993eSxy struct igb *igb; /* Pointer to igb struct */ 598c869993eSxy 599c869993eSxy } igb_rx_ring_t; 600c869993eSxy 601c869993eSxy typedef struct igb { 602c869993eSxy int instance; 603c869993eSxy mac_handle_t mac_hdl; 604c869993eSxy dev_info_t *dip; 605c869993eSxy struct e1000_hw hw; 606c869993eSxy struct igb_osdep osdep; 607c869993eSxy 608c869993eSxy uint32_t igb_state; 609c869993eSxy link_state_t link_state; 610c869993eSxy uint32_t link_speed; 611c869993eSxy uint32_t link_duplex; 612c869993eSxy uint32_t link_down_timeout; 613c869993eSxy 614c869993eSxy uint32_t reset_count; 615c869993eSxy uint32_t attach_progress; 616c869993eSxy uint32_t loopback_mode; 617c869993eSxy uint32_t max_frame_size; 618c869993eSxy 619c869993eSxy /* 620c869993eSxy * Receive Rings 621c869993eSxy */ 622c869993eSxy igb_rx_ring_t *rx_rings; /* Array of rx rings */ 623c869993eSxy uint32_t num_rx_rings; /* Number of rx rings in use */ 624c869993eSxy uint32_t rx_ring_size; /* Rx descriptor ring size */ 625c869993eSxy uint32_t rx_buf_size; /* Rx buffer size */ 626c869993eSxy 627c869993eSxy /* 628c869993eSxy * Transmit Rings 629c869993eSxy */ 630c869993eSxy igb_tx_ring_t *tx_rings; /* Array of tx rings */ 631c869993eSxy uint32_t num_tx_rings; /* Number of tx rings in use */ 632c869993eSxy uint32_t tx_ring_size; /* Tx descriptor ring size */ 633c869993eSxy uint32_t tx_buf_size; /* Tx buffer size */ 634c869993eSxy 635c869993eSxy boolean_t tx_head_wb_enable; /* Tx head wrtie-back */ 636c869993eSxy boolean_t tx_hcksum_enable; /* Tx h/w cksum offload */ 637c869993eSxy boolean_t lso_enable; /* Large Segment Offload */ 638c869993eSxy uint32_t tx_copy_thresh; /* Tx copy threshold */ 639c869993eSxy uint32_t tx_recycle_thresh; /* Tx recycle threshold */ 640c869993eSxy uint32_t tx_overload_thresh; /* Tx overload threshold */ 641c869993eSxy uint32_t tx_resched_thresh; /* Tx reschedule threshold */ 642c869993eSxy boolean_t rx_hcksum_enable; /* Rx h/w cksum offload */ 643c869993eSxy uint32_t rx_copy_thresh; /* Rx copy threshold */ 644c869993eSxy uint32_t rx_limit_per_intr; /* Rx pkts per interrupt */ 645c869993eSxy uint32_t intr_throttling[MAX_NUM_EITR]; 646c869993eSxy uint32_t intr_force; 647c869993eSxy 648c869993eSxy int intr_type; 649c869993eSxy int intr_cnt; 650c869993eSxy int intr_cap; 651c869993eSxy size_t intr_size; 652c869993eSxy uint_t intr_pri; 653c869993eSxy ddi_intr_handle_t *htable; 654c869993eSxy uint32_t eims_mask; 655c869993eSxy 656c869993eSxy kmutex_t gen_lock; /* General lock for device access */ 657c869993eSxy kmutex_t watchdog_lock; 658c869993eSxy 659c869993eSxy boolean_t watchdog_enable; 660c869993eSxy boolean_t watchdog_start; 661c869993eSxy timeout_id_t watchdog_tid; 662c869993eSxy 663c869993eSxy boolean_t unicst_init; 664c869993eSxy uint32_t unicst_avail; 665c869993eSxy uint32_t unicst_total; 666c869993eSxy igb_ether_addr_t unicst_addr[MAX_NUM_UNICAST_ADDRESSES]; 667c869993eSxy uint32_t mcast_count; 668c869993eSxy struct ether_addr mcast_table[MAX_NUM_MULTICAST_ADDRESSES]; 669c869993eSxy 670c869993eSxy /* 671c869993eSxy * Kstat definitions 672c869993eSxy */ 673c869993eSxy kstat_t *igb_ks; 674c869993eSxy 675c869993eSxy /* 676c869993eSxy * NDD definitions 677c869993eSxy */ 678c869993eSxy caddr_t nd_data; 679c869993eSxy nd_param_t nd_params[PARAM_COUNT]; 680c869993eSxy 681*8bb4b220Sgl /* 682*8bb4b220Sgl * FMA capabilities 683*8bb4b220Sgl */ 684*8bb4b220Sgl int fm_capabilities; 685*8bb4b220Sgl 686c869993eSxy } igb_t; 687c869993eSxy 688c869993eSxy typedef struct igb_stat { 689c869993eSxy 690c869993eSxy kstat_named_t link_speed; /* Link Speed */ 691c869993eSxy #ifdef IGB_DEBUG 692c869993eSxy kstat_named_t reset_count; /* Reset Count */ 693c869993eSxy 694c869993eSxy kstat_named_t rx_frame_error; /* Rx Error in Packet */ 695c869993eSxy kstat_named_t rx_cksum_error; /* Rx Checksum Error */ 696c869993eSxy kstat_named_t rx_exceed_pkt; /* Rx Exceed Max Pkt Count */ 697c869993eSxy 698c869993eSxy kstat_named_t tx_overload; /* Tx Desc Ring Overload */ 699c869993eSxy kstat_named_t tx_fail_no_tcb; /* Tx Fail Freelist Empty */ 700c869993eSxy kstat_named_t tx_fail_no_tbd; /* Tx Fail Desc Ring Empty */ 701c869993eSxy kstat_named_t tx_fail_dma_bind; /* Tx Fail DMA bind */ 702c869993eSxy kstat_named_t tx_reschedule; /* Tx Reschedule */ 703c869993eSxy 704c869993eSxy kstat_named_t gprc; /* Good Packets Received Count */ 705c869993eSxy kstat_named_t gptc; /* Good Packets Xmitted Count */ 706c869993eSxy kstat_named_t gor; /* Good Octets Received Count */ 707c869993eSxy kstat_named_t got; /* Good Octets Xmitd Count */ 708c869993eSxy kstat_named_t prc64; /* Packets Received - 64b */ 709c869993eSxy kstat_named_t prc127; /* Packets Received - 65-127b */ 710c869993eSxy kstat_named_t prc255; /* Packets Received - 127-255b */ 711c869993eSxy kstat_named_t prc511; /* Packets Received - 256-511b */ 712c869993eSxy kstat_named_t prc1023; /* Packets Received - 511-1023b */ 713c869993eSxy kstat_named_t prc1522; /* Packets Received - 1024-1522b */ 714c869993eSxy kstat_named_t ptc64; /* Packets Xmitted (64b) */ 715c869993eSxy kstat_named_t ptc127; /* Packets Xmitted (64-127b) */ 716c869993eSxy kstat_named_t ptc255; /* Packets Xmitted (128-255b) */ 717c869993eSxy kstat_named_t ptc511; /* Packets Xmitted (255-511b) */ 718c869993eSxy kstat_named_t ptc1023; /* Packets Xmitted (512-1023b) */ 719c869993eSxy kstat_named_t ptc1522; /* Packets Xmitted (1024-1522b */ 720c869993eSxy #endif 721c869993eSxy kstat_named_t crcerrs; /* CRC Error Count */ 722c869993eSxy kstat_named_t symerrs; /* Symbol Error Count */ 723c869993eSxy kstat_named_t mpc; /* Missed Packet Count */ 724c869993eSxy kstat_named_t scc; /* Single Collision Count */ 725c869993eSxy kstat_named_t ecol; /* Excessive Collision Count */ 726c869993eSxy kstat_named_t mcc; /* Multiple Collision Count */ 727c869993eSxy kstat_named_t latecol; /* Late Collision Count */ 728c869993eSxy kstat_named_t colc; /* Collision Count */ 729c869993eSxy kstat_named_t dc; /* Defer Count */ 730c869993eSxy kstat_named_t sec; /* Sequence Error Count */ 731c869993eSxy kstat_named_t rlec; /* Receive Length Error Count */ 732c869993eSxy kstat_named_t xonrxc; /* XON Received Count */ 733c869993eSxy kstat_named_t xontxc; /* XON Xmitted Count */ 734c869993eSxy kstat_named_t xoffrxc; /* XOFF Received Count */ 735c869993eSxy kstat_named_t xofftxc; /* Xoff Xmitted Count */ 736c869993eSxy kstat_named_t fcruc; /* Unknown Flow Conrol Packet Rcvd Count */ 737c869993eSxy kstat_named_t bprc; /* Broadcasts Pkts Received Count */ 738c869993eSxy kstat_named_t mprc; /* Multicast Pkts Received Count */ 739c869993eSxy kstat_named_t rnbc; /* Receive No Buffers Count */ 740c869993eSxy kstat_named_t ruc; /* Receive Undersize Count */ 741c869993eSxy kstat_named_t rfc; /* Receive Frag Count */ 742c869993eSxy kstat_named_t roc; /* Receive Oversize Count */ 743c869993eSxy kstat_named_t rjc; /* Receive Jabber Count */ 744c869993eSxy kstat_named_t tor; /* Total Octets Recvd Count */ 745c869993eSxy kstat_named_t tot; /* Total Octets Xmted Count */ 746c869993eSxy kstat_named_t tpr; /* Total Packets Received */ 747c869993eSxy kstat_named_t tpt; /* Total Packets Xmitted */ 748c869993eSxy kstat_named_t mptc; /* Multicast Packets Xmited Count */ 749c869993eSxy kstat_named_t bptc; /* Broadcast Packets Xmited Count */ 750c869993eSxy kstat_named_t algnerrc; /* Alignment Error count */ 751c869993eSxy kstat_named_t rxerrc; /* Rx Error Count */ 752c869993eSxy kstat_named_t tncrs; /* Transmit with no CRS */ 753c869993eSxy kstat_named_t cexterr; /* Carrier Extension Error count */ 754c869993eSxy kstat_named_t tsctc; /* TCP seg contexts xmit count */ 755c869993eSxy kstat_named_t tsctfc; /* TCP seg contexts xmit fail count */ 756c869993eSxy } igb_stat_t; 757c869993eSxy 758c869993eSxy /* 759c869993eSxy * Function prototypes in e1000_osdep.c 760c869993eSxy */ 761c869993eSxy void e1000_enable_pciex_master(struct e1000_hw *); 762c869993eSxy 763c869993eSxy /* 764c869993eSxy * Function prototypes in igb_buf.c 765c869993eSxy */ 766c869993eSxy int igb_alloc_dma(igb_t *); 767c869993eSxy void igb_free_dma(igb_t *); 768c869993eSxy 769c869993eSxy /* 770c869993eSxy * Function prototypes in igb_main.c 771c869993eSxy */ 772c869993eSxy int igb_start(igb_t *); 773c869993eSxy void igb_stop(igb_t *); 774c869993eSxy int igb_setup_link(igb_t *, boolean_t); 775c869993eSxy int igb_unicst_set(igb_t *, const uint8_t *, mac_addr_slot_t); 776c869993eSxy int igb_multicst_add(igb_t *, const uint8_t *); 777c869993eSxy int igb_multicst_remove(igb_t *, const uint8_t *); 778c869993eSxy enum ioc_reply igb_loopback_ioctl(igb_t *, struct iocblk *, mblk_t *); 779c869993eSxy void igb_enable_watchdog_timer(igb_t *); 780c869993eSxy void igb_disable_watchdog_timer(igb_t *); 781c869993eSxy int igb_atomic_reserve(uint32_t *, uint32_t); 782*8bb4b220Sgl int igb_check_acc_handle(ddi_acc_handle_t); 783*8bb4b220Sgl int igb_check_dma_handle(ddi_dma_handle_t); 784*8bb4b220Sgl void igb_fm_ereport(igb_t *, char *); 785*8bb4b220Sgl void igb_set_fma_flags(int, int); 786c869993eSxy 787c869993eSxy /* 788c869993eSxy * Function prototypes in igb_gld.c 789c869993eSxy */ 790c869993eSxy int igb_m_start(void *); 791c869993eSxy void igb_m_stop(void *); 792c869993eSxy int igb_m_promisc(void *, boolean_t); 793c869993eSxy int igb_m_multicst(void *, boolean_t, const uint8_t *); 794c869993eSxy int igb_m_unicst(void *, const uint8_t *); 795c869993eSxy int igb_m_stat(void *, uint_t, uint64_t *); 796c869993eSxy void igb_m_resources(void *); 797c869993eSxy void igb_m_ioctl(void *, queue_t *, mblk_t *); 798c869993eSxy int igb_m_unicst_add(void *, mac_multi_addr_t *); 799c869993eSxy int igb_m_unicst_remove(void *, mac_addr_slot_t); 800c869993eSxy int igb_m_unicst_modify(void *, mac_multi_addr_t *); 801c869993eSxy int igb_m_unicst_get(void *, mac_multi_addr_t *); 802c869993eSxy boolean_t igb_m_getcapab(void *, mac_capab_t, void *); 803c869993eSxy 804c869993eSxy /* 805c869993eSxy * Function prototypes in igb_rx.c 806c869993eSxy */ 807c869993eSxy mblk_t *igb_rx(igb_rx_ring_t *); 808c869993eSxy void igb_rx_recycle(caddr_t arg); 809c869993eSxy 810c869993eSxy /* 811c869993eSxy * Function prototypes in igb_tx.c 812c869993eSxy */ 813c869993eSxy mblk_t *igb_m_tx(void *, mblk_t *); 814c869993eSxy void igb_free_tcb(tx_control_block_t *); 815c869993eSxy void igb_put_free_list(igb_tx_ring_t *, link_list_t *); 816c869993eSxy uint32_t igb_tx_recycle_legacy(igb_tx_ring_t *); 817c869993eSxy uint32_t igb_tx_recycle_head_wb(igb_tx_ring_t *); 818c869993eSxy 819c869993eSxy /* 820c869993eSxy * Function prototypes in igb_log.c 821c869993eSxy */ 822c869993eSxy void igb_notice(void *, const char *, ...); 823c869993eSxy void igb_log(void *, const char *, ...); 824c869993eSxy void igb_error(void *, const char *, ...); 825c869993eSxy 826c869993eSxy /* 827c869993eSxy * Function prototypes in igb_ndd.c 828c869993eSxy */ 829c869993eSxy int igb_nd_init(igb_t *); 830c869993eSxy void igb_nd_cleanup(igb_t *); 831c869993eSxy enum ioc_reply igb_nd_ioctl(igb_t *, queue_t *, mblk_t *, struct iocblk *); 832c869993eSxy 833c869993eSxy /* 834c869993eSxy * Function prototypes in igb_stat.c 835c869993eSxy */ 836c869993eSxy int igb_init_stats(igb_t *); 837c869993eSxy 838c869993eSxy 839c869993eSxy #ifdef __cplusplus 840c869993eSxy } 841c869993eSxy #endif 842c869993eSxy 843c869993eSxy #endif /* _IGB_SW_H */ 844