c869993e79c1eafbec61a56bf6cea848fe754c71xy * CDDL HEADER START
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The contents of this file are subject to the terms of the
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Common Development and Distribution License (the "License").
c869993e79c1eafbec61a56bf6cea848fe754c71xy * You may not use this file except in compliance with the License.
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer * or http://www.opensolaris.org/os/licensing.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * See the License for the specific language governing permissions
c869993e79c1eafbec61a56bf6cea848fe754c71xy * and limitations under the License.
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer * When distributing Covered Code, include this CDDL HEADER in each
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If applicable, add the following below this CDDL HEADER, with the
c869993e79c1eafbec61a56bf6cea848fe754c71xy * fields enclosed by brackets "[]" replaced with your own identifying
c869993e79c1eafbec61a56bf6cea848fe754c71xy * information: Portions Copyright [yyyy] [name of copyright owner]
c869993e79c1eafbec61a56bf6cea848fe754c71xy * CDDL HEADER END
7e5262732e5b384b6aaeaa77959a6c9dad5d1161Robert Mustacchi * Copyright (c) 2007-2012 Intel Corporation. All rights reserved.
6d1cdc09693601c358cdcd1bbd6a462920ac89adGuoqing Zhu * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
43ae55058ad99c869a9ae39d039490e8a3680520Dan McDonald * Copyright 2013, Nexenta Systems, Inc. All rights reserved.
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi * Copyright 2016 Joyent, Inc.
193974072f41a843678abf5f61979c748687e66bSherry Moorestatic char ident[] = "Intel 1Gb Ethernet";
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingalestatic char igb_version[] = "igb 2.3.8-ish";
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Local function protoypes
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing Chinastatic int igb_init_mac_address(igb_t *);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing Chinastatic int igb_init_adapter(igb_t *);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing Chinastatic void igb_stop_adapter(igb_t *);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing Chinastatic int igb_alloc_rx_data(igb_t *);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing Chinastatic void igb_free_rx_data(igb_t *);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing Chinastatic void igb_param_sync(igb_t *);
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void igb_local_timer(void *);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing Chinastatic void igb_link_timer(void *);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing Chinastatic void igb_start_link_timer(igb_t *);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing Chinastatic void igb_stop_link_timer(igb_t *);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing Chinastatic void igb_enable_adapter_interrupts_82575(igb_t *);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing Chinastatic void igb_enable_adapter_interrupts_82576(igb_t *);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing Chinastatic void igb_enable_adapter_interrupts_82580(igb_t *);
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic boolean_t igb_set_loopback_mode(igb_t *, uint32_t);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing Chinastatic void igb_setup_msix_82575(igb_t *);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing Chinastatic void igb_setup_msix_82576(igb_t *);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing Chinastatic void igb_setup_msix_82580(igb_t *);
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void igb_release_driver_control(struct e1000_hw *);
8bb4b220fdb894543e41a5f9037898cf3c3f312bglstatic int igb_fm_error_cb(dev_info_t *, ddi_fm_error_t *,
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl const void *);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republicstatic void igb_release_multicast(igb_t *);
43ae55058ad99c869a9ae39d039490e8a3680520Dan McDonald "_eee_support",
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer "_tx_copy_thresh",
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer "_tx_recycle_thresh",
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer "_tx_overload_thresh",
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer "_tx_resched_thresh",
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer "_rx_copy_thresh",
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer "_rx_limit_per_intr",
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer "_intr_throttling",
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer "_adv_pause_cap",
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer "_adv_asym_pause_cap",
c869993e79c1eafbec61a56bf6cea848fe754c71xy 0, /* devo_refcnt */
c869993e79c1eafbec61a56bf6cea848fe754c71xy &mod_driverops, /* Type of module. This one is a driver */
c869993e79c1eafbec61a56bf6cea848fe754c71xy ident, /* Discription string */
c869993e79c1eafbec61a56bf6cea848fe754c71xy/* Access attributes for register mapping */
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China#define IGB_M_CALLBACK_FLAGS \
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer (MC_IOCTL | MC_GETCAPAB | MC_SETPROP | MC_GETPROP | MC_PROPINFO)
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_m_getcapab,
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_m_setprop,
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Initialize capabilities of each supported adapter type
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing Chinastatic adapter_info_t igb_82575_cap = {
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 4, /* maximum number of rx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 1, /* minimum number of rx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 4, /* default number of rx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 4, /* maximum number of tx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 1, /* minimum number of tx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 4, /* default number of tx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 65535, /* maximum interrupt throttle rate */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 0, /* minimum interrupt throttle rate */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 200, /* default interrupt throttle rate */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* function pointers */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb_enable_adapter_interrupts_82575,
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb_setup_msix_82575,
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* capabilities */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China (IGB_FLAG_HAS_DCA | /* capability flags */
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China IGB_FLAG_VMDQ_POOL),
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China 0xffc00000 /* mask for RXDCTL register */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing Chinastatic adapter_info_t igb_82576_cap = {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China 16, /* maximum number of rx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 1, /* minimum number of rx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 4, /* default number of rx queues */
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China 16, /* maximum number of tx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 1, /* minimum number of tx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 4, /* default number of tx queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 65535, /* maximum interrupt throttle rate */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 0, /* minimum interrupt throttle rate */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China 200, /* default interrupt throttle rate */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* function pointers */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb_enable_adapter_interrupts_82576,
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb_setup_msix_82576,
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* capabilities */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China (IGB_FLAG_HAS_DCA | /* capability flags */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China IGB_FLAG_VMDQ_POOL |
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China IGB_FLAG_NEED_CTX_IDX),
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China 0xffe00000 /* mask for RXDCTL register */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing Chinastatic adapter_info_t igb_82580_cap = {
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China 8, /* maximum number of rx queues */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China 1, /* minimum number of rx queues */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China 4, /* default number of rx queues */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China 8, /* maximum number of tx queues */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China 1, /* minimum number of tx queues */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China 4, /* default number of tx queues */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China 65535, /* maximum interrupt throttle rate */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China 0, /* minimum interrupt throttle rate */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China 200, /* default interrupt throttle rate */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* function pointers */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China igb_enable_adapter_interrupts_82580,
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China igb_setup_msix_82580,
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* capabilities */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China (IGB_FLAG_HAS_DCA | /* capability flags */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China IGB_FLAG_VMDQ_POOL |
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China IGB_FLAG_NEED_CTX_IDX),
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China 0xffe00000 /* mask for RXDCTL register */
7e5262732e5b384b6aaeaa77959a6c9dad5d1161Robert Mustacchi 65535, /* maximum interrupt throttle rate */
7e5262732e5b384b6aaeaa77959a6c9dad5d1161Robert Mustacchi 0, /* minimum interrupt throttle rate */
7e5262732e5b384b6aaeaa77959a6c9dad5d1161Robert Mustacchi /* function pointers */
7e5262732e5b384b6aaeaa77959a6c9dad5d1161Robert Mustacchi /* capabilities */
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale 65535, /* maximum interrupt throttle rate */
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale 0, /* minimum interrupt throttle rate */
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale 200, /* default interrupt throttle rate */
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale /* function pointers */
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale /* capabilities */
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale (IGB_FLAG_HAS_DCA | /* capability flags */
13485e69b5429e6c7d27301fb3c0deee0e93768aGarrett D'Amore 65535, /* maximum interrupt throttle rate */
13485e69b5429e6c7d27301fb3c0deee0e93768aGarrett D'Amore 0, /* minimum interrupt throttle rate */
13485e69b5429e6c7d27301fb3c0deee0e93768aGarrett D'Amore /* function pointers */
13485e69b5429e6c7d27301fb3c0deee0e93768aGarrett D'Amore /* capabilities */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Module Initialization Functions
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_attach - driver attach
c869993e79c1eafbec61a56bf6cea848fe754c71xy * This function is the device specific initialization entry
c869993e79c1eafbec61a56bf6cea848fe754c71xy * point. This entry point is required and must be written.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The DDI_ATTACH command must be provided in the attach entry
c869993e79c1eafbec61a56bf6cea848fe754c71xy * point. When attach() is called with cmd set to DDI_ATTACH,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * all normal kernel services (such as kmem_alloc(9F)) are
c869993e79c1eafbec61a56bf6cea848fe754c71xy * available for use by the driver.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The attach() function will be called once for each instance
c869993e79c1eafbec61a56bf6cea848fe754c71xy * of the device on the system with cmd set to DDI_ATTACH.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Until attach() succeeds, the only driver entry points which
c869993e79c1eafbec61a56bf6cea848fe754c71xy * may be called are open(9E) and getinfo(9E).
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Check the command and perform corresponding operations
c869993e79c1eafbec61a56bf6cea848fe754c71xy switch (cmd) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Get the device instance */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Allocate memory for the instance data structure */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Attach the instance pointer to the dev_info data structure */
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl /* Initialize for fma support */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Map PCI config space registers
c869993e79c1eafbec61a56bf6cea848fe754c71xy if (pci_config_setup(devinfo, &osdep->cfg_handle) != DDI_SUCCESS) {
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to map PCI configurations");
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Identify the chipset family
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to identify hardware");
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Map device registers
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to map device registers");
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize driver parameters
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Allocate interrupts
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to allocate interrupts");
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Allocate rx/tx rings based on the ring numbers.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The actual numbers of rx/tx rings are decided by the number of
c869993e79c1eafbec61a56bf6cea848fe754c71xy * allocated interrupt vectors, so we should allocate the rings after
c869993e79c1eafbec61a56bf6cea848fe754c71xy * interrupts are allocated.
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov "Failed to allocate rx/tx rings or groups");
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Add interrupt handlers
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to add interrupt handlers");
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize driver parameters
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov "Failed to initialize driver settings");
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.cfg_handle) != DDI_FM_OK) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize mutexes for this device.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Do this before enabling the interrupt handler and
c869993e79c1eafbec61a56bf6cea848fe754c71xy * register the softint to avoid the condition where
c869993e79c1eafbec61a56bf6cea848fe754c71xy * interrupt handler can try using uninitialized mutex
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * Initialize the adapter
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (igb_init(igb) != IGB_SUCCESS) {
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to initialize adapter");
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China igb->attach_progress |= ATTACH_PROGRESS_INIT_ADAPTER;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize statistics
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to initialize statistics");
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Register the driver to the MAC
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to register MAC");
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Now that mutex locks are initialized, and the chip is also
c869993e79c1eafbec61a56bf6cea848fe754c71xy * initialized, enable interrupts.
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to enable DDI interrupts");
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_or_32(&igb->igb_state, IGB_INITIALIZED);
7e5262732e5b384b6aaeaa77959a6c9dad5d1161Robert Mustacchi * Newer models have Energy Efficient Ethernet, let's disable this by
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi (void) e1000_set_eee_i350(&igb->hw, B_FALSE, B_FALSE);
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi (void) e1000_set_eee_i354(&igb->hw, B_FALSE, B_FALSE);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_detach - driver detach
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The detach() function is the complement of the attach routine.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If cmd is set to DDI_DETACH, detach() is used to remove the
c869993e79c1eafbec61a56bf6cea848fe754c71xy * state associated with a given instance of a device node
c869993e79c1eafbec61a56bf6cea848fe754c71xy * prior to the removal of that instance from the system.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The detach() function will be called once for each instance
c869993e79c1eafbec61a56bf6cea848fe754c71xy * of the device for which there has been a successful attach()
c869993e79c1eafbec61a56bf6cea848fe754c71xy * once there are no longer any opens on the device.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Interrupts routine are disabled, All memory allocated by this
c869993e79c1eafbec61a56bf6cea848fe754c71xy * driver are freed.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Check detach command
c869993e79c1eafbec61a56bf6cea848fe754c71xy switch (cmd) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Get the pointer to the driver private data structure
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Unregister MAC. If failed, we have to fail the detach
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to unregister MAC");
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If the device is still running, it needs to be stopped first.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * This check is necessary because under some specific circumstances,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * the detach routine can be called without stopping the interface
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_and_32(&igb->igb_state, ~IGB_STARTED);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_stop(igb, B_TRUE);
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Disable and stop the watchdog timer */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Check if there are still rx buffers held by the upper layer.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If so, fail the detach.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Do the remaining unconfigure routines
193974072f41a843678abf5f61979c748687e66bSherry Moore * quiesce(9E) entry point.
193974072f41a843678abf5f61979c748687e66bSherry Moore * This function is called when the system is single-threaded at high
193974072f41a843678abf5f61979c748687e66bSherry Moore * PIL with preemption disabled. Therefore, this function must not be
193974072f41a843678abf5f61979c748687e66bSherry Moore * This function returns DDI_SUCCESS on success, or DDI_FAILURE on failure.
193974072f41a843678abf5f61979c748687e66bSherry Moore * DDI_FAILURE indicates an error condition and should almost never happen.
193974072f41a843678abf5f61979c748687e66bSherry Moore igb = (igb_t *)ddi_get_driver_private(devinfo);
193974072f41a843678abf5f61979c748687e66bSherry Moore * Disable the adapter interrupts
193974072f41a843678abf5f61979c748687e66bSherry Moore /* Tell firmware driver is no longer in control */
193974072f41a843678abf5f61979c748687e66bSherry Moore * Reset the chipset
193974072f41a843678abf5f61979c748687e66bSherry Moore * Reset PHY if possible
193974072f41a843678abf5f61979c748687e66bSherry Moore if (e1000_check_reset_block(hw) == E1000_SUCCESS)
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * igb_unconfigure - release all resources held by this instance
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Disable interrupt
c869993e79c1eafbec61a56bf6cea848fe754c71xy if (igb->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Unregister MAC
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Free statistics
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Remove interrupt handlers
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Remove interrupts
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Remove driver properties
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Stop the adapter
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (igb->attach_progress & ATTACH_PROGRESS_INIT_ADAPTER) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China igb_stop_adapter(igb);
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK)
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic /*
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic * Free multicast table
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic */
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic igb_release_multicast(igb);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Free register handle
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Free PCI config handle
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Free locks
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Free the rx/tx rings
c869993e79c1eafbec61a56bf6cea848fe754c71xy if (igb->attach_progress & ATTACH_PROGRESS_ALLOC_RINGS) {
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl * Remove FMA
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Free the driver data structure
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_register_mac - Register the driver and its function pointers with
c869993e79c1eafbec61a56bf6cea848fe754c71xy * the GLD interface
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China mac->m_priv_props = igb_priv_props;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_identify_hardware - Identify the type of the chipset
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Get the device id
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set the mac type of the adapter based on the device id
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Install adapter capabilities based on mac type
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China switch (hw->mac.type) {
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China case e1000_82575:
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->capab = &igb_82575_cap;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China case e1000_82576:
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->capab = &igb_82576_cap;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China case e1000_82580:
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China igb->capab = &igb_82580_cap;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China return (IGB_FAILURE);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_regs_map - Map the device registers
c869993e79c1eafbec61a56bf6cea848fe754c71xy * First get the size of device registers to be mapped.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China if (ddi_dev_regsize(devinfo, IGB_ADAPTER_REGSET, &mem_size) !=
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China DDI_SUCCESS) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Call ddi_regs_map_setup() to map registers
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China if ((ddi_regs_map_setup(devinfo, IGB_ADAPTER_REGSET,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_init_properties - Initialize driver properties
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Get conf file properties, including link settings
c869993e79c1eafbec61a56bf6cea848fe754c71xy * jumbo frames, ring number, descriptor number, etc.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_init_driver_settings - Initialize driver settings
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The settings include hardware function pointers, bus information,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * rx/tx rings settings, link state, and any other parameters that
c869993e79c1eafbec61a56bf6cea848fe754c71xy * need to be setup during driver initialization.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize chipset specific hardware function pointers
c869993e79c1eafbec61a56bf6cea848fe754c71xy if (e1000_setup_init_funcs(hw, B_TRUE) != E1000_SUCCESS) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Get bus information
d11274aa6f1c1462c11e04d3da70b7453f6f0ebdPaul Guo * Get the system page size
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set rx buffer size
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The IP header alignment room is counted in the calculation.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The rx buffer size is in unit of 1K that is required by the
c869993e79c1eafbec61a56bf6cea848fe754c71xy * chipset hardware.
c869993e79c1eafbec61a56bf6cea848fe754c71xy ((rx_size & (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set tx buffer size
c869993e79c1eafbec61a56bf6cea848fe754c71xy ((tx_size & (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize rx/tx rings parameters
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Initialize values of interrupt throttling rates
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The initial link state should be "unknown"
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_init_locks - Initialize locks
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China mutex_init(&igb->link_lock, NULL,
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China MUTEX_DRIVER, DDI_INTR_PRI(igb->intr_pri));
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_destroy_locks - Destroy locks
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China mutex_destroy(&igb->link_lock);
82722020b3918ce4d9594e3c6e0462bab345d102Crisson Guanghao Hu * Enable interrupts
82722020b3918ce4d9594e3c6e0462bab345d102Crisson Guanghao Hu if (igb->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) {
82722020b3918ce4d9594e3c6e0462bab345d102Crisson Guanghao Hu if (igb_enable_intrs(igb) != IGB_SUCCESS) {
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov "Failed to enable DDI interrupts");
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (igb_start(igb, B_FALSE) != IGB_SUCCESS) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Enable and start the watchdog timer
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_and_32(&igb->igb_state, ~IGB_SUSPENDED);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_or_32(&igb->igb_state, IGB_SUSPENDED);
82722020b3918ce4d9594e3c6e0462bab345d102Crisson Guanghao Hu * Disable interrupts
82722020b3918ce4d9594e3c6e0462bab345d102Crisson Guanghao Hu if (igb->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (!(igb->igb_state & IGB_STARTED)) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China mutex_exit(&igb->gen_lock);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China return (DDI_SUCCESS);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_stop(igb, B_FALSE);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Disable and stop the watchdog timer
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing Chinaigb_init(igb_t *igb)
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China mutex_enter(&igb->gen_lock);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Initilize the adapter
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (igb_init_adapter(igb) != IGB_SUCCESS) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China mutex_exit(&igb->gen_lock);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China igb_fm_ereport(igb, DDI_FM_DEVICE_INVAL_STATE);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China ddi_fm_service_impact(igb->dip, DDI_SERVICE_LOST);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China return (IGB_FAILURE);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China mutex_exit(&igb->gen_lock);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China return (IGB_SUCCESS);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * igb_init_mac_address - Initialize the default MAC address
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * On success, the MAC address is entered in the igb->hw.mac.addr
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * and hw->mac.perm_addr fields and the adapter's RAR(0) receive
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * address register.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Important side effects:
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * 1. adapter is reset - this is required to put it in a known state.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * 2. all of non-volatile memory (NVM) is read & checksummed - NVM is where
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * MAC address and all default settings are stored, so a valid checksum
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * is required.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing Chinaigb_init_mac_address(igb_t *igb)
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Reset chipset to put the hardware in a known state
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * before we try to get MAC address from NVM.
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Adapter reset failed.");
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China goto init_mac_fail;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * NVM validation
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Some PCI-E parts fail the first check due to
c869993e79c1eafbec61a56bf6cea848fe754c71xy * the link being in sleep state. Call it again,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * if it fails a second time its a real issue.
c869993e79c1eafbec61a56bf6cea848fe754c71xy "Invalid NVM checksum. Please contact "
c869993e79c1eafbec61a56bf6cea848fe754c71xy "the vendor to update the NVM.");
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China goto init_mac_fail;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Get the mac address
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * This function should handle SPARC case correctly.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (!igb_find_mac_address(igb)) {
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to get the mac address");
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China goto init_mac_fail;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China /* Validate mac address */
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (!is_valid_mac_addr(hw->mac.addr)) {
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Invalid mac address");
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China goto init_mac_fail;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China return (IGB_SUCCESS);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing Chinainit_mac_fail:
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China return (IGB_FAILURE);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * igb_init_adapter - Initialize the adapter
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing Chinaigb_init_adapter(igb_t *igb)
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China struct e1000_hw *hw = &igb->hw;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China uint32_t pba;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China ASSERT(mutex_owned(&igb->gen_lock));
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * In order to obtain the default MAC address, this will reset the
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * adapter and validate the NVM that the address and many other
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * default settings come from.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (igb_init_mac_address(igb) != IGB_SUCCESS) {
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to initialize MAC address");
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China goto init_adapter_fail;
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * Packet Buffer Allocation (PBA)
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * Writing PBA sets the receive portion of the buffer
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * the remainder is used for the transmit buffer.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China pba = E1000_PBA_34K;
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale /* Special needs in case of Jumbo frames */
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale default_mtu = igb_get_prop(igb, PROP_DEFAULT_MTU,
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale if ((hw->mac.type == e1000_82575) && (default_mtu > ETHERMTU)) {
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale sizeof (struct e1000_tx_desc) - ETHERNET_FCS_SIZE) * 2;
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * if short on rx space, rx wins
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * and must trump tx adjustment
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * These parameters control the automatic generation (Tx) and
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * response (Rx) to Ethernet PAUSE frames.
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * - High water mark should allow for at least two frames to be
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * received after sending an XOFF.
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * - Low water mark works best when it is very near the high water mark.
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * This allows the receiver to restart by sending XON when it has
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale * drained a bit.
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale hw->fc.high_water = hwm & 0xFFF8; /* 8-byte granularity */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China hw->fc.low_water = hw->fc.high_water - 8;
6ed0a5cff079e25f4aa15cef67c6dd48ee60b018Tycho Nightingale hw->fc.high_water = hwm & 0xFFF0; /* 16-byte granularity */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China hw->fc.low_water = hw->fc.high_water - 16;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China (void) e1000_validate_mdi_setting(hw);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Reset the chipset hardware the second time to put PBA settings
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * into effect.
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Second reset failed");
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China goto init_adapter_fail;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Don't wait for auto-negotiation to complete
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Copper options
c869993e79c1eafbec61a56bf6cea848fe754c71xy hw->phy.ms_type = e1000_ms_hw_default; /* E1000_MASTER_SLAVE */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize link settings
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Configure/Initialize hardware
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (e1000_init_hw(hw) != E1000_SUCCESS) {
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Failed to initialize hardware");
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China goto init_adapter_fail;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China * Start the link setup timer
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb_start_link_timer(igb);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Disable wakeup control by default
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Record phy info in hw struct
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China (void) e1000_get_phy_info(hw);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Make sure driver has control
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Restore LED settings to the default from EEPROM
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * to meet the standard for Sun platforms.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China (void) e1000_cleanup_led(hw);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Setup MSI-X interrupts
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->capab->setup_msix(igb);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize unicast addresses.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Setup and initialize the mctable structures.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set interrupt throttling rate
c869993e79c1eafbec61a56bf6cea848fe754c71xy E1000_WRITE_REG(hw, E1000_EITR(i), igb->intr_throttling[i]);
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski * Read identifying information and place in devinfo.
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski (void) e1000_read_nvm(&igb->hw, NVM_OEM_OFFSET_0, 1, &nvmword);
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski (void) e1000_read_nvm(&igb->hw, NVM_OEM_OFFSET_1, 1, &nvmword);
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski (void) ddi_prop_update_int_array(DDI_DEV_T_NONE, igb->dip,
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski (void) e1000_read_pba_string(&igb->hw, pbanum, sizeof (pbanum));
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski (void) ddi_prop_update_string(DDI_DEV_T_NONE, igb->dip,
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski "printed-board-assembly", (char *)pbanum);
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski (void) e1000_read_nvm(&igb->hw, NVM_VERSION, 1, &nvmword);
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski (void) snprintf(eepromver, sizeof (eepromver), "%x.%x",
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski (nvmword & 0xf000) >> 12, (nvmword & 0xff));
69c7619071dc71a079b65cd199d237df0f487d15Keith M Wesolowski (void) ddi_prop_update_string(DDI_DEV_T_NONE, igb->dip,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Save the state of the phy
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_param_sync(igb);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing Chinainit_adapter_fail:
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Reset PHY if possible
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (e1000_check_reset_block(hw) == E1000_SUCCESS)
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China (void) e1000_phy_hw_reset(hw);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China return (IGB_FAILURE);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * igb_stop_adapter - Stop the adapter
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing Chinaigb_stop_adapter(igb_t *igb)
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China /* Stop the link setup timer */
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb_stop_link_timer(igb);
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Tell firmware driver is no longer in control */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Reset the chipset
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * e1000_phy_hw_reset is not needed here, MAC reset above is sufficient
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_reset - Reset the chipset and restart the driver.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * It involves stopping and re-starting the chipset,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * and re-configuring the rx/tx rings.
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_and_32(&igb->igb_state, ~IGB_STARTED);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Disable the adapter interrupts to stop any rx/tx activities
c869993e79c1eafbec61a56bf6cea848fe754c71xy * before draining pending data and resetting hardware.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Drain the pending transmit packets
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Stop the adapter
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China igb_stop_adapter(igb);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Clean the pending tx data/resources
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Start the adapter
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (igb_init_adapter(igb) != IGB_SUCCESS) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Setup the rx/tx rings
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->tx_ring_init = B_FALSE;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_and_32(&igb->igb_state, ~(IGB_ERROR | IGB_STALL));
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Enable adapter interrupts
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The interrupts must be enabled after the driver state is START
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->capab->enable_intr(igb);
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.cfg_handle) != DDI_FM_OK)
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK)
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_or_32(&igb->igb_state, IGB_STARTED);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_tx_clean - Clean the pending transmit packets and DMA resources
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Clean the pending tx data - the pending packets in the
c869993e79c1eafbec61a56bf6cea848fe754c71xy * work_list that have no chances to be transmitted again.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * We must ensure the chipset is stopped or the link is down
c869993e79c1eafbec61a56bf6cea848fe754c71xy * before cleaning the transmit packets.
fa25784ca4b51c206177d891a654f1d36a25d41fxy * Reset the head and tail pointers of the tbd ring;
fa25784ca4b51c206177d891a654f1d36a25d41fxy * Reset the head write-back if it is enabled.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Add the tx control blocks in the pending list to
c869993e79c1eafbec61a56bf6cea848fe754c71xy * the free list.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_tx_drain - Drain the tx rings to allow pending packets to be transmitted
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Wait for a specific time to allow pending tx packets
c869993e79c1eafbec61a56bf6cea848fe754c71xy * to be transmitted.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Check the counter tbd_free to see if transmission is done.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * No lock protection is needed here.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Return B_TRUE if all pending packets have been transmitted;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Otherwise return B_FALSE;
c869993e79c1eafbec61a56bf6cea848fe754c71xy for (i = 0; i < TX_DRAIN_TIME; i++) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_rx_drain - Wait for all rx buffers to be released by upper layer
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Polling the rx free list to check if those rx buffers held by
c869993e79c1eafbec61a56bf6cea848fe754c71xy * the upper layer are released.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Check the counter rcb_free to see if all pending buffers are
c869993e79c1eafbec61a56bf6cea848fe754c71xy * released. No lock protection is needed here.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Return B_TRUE if all pending buffers have been released;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Otherwise return B_FALSE;
c869993e79c1eafbec61a56bf6cea848fe754c71xy for (i = 0; i < RX_DRAIN_TIME; i++) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China done = (igb->rcb_pending == 0);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_start - Start the driver/chipset
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing Chinaigb_start(igb_t *igb, boolean_t alloc_buffer)
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (alloc_buffer) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (igb_alloc_rx_data(igb) != IGB_SUCCESS) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China "Failed to allocate software receive rings");
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China return (IGB_FAILURE);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China /* Allocate buffers for all the rx/tx rings */
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (igb_alloc_dma(igb) != IGB_SUCCESS) {
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov "Failed to allocate DMA resource");
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China return (IGB_FAILURE);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->tx_ring_init = B_TRUE;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->tx_ring_init = B_FALSE;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Start the adapter
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if ((igb->attach_progress & ATTACH_PROGRESS_INIT_ADAPTER) == 0) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (igb_init_adapter(igb) != IGB_SUCCESS) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China igb->attach_progress |= ATTACH_PROGRESS_INIT_ADAPTER;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * Setup the rx/tx rings
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_setup_rings(igb);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Enable adapter interrupts
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The interrupts must be enabled after the driver state is START
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->capab->enable_intr(igb);
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.cfg_handle) != DDI_FM_OK)
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK)
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi (void) e1000_set_eee_i350(&igb->hw, B_FALSE, B_FALSE);
49b7860084dbba18bc00b29413d6182197f9fe93Robert Mustacchi (void) e1000_set_eee_i354(&igb->hw, B_FALSE, B_FALSE);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_stop - Stop the driver/chipset
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing Chinaigb_stop(igb_t *igb, boolean_t free_buffer)
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China igb->attach_progress &= ~ATTACH_PROGRESS_INIT_ADAPTER;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Disable the adapter interrupts
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Drain the pending tx packets
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Stop the adapter
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China igb_stop_adapter(igb);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Clean the pending tx data/resources
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK)
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (igb->link_state == LINK_STATE_UP) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->link_state = LINK_STATE_UNKNOWN;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China mac_link_update(igb->mac_hdl, igb->link_state);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (free_buffer) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * Release the DMA/memory resources of rx/tx rings
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_free_dma(igb);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_free_rx_data(igb);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_alloc_rings - Allocate memory space for rx/tx rings
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Allocate memory space for rx rings
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Allocate memory space for tx rings
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Allocate memory space for rx ring groups
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_free_rings - Free the memory space of rx/tx rings.
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing Chinaigb_alloc_rx_data(igb_t *igb)
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_rx_ring_t *rx_ring;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China for (i = 0; i < igb->num_rx_rings; i++) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China rx_ring = &igb->rx_rings[i];
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (igb_alloc_rx_ring_data(rx_ring) != IGB_SUCCESS)
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China goto alloc_rx_rings_failure;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China return (IGB_SUCCESS);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing Chinaalloc_rx_rings_failure:
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_free_rx_data(igb);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China return (IGB_FAILURE);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing Chinaigb_free_rx_data(igb_t *igb)
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_rx_ring_t *rx_ring;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_rx_data_t *rx_data;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China for (i = 0; i < igb->num_rx_rings; i++) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China rx_ring = &igb->rx_rings[i];
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China mutex_enter(&igb->rx_pending_lock);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China rx_data = rx_ring->rx_data;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (rx_data != NULL) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China rx_data->flag |= IGB_RX_STOPPED;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (rx_data->rcb_pending == 0) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_free_rx_ring_data(rx_data);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China rx_ring->rx_data = NULL;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China mutex_exit(&igb->rx_pending_lock);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_setup_rings - Setup rx/tx rings
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Setup the rx/tx rings, including the following:
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 1. Setup the descriptor ring and the control block buffers;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 2. Initialize necessary registers for receive/transmit;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 3. Initialize software pointers/parameters for receive/transmit;
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_rx_data_t *rx_data = rx_ring->rx_data;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China uint32_t rxdctl;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Initialize descriptor ring with buffer addresses
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China rcb = rx_data->work_list[i];
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China rbd = &rx_data->rbd_ring[i];
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Initialize the base address registers
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China buf_low = (uint32_t)rx_data->rbd_area.dma_address;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China buf_high = (uint32_t)(rx_data->rbd_area.dma_address >> 32);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_RDBAH(rx_ring->index), buf_high);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_RDBAL(rx_ring->index), buf_low);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize the length register
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China size = rx_data->ring_size * sizeof (union e1000_adv_rx_desc);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Initialize buffer size & descriptor type
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_SRRCTL(rx_ring->index),
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China ((igb->rx_buf_size >> E1000_SRRCTL_BSIZEPKT_SHIFT) |
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China E1000_SRRCTL_DESCTYPE_ADV_ONEBUF));
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Setup the Receive Descriptor Control Register (RXDCTL)
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(rx_ring->index));
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China rxdctl &= igb->capab->rxdctl_mask;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China rxdctl |= E1000_RXDCTL_QUEUE_ENABLE;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China rxdctl |= 16; /* pthresh */
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China rxdctl |= 8 << 8; /* hthresh */
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China rxdctl |= 1 << 16; /* wthresh */
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_RXDCTL(rx_ring->index), rxdctl);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China rx_data->rbd_next = 0;
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_rx_data_t *rx_data;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China uint32_t rctl, rxcsum;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Setup the Receive Control Register (RCTL), and enable the
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * receiver. The initial configuration is to: enable the receiver,
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * accept broadcasts, discard bad packets, accept long packets,
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * disable VLAN filter checking, and set receive buffer size to
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * 2k. For 82575, also set the receive descriptor minimum
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * threshold size to 1/2 the ring.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China rctl = E1000_READ_REG(hw, E1000_RCTL);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Clear the field used for wakeup control. This driver doesn't do
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * wakeup but leave this here for completeness.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China rctl &= ~(3 << E1000_RCTL_MO_SHIFT);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China rctl |= (E1000_RCTL_EN | /* Enable Receive Unit */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_RCTL_BAM | /* Accept Broadcast Packets */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_RCTL_LPE | /* Large Packet Enable */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* Multicast filter offset */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China (hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT) |
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_RCTL_RDMTS_HALF | /* rx descriptor threshold */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_RCTL_SECRC); /* Strip Ethernet CRC */
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Set up all rx descriptor rings - must be called before receive unit
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng ring_per_group = igb->num_rx_rings / igb->num_rx_groups;
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Map a ring to a group by assigning a group index
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Setup the Rx Long Packet Max Length register
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Hardware checksum settings
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Setup classify and RSS for multiple receive queues
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * One ring group, only RSS is needed when more than
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * one ring enabled.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Multiple groups, each group has one ring,
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * only the MAC classification is needed.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Multiple groups and multiple rings, both
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * MAC classification and RSS are needed.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Enable the receive unit - must be done after all
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * the rx setup above.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_RCTL, rctl);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Initialize all adapter ring head & tail pointers - must
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * be done after receive unit is enabled
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China for (i = 0; i < igb->num_rx_rings; i++) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China rx_ring = &igb->rx_rings[i];
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China rx_data = rx_ring->rx_data;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_RDH(i), 0);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_RDT(i), rx_data->ring_size - 1);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * 82575 with manageability enabled needs a special flush to make
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * sure the fifos start clean.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if ((hw->mac.type == e1000_82575) &&
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China (E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_RCV_TCO_EN)) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China e1000_rx_fifo_flush_82575(hw);
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize the length register
c869993e79c1eafbec61a56bf6cea848fe754c71xy size = tx_ring->ring_size * sizeof (union e1000_adv_tx_desc);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize the base address registers
c869993e79c1eafbec61a56bf6cea848fe754c71xy buf_high = (uint32_t)(tx_ring->tbd_area.dma_address >> 32);
c869993e79c1eafbec61a56bf6cea848fe754c71xy E1000_WRITE_REG(hw, E1000_TDBAL(tx_ring->index), buf_low);
c869993e79c1eafbec61a56bf6cea848fe754c71xy E1000_WRITE_REG(hw, E1000_TDBAH(tx_ring->index), buf_high);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Setup head & tail pointers
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Setup head write-back
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The memory of the head write-back is allocated using
c869993e79c1eafbec61a56bf6cea848fe754c71xy * the extra tbd beyond the tail of the tbd ring.
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Set the head write-back enable bit */
c869993e79c1eafbec61a56bf6cea848fe754c71xy E1000_WRITE_REG(hw, E1000_TDWBAL(tx_ring->index), buf_low);
c869993e79c1eafbec61a56bf6cea848fe754c71xy E1000_WRITE_REG(hw, E1000_TDWBAH(tx_ring->index), buf_high);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Turn off relaxed ordering for head write back or it will
c869993e79c1eafbec61a56bf6cea848fe754c71xy * cause problems with the tx recycling
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (igb->tx_ring_init == B_TRUE) {
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Enable TXDCTL per queue
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China reg_val = E1000_READ_REG(hw, E1000_TXDCTL(tx_ring->index));
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China reg_val |= E1000_TXDCTL_QUEUE_ENABLE;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_TXDCTL(tx_ring->index), reg_val);
d11274aa6f1c1462c11e04d3da70b7453f6f0ebdPaul Guo * Initialize hardware checksum offload settings
d11274aa6f1c1462c11e04d3da70b7453f6f0ebdPaul Guo bzero(&tx_ring->tx_context, sizeof (tx_context_t));
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Setup the Transmit Control Register (TCTL)
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China reg_val = E1000_READ_REG(hw, E1000_TCTL);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China reg_val &= ~E1000_TCTL_CT;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China reg_val |= E1000_TCTL_PSP | E1000_TCTL_RTLC |
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* Enable transmits */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China reg_val |= E1000_TCTL_EN;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_TCTL, reg_val);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_setup_rss - Setup receive-side scaling feature
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China int shift = 0;
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Setup the Redirection Table */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China if (hw->mac.type == e1000_82576) {
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China } else if (hw->mac.type == e1000_82575) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Fill out hash function seeds */
c869993e79c1eafbec61a56bf6cea848fe754c71xy for (i = 0; i < 10; i++) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Setup the Multiple Receive Queue Control register */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Disable Packet Checksum to enable RSS for multiple receive queues.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The Packet Checksum is not ethernet CRC. It is another kind of
c869993e79c1eafbec61a56bf6cea848fe754c71xy * checksum offloading provided by the 82575 chipset besides the IP
c869993e79c1eafbec61a56bf6cea848fe754c71xy * header checksum offloading and the TCP/UDP checksum offloading.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The Packet Checksum is by default computed over the entire packet
c869993e79c1eafbec61a56bf6cea848fe754c71xy * from the first byte of the DA through the last byte of the CRC,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * including the Ethernet and IP headers.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * It is a hardware limitation that Packet Checksum is mutually
c869993e79c1eafbec61a56bf6cea848fe754c71xy * exclusive with RSS.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * igb_setup_mac_rss_classify - Setup MAC classification and rss
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng ring_per_group = igb->num_rx_rings / igb->num_rx_groups;
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng /* Setup the Redirection Table, it is shared between two groups */
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng reta.bytes[i & 3] = ((i % ring_per_group) << shift_group0) |
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng ((ring_per_group + (i % ring_per_group)) << shift_group1);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng /* Fill out hash function seeds */
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng for (i = 0; i < 10; i++) {
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng (void) random_get_pseudo_bytes((uint8_t *)&random,
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Setup the Multiple Receive Queue Control register,
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * enable VMDq based on packet destination MAC address and RSS.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng /* Define the default group and default queues */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_VT_CTL, vmdctl);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Disable Packet Checksum to enable RSS for multiple receive queues.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * The Packet Checksum is not ethernet CRC. It is another kind of
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * checksum offloading provided by the 82575 chipset besides the IP
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * header checksum offloading and the TCP/UDP checksum offloading.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * The Packet Checksum is by default computed over the entire packet
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * from the first byte of the DA through the last byte of the CRC,
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * including the Ethernet and IP headers.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * It is a hardware limitation that Packet Checksum is mutually
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * exclusive with RSS.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * igb_setup_mac_classify - Setup MAC classification feature
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Setup the Multiple Receive Queue Control register,
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * enable VMDq based on packet destination MAC address.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Disable Packet Checksum to enable RSS for multiple receive queues.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * The Packet Checksum is not ethernet CRC. It is another kind of
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * checksum offloading provided by the 82575 chipset besides the IP
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * header checksum offloading and the TCP/UDP checksum offloading.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * The Packet Checksum is by default computed over the entire packet
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * from the first byte of the DA through the last byte of the CRC,
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * including the Ethernet and IP headers.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * It is a hardware limitation that Packet Checksum is mutually
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * exclusive with RSS.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_init_unicst - Initialize the unicast addresses
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Here we should consider two situations:
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 1. Chipset is initialized the first time
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Initialize the multiple unicast addresses, and
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * save the default MAC address.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 2. Chipset is reset
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Recover the multiple unicast addresses from the
c869993e79c1eafbec61a56bf6cea848fe754c71xy * software data structure to the RAR registers.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Clear the default MAC address in the RAR0 rgister,
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * which is loaded from EEPROM when system boot or chipreset,
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * this will cause the conficts with add_mac/rem_mac entry
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * points when VMDq is enabled. For this reason, the RAR0
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * must be cleared for both cases mentioned above.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng /* Initialize the multiple unicast addresses */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Re-configure the RAR registers */
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng for (slot = 0; slot < igb->unicst_total; slot++) {
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * igb_unicst_find - Find the slot for the specified unicast address
da14cebe459d3275048785f25bd869cb09b5307fEric Chengigb_unicst_find(igb_t *igb, const uint8_t *mac_addr)
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng for (slot = 0; slot < igb->unicst_total; slot++) {
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng return (-1);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_unicst_set - Set the unicast address to the specified slot
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Save the unicast address in the software data structure
c869993e79c1eafbec61a56bf6cea848fe754c71xy bcopy(mac_addr, igb->unicst_addr[slot].mac.addr, ETHERADDRL);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set the unicast address to the RAR register
c124a83e09115de88ecccd4f689983f42a1d53bdRobert Mustacchi (void) e1000_rar_set(hw, (uint8_t *)mac_addr, slot);
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy return (0);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_multicst_add - Add a multicst address
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic struct ether_addr *new_table;
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic size_t new_len;
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic size_t old_len;
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_ERROR, "Illegal multicast address");
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic if (igb->mcast_count >= igb->mcast_max_num) {
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov "Adapter requested more than %d mcast addresses",
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic igb->mcast_max_num);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic if (igb->mcast_count == igb->mcast_alloc_count) {
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic old_len = igb->mcast_alloc_count *
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic sizeof (struct ether_addr);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic new_len = (igb->mcast_alloc_count + MCAST_ALLOC_COUNT) *
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic sizeof (struct ether_addr);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic new_table = kmem_alloc(new_len, KM_NOSLEEP);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic if (new_table == NULL) {
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic "Not enough memory to alloc mcast table");
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic return (ENOMEM);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic }
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic if (igb->mcast_table != NULL) {
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic bcopy(igb->mcast_table, new_table, old_len);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic kmem_free(igb->mcast_table, old_len);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic }
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic igb->mcast_alloc_count += MCAST_ALLOC_COUNT;
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic igb->mcast_table = new_table;
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic }
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Update the multicast table in the hardware
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy return (0);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_multicst_remove - Remove a multicst address
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic struct ether_addr *new_table;
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic size_t new_len;
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic size_t old_len;
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic if ((igb->mcast_alloc_count - igb->mcast_count) >
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic MCAST_ALLOC_COUNT) {
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic old_len = igb->mcast_alloc_count *
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic sizeof (struct ether_addr);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic new_len = (igb->mcast_alloc_count - MCAST_ALLOC_COUNT) *
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic sizeof (struct ether_addr);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic new_table = kmem_alloc(new_len, KM_NOSLEEP);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic if (new_table != NULL) {
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic bcopy(igb->mcast_table, new_table, new_len);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic kmem_free(igb->mcast_table, old_len);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic igb->mcast_alloc_count -= MCAST_ALLOC_COUNT;
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic igb->mcast_table = new_table;
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic }
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic }
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Update the multicast table in the hardware
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy return (0);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republicstatic void
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republicigb_release_multicast(igb_t *igb)
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic{
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic if (igb->mcast_table != NULL) {
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic kmem_free(igb->mcast_table,
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic igb->mcast_alloc_count * sizeof (struct ether_addr));
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic igb->mcast_table = NULL;
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic }
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic}
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_setup_multicast - setup multicast data structures
c869993e79c1eafbec61a56bf6cea848fe754c71xy * This routine initializes all of the multicast related structures
c869993e79c1eafbec61a56bf6cea848fe754c71xy * and save them in the hardware registers.
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic ASSERT(igb->mcast_count <= igb->mcast_max_num);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Update the multicase addresses to the MTA registers
7d46e7ad7bb3e7ef36bb4f0816ad4d6c2784f405zhefeng xu - Sun Microsystems - Beijing China e1000_update_mc_addr_list(hw, mc_addr_list, mc_addr_count);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_get_conf - Get driver configurations set in driver.conf
c869993e79c1eafbec61a56bf6cea848fe754c71xy * This routine gets user-configured values out of the configuration
c869993e79c1eafbec61a56bf6cea848fe754c71xy * For each configurable value, there is a minimum, a maximum, and a
c869993e79c1eafbec61a56bf6cea848fe754c71xy * default.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If user does not configure a value, use the default.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If user configures below the minimum, use the minumum.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If user configures above the maximum, use the maxumum.
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb driver supports the following user configurations:
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Link configurations:
c869993e79c1eafbec61a56bf6cea848fe754c71xy * adv_autoneg_cap
c869993e79c1eafbec61a56bf6cea848fe754c71xy * adv_1000fdx_cap
c869993e79c1eafbec61a56bf6cea848fe754c71xy * adv_100fdx_cap
c869993e79c1eafbec61a56bf6cea848fe754c71xy * adv_100hdx_cap
c869993e79c1eafbec61a56bf6cea848fe754c71xy * adv_10fdx_cap
c869993e79c1eafbec61a56bf6cea848fe754c71xy * adv_10hdx_cap
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Note: 1000hdx is not supported.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Jumbo frame configuration:
c869993e79c1eafbec61a56bf6cea848fe754c71xy * default_mtu
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Ethernet flow control configuration:
c869993e79c1eafbec61a56bf6cea848fe754c71xy * flow_control
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Multiple rings configurations:
c869993e79c1eafbec61a56bf6cea848fe754c71xy * tx_queue_number
c869993e79c1eafbec61a56bf6cea848fe754c71xy * tx_ring_size
c869993e79c1eafbec61a56bf6cea848fe754c71xy * rx_queue_number
c869993e79c1eafbec61a56bf6cea848fe754c71xy * rx_ring_size
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Call igb_get_prop() to get the value for a specific
c869993e79c1eafbec61a56bf6cea848fe754c71xy * configuration parameter.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Link configurations
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Jumbo frame configurations
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Ethernet flow control configuration
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China hw->fc.requested_mode = flow_control;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Multiple rings configurations
c869993e79c1eafbec61a56bf6cea848fe754c71xy MIN_TX_RING_SIZE, MAX_TX_RING_SIZE, DEFAULT_TX_RING_SIZE);
c869993e79c1eafbec61a56bf6cea848fe754c71xy MIN_RX_RING_SIZE, MAX_RX_RING_SIZE, DEFAULT_RX_RING_SIZE);
7d46e7ad7bb3e7ef36bb4f0816ad4d6c2784f405zhefeng xu - Sun Microsystems - Beijing China igb->mr_enable = igb_get_prop(igb, PROP_MR_ENABLE, 0, 1, 0);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng igb->num_rx_groups = igb_get_prop(igb, PROP_RX_GROUP_NUM,
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng MIN_RX_GROUP_NUM, MAX_RX_GROUP_NUM, DEFAULT_RX_GROUP_NUM);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * Currently we do not support VMDq for 82576 and 82580.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * If it is e1000_82576, set num_rx_groups to 1.
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China if (hw->mac.type >= e1000_82576)
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->num_rx_groups = 1;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->num_tx_rings = igb->capab->def_tx_que_num;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->num_rx_rings = igb->capab->def_rx_que_num;
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng "Invalid rx groups number. Please enable multiple "
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng "rings first");
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Check the divisibility between rx rings and rx groups.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng "Invalid rx groups number. Downgrade the rx group "
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng "number to %d.", i);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Get the ring number per group.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng ring_per_group = igb->num_rx_rings / igb->num_rx_groups;
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * One rx ring group, the rx ring number is num_rx_rings.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Multiple rx groups, each group has one rx ring.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Multiple groups and multiple rings.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Tunable used to force an interrupt type. The only use is
c869993e79c1eafbec61a56bf6cea848fe754c71xy * for testing of the lesser interrupt types.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 0 = don't force interrupt type
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 1 = force interrupt type MSIX
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 2 = force interrupt type MSI
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 3 = force interrupt type Legacy
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->tx_hcksum_enable = igb_get_prop(igb, PROP_TX_HCKSUM_ENABLE,
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->rx_hcksum_enable = igb_get_prop(igb, PROP_RX_HCKSUM_ENABLE,
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->tx_head_wb_enable = igb_get_prop(igb, PROP_TX_HEAD_WB_ENABLE,
d11274aa6f1c1462c11e04d3da70b7453f6f0ebdPaul Guo * igb LSO needs the tx h/w checksum support.
d11274aa6f1c1462c11e04d3da70b7453f6f0ebdPaul Guo * Here LSO will be disabled if tx h/w checksum has been disabled.
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->tx_copy_thresh = igb_get_prop(igb, PROP_TX_COPY_THRESHOLD,
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->tx_recycle_thresh = igb_get_prop(igb, PROP_TX_RECYCLE_THRESHOLD,
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->tx_overload_thresh = igb_get_prop(igb, PROP_TX_OVERLOAD_THRESHOLD,
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->tx_resched_thresh = igb_get_prop(igb, PROP_TX_RESCHED_THRESHOLD,
69b2d733deffed6bf9baf89d901afd9c81b484edGuoqing Zhu MIN(igb->tx_ring_size, MAX_TX_RESCHED_THRESHOLD),
69b2d733deffed6bf9baf89d901afd9c81b484edGuoqing Zhu igb->tx_ring_size > DEFAULT_TX_RESCHED_THRESHOLD ?
69b2d733deffed6bf9baf89d901afd9c81b484edGuoqing Zhu DEFAULT_TX_RESCHED_THRESHOLD : DEFAULT_TX_RESCHED_THRESHOLD_LOW);
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->rx_copy_thresh = igb_get_prop(igb, PROP_RX_COPY_THRESHOLD,
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->rx_limit_per_intr = igb_get_prop(igb, PROP_RX_LIMIT_PER_INTR,
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->intr_throttling[0] = igb_get_prop(igb, PROP_INTR_THROTTLING,
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->capab->min_intr_throttle,
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->capab->max_intr_throttle,
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->capab->def_intr_throttle);
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic /*
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic * Max number of multicast addresses
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic */
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic igb->mcast_max_num =
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic igb_get_prop(igb, PROP_MCAST_MAX_NUM,
6ca163a136944eea4423498926e09cef9889312cvitezslav batrla - Sun Microsystems - Prague Czech Republic MIN_MCAST_NUM, MAX_MCAST_NUM, DEFAULT_MCAST_NUM);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_get_prop - Get a property value out of the configuration file igb.conf
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Caller provides the name of the property, a default value, a minimum
c869993e79c1eafbec61a56bf6cea848fe754c71xy * value, and a maximum value.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Return configured value of the property, with default, minimum and
c869993e79c1eafbec61a56bf6cea848fe754c71xy * maximum properly applied.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Call ddi_prop_get_int() to read the conf settings
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_setup_link - Using the link properties to setup the link
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 1000hdx is not supported for autonegotiation
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 1000fdx and 1000hdx are not supported for forced link
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_INFO, "Invalid link settings. Setup "
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov "link to autonegotiation with full link capabilities.");
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_is_link_up - Check if the link is up
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China boolean_t link_up = B_FALSE;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * get_link_status is set in the interrupt handler on link-status-change
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * or rx sequence error interrupt. get_link_status will stay
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * false until the e1000_check_for_link establishes link only
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * for copper adapters.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China switch (hw->phy.media_type) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China case e1000_media_type_copper:
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (hw->mac.get_link_status) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China (void) e1000_check_for_link(hw);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China link_up = !hw->mac.get_link_status;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China link_up = B_TRUE;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China case e1000_media_type_fiber:
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China (void) e1000_check_for_link(hw);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China link_up = (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China case e1000_media_type_internal_serdes:
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China (void) e1000_check_for_link(hw);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China link_up = hw->mac.serdes_has_link;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_link_check - Link status processing
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The Link is up, check whether it was marked as down earlier
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China if (!igb->link_complete)
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb_stop_link_timer(igb);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China } else if (igb->link_complete) {
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) {
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China return (B_FALSE);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_local_timer - driver watchdog function
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * This function will handle the hardware stall check, link status
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * check and other routines.
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China boolean_t link_changed = B_FALSE;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China if (igb->igb_state & IGB_ERROR) {
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb->reset_count++;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China if (igb_reset(igb) == IGB_SUCCESS)
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China ddi_fm_service_impact(igb->dip, DDI_SERVICE_RESTORED);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb_restart_watchdog_timer(igb);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China if (igb_stall_check(igb) || (igb->igb_state & IGB_STALL)) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China ddi_fm_service_impact(igb->dip, DDI_SERVICE_LOST);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China ddi_fm_service_impact(igb->dip, DDI_SERVICE_RESTORED);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb_restart_watchdog_timer(igb);
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (!(igb->igb_state & IGB_SUSPENDED) && (igb->igb_state & IGB_STARTED))
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China link_changed = igb_link_check(igb);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China * igb_link_timer - link setup timer function
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China * It is called when the timer for link setup is expired, which indicates
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China * the completion of the link setup. The link state will not be updated
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China * until the link setup is completed. And the link state will not be sent
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China * to the upper layer through mac_link_update() in this function. It will
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China * be updated in the local timer routine or the interrupts service routine
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China * after the interface is started (plumbed).
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing Chinaigb_link_timer(void *arg)
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb_t *igb = (igb_t *)arg;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China mutex_enter(&igb->link_lock);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb->link_complete = B_TRUE;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb->link_tid = 0;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China mutex_exit(&igb->link_lock);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_stall_check - check for transmit stall
c869993e79c1eafbec61a56bf6cea848fe754c71xy * This function checks if the adapter is stalled (in transmit).
c869993e79c1eafbec61a56bf6cea848fe754c71xy * It is called each time the watchdog timeout is invoked.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If the transmit descriptor reclaim continuously fails,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * the watchdog value will increment by 1. If the watchdog
c869993e79c1eafbec61a56bf6cea848fe754c71xy * value exceeds the threshold, the igb is assumed to
c869993e79c1eafbec61a56bf6cea848fe754c71xy * have stalled and need to be reset.
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China struct e1000_hw *hw = &igb->hw;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If any tx ring is stalled, we'll reset the chipset
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China if (hw->mac.type == e1000_82580) {
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China hw->dev_spec._82575.global_device_reset
c869993e79c1eafbec61a56bf6cea848fe754c71xy * is_valid_mac_addr - Check if the mac address is valid
c869993e79c1eafbec61a56bf6cea848fe754c71xy * The "vendor's factory-set address" may already have
c869993e79c1eafbec61a56bf6cea848fe754c71xy * been extracted from the chip, but if the property
c869993e79c1eafbec61a56bf6cea848fe754c71xy * "local-mac-address" is set we use that instead.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * We check whether it looks like an array of 6
c869993e79c1eafbec61a56bf6cea848fe754c71xy * bytes (which it should, if OBP set it). If we can't
c869993e79c1eafbec61a56bf6cea848fe754c71xy * make sense of it this way, we'll ignore it.
c869993e79c1eafbec61a56bf6cea848fe754c71xy err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, igb->dip,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Look up the OBP property "local-mac-address?". If the user has set
c869993e79c1eafbec61a56bf6cea848fe754c71xy * 'local-mac-address? = false', use "the system address" instead.
c869993e79c1eafbec61a56bf6cea848fe754c71xy if (ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, igb->dip, 0,
c869993e79c1eafbec61a56bf6cea848fe754c71xy "local-mac-address?", &bytes, &nelts) == DDI_PROP_SUCCESS) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy if (strncmp("false", (caddr_t)bytes, (size_t)nelts) == 0) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Finally(!), if there's a valid "mac-address" property (created
c869993e79c1eafbec61a56bf6cea848fe754c71xy * if we netbooted from this interface), we must use this instead
c869993e79c1eafbec61a56bf6cea848fe754c71xy * of any of the above to ensure that the NFS/install server doesn't
c869993e79c1eafbec61a56bf6cea848fe754c71xy * get confused by the address changing as Solaris takes over!
c869993e79c1eafbec61a56bf6cea848fe754c71xy err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, igb->dip,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Read the device MAC address from the EEPROM
c869993e79c1eafbec61a56bf6cea848fe754c71xy#pragma inline(igb_arm_watchdog_timer)
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Fire a watchdog timer
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_enable_watchdog_timer - Enable and start the driver watchdog timer
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_disable_watchdog_timer - Disable and stop the driver watchdog timer
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_start_watchdog_timer - Start the driver watchdog timer
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_restart_watchdog_timer - Restart the driver watchdog timer
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_stop_watchdog_timer - Stop the driver watchdog timer
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China * igb_start_link_timer - Start the link setup timer
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing Chinaigb_start_link_timer(struct igb *igb)
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China struct e1000_hw *hw = &igb->hw;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China clock_t link_timeout;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China if (hw->mac.autoneg)
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China link_timeout = PHY_AUTO_NEG_LIMIT *
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China drv_usectohz(100000);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China link_timeout = PHY_FORCE_LIMIT * drv_usectohz(100000);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China mutex_enter(&igb->link_lock);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China if (hw->phy.autoneg_wait_to_complete) {
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb->link_complete = B_TRUE;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb->link_complete = B_FALSE;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb->link_tid = timeout(igb_link_timer, (void *)igb,
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China link_timeout);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China mutex_exit(&igb->link_lock);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China * igb_stop_link_timer - Stop the link setup timer
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing Chinaigb_stop_link_timer(struct igb *igb)
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China timeout_id_t tid;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China mutex_enter(&igb->link_lock);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb->link_complete = B_TRUE;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China tid = igb->link_tid;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China igb->link_tid = 0;
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China mutex_exit(&igb->link_lock);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China (void) untimeout(tid);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_disable_adapter_interrupts - Clear/disable all hardware interrupts
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set the IMC register to mask all the interrupts,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * including the tx interrupts.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IMC, ~0);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IAM, 0);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Additional disabling for MSI-X
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_EIMC, ~0);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_EIAC, 0);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_EIAM, 0);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * igb_enable_adapter_interrupts_82580 - Enable NIC interrupts for 82580
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing Chinaigb_enable_adapter_interrupts_82580(igb_t *igb)
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China struct e1000_hw *hw = &igb->hw;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* Clear any pending interrupts */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China (void) E1000_READ_REG(hw, E1000_ICR);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China igb->ims_mask |= E1000_IMS_DRSTA;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China if (igb->intr_type == DDI_INTR_TYPE_MSIX) {
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* Interrupt enabling for MSI-X */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_EIMS, igb->eims_mask);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_EIAC, igb->eims_mask);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China igb->ims_mask = (E1000_IMS_LSC | E1000_IMS_DRSTA);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IMS, igb->ims_mask);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China } else { /* Interrupt enabling for MSI and legacy */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IVAR0, E1000_IVAR_VALID);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China igb->ims_mask = IMS_ENABLE_MASK | E1000_IMS_TXQE;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China igb->ims_mask |= E1000_IMS_DRSTA;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IMS, igb->ims_mask);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* Disable auto-mask for ICR interrupt bits */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IAM, 0);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_FLUSH(hw);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * igb_enable_adapter_interrupts_82576 - Enable NIC interrupts for 82576
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing Chinaigb_enable_adapter_interrupts_82576(igb_t *igb)
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China struct e1000_hw *hw = &igb->hw;
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China /* Clear any pending interrupts */
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China (void) E1000_READ_REG(hw, E1000_ICR);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China if (igb->intr_type == DDI_INTR_TYPE_MSIX) {
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* Interrupt enabling for MSI-X */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_EIMS, igb->eims_mask);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_EIAC, igb->eims_mask);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->ims_mask = E1000_IMS_LSC;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_LSC);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* Interrupt enabling for MSI and legacy */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IVAR0, E1000_IVAR_VALID);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->ims_mask = IMS_ENABLE_MASK | E1000_IMS_TXQE;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IMS,
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China (IMS_ENABLE_MASK | E1000_IMS_TXQE));
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* Disable auto-mask for ICR interrupt bits */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IAM, 0);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_FLUSH(hw);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * igb_enable_adapter_interrupts_82575 - Enable NIC interrupts for 82575
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing Chinaigb_enable_adapter_interrupts_82575(igb_t *igb)
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China /* Clear any pending interrupts */
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China (void) E1000_READ_REG(hw, E1000_ICR);
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Interrupt enabling for MSI-X */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Enable MSI-X PBA support */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Non-selective interrupt clear-on-read */
c869993e79c1eafbec61a56bf6cea848fe754c71xy reg |= E1000_CTRL_EXT_IRCA; /* Called NSICR in the EAS */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Interrupt enabling for MSI and legacy */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Loopback Support
c869993e79c1eafbec61a56bf6cea848fe754c71xyigb_loopback_ioctl(igb_t *igb, struct iocblk *iocp, mblk_t *mp)
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) {
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_set_loopback_mode - Setup loopback based on the loopback mode
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Reset the chip */
c869993e79c1eafbec61a56bf6cea848fe754c71xy switch (mode) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * When external loopback is set, wait up to 1000ms to get the link up.
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * According to test, 1000ms can work and it's an experimental value.
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (mode == IGB_LB_EXTERNAL) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China for (i = 0; i <= 10; i++) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China mutex_enter(&igb->gen_lock);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (void) igb_link_check(igb);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China mutex_exit(&igb->gen_lock);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (igb->link_state == LINK_STATE_UP)
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China msec_delay(100);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (igb->link_state != LINK_STATE_UP) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * Does not support external loopback.
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * Reset driver to loopback none.
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->loopback_mode = IGB_LB_NONE;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China /* Reset the chip */
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China hw->phy.autoneg_wait_to_complete = B_TRUE;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (void) igb_reset(igb);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China hw->phy.autoneg_wait_to_complete = B_FALSE;
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_INFO, "Set external loopback "
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov "failed, reset to loopback none.");
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China return (B_FALSE);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_set_external_loopback - Set the external loopback mode
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
69b2d733deffed6bf9baf89d901afd9c81b484edGuoqing Zhu /* Set link mode to PHY (00b) in the Extended Control register */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_set_internal_phy_loopback - Set the internal PHY loopback mode
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Set link mode to PHY (00b) in the Extended Control register */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set PHY control register (0x4140):
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set full duplex mode
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set loopback bit
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Clear auto-neg enable bit
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set PHY speed
c869993e79c1eafbec61a56bf6cea848fe754c71xy phy_ctrl = MII_CR_FULL_DUPLEX | MII_CR_SPEED_1000 | MII_CR_LOOPBACK;
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Set the link disable bit in the Port Configuration register */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_set_internal_serdes_loopback - Set the internal SerDes loopback mode
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Set link mode to SerDes (11b) in the Extended Control register */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Configure the SerDes to loopback */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Set Device Control register */
c869993e79c1eafbec61a56bf6cea848fe754c71xy ctrl &= ~(E1000_CTRL_RFCE | /* Disable receive flow control */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Set PCS Link Control register */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Set the Copper/Fiber Switch Control - CONNSW register */
c869993e79c1eafbec61a56bf6cea848fe754c71xy#pragma inline(igb_intr_rx_work)
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_intr_rx_work - rx processing of ISR
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng mac_rx_ring(rx_ring->igb->mac_hdl, rx_ring->ring_handle, mp,
c869993e79c1eafbec61a56bf6cea848fe754c71xy#pragma inline(igb_intr_tx_work)
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_intr_tx_work - tx processing of ISR
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb_t *igb = tx_ring->igb;
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Recycle the tx descriptors */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Schedule the re-transmit */
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (tx_ring->tbd_free >= igb->tx_resched_thresh)) {
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng mac_tx_ring_update(tx_ring->igb->mac_hdl, tx_ring->ring_handle);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * igb_intr_link_work - link-status-change processing of ISR
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Because we got a link-status-change interrupt, force
c869993e79c1eafbec61a56bf6cea848fe754c71xy * e1000_check_for_link() to look at phy
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* igb_link_check takes care of link status change */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Get new phy state */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_intr_legacy - Interrupt handler for legacy interrupts
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) {
b227c420ebc30f71999e5e7cd26ca1b23d2cb088chenlu chen - Sun Microsystems - Beijing China mutex_exit(&igb->gen_lock);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_or_32(&igb->igb_state, IGB_ERROR);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China return (DDI_INTR_UNCLAIMED);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * E1000_ICR_INT_ASSERTED bit was set:
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Read(Clear) the ICR, claim this interrupt,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * look for work to do.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* Make sure all interrupt causes cleared */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China (void) E1000_READ_REG(&igb->hw, E1000_EICR);
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Recycle the tx descriptors */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Schedule the re-transmit */
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (tx_ring->tbd_free >= igb->tx_resched_thresh));
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Because we got a link-status-change interrupt, force
c869993e79c1eafbec61a56bf6cea848fe754c71xy * e1000_check_for_link() to look at phy
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* igb_link_check takes care of link status change */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Get new phy state */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China if (icr & E1000_ICR_DRSTA) {
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* 82580 Full Device Reset needed */
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_or_32(&igb->igb_state, IGB_STALL);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * E1000_ICR_INT_ASSERTED bit was not set:
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Don't claim this interrupt.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Do the following work outside of the gen_lock
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng mac_tx_ring_update(igb->mac_hdl, tx_ring->ring_handle);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_intr_msi - Interrupt handler for MSI
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) {
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_or_32(&igb->igb_state, IGB_ERROR);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China return (DDI_INTR_CLAIMED);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* Make sure all interrupt causes cleared */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China (void) E1000_READ_REG(&igb->hw, E1000_EICR);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * For MSI interrupt, we have only one vector,
c869993e79c1eafbec61a56bf6cea848fe754c71xy * so we have only one rx ring and one tx ring enabled.
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China if (icr & E1000_ICR_DRSTA) {
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* 82580 Full Device Reset needed */
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_or_32(&igb->igb_state, IGB_STALL);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_intr_rx - Interrupt handler for rx
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Only used via MSI-X vector so don't check cause bits
c869993e79c1eafbec61a56bf6cea848fe754c71xy * and only clean the given ring.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * igb_intr_tx - Interrupt handler for tx
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Only used via MSI-X vector so don't check cause bits
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * and only clean the given ring.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_intr_tx_other - Interrupt handler for both tx and other
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) {
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_or_32(&igb->igb_state, IGB_ERROR);
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China return (DDI_INTR_CLAIMED);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Look for tx reclaiming work first. Remember, in the
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * case of only interrupt sharing, only one tx ring is
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * Check for "other" causes.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * The DOUTSYNC bit indicates a tx packet dropped because
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * DMA engine gets "out of sync". There isn't a real fix
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * for this. The Intel recommendation is to count the number
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * of occurrences so user can detect when it is happening.
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China * The issue is non-fatal and there's no recovery action
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China if (icr & E1000_ICR_DOUTSYNC) {
b8d0a37778010a5166d34bb0d192cf6b1b2f7becchenlu chen - Sun Microsystems - Beijing China IGB_STAT(igb->dout_sync);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China if (icr & E1000_ICR_DRSTA) {
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* 82580 Full Device Reset needed */
cf8dcc9bbabedca41ecfee13dec8172104e99968zhefeng xu - Sun Microsystems - Beijing China atomic_or_32(&igb->igb_state, IGB_STALL);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_alloc_intrs - Allocate interrupts for the driver
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Normal sequence is to try MSI-X; if not sucessful, try MSI;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * if not successful, try Legacy.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb->intr_force can be used to force sequence to start with
c869993e79c1eafbec61a56bf6cea848fe754c71xy * any of the 3 types.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * If MSI-X is not used, number of tx/rx rings is forced to 1.
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Get supported interrupt types */
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_INFO, "Supported interrupt types: %x",
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Install MSI-X interrupts */
c869993e79c1eafbec61a56bf6cea848fe754c71xy "Allocate MSI-X failed, trying MSI interrupts...");
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* MSI-X not used, force rings to 1 */
c869993e79c1eafbec61a56bf6cea848fe754c71xy "MSI-X not used, force rx and tx queue number to 1");
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Install MSI interrupts */
c869993e79c1eafbec61a56bf6cea848fe754c71xy "Allocate MSI failed, trying Legacy interrupts...");
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Install legacy interrupts */
c869993e79c1eafbec61a56bf6cea848fe754c71xy "Allocate Legacy interrupts failed");
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* If none of the 3 types succeeded, return failure */
fa25784ca4b51c206177d891a654f1d36a25d41fxy * igb_alloc_intr_handles - Allocate interrupt handles.
fa25784ca4b51c206177d891a654f1d36a25d41fxy * For legacy and MSI, only 1 handle is needed. For MSI-X,
fa25784ca4b51c206177d891a654f1d36a25d41fxy * if fewer than 2 handles are available, return failure.
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Upon success, this sets the number of Rx rings to a number that
fa25784ca4b51c206177d891a654f1d36a25d41fxy * matches the handles available for Rx interrupts.
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_INFO, "interrupt type: legacy");
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_INFO, "interrupt type: MSI");
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Number of vectors for the adapter is
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * # rx rings + # tx rings
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * One of tx vectors is for tx & other
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_INFO, "interrupt type: MSI-X");
fa25784ca4b51c206177d891a654f1d36a25d41fxy "invalid call to igb_alloc_intr_handles(): %d\n",
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov "interrupt handles requested: %d minimum: %d",
fa25784ca4b51c206177d891a654f1d36a25d41fxy * Get number of supported interrupts
fa25784ca4b51c206177d891a654f1d36a25d41fxy "Get supported interrupt number failed. "
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_INFO, "interrupts supported: %d", count);
fa25784ca4b51c206177d891a654f1d36a25d41fxy * Get number of available interrupts
fa25784ca4b51c206177d891a654f1d36a25d41fxy "Get available interrupt number failed. "
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_INFO, "interrupts available: %d", avail);
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov "Request %d handles, %d available",
fa25784ca4b51c206177d891a654f1d36a25d41fxy * Allocate an array of interrupt handles
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_INFO, "Allocate interrupts failed. "
c869993e79c1eafbec61a56bf6cea848fe754c71xy "return: %d, request: %d, actual: %d",
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov igb_log(igb, IGB_LOG_INFO, "interrupts actually allocated: %d", actual);
fa4e188e8e6bc718b1a096b3d1dc046952a69304Yuri Pankov "Insufficient interrupt handles allocated: %d",
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * For MSI-X, actual might force us to reduce number of tx & rx rings
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng if ((intr_type == DDI_INTR_TYPE_MSIX) && (orig > actual)) {
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng "MSI-X vectors force Tx queue number to %d",
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng "MSI-X vectors force Tx queue number to 1");
fa25784ca4b51c206177d891a654f1d36a25d41fxy "MSI-X vectors force Rx queue number to %d",
fa25784ca4b51c206177d891a654f1d36a25d41fxy * Get priority for first vector, assume remaining are all the same
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_add_intr_handlers - Add interrupt handlers based on the interrupt type
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Before adding the interrupt handlers, the interrupt vectors have
c869993e79c1eafbec61a56bf6cea848fe754c71xy * been allocated, and the rx/tx rings have also been allocated.
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Add interrupt handler for tx + other */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Add interrupt handler for each rx ring */
c869993e79c1eafbec61a56bf6cea848fe754c71xy "Add rx interrupt handler failed. "
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng /* Add interrupt handler for each tx ring from 2nd ring */
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng "Add tx interrupt handler failed. "
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Add interrupt handlers for the only vector */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Add interrupt handlers for the only vector */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * igb_setup_msix_82575 - setup 82575 adapter to use MSI-X interrupts
c869993e79c1eafbec61a56bf6cea848fe754c71xy * For each vector enabled on the adapter, Set the MSIXBM register accordingly
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing Chinaigb_setup_msix_82575(igb_t *igb)
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Set vector for tx ring 0 and other causes.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * NOTE assumption that it is vector 0.
c869993e79c1eafbec61a56bf6cea848fe754c71xy igb->eims_mask = E1000_EICR_TX_QUEUE0 | E1000_EICR_OTHER;
c869993e79c1eafbec61a56bf6cea848fe754c71xy E1000_WRITE_REG(hw, E1000_MSIXBM(vector), igb->eims_mask);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Set vector for each rx ring
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Accumulate bits to enable in
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * igb_enable_adapter_interrupts_82575()
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Set vector for each tx ring from 2nd tx ring
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Accumulate bits to enable in
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * igb_enable_adapter_interrupts_82575()
c869993e79c1eafbec61a56bf6cea848fe754c71xy * Disable IAM for ICR interrupt bits
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * igb_setup_msix_82576 - setup 82576 adapter to use MSI-X interrupts
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * 82576 uses a table based method for assigning vectors. Each queue has a
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * single entry in the table to which we write a vector number along with a
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * "valid" bit. The entry is a single byte in a 4-byte register. Vectors
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * take a different position in the 4-byte register depending on whether
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * they are numbered above or below 8.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing Chinaigb_setup_msix_82576(igb_t *igb)
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China struct e1000_hw *hw = &igb->hw;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China uint32_t ivar, index, vector;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* must enable msi-x capability before IVAR settings */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_GPIE,
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China (E1000_GPIE_MSIX_MODE | E1000_GPIE_PBA | E1000_GPIE_NSICR));
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Set vector for tx ring 0 and other causes.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * NOTE assumption that it is vector 0.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * This is also interdependent with installation of interrupt service
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * routines in igb_add_intr_handlers().
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* assign "other" causes to vector 0 */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar = ((vector | E1000_IVAR_VALID) << 8);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IVAR_MISC, ivar);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* assign tx ring 0 to vector 0 */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar = ((vector | E1000_IVAR_VALID) << 8);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IVAR0, ivar);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* prepare to enable tx & other interrupt causes */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->eims_mask = (1 << vector);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China for (i = 0; i < igb->num_rx_rings; i++) {
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Set vector for each rx ring
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China index = (i & 0x7);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* vector goes into low byte of register */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar = ivar & 0xFFFFFF00;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar |= (vector | E1000_IVAR_VALID);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* vector goes into third byte of register */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar = ivar & 0xFF00FFFF;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar |= ((vector | E1000_IVAR_VALID) << 16);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* Accumulate interrupt-cause bits to enable */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->eims_mask |= (1 << vector);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China for (i = 1; i < igb->num_tx_rings; i++) {
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Set vector for each tx ring from 2nd tx ring.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China * Note assumption that tx vectors numericall follow rx vectors.
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China index = (i & 0x7);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* vector goes into second byte of register */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar = ivar & 0xFFFF00FF;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar |= ((vector | E1000_IVAR_VALID) << 8);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* vector goes into fourth byte of register */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar = ivar & 0x00FFFFFF;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ivar |= (vector | E1000_IVAR_VALID) << 24;
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China /* Accumulate interrupt-cause bits to enable */
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China igb->eims_mask |= (1 << vector);
80a11ad227f9c82cd6e7cf5c8913a37f00b7af0echenlu chen - Sun Microsystems - Beijing China ASSERT(vector == igb->intr_cnt);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * igb_setup_msix_82580 - setup 82580 adapter to use MSI-X interrupts
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * 82580 uses same table approach at 82576 but has fewer entries. Each
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * queue has a single entry in the table to which we write a vector number
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * along with a "valid" bit. Vectors take a different position in the
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * register depending on * whether * they are numbered above or below 4.
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing Chinaigb_setup_msix_82580(igb_t *igb)
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China struct e1000_hw *hw = &igb->hw;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China uint32_t ivar, index, vector;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* must enable msi-x capability before IVAR settings */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_GPIE, (E1000_GPIE_MSIX_MODE |
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_GPIE_PBA | E1000_GPIE_NSICR | E1000_GPIE_EIAME));
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * Set vector for tx ring 0 and other causes.
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * NOTE assumption that it is vector 0.
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * This is also interdependent with installation of interrupt service
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * routines in igb_add_intr_handlers().
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* assign "other" causes to vector 0 */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar = ((vector | E1000_IVAR_VALID) << 8);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IVAR_MISC, ivar);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* assign tx ring 0 to vector 0 */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar = ((vector | E1000_IVAR_VALID) << 8);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG(hw, E1000_IVAR0, ivar);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* prepare to enable tx & other interrupt causes */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China igb->eims_mask = (1 << vector);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China for (i = 0; i < igb->num_rx_rings; i++) {
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * Set vector for each rx ring
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China index = (i >> 1);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* vector goes into third byte of register */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar = ivar & 0xFF00FFFF;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar |= ((vector | E1000_IVAR_VALID) << 16);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* vector goes into low byte of register */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar = ivar & 0xFFFFFF00;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar |= (vector | E1000_IVAR_VALID);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* Accumulate interrupt-cause bits to enable */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China igb->eims_mask |= (1 << vector);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China for (i = 1; i < igb->num_tx_rings; i++) {
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * Set vector for each tx ring from 2nd tx ring.
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China * Note assumption that tx vectors numericall follow rx vectors.
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China index = (i >> 1);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* vector goes into high byte of register */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar = ivar & 0x00FFFFFF;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar |= ((vector | E1000_IVAR_VALID) << 24);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* vector goes into second byte of register */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar = ivar & 0xFFFF00FF;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ivar |= (vector | E1000_IVAR_VALID) << 8;
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China /* Accumulate interrupt-cause bits to enable */
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China igb->eims_mask |= (1 << vector);
3f7e60a636ef887af87fadf9ab6289c672532dd9zhefeng xu - Sun Microsystems - Beijing China ASSERT(vector == igb->intr_cnt);
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_rem_intr_handlers - remove the interrupt handlers
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_rem_intrs - remove the allocated interrupts
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_enable_intrs - enable all the ddi interrupts
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Enable interrupts */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Call ddi_intr_block_enable() for MSI */
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Call ddi_intr_enable() for Legacy/MSI non block enable */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_disable_intrs - disable all the ddi interrupts
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Disable all interrupts */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_get_phy_state - Get and save the parameters read from PHY registers
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (hw->phy.media_type == e1000_media_type_copper) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (void) e1000_read_phy_reg(hw, PHY_CONTROL, &phy_ctrl);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (void) e1000_read_phy_reg(hw, PHY_STATUS, &phy_status);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (void) e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &phy_an_adv);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (void) e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_an_exp);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (void) e1000_read_phy_reg(hw, PHY_EXT_STATUS, &phy_ext_status);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (void) e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_1000t_ctrl);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (void) e1000_read_phy_reg(hw,
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China PHY_1000T_STATUS, &phy_1000t_status);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (void) e1000_read_phy_reg(hw, PHY_LP_ABILITY, &phy_lp_able);
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_autoneg_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_status & MII_SR_AUTONEG_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_pause_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_adv & NWAY_AR_PAUSE) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_asym_pause_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_adv & NWAY_AR_ASM_DIR) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_1000fdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China ((phy_ext_status & IEEE_ESR_1000T_FD_CAPS) ||
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_ext_status & IEEE_ESR_1000X_FD_CAPS)) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_1000hdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China ((phy_ext_status & IEEE_ESR_1000T_HD_CAPS) ||
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_ext_status & IEEE_ESR_1000X_HD_CAPS)) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_100t4_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_status & MII_SR_100T4_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_100fdx_cap = ((phy_status & MII_SR_100X_FD_CAPS) ||
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_status & MII_SR_100T2_FD_CAPS)) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_100hdx_cap = ((phy_status & MII_SR_100X_HD_CAPS) ||
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_status & MII_SR_100T2_HD_CAPS)) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_10fdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_status & MII_SR_10T_FD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_10hdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_status & MII_SR_10T_HD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_rem_fault =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_status & MII_SR_REMOTE_FAULT) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_autoneg_cap = hw->mac.autoneg;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_pause_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_adv & NWAY_AR_PAUSE) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_asym_pause_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_adv & NWAY_AR_ASM_DIR) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_1000hdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_1000t_ctrl & CR_1000T_HD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_100t4_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_adv & NWAY_AR_100T4_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_rem_fault =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_adv & NWAY_AR_REMOTE_FAULT) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China if (igb->param_adv_autoneg_cap == 1) {
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_1000fdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_1000t_ctrl & CR_1000T_FD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_100fdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_adv & NWAY_AR_100TX_FD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_100hdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_adv & NWAY_AR_100TX_HD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_10fdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_adv & NWAY_AR_10T_FD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_10hdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_adv & NWAY_AR_10T_HD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_autoneg_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_an_exp & NWAY_ER_LP_NWAY_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_pause_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_lp_able & NWAY_LPAR_PAUSE) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_asym_pause_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_lp_able & NWAY_LPAR_ASM_DIR) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_1000fdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_1000t_status & SR_1000T_LP_FD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_1000hdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_1000t_status & SR_1000T_LP_HD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_100t4_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_lp_able & NWAY_LPAR_100T4_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_100fdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_lp_able & NWAY_LPAR_100TX_FD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_100hdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_lp_able & NWAY_LPAR_100TX_HD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_10fdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_lp_able & NWAY_LPAR_10T_FD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_10hdx_cap =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_lp_able & NWAY_LPAR_10T_HD_CAPS) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_rem_fault =
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China (phy_lp_able & NWAY_LPAR_REMOTE_FAULT) ? 1 : 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * 1Gig Fiber adapter only offers 1Gig Full Duplex.
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_autoneg_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_pause_cap = 1;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_asym_pause_cap = 1;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_1000fdx_cap = 1;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_1000hdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_100t4_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_100fdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_100hdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_10fdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_10hdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_autoneg_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_pause_cap = 1;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_asym_pause_cap = 1;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_1000fdx_cap = 1;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_1000hdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_100t4_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_100fdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_100hdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_10fdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_adv_10hdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_autoneg_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_pause_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_asym_pause_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_1000fdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_1000hdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_100t4_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_100fdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_100hdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_10fdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_10hdx_cap = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_lp_rem_fault = 0;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * synchronize the adv* and en* parameters.
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * See comments in <sys/dld.h> for details of the *_en_*
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * parameters. The usage of ndd for setting adv parameters will
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * synchronize all the en parameters with the e1000g parameters,
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China * implicitly disabling any settings made via dladm.
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing Chinaigb_param_sync(igb_t *igb)
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_en_1000fdx_cap = igb->param_adv_1000fdx_cap;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_en_1000hdx_cap = igb->param_adv_1000hdx_cap;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_en_100t4_cap = igb->param_adv_100t4_cap;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_en_100fdx_cap = igb->param_adv_100fdx_cap;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_en_100hdx_cap = igb->param_adv_100hdx_cap;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_en_10fdx_cap = igb->param_adv_10fdx_cap;
ac7f5757903d7806e03e59f71c10eec36e0deadechenlu chen - Sun Microsystems - Beijing China igb->param_en_10hdx_cap = igb->param_adv_10hdx_cap;
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_get_driver_control
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Notify firmware that driver is in control of device */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_release_driver_control
c869993e79c1eafbec61a56bf6cea848fe754c71xystatic void
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* Notify firmware that driver is no longer in control of device */
c869993e79c1eafbec61a56bf6cea848fe754c71xy * igb_atomic_reserve - Atomic decrease operation
c869993e79c1eafbec61a56bf6cea848fe754c71xy /* ATOMICALLY */
c869993e79c1eafbec61a56bf6cea848fe754c71xy return (-1);
c869993e79c1eafbec61a56bf6cea848fe754c71xy } while (atomic_cas_32(count_p, oldval, newval) != oldval);
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl * FMA support
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl * The IO fault service error handling callback function
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl/*ARGSUSED*/
8bb4b220fdb894543e41a5f9037898cf3c3f312bgligb_fm_error_cb(dev_info_t *dip, ddi_fm_error_t *err, const void *impl_data)
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl * as the driver can always deal with an error in any dma or
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl * access handle, we can just return the fme_status value.
8bb4b220fdb894543e41a5f9037898cf3c3f312bglstatic void
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl /* Only register with IO Fault Services if we have some capability */
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl /* Register capabilities with IO Fault Services */
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl * Initialize pci ereport capabilities if ereport capable
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl * Register error callback if error callback capable
8bb4b220fdb894543e41a5f9037898cf3c3f312bglstatic void
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl /* Only unregister FMA capabilities if we registered some */
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl * Release any resources allocated by pci_ereport_setup()
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl * Un-register error callback if error callback capable
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl /* Unregister from IO Fault Services */
8bb4b220fdb894543e41a5f9037898cf3c3f312bgl (void) snprintf(buf, FM_MAX_CLASS, "%s.%s", DDI_FM_DEVICE, detail);