Lines Matching refs:igb
441 igb_t *igb; in igb_attach() local
464 igb = kmem_zalloc(sizeof (igb_t), KM_SLEEP); in igb_attach()
466 igb->dip = devinfo; in igb_attach()
467 igb->instance = instance; in igb_attach()
469 hw = &igb->hw; in igb_attach()
470 osdep = &igb->osdep; in igb_attach()
472 osdep->igb = igb; in igb_attach()
475 ddi_set_driver_private(devinfo, igb); in igb_attach()
479 igb->fm_capabilities = igb_get_prop(igb, "fm-capable", in igb_attach()
483 igb_fm_init(igb); in igb_attach()
484 igb->attach_progress |= ATTACH_PROGRESS_FMINIT; in igb_attach()
490 igb_log(igb, IGB_LOG_ERROR, "Failed to map PCI configurations"); in igb_attach()
493 igb->attach_progress |= ATTACH_PROGRESS_PCI_CONFIG; in igb_attach()
498 if (igb_identify_hardware(igb) != IGB_SUCCESS) { in igb_attach()
499 igb_log(igb, IGB_LOG_ERROR, "Failed to identify hardware"); in igb_attach()
506 if (igb_regs_map(igb) != IGB_SUCCESS) { in igb_attach()
507 igb_log(igb, IGB_LOG_ERROR, "Failed to map device registers"); in igb_attach()
510 igb->attach_progress |= ATTACH_PROGRESS_REGS_MAP; in igb_attach()
515 igb_init_properties(igb); in igb_attach()
516 igb->attach_progress |= ATTACH_PROGRESS_PROPS; in igb_attach()
521 if (igb_alloc_intrs(igb) != IGB_SUCCESS) { in igb_attach()
522 igb_log(igb, IGB_LOG_ERROR, "Failed to allocate interrupts"); in igb_attach()
525 igb->attach_progress |= ATTACH_PROGRESS_ALLOC_INTR; in igb_attach()
533 if (igb_alloc_rings(igb) != IGB_SUCCESS) { in igb_attach()
534 igb_log(igb, IGB_LOG_ERROR, in igb_attach()
538 igb->attach_progress |= ATTACH_PROGRESS_ALLOC_RINGS; in igb_attach()
543 if (igb_add_intr_handlers(igb) != IGB_SUCCESS) { in igb_attach()
544 igb_log(igb, IGB_LOG_ERROR, "Failed to add interrupt handlers"); in igb_attach()
547 igb->attach_progress |= ATTACH_PROGRESS_ADD_INTR; in igb_attach()
552 if (igb_init_driver_settings(igb) != IGB_SUCCESS) { in igb_attach()
553 igb_log(igb, IGB_LOG_ERROR, in igb_attach()
558 if (igb_check_acc_handle(igb->osdep.cfg_handle) != DDI_FM_OK) { in igb_attach()
559 ddi_fm_service_impact(igb->dip, DDI_SERVICE_LOST); in igb_attach()
569 igb_init_locks(igb); in igb_attach()
570 igb->attach_progress |= ATTACH_PROGRESS_LOCKS; in igb_attach()
575 if (igb_init(igb) != IGB_SUCCESS) { in igb_attach()
576 igb_log(igb, IGB_LOG_ERROR, "Failed to initialize adapter"); in igb_attach()
579 igb->attach_progress |= ATTACH_PROGRESS_INIT_ADAPTER; in igb_attach()
585 igb_init_sensors(igb); in igb_attach()
590 if (igb_init_stats(igb) != IGB_SUCCESS) { in igb_attach()
591 igb_log(igb, IGB_LOG_ERROR, "Failed to initialize statistics"); in igb_attach()
594 igb->attach_progress |= ATTACH_PROGRESS_STATS; in igb_attach()
599 if (igb_register_mac(igb) != IGB_SUCCESS) { in igb_attach()
600 igb_log(igb, IGB_LOG_ERROR, "Failed to register MAC"); in igb_attach()
603 igb->attach_progress |= ATTACH_PROGRESS_MAC; in igb_attach()
609 if (igb_enable_intrs(igb) != IGB_SUCCESS) { in igb_attach()
610 igb_log(igb, IGB_LOG_ERROR, "Failed to enable DDI interrupts"); in igb_attach()
613 igb->attach_progress |= ATTACH_PROGRESS_ENABLE_INTR; in igb_attach()
619 if (igb->hw.bus.func == 0) { in igb_attach()
621 &igb->igb_ufmh, igb) != 0) { in igb_attach()
622 igb_log(igb, IGB_LOG_ERROR, "Failed to enable DDI UFM " in igb_attach()
626 igb->attach_progress |= ATTACH_PROGRESS_UFM; in igb_attach()
627 ddi_ufm_update(igb->igb_ufmh); in igb_attach()
630 igb_log(igb, IGB_LOG_INFO, "%s", igb_version); in igb_attach()
631 atomic_or_32(&igb->igb_state, IGB_INITIALIZED); in igb_attach()
637 if (igb->hw.mac.type == e1000_i350) in igb_attach()
638 (void) e1000_set_eee_i350(&igb->hw, B_FALSE, B_FALSE); in igb_attach()
639 else if (igb->hw.mac.type == e1000_i354) in igb_attach()
640 (void) e1000_set_eee_i354(&igb->hw, B_FALSE, B_FALSE); in igb_attach()
645 igb_unconfigure(devinfo, igb); in igb_attach()
667 igb_t *igb; in igb_detach() local
687 igb = (igb_t *)ddi_get_driver_private(devinfo); in igb_detach()
688 if (igb == NULL) in igb_detach()
694 if (mac_unregister(igb->mac_hdl) != 0) { in igb_detach()
695 igb_log(igb, IGB_LOG_ERROR, "Failed to unregister MAC"); in igb_detach()
698 igb->attach_progress &= ~ATTACH_PROGRESS_MAC; in igb_detach()
706 mutex_enter(&igb->gen_lock); in igb_detach()
707 if (igb->igb_state & IGB_STARTED) { in igb_detach()
708 atomic_and_32(&igb->igb_state, ~IGB_STARTED); in igb_detach()
709 igb_stop(igb, B_TRUE); in igb_detach()
710 mutex_exit(&igb->gen_lock); in igb_detach()
712 igb_disable_watchdog_timer(igb); in igb_detach()
714 mutex_exit(&igb->gen_lock); in igb_detach()
720 if (!igb_rx_drain(igb)) in igb_detach()
726 igb_unconfigure(devinfo, igb); in igb_detach()
744 igb_t *igb; in igb_quiesce() local
747 igb = (igb_t *)ddi_get_driver_private(devinfo); in igb_quiesce()
749 if (igb == NULL) in igb_quiesce()
752 hw = &igb->hw; in igb_quiesce()
757 igb_disable_adapter_interrupts(igb); in igb_quiesce()
780 igb_unconfigure(dev_info_t *devinfo, igb_t *igb) in igb_unconfigure() argument
782 if (igb->attach_progress & ATTACH_PROGRESS_UFM) { in igb_unconfigure()
783 ddi_ufm_fini(igb->igb_ufmh); in igb_unconfigure()
789 if (igb->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) { in igb_unconfigure()
790 (void) igb_disable_intrs(igb); in igb_unconfigure()
796 if (igb->attach_progress & ATTACH_PROGRESS_MAC) { in igb_unconfigure()
797 (void) mac_unregister(igb->mac_hdl); in igb_unconfigure()
803 if (igb->attach_progress & ATTACH_PROGRESS_STATS) { in igb_unconfigure()
804 kstat_delete((kstat_t *)igb->igb_ks); in igb_unconfigure()
810 if (igb->attach_progress & ATTACH_PROGRESS_ADD_INTR) { in igb_unconfigure()
811 igb_rem_intr_handlers(igb); in igb_unconfigure()
817 if (igb->attach_progress & ATTACH_PROGRESS_ALLOC_INTR) { in igb_unconfigure()
818 igb_rem_intrs(igb); in igb_unconfigure()
824 if (igb->attach_progress & ATTACH_PROGRESS_PROPS) { in igb_unconfigure()
831 if (igb->attach_progress & ATTACH_PROGRESS_INIT_ADAPTER) { in igb_unconfigure()
832 mutex_enter(&igb->gen_lock); in igb_unconfigure()
833 igb_stop_adapter(igb); in igb_unconfigure()
834 mutex_exit(&igb->gen_lock); in igb_unconfigure()
835 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) in igb_unconfigure()
836 ddi_fm_service_impact(igb->dip, DDI_SERVICE_UNAFFECTED); in igb_unconfigure()
842 igb_fini_sensors(igb); in igb_unconfigure()
847 igb_release_multicast(igb); in igb_unconfigure()
852 if (igb->attach_progress & ATTACH_PROGRESS_REGS_MAP) { in igb_unconfigure()
853 if (igb->osdep.reg_handle != NULL) in igb_unconfigure()
854 ddi_regs_map_free(&igb->osdep.reg_handle); in igb_unconfigure()
860 if (igb->attach_progress & ATTACH_PROGRESS_PCI_CONFIG) { in igb_unconfigure()
861 if (igb->osdep.cfg_handle != NULL) in igb_unconfigure()
862 pci_config_teardown(&igb->osdep.cfg_handle); in igb_unconfigure()
868 if (igb->attach_progress & ATTACH_PROGRESS_LOCKS) { in igb_unconfigure()
869 igb_destroy_locks(igb); in igb_unconfigure()
875 if (igb->attach_progress & ATTACH_PROGRESS_ALLOC_RINGS) { in igb_unconfigure()
876 igb_free_rings(igb); in igb_unconfigure()
882 if (igb->attach_progress & ATTACH_PROGRESS_FMINIT) { in igb_unconfigure()
883 igb_fm_fini(igb); in igb_unconfigure()
889 kmem_free(igb, sizeof (igb_t)); in igb_unconfigure()
899 igb_register_mac(igb_t *igb) in igb_register_mac() argument
901 struct e1000_hw *hw = &igb->hw; in igb_register_mac()
909 mac->m_driver = igb; in igb_register_mac()
910 mac->m_dip = igb->dip; in igb_register_mac()
914 mac->m_max_sdu = igb->max_frame_size - in igb_register_mac()
920 status = mac_register(mac, &igb->mac_hdl); in igb_register_mac()
931 igb_identify_hardware(igb_t *igb) in igb_identify_hardware() argument
933 struct e1000_hw *hw = &igb->hw; in igb_identify_hardware()
934 struct igb_osdep *osdep = &igb->osdep; in igb_identify_hardware()
962 igb->capab = &igb_82575_cap; in igb_identify_hardware()
965 igb->capab = &igb_82576_cap; in igb_identify_hardware()
968 igb->capab = &igb_82580_cap; in igb_identify_hardware()
971 igb->capab = &igb_i350_cap; in igb_identify_hardware()
975 igb->capab = &igb_i210_cap; in igb_identify_hardware()
978 igb->capab = &igb_i354_cap; in igb_identify_hardware()
991 igb_regs_map(igb_t *igb) in igb_regs_map() argument
993 dev_info_t *devinfo = igb->dip; in igb_regs_map()
994 struct e1000_hw *hw = &igb->hw; in igb_regs_map()
995 struct igb_osdep *osdep = &igb->osdep; in igb_regs_map()
1023 igb_init_properties(igb_t *igb) in igb_init_properties() argument
1029 igb_get_conf(igb); in igb_init_properties()
1040 igb_init_driver_settings(igb_t *igb) in igb_init_driver_settings() argument
1042 struct e1000_hw *hw = &igb->hw; in igb_init_driver_settings()
1066 igb->page_size = ddi_ptob(igb->dip, (ulong_t)1); in igb_init_driver_settings()
1074 rx_size = igb->max_frame_size + IPHDR_ALIGN_ROOM; in igb_init_driver_settings()
1075 igb->rx_buf_size = ((rx_size >> 10) + in igb_init_driver_settings()
1081 tx_size = igb->max_frame_size; in igb_init_driver_settings()
1082 igb->tx_buf_size = ((tx_size >> 10) + in igb_init_driver_settings()
1088 for (i = 0; i < igb->num_rx_rings; i++) { in igb_init_driver_settings()
1089 rx_ring = &igb->rx_rings[i]; in igb_init_driver_settings()
1091 rx_ring->igb = igb; in igb_init_driver_settings()
1094 for (i = 0; i < igb->num_tx_rings; i++) { in igb_init_driver_settings()
1095 tx_ring = &igb->tx_rings[i]; in igb_init_driver_settings()
1097 tx_ring->igb = igb; in igb_init_driver_settings()
1098 if (igb->tx_head_wb_enable) in igb_init_driver_settings()
1103 tx_ring->ring_size = igb->tx_ring_size; in igb_init_driver_settings()
1104 tx_ring->free_list_size = igb->tx_ring_size + in igb_init_driver_settings()
1105 (igb->tx_ring_size >> 1); in igb_init_driver_settings()
1112 igb->intr_throttling[i] = igb->intr_throttling[0]; in igb_init_driver_settings()
1117 igb->link_state = LINK_STATE_UNKNOWN; in igb_init_driver_settings()
1126 igb_init_locks(igb_t *igb) in igb_init_locks() argument
1132 for (i = 0; i < igb->num_rx_rings; i++) { in igb_init_locks()
1133 rx_ring = &igb->rx_rings[i]; in igb_init_locks()
1135 MUTEX_DRIVER, DDI_INTR_PRI(igb->intr_pri)); in igb_init_locks()
1138 for (i = 0; i < igb->num_tx_rings; i++) { in igb_init_locks()
1139 tx_ring = &igb->tx_rings[i]; in igb_init_locks()
1141 MUTEX_DRIVER, DDI_INTR_PRI(igb->intr_pri)); in igb_init_locks()
1143 MUTEX_DRIVER, DDI_INTR_PRI(igb->intr_pri)); in igb_init_locks()
1145 MUTEX_DRIVER, DDI_INTR_PRI(igb->intr_pri)); in igb_init_locks()
1147 MUTEX_DRIVER, DDI_INTR_PRI(igb->intr_pri)); in igb_init_locks()
1150 mutex_init(&igb->gen_lock, NULL, in igb_init_locks()
1151 MUTEX_DRIVER, DDI_INTR_PRI(igb->intr_pri)); in igb_init_locks()
1153 mutex_init(&igb->watchdog_lock, NULL, in igb_init_locks()
1154 MUTEX_DRIVER, DDI_INTR_PRI(igb->intr_pri)); in igb_init_locks()
1156 mutex_init(&igb->link_lock, NULL, in igb_init_locks()
1157 MUTEX_DRIVER, DDI_INTR_PRI(igb->intr_pri)); in igb_init_locks()
1164 igb_destroy_locks(igb_t *igb) in igb_destroy_locks() argument
1170 for (i = 0; i < igb->num_rx_rings; i++) { in igb_destroy_locks()
1171 rx_ring = &igb->rx_rings[i]; in igb_destroy_locks()
1175 for (i = 0; i < igb->num_tx_rings; i++) { in igb_destroy_locks()
1176 tx_ring = &igb->tx_rings[i]; in igb_destroy_locks()
1183 mutex_destroy(&igb->gen_lock); in igb_destroy_locks()
1184 mutex_destroy(&igb->watchdog_lock); in igb_destroy_locks()
1185 mutex_destroy(&igb->link_lock); in igb_destroy_locks()
1191 igb_t *igb; in igb_resume() local
1193 igb = (igb_t *)ddi_get_driver_private(devinfo); in igb_resume()
1194 if (igb == NULL) in igb_resume()
1197 mutex_enter(&igb->gen_lock); in igb_resume()
1202 if (igb->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) { in igb_resume()
1203 if (igb_enable_intrs(igb) != IGB_SUCCESS) { in igb_resume()
1204 igb_log(igb, IGB_LOG_ERROR, in igb_resume()
1206 mutex_exit(&igb->gen_lock); in igb_resume()
1211 if (igb->igb_state & IGB_STARTED) { in igb_resume()
1212 if (igb_start(igb, B_FALSE) != IGB_SUCCESS) { in igb_resume()
1213 mutex_exit(&igb->gen_lock); in igb_resume()
1220 igb_enable_watchdog_timer(igb); in igb_resume()
1223 atomic_and_32(&igb->igb_state, ~IGB_SUSPENDED); in igb_resume()
1225 mutex_exit(&igb->gen_lock); in igb_resume()
1233 igb_t *igb; in igb_suspend() local
1235 igb = (igb_t *)ddi_get_driver_private(devinfo); in igb_suspend()
1236 if (igb == NULL) in igb_suspend()
1239 mutex_enter(&igb->gen_lock); in igb_suspend()
1241 atomic_or_32(&igb->igb_state, IGB_SUSPENDED); in igb_suspend()
1246 if (igb->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) { in igb_suspend()
1247 (void) igb_disable_intrs(igb); in igb_suspend()
1250 if (!(igb->igb_state & IGB_STARTED)) { in igb_suspend()
1251 mutex_exit(&igb->gen_lock); in igb_suspend()
1255 igb_stop(igb, B_FALSE); in igb_suspend()
1257 mutex_exit(&igb->gen_lock); in igb_suspend()
1262 igb_disable_watchdog_timer(igb); in igb_suspend()
1268 igb_init(igb_t *igb) in igb_init() argument
1270 mutex_enter(&igb->gen_lock); in igb_init()
1275 if (igb_init_adapter(igb) != IGB_SUCCESS) { in igb_init()
1276 mutex_exit(&igb->gen_lock); in igb_init()
1277 igb_fm_ereport(igb, DDI_FM_DEVICE_INVAL_STATE); in igb_init()
1278 ddi_fm_service_impact(igb->dip, DDI_SERVICE_LOST); in igb_init()
1282 mutex_exit(&igb->gen_lock); in igb_init()
1301 igb_init_mac_address(igb_t *igb) in igb_init_mac_address() argument
1303 struct e1000_hw *hw = &igb->hw; in igb_init_mac_address()
1305 ASSERT(mutex_owned(&igb->gen_lock)); in igb_init_mac_address()
1312 igb_log(igb, IGB_LOG_ERROR, "Adapter reset failed."); in igb_init_mac_address()
1319 if (((igb->hw.mac.type != e1000_i210) && in igb_init_mac_address()
1320 (igb->hw.mac.type != e1000_i211)) && in igb_init_mac_address()
1328 igb_log(igb, IGB_LOG_ERROR, in igb_init_mac_address()
1339 if (!igb_find_mac_address(igb)) { in igb_init_mac_address()
1340 igb_log(igb, IGB_LOG_ERROR, "Failed to get the mac address"); in igb_init_mac_address()
1346 igb_log(igb, IGB_LOG_ERROR, "Invalid mac address"); in igb_init_mac_address()
1360 igb_init_adapter(igb_t *igb) in igb_init_adapter() argument
1362 struct e1000_hw *hw = &igb->hw; in igb_init_adapter()
1372 ASSERT(mutex_owned(&igb->gen_lock)); in igb_init_adapter()
1379 if (igb_init_mac_address(igb) != IGB_SUCCESS) { in igb_init_adapter()
1380 igb_log(igb, IGB_LOG_ERROR, "Failed to initialize MAC address"); in igb_init_adapter()
1411 default_mtu = igb_get_prop(igb, PROP_DEFAULT_MTU, in igb_init_adapter()
1418 min_tx = (igb->max_frame_size + in igb_init_adapter()
1422 min_rx = igb->max_frame_size; in igb_init_adapter()
1450 ((pba << 10) - 2 * igb->max_frame_size)); in igb_init_adapter()
1470 igb_log(igb, IGB_LOG_ERROR, "Second reset failed"); in igb_init_adapter()
1491 (void) igb_setup_link(igb, B_FALSE); in igb_init_adapter()
1497 igb_log(igb, IGB_LOG_ERROR, "Failed to initialize hardware"); in igb_init_adapter()
1504 igb_start_link_timer(igb); in igb_init_adapter()
1530 if (igb->intr_type == DDI_INTR_TYPE_MSIX) in igb_init_adapter()
1531 igb->capab->setup_msix(igb); in igb_init_adapter()
1536 igb_init_unicst(igb); in igb_init_adapter()
1541 igb_setup_multicst(igb); in igb_init_adapter()
1546 for (i = 0; i < igb->intr_cnt; i++) in igb_init_adapter()
1547 E1000_WRITE_REG(hw, E1000_EITR(i), igb->intr_throttling[i]); in igb_init_adapter()
1553 (void) e1000_read_nvm(&igb->hw, NVM_OEM_OFFSET_0, 1, &nvmword); in igb_init_adapter()
1555 (void) e1000_read_nvm(&igb->hw, NVM_OEM_OFFSET_1, 1, &nvmword); in igb_init_adapter()
1557 (void) ddi_prop_update_int_array(DDI_DEV_T_NONE, igb->dip, in igb_init_adapter()
1561 (void) e1000_read_pba_string(&igb->hw, pbanum, sizeof (pbanum)); in igb_init_adapter()
1563 (void) ddi_prop_update_string(DDI_DEV_T_NONE, igb->dip, in igb_init_adapter()
1568 (void) e1000_read_nvm(&igb->hw, NVM_VERSION, 1, &nvmword); in igb_init_adapter()
1572 (void) ddi_prop_update_string(DDI_DEV_T_NONE, igb->dip, in igb_init_adapter()
1579 igb_get_phy_state(igb); in igb_init_adapter()
1581 igb_param_sync(igb); in igb_init_adapter()
1599 igb_stop_adapter(igb_t *igb) in igb_stop_adapter() argument
1601 struct e1000_hw *hw = &igb->hw; in igb_stop_adapter()
1603 ASSERT(mutex_owned(&igb->gen_lock)); in igb_stop_adapter()
1606 igb_stop_link_timer(igb); in igb_stop_adapter()
1615 igb_fm_ereport(igb, DDI_FM_DEVICE_INVAL_STATE); in igb_stop_adapter()
1616 ddi_fm_service_impact(igb->dip, DDI_SERVICE_LOST); in igb_stop_adapter()
1631 igb_reset(igb_t *igb) in igb_reset() argument
1635 mutex_enter(&igb->gen_lock); in igb_reset()
1637 ASSERT(igb->igb_state & IGB_STARTED); in igb_reset()
1638 atomic_and_32(&igb->igb_state, ~IGB_STARTED); in igb_reset()
1644 igb_disable_adapter_interrupts(igb); in igb_reset()
1649 (void) igb_tx_drain(igb); in igb_reset()
1651 for (i = 0; i < igb->num_rx_rings; i++) in igb_reset()
1652 mutex_enter(&igb->rx_rings[i].rx_lock); in igb_reset()
1653 for (i = 0; i < igb->num_tx_rings; i++) in igb_reset()
1654 mutex_enter(&igb->tx_rings[i].tx_lock); in igb_reset()
1659 igb_stop_adapter(igb); in igb_reset()
1664 igb_tx_clean(igb); in igb_reset()
1669 if (igb_init_adapter(igb) != IGB_SUCCESS) { in igb_reset()
1670 igb_fm_ereport(igb, DDI_FM_DEVICE_INVAL_STATE); in igb_reset()
1677 igb->tx_ring_init = B_FALSE; in igb_reset()
1678 igb_setup_rings(igb); in igb_reset()
1680 atomic_and_32(&igb->igb_state, ~(IGB_ERROR | IGB_STALL)); in igb_reset()
1686 igb->capab->enable_intr(igb); in igb_reset()
1688 if (igb_check_acc_handle(igb->osdep.cfg_handle) != DDI_FM_OK) in igb_reset()
1691 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) in igb_reset()
1694 for (i = igb->num_tx_rings - 1; i >= 0; i--) in igb_reset()
1695 mutex_exit(&igb->tx_rings[i].tx_lock); in igb_reset()
1696 for (i = igb->num_rx_rings - 1; i >= 0; i--) in igb_reset()
1697 mutex_exit(&igb->rx_rings[i].rx_lock); in igb_reset()
1699 atomic_or_32(&igb->igb_state, IGB_STARTED); in igb_reset()
1701 mutex_exit(&igb->gen_lock); in igb_reset()
1706 for (i = igb->num_tx_rings - 1; i >= 0; i--) in igb_reset()
1707 mutex_exit(&igb->tx_rings[i].tx_lock); in igb_reset()
1708 for (i = igb->num_rx_rings - 1; i >= 0; i--) in igb_reset()
1709 mutex_exit(&igb->rx_rings[i].rx_lock); in igb_reset()
1711 mutex_exit(&igb->gen_lock); in igb_reset()
1713 ddi_fm_service_impact(igb->dip, DDI_SERVICE_LOST); in igb_reset()
1722 igb_tx_clean(igb_t *igb) in igb_tx_clean() argument
1732 for (i = 0; i < igb->num_tx_rings; i++) { in igb_tx_clean()
1733 tx_ring = &igb->tx_rings[i]; in igb_tx_clean()
1768 if (igb->tx_head_wb_enable) in igb_tx_clean()
1771 E1000_WRITE_REG(&igb->hw, E1000_TDH(tx_ring->index), 0); in igb_tx_clean()
1772 E1000_WRITE_REG(&igb->hw, E1000_TDT(tx_ring->index), 0); in igb_tx_clean()
1789 igb_tx_drain(igb_t *igb) in igb_tx_drain() argument
1808 for (j = 0; j < igb->num_tx_rings; j++) { in igb_tx_drain()
1809 tx_ring = &igb->tx_rings[j]; in igb_tx_drain()
1827 igb_rx_drain(igb_t *igb) in igb_rx_drain() argument
1843 done = (igb->rcb_pending == 0); in igb_rx_drain()
1858 igb_start(igb_t *igb, boolean_t alloc_buffer) in igb_start() argument
1862 ASSERT(mutex_owned(&igb->gen_lock)); in igb_start()
1865 if (igb_alloc_rx_data(igb) != IGB_SUCCESS) { in igb_start()
1866 igb_log(igb, IGB_LOG_ERROR, in igb_start()
1872 if (igb_alloc_dma(igb) != IGB_SUCCESS) { in igb_start()
1873 igb_log(igb, IGB_LOG_ERROR, in igb_start()
1878 igb->tx_ring_init = B_TRUE; in igb_start()
1880 igb->tx_ring_init = B_FALSE; in igb_start()
1883 for (i = 0; i < igb->num_rx_rings; i++) in igb_start()
1884 mutex_enter(&igb->rx_rings[i].rx_lock); in igb_start()
1885 for (i = 0; i < igb->num_tx_rings; i++) in igb_start()
1886 mutex_enter(&igb->tx_rings[i].tx_lock); in igb_start()
1891 if ((igb->attach_progress & ATTACH_PROGRESS_INIT_ADAPTER) == 0) { in igb_start()
1892 if (igb_init_adapter(igb) != IGB_SUCCESS) { in igb_start()
1893 igb_fm_ereport(igb, DDI_FM_DEVICE_INVAL_STATE); in igb_start()
1896 igb->attach_progress |= ATTACH_PROGRESS_INIT_ADAPTER; in igb_start()
1902 igb_setup_rings(igb); in igb_start()
1908 igb->capab->enable_intr(igb); in igb_start()
1910 if (igb_check_acc_handle(igb->osdep.cfg_handle) != DDI_FM_OK) in igb_start()
1913 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) in igb_start()
1916 if (igb->hw.mac.type == e1000_i350) in igb_start()
1917 (void) e1000_set_eee_i350(&igb->hw, B_FALSE, B_FALSE); in igb_start()
1918 else if (igb->hw.mac.type == e1000_i354) in igb_start()
1919 (void) e1000_set_eee_i354(&igb->hw, B_FALSE, B_FALSE); in igb_start()
1921 for (i = igb->num_tx_rings - 1; i >= 0; i--) in igb_start()
1922 mutex_exit(&igb->tx_rings[i].tx_lock); in igb_start()
1923 for (i = igb->num_rx_rings - 1; i >= 0; i--) in igb_start()
1924 mutex_exit(&igb->rx_rings[i].rx_lock); in igb_start()
1929 for (i = igb->num_tx_rings - 1; i >= 0; i--) in igb_start()
1930 mutex_exit(&igb->tx_rings[i].tx_lock); in igb_start()
1931 for (i = igb->num_rx_rings - 1; i >= 0; i--) in igb_start()
1932 mutex_exit(&igb->rx_rings[i].rx_lock); in igb_start()
1934 ddi_fm_service_impact(igb->dip, DDI_SERVICE_LOST); in igb_start()
1943 igb_stop(igb_t *igb, boolean_t free_buffer) in igb_stop() argument
1947 ASSERT(mutex_owned(&igb->gen_lock)); in igb_stop()
1949 igb->attach_progress &= ~ATTACH_PROGRESS_INIT_ADAPTER; in igb_stop()
1954 igb_disable_adapter_interrupts(igb); in igb_stop()
1959 (void) igb_tx_drain(igb); in igb_stop()
1961 for (i = 0; i < igb->num_rx_rings; i++) in igb_stop()
1962 mutex_enter(&igb->rx_rings[i].rx_lock); in igb_stop()
1963 for (i = 0; i < igb->num_tx_rings; i++) in igb_stop()
1964 mutex_enter(&igb->tx_rings[i].tx_lock); in igb_stop()
1969 igb_stop_adapter(igb); in igb_stop()
1974 igb_tx_clean(igb); in igb_stop()
1976 for (i = igb->num_tx_rings - 1; i >= 0; i--) in igb_stop()
1977 mutex_exit(&igb->tx_rings[i].tx_lock); in igb_stop()
1978 for (i = igb->num_rx_rings - 1; i >= 0; i--) in igb_stop()
1979 mutex_exit(&igb->rx_rings[i].rx_lock); in igb_stop()
1981 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) in igb_stop()
1982 ddi_fm_service_impact(igb->dip, DDI_SERVICE_LOST); in igb_stop()
1984 if (igb->link_state == LINK_STATE_UP) { in igb_stop()
1985 igb->link_state = LINK_STATE_UNKNOWN; in igb_stop()
1986 mac_link_update(igb->mac_hdl, igb->link_state); in igb_stop()
1993 igb_free_dma(igb); in igb_stop()
1994 igb_free_rx_data(igb); in igb_stop()
2002 igb_alloc_rings(igb_t *igb) in igb_alloc_rings() argument
2007 igb->rx_rings = kmem_zalloc( in igb_alloc_rings()
2008 sizeof (igb_rx_ring_t) * igb->num_rx_rings, in igb_alloc_rings()
2011 if (igb->rx_rings == NULL) { in igb_alloc_rings()
2018 igb->tx_rings = kmem_zalloc( in igb_alloc_rings()
2019 sizeof (igb_tx_ring_t) * igb->num_tx_rings, in igb_alloc_rings()
2022 if (igb->tx_rings == NULL) { in igb_alloc_rings()
2023 kmem_free(igb->rx_rings, in igb_alloc_rings()
2024 sizeof (igb_rx_ring_t) * igb->num_rx_rings); in igb_alloc_rings()
2025 igb->rx_rings = NULL; in igb_alloc_rings()
2032 igb->rx_groups = kmem_zalloc( in igb_alloc_rings()
2033 sizeof (igb_rx_group_t) * igb->num_rx_groups, in igb_alloc_rings()
2036 if (igb->rx_groups == NULL) { in igb_alloc_rings()
2037 kmem_free(igb->rx_rings, in igb_alloc_rings()
2038 sizeof (igb_rx_ring_t) * igb->num_rx_rings); in igb_alloc_rings()
2039 kmem_free(igb->tx_rings, in igb_alloc_rings()
2040 sizeof (igb_tx_ring_t) * igb->num_tx_rings); in igb_alloc_rings()
2041 igb->rx_rings = NULL; in igb_alloc_rings()
2042 igb->tx_rings = NULL; in igb_alloc_rings()
2053 igb_free_rings(igb_t *igb) in igb_free_rings() argument
2055 if (igb->rx_rings != NULL) { in igb_free_rings()
2056 kmem_free(igb->rx_rings, in igb_free_rings()
2057 sizeof (igb_rx_ring_t) * igb->num_rx_rings); in igb_free_rings()
2058 igb->rx_rings = NULL; in igb_free_rings()
2061 if (igb->tx_rings != NULL) { in igb_free_rings()
2062 kmem_free(igb->tx_rings, in igb_free_rings()
2063 sizeof (igb_tx_ring_t) * igb->num_tx_rings); in igb_free_rings()
2064 igb->tx_rings = NULL; in igb_free_rings()
2067 if (igb->rx_groups != NULL) { in igb_free_rings()
2068 kmem_free(igb->rx_groups, in igb_free_rings()
2069 sizeof (igb_rx_group_t) * igb->num_rx_groups); in igb_free_rings()
2070 igb->rx_groups = NULL; in igb_free_rings()
2075 igb_alloc_rx_data(igb_t *igb) in igb_alloc_rx_data() argument
2080 for (i = 0; i < igb->num_rx_rings; i++) { in igb_alloc_rx_data()
2081 rx_ring = &igb->rx_rings[i]; in igb_alloc_rx_data()
2088 igb_free_rx_data(igb); in igb_alloc_rx_data()
2093 igb_free_rx_data(igb_t *igb) in igb_free_rx_data() argument
2099 for (i = 0; i < igb->num_rx_rings; i++) { in igb_free_rx_data()
2100 rx_ring = &igb->rx_rings[i]; in igb_free_rx_data()
2102 mutex_enter(&igb->rx_pending_lock); in igb_free_rx_data()
2114 mutex_exit(&igb->rx_pending_lock); in igb_free_rx_data()
2122 igb_setup_rings(igb_t *igb) in igb_setup_rings() argument
2131 igb_setup_rx(igb); in igb_setup_rings()
2133 igb_setup_tx(igb); in igb_setup_rings()
2139 igb_t *igb = rx_ring->igb; in igb_setup_rx_ring() local
2141 struct e1000_hw *hw = &igb->hw; in igb_setup_rx_ring()
2151 ASSERT(mutex_owned(&igb->gen_lock)); in igb_setup_rx_ring()
2156 for (i = 0; i < igb->rx_ring_size; i++) { in igb_setup_rx_ring()
2182 ((igb->rx_buf_size >> E1000_SRRCTL_BSIZEPKT_SHIFT) | in igb_setup_rx_ring()
2189 rxdctl &= igb->capab->rxdctl_mask; in igb_setup_rx_ring()
2200 igb_setup_rx(igb_t *igb) in igb_setup_rx() argument
2205 struct e1000_hw *hw = &igb->hw; in igb_setup_rx()
2235 for (i = 0; i < igb->num_rx_groups; i++) { in igb_setup_rx()
2236 rx_group = &igb->rx_groups[i]; in igb_setup_rx()
2238 rx_group->igb = igb; in igb_setup_rx()
2245 ring_per_group = igb->num_rx_rings / igb->num_rx_groups; in igb_setup_rx()
2246 for (i = 0; i < igb->num_rx_rings; i++) { in igb_setup_rx()
2247 rx_ring = &igb->rx_rings[i]; in igb_setup_rx()
2259 E1000_WRITE_REG(hw, E1000_RLPML, igb->max_frame_size); in igb_setup_rx()
2264 if (igb->rx_hcksum_enable) { in igb_setup_rx()
2275 switch (igb->vmdq_mode) { in igb_setup_rx()
2281 if (igb->num_rx_rings > 1) in igb_setup_rx()
2282 igb_setup_rss(igb); in igb_setup_rx()
2289 igb_setup_mac_classify(igb); in igb_setup_rx()
2296 igb_setup_mac_rss_classify(igb); in igb_setup_rx()
2310 for (i = 0; i < igb->num_rx_rings; i++) { in igb_setup_rx()
2311 rx_ring = &igb->rx_rings[i]; in igb_setup_rx()
2330 igb_t *igb = tx_ring->igb; in igb_setup_tx_ring() local
2331 struct e1000_hw *hw = &igb->hw; in igb_setup_tx_ring()
2338 ASSERT(mutex_owned(&igb->gen_lock)); in igb_setup_tx_ring()
2364 if (igb->tx_head_wb_enable) { in igb_setup_tx_ring()
2401 if (igb->tx_ring_init == B_TRUE) { in igb_setup_tx_ring()
2421 igb_setup_tx(igb_t *igb) in igb_setup_tx() argument
2424 struct e1000_hw *hw = &igb->hw; in igb_setup_tx()
2428 for (i = 0; i < igb->num_tx_rings; i++) { in igb_setup_tx()
2429 tx_ring = &igb->tx_rings[i]; in igb_setup_tx()
2451 igb_setup_rss(igb_t *igb) in igb_setup_rss() argument
2453 struct e1000_hw *hw = &igb->hw; in igb_setup_rss()
2469 reta.bytes[i & 3] = (i % igb->num_rx_rings) << shift; in igb_setup_rss()
2518 igb_setup_mac_rss_classify(igb_t *igb) in igb_setup_mac_rss_classify() argument
2520 struct e1000_hw *hw = &igb->hw; in igb_setup_mac_rss_classify()
2530 ring_per_group = igb->num_rx_rings / igb->num_rx_groups; in igb_setup_mac_rss_classify()
2594 igb_setup_mac_classify(igb_t *igb) in igb_setup_mac_classify() argument
2596 struct e1000_hw *hw = &igb->hw; in igb_setup_mac_classify()
2629 igb_init_unicst(igb_t *igb) in igb_init_unicst() argument
2631 struct e1000_hw *hw = &igb->hw; in igb_init_unicst()
2655 if (!igb->unicst_init) { in igb_init_unicst()
2658 igb->unicst_total = MAX_NUM_UNICAST_ADDRESSES; in igb_init_unicst()
2659 igb->unicst_avail = igb->unicst_total; in igb_init_unicst()
2661 for (slot = 0; slot < igb->unicst_total; slot++) in igb_init_unicst()
2662 igb->unicst_addr[slot].mac.set = 0; in igb_init_unicst()
2664 igb->unicst_init = B_TRUE; in igb_init_unicst()
2667 for (slot = 0; slot < igb->unicst_total; slot++) { in igb_init_unicst()
2669 igb->unicst_addr[slot].mac.addr, in igb_init_unicst()
2670 slot, igb->vmdq_mode, in igb_init_unicst()
2671 igb->unicst_addr[slot].mac.group_index); in igb_init_unicst()
2680 igb_unicst_find(igb_t *igb, const uint8_t *mac_addr) in igb_unicst_find() argument
2684 ASSERT(mutex_owned(&igb->gen_lock)); in igb_unicst_find()
2686 for (slot = 0; slot < igb->unicst_total; slot++) { in igb_unicst_find()
2687 if (bcmp(igb->unicst_addr[slot].mac.addr, in igb_unicst_find()
2699 igb_unicst_set(igb_t *igb, const uint8_t *mac_addr, in igb_unicst_set() argument
2702 struct e1000_hw *hw = &igb->hw; in igb_unicst_set()
2704 ASSERT(mutex_owned(&igb->gen_lock)); in igb_unicst_set()
2709 bcopy(mac_addr, igb->unicst_addr[slot].mac.addr, ETHERADDRL); in igb_unicst_set()
2716 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) { in igb_unicst_set()
2717 ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED); in igb_unicst_set()
2728 igb_multicst_add(igb_t *igb, const uint8_t *multiaddr) in igb_multicst_add() argument
2734 ASSERT(mutex_owned(&igb->gen_lock)); in igb_multicst_add()
2737 igb_log(igb, IGB_LOG_ERROR, "Illegal multicast address"); in igb_multicst_add()
2741 if (igb->mcast_count >= igb->mcast_max_num) { in igb_multicst_add()
2742 igb_log(igb, IGB_LOG_ERROR, in igb_multicst_add()
2744 igb->mcast_max_num); in igb_multicst_add()
2748 if (igb->mcast_count == igb->mcast_alloc_count) { in igb_multicst_add()
2749 old_len = igb->mcast_alloc_count * in igb_multicst_add()
2751 new_len = (igb->mcast_alloc_count + MCAST_ALLOC_COUNT) * in igb_multicst_add()
2756 igb_log(igb, IGB_LOG_ERROR, in igb_multicst_add()
2761 if (igb->mcast_table != NULL) { in igb_multicst_add()
2762 bcopy(igb->mcast_table, new_table, old_len); in igb_multicst_add()
2763 kmem_free(igb->mcast_table, old_len); in igb_multicst_add()
2765 igb->mcast_alloc_count += MCAST_ALLOC_COUNT; in igb_multicst_add()
2766 igb->mcast_table = new_table; in igb_multicst_add()
2770 &igb->mcast_table[igb->mcast_count], ETHERADDRL); in igb_multicst_add()
2771 igb->mcast_count++; in igb_multicst_add()
2776 igb_setup_multicst(igb); in igb_multicst_add()
2778 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) { in igb_multicst_add()
2779 ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED); in igb_multicst_add()
2790 igb_multicst_remove(igb_t *igb, const uint8_t *multiaddr) in igb_multicst_remove() argument
2797 ASSERT(mutex_owned(&igb->gen_lock)); in igb_multicst_remove()
2799 for (i = 0; i < igb->mcast_count; i++) { in igb_multicst_remove()
2800 if (bcmp(multiaddr, &igb->mcast_table[i], in igb_multicst_remove()
2802 for (i++; i < igb->mcast_count; i++) { in igb_multicst_remove()
2803 igb->mcast_table[i - 1] = in igb_multicst_remove()
2804 igb->mcast_table[i]; in igb_multicst_remove()
2806 igb->mcast_count--; in igb_multicst_remove()
2811 if ((igb->mcast_alloc_count - igb->mcast_count) > in igb_multicst_remove()
2813 old_len = igb->mcast_alloc_count * in igb_multicst_remove()
2815 new_len = (igb->mcast_alloc_count - MCAST_ALLOC_COUNT) * in igb_multicst_remove()
2820 bcopy(igb->mcast_table, new_table, new_len); in igb_multicst_remove()
2821 kmem_free(igb->mcast_table, old_len); in igb_multicst_remove()
2822 igb->mcast_alloc_count -= MCAST_ALLOC_COUNT; in igb_multicst_remove()
2823 igb->mcast_table = new_table; in igb_multicst_remove()
2830 igb_setup_multicst(igb); in igb_multicst_remove()
2832 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) { in igb_multicst_remove()
2833 ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED); in igb_multicst_remove()
2841 igb_release_multicast(igb_t *igb) in igb_release_multicast() argument
2843 if (igb->mcast_table != NULL) { in igb_release_multicast()
2844 kmem_free(igb->mcast_table, in igb_release_multicast()
2845 igb->mcast_alloc_count * sizeof (struct ether_addr)); in igb_release_multicast()
2846 igb->mcast_table = NULL; in igb_release_multicast()
2857 igb_setup_multicst(igb_t *igb) in igb_setup_multicst() argument
2861 struct e1000_hw *hw = &igb->hw; in igb_setup_multicst()
2863 ASSERT(mutex_owned(&igb->gen_lock)); in igb_setup_multicst()
2864 ASSERT(igb->mcast_count <= igb->mcast_max_num); in igb_setup_multicst()
2866 mc_addr_list = (uint8_t *)igb->mcast_table; in igb_setup_multicst()
2867 mc_addr_count = igb->mcast_count; in igb_setup_multicst()
2888 igb_get_conf(igb_t *igb) in igb_get_conf() argument
2890 struct e1000_hw *hw = &igb->hw; in igb_get_conf()
2927 igb->param_adv_autoneg_cap = igb_get_prop(igb, in igb_get_conf()
2929 igb->param_adv_1000fdx_cap = igb_get_prop(igb, in igb_get_conf()
2931 igb->param_adv_100fdx_cap = igb_get_prop(igb, in igb_get_conf()
2933 igb->param_adv_100hdx_cap = igb_get_prop(igb, in igb_get_conf()
2935 igb->param_adv_10fdx_cap = igb_get_prop(igb, in igb_get_conf()
2937 igb->param_adv_10hdx_cap = igb_get_prop(igb, in igb_get_conf()
2943 default_mtu = igb_get_prop(igb, PROP_DEFAULT_MTU, in igb_get_conf()
2946 igb->max_frame_size = default_mtu + in igb_get_conf()
2952 flow_control = igb_get_prop(igb, PROP_FLOW_CONTROL, in igb_get_conf()
2962 igb->tx_ring_size = igb_get_prop(igb, PROP_TX_RING_SIZE, in igb_get_conf()
2964 igb->rx_ring_size = igb_get_prop(igb, PROP_RX_RING_SIZE, in igb_get_conf()
2967 igb->mr_enable = igb_get_prop(igb, PROP_MR_ENABLE, 0, 1, 0); in igb_get_conf()
2968 igb->num_rx_groups = igb_get_prop(igb, PROP_RX_GROUP_NUM, in igb_get_conf()
2975 igb->num_rx_groups = 1; in igb_get_conf()
2977 if (igb->mr_enable) { in igb_get_conf()
2978 igb->num_tx_rings = igb->capab->def_tx_que_num; in igb_get_conf()
2979 igb->num_rx_rings = igb->capab->def_rx_que_num; in igb_get_conf()
2981 igb->num_tx_rings = 1; in igb_get_conf()
2982 igb->num_rx_rings = 1; in igb_get_conf()
2984 if (igb->num_rx_groups > 1) { in igb_get_conf()
2985 igb_log(igb, IGB_LOG_ERROR, in igb_get_conf()
2988 igb->num_rx_groups = 1; in igb_get_conf()
2995 for (i = igb->num_rx_groups; i > 0; i--) { in igb_get_conf()
2996 if ((igb->num_rx_rings % i) == 0) in igb_get_conf()
2999 if (i != igb->num_rx_groups) { in igb_get_conf()
3000 igb_log(igb, IGB_LOG_ERROR, in igb_get_conf()
3003 igb->num_rx_groups = i; in igb_get_conf()
3009 ring_per_group = igb->num_rx_rings / igb->num_rx_groups; in igb_get_conf()
3011 if (igb->num_rx_groups == 1) { in igb_get_conf()
3015 igb->vmdq_mode = E1000_VMDQ_OFF; in igb_get_conf()
3020 igb->vmdq_mode = E1000_VMDQ_MAC; in igb_get_conf()
3025 igb->vmdq_mode = E1000_VMDQ_MAC_RSS; in igb_get_conf()
3036 igb->intr_force = igb_get_prop(igb, PROP_INTR_FORCE, in igb_get_conf()
3039 igb->tx_hcksum_enable = igb_get_prop(igb, PROP_TX_HCKSUM_ENABLE, in igb_get_conf()
3041 igb->rx_hcksum_enable = igb_get_prop(igb, PROP_RX_HCKSUM_ENABLE, in igb_get_conf()
3043 igb->lso_enable = igb_get_prop(igb, PROP_LSO_ENABLE, in igb_get_conf()
3045 igb->tx_head_wb_enable = igb_get_prop(igb, PROP_TX_HEAD_WB_ENABLE, in igb_get_conf()
3052 if (igb->tx_hcksum_enable == B_FALSE) in igb_get_conf()
3053 igb->lso_enable = B_FALSE; in igb_get_conf()
3055 igb->tx_copy_thresh = igb_get_prop(igb, PROP_TX_COPY_THRESHOLD, in igb_get_conf()
3058 igb->tx_recycle_thresh = igb_get_prop(igb, PROP_TX_RECYCLE_THRESHOLD, in igb_get_conf()
3061 igb->tx_overload_thresh = igb_get_prop(igb, PROP_TX_OVERLOAD_THRESHOLD, in igb_get_conf()
3064 igb->tx_resched_thresh = igb_get_prop(igb, PROP_TX_RESCHED_THRESHOLD, in igb_get_conf()
3066 MIN(igb->tx_ring_size, MAX_TX_RESCHED_THRESHOLD), in igb_get_conf()
3067 igb->tx_ring_size > DEFAULT_TX_RESCHED_THRESHOLD ? in igb_get_conf()
3070 igb->rx_copy_thresh = igb_get_prop(igb, PROP_RX_COPY_THRESHOLD, in igb_get_conf()
3073 igb->rx_limit_per_intr = igb_get_prop(igb, PROP_RX_LIMIT_PER_INTR, in igb_get_conf()
3077 igb->intr_throttling[0] = igb_get_prop(igb, PROP_INTR_THROTTLING, in igb_get_conf()
3078 igb->capab->min_intr_throttle, in igb_get_conf()
3079 igb->capab->max_intr_throttle, in igb_get_conf()
3080 igb->capab->def_intr_throttle); in igb_get_conf()
3085 igb->mcast_max_num = in igb_get_conf()
3086 igb_get_prop(igb, PROP_MCAST_MAX_NUM, in igb_get_conf()
3100 igb_get_prop(igb_t *igb, in igb_get_prop() argument
3111 value = ddi_prop_get_int(DDI_DEV_T_ANY, igb->dip, in igb_get_prop()
3127 igb_setup_link(igb_t *igb, boolean_t setup_hw) in igb_setup_link() argument
3133 mac = &igb->hw.mac; in igb_setup_link()
3134 phy = &igb->hw.phy; in igb_setup_link()
3137 if (igb->param_adv_autoneg_cap == 1) { in igb_setup_link()
3144 if (igb->param_adv_1000fdx_cap == 1) in igb_setup_link()
3147 if (igb->param_adv_100fdx_cap == 1) in igb_setup_link()
3150 if (igb->param_adv_100hdx_cap == 1) in igb_setup_link()
3153 if (igb->param_adv_10fdx_cap == 1) in igb_setup_link()
3156 if (igb->param_adv_10hdx_cap == 1) in igb_setup_link()
3167 if (igb->param_adv_100fdx_cap == 1) in igb_setup_link()
3169 else if (igb->param_adv_100hdx_cap == 1) in igb_setup_link()
3171 else if (igb->param_adv_10fdx_cap == 1) in igb_setup_link()
3173 else if (igb->param_adv_10hdx_cap == 1) in igb_setup_link()
3180 igb_log(igb, IGB_LOG_INFO, "Invalid link settings. Setup " in igb_setup_link()
3189 if (e1000_setup_link(&igb->hw) != E1000_SUCCESS) in igb_setup_link()
3201 igb_is_link_up(igb_t *igb) in igb_is_link_up() argument
3203 struct e1000_hw *hw = &igb->hw; in igb_is_link_up()
3206 ASSERT(mutex_owned(&igb->gen_lock)); in igb_is_link_up()
3240 igb_link_check(igb_t *igb) in igb_link_check() argument
3242 struct e1000_hw *hw = &igb->hw; in igb_link_check()
3246 ASSERT(mutex_owned(&igb->gen_lock)); in igb_link_check()
3248 if (igb_is_link_up(igb)) { in igb_link_check()
3252 if (igb->link_state != LINK_STATE_UP) { in igb_link_check()
3254 igb->link_speed = speed; in igb_link_check()
3255 igb->link_duplex = duplex; in igb_link_check()
3256 igb->link_state = LINK_STATE_UP; in igb_link_check()
3258 if (!igb->link_complete) in igb_link_check()
3259 igb_stop_link_timer(igb); in igb_link_check()
3261 } else if (igb->link_complete) { in igb_link_check()
3262 if (igb->link_state != LINK_STATE_DOWN) { in igb_link_check()
3263 igb->link_speed = 0; in igb_link_check()
3264 igb->link_duplex = 0; in igb_link_check()
3265 igb->link_state = LINK_STATE_DOWN; in igb_link_check()
3270 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) { in igb_link_check()
3271 ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED); in igb_link_check()
3287 igb_t *igb = (igb_t *)arg; in igb_local_timer() local
3290 if (igb->igb_state & IGB_ERROR) { in igb_local_timer()
3291 igb->reset_count++; in igb_local_timer()
3292 if (igb_reset(igb) == IGB_SUCCESS) in igb_local_timer()
3293 ddi_fm_service_impact(igb->dip, DDI_SERVICE_RESTORED); in igb_local_timer()
3295 igb_restart_watchdog_timer(igb); in igb_local_timer()
3299 if (igb_stall_check(igb) || (igb->igb_state & IGB_STALL)) { in igb_local_timer()
3300 igb_fm_ereport(igb, DDI_FM_DEVICE_STALL); in igb_local_timer()
3301 ddi_fm_service_impact(igb->dip, DDI_SERVICE_LOST); in igb_local_timer()
3302 igb->reset_count++; in igb_local_timer()
3303 if (igb_reset(igb) == IGB_SUCCESS) in igb_local_timer()
3304 ddi_fm_service_impact(igb->dip, DDI_SERVICE_RESTORED); in igb_local_timer()
3306 igb_restart_watchdog_timer(igb); in igb_local_timer()
3310 mutex_enter(&igb->gen_lock); in igb_local_timer()
3311 if (!(igb->igb_state & IGB_SUSPENDED) && (igb->igb_state & IGB_STARTED)) in igb_local_timer()
3312 link_changed = igb_link_check(igb); in igb_local_timer()
3313 mutex_exit(&igb->gen_lock); in igb_local_timer()
3316 mac_link_update(igb->mac_hdl, igb->link_state); in igb_local_timer()
3318 igb_restart_watchdog_timer(igb); in igb_local_timer()
3334 igb_t *igb = (igb_t *)arg; in igb_link_timer() local
3336 mutex_enter(&igb->link_lock); in igb_link_timer()
3337 igb->link_complete = B_TRUE; in igb_link_timer()
3338 igb->link_tid = 0; in igb_link_timer()
3339 mutex_exit(&igb->link_lock); in igb_link_timer()
3353 igb_stall_check(igb_t *igb) in igb_stall_check() argument
3356 struct e1000_hw *hw = &igb->hw; in igb_stall_check()
3360 if (igb->link_state != LINK_STATE_UP) in igb_stall_check()
3367 for (i = 0; i < igb->num_tx_rings; i++) { in igb_stall_check()
3368 tx_ring = &igb->tx_rings[i]; in igb_stall_check()
3412 igb_find_mac_address(igb_t *igb) in igb_find_mac_address() argument
3414 struct e1000_hw *hw = &igb->hw; in igb_find_mac_address()
3431 err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, igb->dip, in igb_find_mac_address()
3446 if (ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, igb->dip, 0, in igb_find_mac_address()
3463 err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, igb->dip, in igb_find_mac_address()
3492 igb_arm_watchdog_timer(igb_t *igb) in igb_arm_watchdog_timer() argument
3497 igb->watchdog_tid = in igb_arm_watchdog_timer()
3499 (void *)igb, 1 * drv_usectohz(1000000)); in igb_arm_watchdog_timer()
3507 igb_enable_watchdog_timer(igb_t *igb) in igb_enable_watchdog_timer() argument
3509 mutex_enter(&igb->watchdog_lock); in igb_enable_watchdog_timer()
3511 if (!igb->watchdog_enable) { in igb_enable_watchdog_timer()
3512 igb->watchdog_enable = B_TRUE; in igb_enable_watchdog_timer()
3513 igb->watchdog_start = B_TRUE; in igb_enable_watchdog_timer()
3514 igb_arm_watchdog_timer(igb); in igb_enable_watchdog_timer()
3517 mutex_exit(&igb->watchdog_lock); in igb_enable_watchdog_timer()
3525 igb_disable_watchdog_timer(igb_t *igb) in igb_disable_watchdog_timer() argument
3529 mutex_enter(&igb->watchdog_lock); in igb_disable_watchdog_timer()
3531 igb->watchdog_enable = B_FALSE; in igb_disable_watchdog_timer()
3532 igb->watchdog_start = B_FALSE; in igb_disable_watchdog_timer()
3533 tid = igb->watchdog_tid; in igb_disable_watchdog_timer()
3534 igb->watchdog_tid = 0; in igb_disable_watchdog_timer()
3536 mutex_exit(&igb->watchdog_lock); in igb_disable_watchdog_timer()
3547 igb_start_watchdog_timer(igb_t *igb) in igb_start_watchdog_timer() argument
3549 mutex_enter(&igb->watchdog_lock); in igb_start_watchdog_timer()
3551 if (igb->watchdog_enable) { in igb_start_watchdog_timer()
3552 if (!igb->watchdog_start) { in igb_start_watchdog_timer()
3553 igb->watchdog_start = B_TRUE; in igb_start_watchdog_timer()
3554 igb_arm_watchdog_timer(igb); in igb_start_watchdog_timer()
3558 mutex_exit(&igb->watchdog_lock); in igb_start_watchdog_timer()
3565 igb_restart_watchdog_timer(igb_t *igb) in igb_restart_watchdog_timer() argument
3567 mutex_enter(&igb->watchdog_lock); in igb_restart_watchdog_timer()
3569 if (igb->watchdog_start) in igb_restart_watchdog_timer()
3570 igb_arm_watchdog_timer(igb); in igb_restart_watchdog_timer()
3572 mutex_exit(&igb->watchdog_lock); in igb_restart_watchdog_timer()
3579 igb_stop_watchdog_timer(igb_t *igb) in igb_stop_watchdog_timer() argument
3583 mutex_enter(&igb->watchdog_lock); in igb_stop_watchdog_timer()
3585 igb->watchdog_start = B_FALSE; in igb_stop_watchdog_timer()
3586 tid = igb->watchdog_tid; in igb_stop_watchdog_timer()
3587 igb->watchdog_tid = 0; in igb_stop_watchdog_timer()
3589 mutex_exit(&igb->watchdog_lock); in igb_stop_watchdog_timer()
3599 igb_start_link_timer(struct igb *igb) in igb_start_link_timer() argument
3601 struct e1000_hw *hw = &igb->hw; in igb_start_link_timer()
3610 mutex_enter(&igb->link_lock); in igb_start_link_timer()
3612 igb->link_complete = B_TRUE; in igb_start_link_timer()
3614 igb->link_complete = B_FALSE; in igb_start_link_timer()
3615 igb->link_tid = timeout(igb_link_timer, (void *)igb, in igb_start_link_timer()
3618 mutex_exit(&igb->link_lock); in igb_start_link_timer()
3625 igb_stop_link_timer(struct igb *igb) in igb_stop_link_timer() argument
3629 mutex_enter(&igb->link_lock); in igb_stop_link_timer()
3630 igb->link_complete = B_TRUE; in igb_stop_link_timer()
3631 tid = igb->link_tid; in igb_stop_link_timer()
3632 igb->link_tid = 0; in igb_stop_link_timer()
3633 mutex_exit(&igb->link_lock); in igb_stop_link_timer()
3643 igb_disable_adapter_interrupts(igb_t *igb) in igb_disable_adapter_interrupts() argument
3645 struct e1000_hw *hw = &igb->hw; in igb_disable_adapter_interrupts()
3657 if (igb->intr_type == DDI_INTR_TYPE_MSIX) { in igb_disable_adapter_interrupts()
3670 igb_enable_adapter_interrupts_82580(igb_t *igb) in igb_enable_adapter_interrupts_82580() argument
3672 struct e1000_hw *hw = &igb->hw; in igb_enable_adapter_interrupts_82580()
3676 igb->ims_mask |= E1000_IMS_DRSTA; in igb_enable_adapter_interrupts_82580()
3678 if (igb->intr_type == DDI_INTR_TYPE_MSIX) { in igb_enable_adapter_interrupts_82580()
3681 E1000_WRITE_REG(hw, E1000_EIMS, igb->eims_mask); in igb_enable_adapter_interrupts_82580()
3682 E1000_WRITE_REG(hw, E1000_EIAC, igb->eims_mask); in igb_enable_adapter_interrupts_82580()
3683 igb->ims_mask = (E1000_IMS_LSC | E1000_IMS_DRSTA); in igb_enable_adapter_interrupts_82580()
3684 E1000_WRITE_REG(hw, E1000_IMS, igb->ims_mask); in igb_enable_adapter_interrupts_82580()
3687 igb->ims_mask = IMS_ENABLE_MASK | E1000_IMS_TXQE; in igb_enable_adapter_interrupts_82580()
3688 igb->ims_mask |= E1000_IMS_DRSTA; in igb_enable_adapter_interrupts_82580()
3689 E1000_WRITE_REG(hw, E1000_IMS, igb->ims_mask); in igb_enable_adapter_interrupts_82580()
3702 igb_enable_adapter_interrupts_82576(igb_t *igb) in igb_enable_adapter_interrupts_82576() argument
3704 struct e1000_hw *hw = &igb->hw; in igb_enable_adapter_interrupts_82576()
3709 if (igb->intr_type == DDI_INTR_TYPE_MSIX) { in igb_enable_adapter_interrupts_82576()
3712 E1000_WRITE_REG(hw, E1000_EIMS, igb->eims_mask); in igb_enable_adapter_interrupts_82576()
3713 E1000_WRITE_REG(hw, E1000_EIAC, igb->eims_mask); in igb_enable_adapter_interrupts_82576()
3714 igb->ims_mask = E1000_IMS_LSC; in igb_enable_adapter_interrupts_82576()
3719 igb->ims_mask = IMS_ENABLE_MASK | E1000_IMS_TXQE; in igb_enable_adapter_interrupts_82576()
3734 igb_enable_adapter_interrupts_82575(igb_t *igb) in igb_enable_adapter_interrupts_82575() argument
3736 struct e1000_hw *hw = &igb->hw; in igb_enable_adapter_interrupts_82575()
3742 if (igb->intr_type == DDI_INTR_TYPE_MSIX) { in igb_enable_adapter_interrupts_82575()
3744 E1000_WRITE_REG(hw, E1000_EIMS, igb->eims_mask); in igb_enable_adapter_interrupts_82575()
3745 E1000_WRITE_REG(hw, E1000_EIAC, igb->eims_mask); in igb_enable_adapter_interrupts_82575()
3746 igb->ims_mask = E1000_IMS_LSC; in igb_enable_adapter_interrupts_82575()
3759 igb->ims_mask = IMS_ENABLE_MASK; in igb_enable_adapter_interrupts_82575()
3779 igb_loopback_ioctl(igb_t *igb, struct iocblk *iocp, mblk_t *mp) in igb_loopback_ioctl() argument
3788 hw = &igb->hw; in igb_loopback_ioctl()
3842 *lbmp = igb->loopback_mode; in igb_loopback_ioctl()
3851 if (!igb_set_loopback_mode(igb, *lbmp)) in igb_loopback_ioctl()
3859 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) { in igb_loopback_ioctl()
3860 ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED); in igb_loopback_ioctl()
3871 igb_set_loopback_mode(igb_t *igb, uint32_t mode) in igb_set_loopback_mode() argument
3876 if (mode == igb->loopback_mode) in igb_set_loopback_mode()
3879 hw = &igb->hw; in igb_set_loopback_mode()
3881 igb->loopback_mode = mode; in igb_set_loopback_mode()
3886 (void) igb_reset(igb); in igb_set_loopback_mode()
3891 mutex_enter(&igb->gen_lock); in igb_set_loopback_mode()
3895 mutex_exit(&igb->gen_lock); in igb_set_loopback_mode()
3899 igb_set_external_loopback(igb); in igb_set_loopback_mode()
3903 igb_set_internal_phy_loopback(igb); in igb_set_loopback_mode()
3907 igb_set_internal_serdes_loopback(igb); in igb_set_loopback_mode()
3911 mutex_exit(&igb->gen_lock); in igb_set_loopback_mode()
3919 mutex_enter(&igb->gen_lock); in igb_set_loopback_mode()
3920 (void) igb_link_check(igb); in igb_set_loopback_mode()
3921 mutex_exit(&igb->gen_lock); in igb_set_loopback_mode()
3923 if (igb->link_state == LINK_STATE_UP) in igb_set_loopback_mode()
3929 if (igb->link_state != LINK_STATE_UP) { in igb_set_loopback_mode()
3934 igb->loopback_mode = IGB_LB_NONE; in igb_set_loopback_mode()
3938 (void) igb_reset(igb); in igb_set_loopback_mode()
3941 igb_log(igb, IGB_LOG_INFO, "Set external loopback " in igb_set_loopback_mode()
3955 igb_set_external_loopback(igb_t *igb) in igb_set_external_loopback() argument
3960 hw = &igb->hw; in igb_set_external_loopback()
3977 igb_set_internal_phy_loopback(igb_t *igb) in igb_set_internal_phy_loopback() argument
3984 hw = &igb->hw; in igb_set_internal_phy_loopback()
4011 igb_set_internal_serdes_loopback(igb_t *igb) in igb_set_internal_serdes_loopback() argument
4019 hw = &igb->hw; in igb_set_internal_serdes_loopback()
4067 mac_rx_ring(rx_ring->igb->mac_hdl, rx_ring->ring_handle, mp, in igb_intr_rx_work()
4078 igb_t *igb = tx_ring->igb; in igb_intr_tx_work() local
4085 (tx_ring->tbd_free >= igb->tx_resched_thresh)) { in igb_intr_tx_work()
4087 mac_tx_ring_update(tx_ring->igb->mac_hdl, tx_ring->ring_handle); in igb_intr_tx_work()
4097 igb_intr_link_work(igb_t *igb) in igb_intr_link_work() argument
4101 igb_stop_watchdog_timer(igb); in igb_intr_link_work()
4103 mutex_enter(&igb->gen_lock); in igb_intr_link_work()
4109 igb->hw.mac.get_link_status = B_TRUE; in igb_intr_link_work()
4112 link_changed = igb_link_check(igb); in igb_intr_link_work()
4115 igb_get_phy_state(igb); in igb_intr_link_work()
4117 mutex_exit(&igb->gen_lock); in igb_intr_link_work()
4120 mac_link_update(igb->mac_hdl, igb->link_state); in igb_intr_link_work()
4122 igb_start_watchdog_timer(igb); in igb_intr_link_work()
4131 igb_t *igb = (igb_t *)arg1; in igb_intr_legacy() local
4141 mutex_enter(&igb->gen_lock); in igb_intr_legacy()
4143 if (igb->igb_state & IGB_SUSPENDED) { in igb_intr_legacy()
4144 mutex_exit(&igb->gen_lock); in igb_intr_legacy()
4151 icr = E1000_READ_REG(&igb->hw, E1000_ICR); in igb_intr_legacy()
4153 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) { in igb_intr_legacy()
4154 mutex_exit(&igb->gen_lock); in igb_intr_legacy()
4155 ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED); in igb_intr_legacy()
4156 atomic_or_32(&igb->igb_state, IGB_ERROR); in igb_intr_legacy()
4166 ASSERT(igb->num_rx_rings == 1); in igb_intr_legacy()
4167 ASSERT(igb->num_tx_rings == 1); in igb_intr_legacy()
4170 (void) E1000_READ_REG(&igb->hw, E1000_EICR); in igb_intr_legacy()
4173 mp = igb_rx(&igb->rx_rings[0], IGB_NO_POLL); in igb_intr_legacy()
4177 tx_ring = &igb->tx_rings[0]; in igb_intr_legacy()
4184 (tx_ring->tbd_free >= igb->tx_resched_thresh)); in igb_intr_legacy()
4192 igb->hw.mac.get_link_status = B_TRUE; in igb_intr_legacy()
4195 link_changed = igb_link_check(igb); in igb_intr_legacy()
4198 igb_get_phy_state(igb); in igb_intr_legacy()
4203 atomic_or_32(&igb->igb_state, IGB_STALL); in igb_intr_legacy()
4215 mutex_exit(&igb->gen_lock); in igb_intr_legacy()
4221 mac_rx(igb->mac_hdl, NULL, mp); in igb_intr_legacy()
4225 mac_tx_ring_update(igb->mac_hdl, tx_ring->ring_handle); in igb_intr_legacy()
4230 mac_link_update(igb->mac_hdl, igb->link_state); in igb_intr_legacy()
4241 igb_t *igb = (igb_t *)arg1; in igb_intr_msi() local
4246 icr = E1000_READ_REG(&igb->hw, E1000_ICR); in igb_intr_msi()
4248 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) { in igb_intr_msi()
4249 ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED); in igb_intr_msi()
4250 atomic_or_32(&igb->igb_state, IGB_ERROR); in igb_intr_msi()
4255 (void) E1000_READ_REG(&igb->hw, E1000_EICR); in igb_intr_msi()
4261 ASSERT(igb->num_rx_rings == 1); in igb_intr_msi()
4262 ASSERT(igb->num_tx_rings == 1); in igb_intr_msi()
4265 igb_intr_rx_work(&igb->rx_rings[0]); in igb_intr_msi()
4269 igb_intr_tx_work(&igb->tx_rings[0]); in igb_intr_msi()
4273 igb_intr_link_work(igb); in igb_intr_msi()
4278 atomic_or_32(&igb->igb_state, IGB_STALL); in igb_intr_msi()
4329 igb_t *igb = (igb_t *)arg1; in igb_intr_tx_other() local
4334 icr = E1000_READ_REG(&igb->hw, E1000_ICR); in igb_intr_tx_other()
4336 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) { in igb_intr_tx_other()
4337 ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED); in igb_intr_tx_other()
4338 atomic_or_32(&igb->igb_state, IGB_ERROR); in igb_intr_tx_other()
4347 igb_intr_tx_work(&igb->tx_rings[0]); in igb_intr_tx_other()
4353 igb_intr_link_work(igb); in igb_intr_tx_other()
4365 IGB_STAT(igb->dout_sync); in igb_intr_tx_other()
4370 atomic_or_32(&igb->igb_state, IGB_STALL); in igb_intr_tx_other()
4386 igb_alloc_intrs(igb_t *igb) in igb_alloc_intrs() argument
4392 devinfo = igb->dip; in igb_alloc_intrs()
4398 igb_log(igb, IGB_LOG_ERROR, in igb_alloc_intrs()
4402 igb_log(igb, IGB_LOG_INFO, "Supported interrupt types: %x", in igb_alloc_intrs()
4405 igb->intr_type = 0; in igb_alloc_intrs()
4409 (igb->intr_force <= IGB_INTR_MSIX)) { in igb_alloc_intrs()
4410 rc = igb_alloc_intr_handles(igb, DDI_INTR_TYPE_MSIX); in igb_alloc_intrs()
4415 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intrs()
4420 igb->num_rx_rings = 1; in igb_alloc_intrs()
4421 igb->num_tx_rings = 1; in igb_alloc_intrs()
4422 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intrs()
4427 (igb->intr_force <= IGB_INTR_MSI)) { in igb_alloc_intrs()
4428 rc = igb_alloc_intr_handles(igb, DDI_INTR_TYPE_MSI); in igb_alloc_intrs()
4433 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intrs()
4439 rc = igb_alloc_intr_handles(igb, DDI_INTR_TYPE_FIXED); in igb_alloc_intrs()
4444 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intrs()
4461 igb_alloc_intr_handles(igb_t *igb, int intr_type) in igb_alloc_intr_handles() argument
4468 devinfo = igb->dip; in igb_alloc_intr_handles()
4474 igb_log(igb, IGB_LOG_INFO, "interrupt type: legacy"); in igb_alloc_intr_handles()
4480 igb_log(igb, IGB_LOG_INFO, "interrupt type: MSI"); in igb_alloc_intr_handles()
4489 request = igb->num_rx_rings + igb->num_tx_rings; in igb_alloc_intr_handles()
4492 igb_log(igb, IGB_LOG_INFO, "interrupt type: MSI-X"); in igb_alloc_intr_handles()
4496 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4501 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4510 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4515 igb_log(igb, IGB_LOG_INFO, "interrupts supported: %d", count); in igb_alloc_intr_handles()
4522 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4527 igb_log(igb, IGB_LOG_INFO, "interrupts available: %d", avail); in igb_alloc_intr_handles()
4530 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4537 igb->intr_cnt = 0; in igb_alloc_intr_handles()
4542 igb->intr_size = request * sizeof (ddi_intr_handle_t); in igb_alloc_intr_handles()
4543 igb->htable = kmem_alloc(igb->intr_size, KM_SLEEP); in igb_alloc_intr_handles()
4545 rc = ddi_intr_alloc(devinfo, igb->htable, intr_type, 0, in igb_alloc_intr_handles()
4548 igb_log(igb, IGB_LOG_INFO, "Allocate interrupts failed. " in igb_alloc_intr_handles()
4553 igb_log(igb, IGB_LOG_INFO, "interrupts actually allocated: %d", actual); in igb_alloc_intr_handles()
4555 igb->intr_cnt = actual; in igb_alloc_intr_handles()
4558 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4569 if (diff < igb->num_tx_rings) { in igb_alloc_intr_handles()
4570 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4572 igb->num_tx_rings - diff); in igb_alloc_intr_handles()
4573 igb->num_tx_rings -= diff; in igb_alloc_intr_handles()
4575 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4577 igb->num_tx_rings = 1; in igb_alloc_intr_handles()
4579 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4582 igb->num_rx_rings = actual - 1; in igb_alloc_intr_handles()
4589 rc = ddi_intr_get_pri(igb->htable[0], &igb->intr_pri); in igb_alloc_intr_handles()
4591 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4596 rc = ddi_intr_get_cap(igb->htable[0], &igb->intr_cap); in igb_alloc_intr_handles()
4598 igb_log(igb, IGB_LOG_INFO, in igb_alloc_intr_handles()
4603 igb->intr_type = intr_type; in igb_alloc_intr_handles()
4608 igb_rem_intrs(igb); in igb_alloc_intr_handles()
4620 igb_add_intr_handlers(igb_t *igb) in igb_add_intr_handlers() argument
4630 switch (igb->intr_type) { in igb_add_intr_handlers()
4633 tx_ring = &igb->tx_rings[0]; in igb_add_intr_handlers()
4634 rc = ddi_intr_add_handler(igb->htable[vector], in igb_add_intr_handlers()
4636 (void *)igb, NULL); in igb_add_intr_handlers()
4639 igb_log(igb, IGB_LOG_INFO, in igb_add_intr_handlers()
4647 for (i = 0; i < igb->num_rx_rings; i++) { in igb_add_intr_handlers()
4648 rx_ring = &igb->rx_rings[i]; in igb_add_intr_handlers()
4650 rc = ddi_intr_add_handler(igb->htable[vector], in igb_add_intr_handlers()
4655 igb_log(igb, IGB_LOG_INFO, in igb_add_intr_handlers()
4660 igb->htable[vector]); in igb_add_intr_handlers()
4671 for (i = 1; i < igb->num_tx_rings; i++) { in igb_add_intr_handlers()
4672 tx_ring = &igb->tx_rings[i]; in igb_add_intr_handlers()
4674 rc = ddi_intr_add_handler(igb->htable[vector], in igb_add_intr_handlers()
4679 igb_log(igb, IGB_LOG_INFO, in igb_add_intr_handlers()
4684 igb->htable[vector]); in igb_add_intr_handlers()
4698 rc = ddi_intr_add_handler(igb->htable[vector], in igb_add_intr_handlers()
4700 (void *)igb, NULL); in igb_add_intr_handlers()
4703 igb_log(igb, IGB_LOG_INFO, in igb_add_intr_handlers()
4708 rx_ring = &igb->rx_rings[0]; in igb_add_intr_handlers()
4716 rc = ddi_intr_add_handler(igb->htable[vector], in igb_add_intr_handlers()
4718 (void *)igb, NULL); in igb_add_intr_handlers()
4721 igb_log(igb, IGB_LOG_INFO, in igb_add_intr_handlers()
4726 rx_ring = &igb->rx_rings[0]; in igb_add_intr_handlers()
4736 ASSERT(vector == igb->intr_cnt); in igb_add_intr_handlers()
4747 igb_setup_msix_82575(igb_t *igb) in igb_setup_msix_82575() argument
4751 struct e1000_hw *hw = &igb->hw; in igb_setup_msix_82575()
4759 igb->eims_mask = E1000_EICR_TX_QUEUE0 | E1000_EICR_OTHER; in igb_setup_msix_82575()
4760 E1000_WRITE_REG(hw, E1000_MSIXBM(vector), igb->eims_mask); in igb_setup_msix_82575()
4763 for (i = 0; i < igb->num_rx_rings; i++) { in igb_setup_msix_82575()
4774 igb->eims_mask |= eims; in igb_setup_msix_82575()
4779 for (i = 1; i < igb->num_tx_rings; i++) { in igb_setup_msix_82575()
4790 igb->eims_mask |= eims; in igb_setup_msix_82575()
4795 ASSERT(vector == igb->intr_cnt); in igb_setup_msix_82575()
4814 igb_setup_msix_82576(igb_t *igb) in igb_setup_msix_82576() argument
4816 struct e1000_hw *hw = &igb->hw; in igb_setup_msix_82576()
4841 igb->eims_mask = (1 << vector); in igb_setup_msix_82576()
4844 for (i = 0; i < igb->num_rx_rings; i++) { in igb_setup_msix_82576()
4863 igb->eims_mask |= (1 << vector); in igb_setup_msix_82576()
4868 for (i = 1; i < igb->num_tx_rings; i++) { in igb_setup_msix_82576()
4888 igb->eims_mask |= (1 << vector); in igb_setup_msix_82576()
4893 ASSERT(vector == igb->intr_cnt); in igb_setup_msix_82576()
4905 igb_setup_msix_82580(igb_t *igb) in igb_setup_msix_82580() argument
4907 struct e1000_hw *hw = &igb->hw; in igb_setup_msix_82580()
4931 igb->eims_mask = (1 << vector); in igb_setup_msix_82580()
4935 for (i = 0; i < igb->num_rx_rings; i++) { in igb_setup_msix_82580()
4954 igb->eims_mask |= (1 << vector); in igb_setup_msix_82580()
4959 for (i = 1; i < igb->num_tx_rings; i++) { in igb_setup_msix_82580()
4979 igb->eims_mask |= (1 << vector); in igb_setup_msix_82580()
4983 ASSERT(vector == igb->intr_cnt); in igb_setup_msix_82580()
4990 igb_rem_intr_handlers(igb_t *igb) in igb_rem_intr_handlers() argument
4995 for (i = 0; i < igb->intr_cnt; i++) { in igb_rem_intr_handlers()
4996 rc = ddi_intr_remove_handler(igb->htable[i]); in igb_rem_intr_handlers()
4998 igb_log(igb, IGB_LOG_INFO, in igb_rem_intr_handlers()
5008 igb_rem_intrs(igb_t *igb) in igb_rem_intrs() argument
5013 for (i = 0; i < igb->intr_cnt; i++) { in igb_rem_intrs()
5014 rc = ddi_intr_free(igb->htable[i]); in igb_rem_intrs()
5016 igb_log(igb, IGB_LOG_INFO, in igb_rem_intrs()
5021 kmem_free(igb->htable, igb->intr_size); in igb_rem_intrs()
5022 igb->htable = NULL; in igb_rem_intrs()
5029 igb_enable_intrs(igb_t *igb) in igb_enable_intrs() argument
5035 if (igb->intr_cap & DDI_INTR_FLAG_BLOCK) { in igb_enable_intrs()
5037 rc = ddi_intr_block_enable(igb->htable, igb->intr_cnt); in igb_enable_intrs()
5039 igb_log(igb, IGB_LOG_ERROR, in igb_enable_intrs()
5045 for (i = 0; i < igb->intr_cnt; i++) { in igb_enable_intrs()
5046 rc = ddi_intr_enable(igb->htable[i]); in igb_enable_intrs()
5048 igb_log(igb, IGB_LOG_ERROR, in igb_enable_intrs()
5062 igb_disable_intrs(igb_t *igb) in igb_disable_intrs() argument
5068 if (igb->intr_cap & DDI_INTR_FLAG_BLOCK) { in igb_disable_intrs()
5069 rc = ddi_intr_block_disable(igb->htable, igb->intr_cnt); in igb_disable_intrs()
5071 igb_log(igb, IGB_LOG_ERROR, in igb_disable_intrs()
5076 for (i = 0; i < igb->intr_cnt; i++) { in igb_disable_intrs()
5077 rc = ddi_intr_disable(igb->htable[i]); in igb_disable_intrs()
5079 igb_log(igb, IGB_LOG_ERROR, in igb_disable_intrs()
5093 igb_get_phy_state(igb_t *igb) in igb_get_phy_state() argument
5095 struct e1000_hw *hw = &igb->hw; in igb_get_phy_state()
5105 ASSERT(mutex_owned(&igb->gen_lock)); in igb_get_phy_state()
5118 igb->param_autoneg_cap = in igb_get_phy_state()
5120 igb->param_pause_cap = in igb_get_phy_state()
5122 igb->param_asym_pause_cap = in igb_get_phy_state()
5124 igb->param_1000fdx_cap = in igb_get_phy_state()
5127 igb->param_1000hdx_cap = in igb_get_phy_state()
5130 igb->param_100t4_cap = in igb_get_phy_state()
5132 igb->param_100fdx_cap = ((phy_status & MII_SR_100X_FD_CAPS) || in igb_get_phy_state()
5134 igb->param_100hdx_cap = ((phy_status & MII_SR_100X_HD_CAPS) || in igb_get_phy_state()
5136 igb->param_10fdx_cap = in igb_get_phy_state()
5138 igb->param_10hdx_cap = in igb_get_phy_state()
5140 igb->param_rem_fault = in igb_get_phy_state()
5143 igb->param_adv_autoneg_cap = hw->mac.autoneg; in igb_get_phy_state()
5144 igb->param_adv_pause_cap = in igb_get_phy_state()
5146 igb->param_adv_asym_pause_cap = in igb_get_phy_state()
5148 igb->param_adv_1000hdx_cap = in igb_get_phy_state()
5150 igb->param_adv_100t4_cap = in igb_get_phy_state()
5152 igb->param_adv_rem_fault = in igb_get_phy_state()
5154 if (igb->param_adv_autoneg_cap == 1) { in igb_get_phy_state()
5155 igb->param_adv_1000fdx_cap = in igb_get_phy_state()
5157 igb->param_adv_100fdx_cap = in igb_get_phy_state()
5159 igb->param_adv_100hdx_cap = in igb_get_phy_state()
5161 igb->param_adv_10fdx_cap = in igb_get_phy_state()
5163 igb->param_adv_10hdx_cap = in igb_get_phy_state()
5167 igb->param_lp_autoneg_cap = in igb_get_phy_state()
5169 igb->param_lp_pause_cap = in igb_get_phy_state()
5171 igb->param_lp_asym_pause_cap = in igb_get_phy_state()
5173 igb->param_lp_1000fdx_cap = in igb_get_phy_state()
5175 igb->param_lp_1000hdx_cap = in igb_get_phy_state()
5177 igb->param_lp_100t4_cap = in igb_get_phy_state()
5179 igb->param_lp_100fdx_cap = in igb_get_phy_state()
5181 igb->param_lp_100hdx_cap = in igb_get_phy_state()
5183 igb->param_lp_10fdx_cap = in igb_get_phy_state()
5185 igb->param_lp_10hdx_cap = in igb_get_phy_state()
5187 igb->param_lp_rem_fault = in igb_get_phy_state()
5193 igb->param_autoneg_cap = 0; in igb_get_phy_state()
5194 igb->param_pause_cap = 1; in igb_get_phy_state()
5195 igb->param_asym_pause_cap = 1; in igb_get_phy_state()
5196 igb->param_1000fdx_cap = 1; in igb_get_phy_state()
5197 igb->param_1000hdx_cap = 0; in igb_get_phy_state()
5198 igb->param_100t4_cap = 0; in igb_get_phy_state()
5199 igb->param_100fdx_cap = 0; in igb_get_phy_state()
5200 igb->param_100hdx_cap = 0; in igb_get_phy_state()
5201 igb->param_10fdx_cap = 0; in igb_get_phy_state()
5202 igb->param_10hdx_cap = 0; in igb_get_phy_state()
5204 igb->param_adv_autoneg_cap = 0; in igb_get_phy_state()
5205 igb->param_adv_pause_cap = 1; in igb_get_phy_state()
5206 igb->param_adv_asym_pause_cap = 1; in igb_get_phy_state()
5207 igb->param_adv_1000fdx_cap = 1; in igb_get_phy_state()
5208 igb->param_adv_1000hdx_cap = 0; in igb_get_phy_state()
5209 igb->param_adv_100t4_cap = 0; in igb_get_phy_state()
5210 igb->param_adv_100fdx_cap = 0; in igb_get_phy_state()
5211 igb->param_adv_100hdx_cap = 0; in igb_get_phy_state()
5212 igb->param_adv_10fdx_cap = 0; in igb_get_phy_state()
5213 igb->param_adv_10hdx_cap = 0; in igb_get_phy_state()
5215 igb->param_lp_autoneg_cap = 0; in igb_get_phy_state()
5216 igb->param_lp_pause_cap = 0; in igb_get_phy_state()
5217 igb->param_lp_asym_pause_cap = 0; in igb_get_phy_state()
5218 igb->param_lp_1000fdx_cap = 0; in igb_get_phy_state()
5219 igb->param_lp_1000hdx_cap = 0; in igb_get_phy_state()
5220 igb->param_lp_100t4_cap = 0; in igb_get_phy_state()
5221 igb->param_lp_100fdx_cap = 0; in igb_get_phy_state()
5222 igb->param_lp_100hdx_cap = 0; in igb_get_phy_state()
5223 igb->param_lp_10fdx_cap = 0; in igb_get_phy_state()
5224 igb->param_lp_10hdx_cap = 0; in igb_get_phy_state()
5225 igb->param_lp_rem_fault = 0; in igb_get_phy_state()
5238 igb_param_sync(igb_t *igb) in igb_param_sync() argument
5240 igb->param_en_1000fdx_cap = igb->param_adv_1000fdx_cap; in igb_param_sync()
5241 igb->param_en_1000hdx_cap = igb->param_adv_1000hdx_cap; in igb_param_sync()
5242 igb->param_en_100t4_cap = igb->param_adv_100t4_cap; in igb_param_sync()
5243 igb->param_en_100fdx_cap = igb->param_adv_100fdx_cap; in igb_param_sync()
5244 igb->param_en_100hdx_cap = igb->param_adv_100hdx_cap; in igb_param_sync()
5245 igb->param_en_10fdx_cap = igb->param_adv_10fdx_cap; in igb_param_sync()
5246 igb->param_en_10hdx_cap = igb->param_adv_10hdx_cap; in igb_param_sync()
5336 igb_fm_init(igb_t *igb) in igb_fm_init() argument
5342 if (igb->fm_capabilities & DDI_FM_ACCCHK_CAPABLE) { in igb_fm_init()
5348 if (igb->fm_capabilities & DDI_FM_DMACHK_CAPABLE) { in igb_fm_init()
5356 if (igb->fm_capabilities) { in igb_fm_init()
5359 ddi_fm_init(igb->dip, &igb->fm_capabilities, &iblk); in igb_fm_init()
5364 if (DDI_FM_EREPORT_CAP(igb->fm_capabilities) || in igb_fm_init()
5365 DDI_FM_ERRCB_CAP(igb->fm_capabilities)) in igb_fm_init()
5366 pci_ereport_setup(igb->dip); in igb_fm_init()
5371 if (DDI_FM_ERRCB_CAP(igb->fm_capabilities)) in igb_fm_init()
5372 ddi_fm_handler_register(igb->dip, in igb_fm_init()
5373 igb_fm_error_cb, (void*) igb); in igb_fm_init()
5378 igb_fm_fini(igb_t *igb) in igb_fm_fini() argument
5381 if (igb->fm_capabilities) { in igb_fm_fini()
5386 if (DDI_FM_EREPORT_CAP(igb->fm_capabilities) || in igb_fm_fini()
5387 DDI_FM_ERRCB_CAP(igb->fm_capabilities)) in igb_fm_fini()
5388 pci_ereport_teardown(igb->dip); in igb_fm_fini()
5393 if (DDI_FM_ERRCB_CAP(igb->fm_capabilities)) in igb_fm_fini()
5394 ddi_fm_handler_unregister(igb->dip); in igb_fm_fini()
5397 ddi_fm_fini(igb->dip); in igb_fm_fini()
5402 igb_fm_ereport(igb_t *igb, char *detail) in igb_fm_ereport() argument
5409 if (DDI_FM_EREPORT_CAP(igb->fm_capabilities)) { in igb_fm_ereport()
5410 ddi_fm_ereport_post(igb->dip, buf, ena, DDI_NOSLEEP, in igb_fm_ereport()
5419 igb_t *igb = arg; in igb_ufm_fill_image() local
5428 switch (igb->hw.nvm.type) { in igb_ufm_fill_image()
5465 igb_t *igb = arg; in igb_ufm_fill_slot() local
5472 if (ddi_prop_lookup_string(DDI_DEV_T_ANY, igb->dip, DDI_PROP_DONTPASS, in igb_ufm_fill_slot()
5482 ddi_ufm_slot_set_imgsize(slotp, igb->hw.nvm.word_size * 2); in igb_ufm_fill_slot()
5489 igb_t *igb = arg; in igb_ufm_getcaps() local
5492 if (igb->hw.nvm.type != e1000_nvm_none && in igb_ufm_getcaps()
5493 igb->hw.nvm.type != e1000_nvm_unknown) { in igb_ufm_getcaps()
5496 if (igb->hw.nvm.ops.read != NULL) { in igb_ufm_getcaps()
5508 igb_t *igb = arg; in igb_ufm_readimg() local
5510 uint32_t imgsize = igb->hw.nvm.word_size * 2; in igb_ufm_readimg()
5521 if (igb->hw.nvm.ops.read == NULL) { in igb_ufm_readimg()
5537 mutex_enter(&igb->gen_lock); in igb_ufm_readimg()
5538 ret = e1000_read_nvm(&igb->hw, wordoff, nwords, buf16); in igb_ufm_readimg()
5539 mutex_exit(&igb->gen_lock); in igb_ufm_readimg()