Lines Matching refs:ixgbe
75 static void ixgbe_setup_vmdq_rss_conf(ixgbe_t *ixgbe);
102 static uint32_t ixgbe_get_hw_rx_index(ixgbe_t *ixgbe, uint32_t sw_rx_index);
436 ixgbe_t *ixgbe; in ixgbe_attach() local
460 ixgbe = kmem_zalloc(sizeof (ixgbe_t), KM_SLEEP); in ixgbe_attach()
462 ixgbe->dip = devinfo; in ixgbe_attach()
463 ixgbe->instance = instance; in ixgbe_attach()
465 hw = &ixgbe->hw; in ixgbe_attach()
466 osdep = &ixgbe->osdep; in ixgbe_attach()
468 osdep->ixgbe = ixgbe; in ixgbe_attach()
471 ddi_set_driver_private(devinfo, ixgbe); in ixgbe_attach()
476 ixgbe->fm_capabilities = ixgbe_get_prop(ixgbe, PROP_FM_CAPABLE, in ixgbe_attach()
479 ixgbe_fm_init(ixgbe); in ixgbe_attach()
480 ixgbe->attach_progress |= ATTACH_PROGRESS_FM_INIT; in ixgbe_attach()
486 ixgbe_error(ixgbe, "Failed to map PCI configurations"); in ixgbe_attach()
489 ixgbe->attach_progress |= ATTACH_PROGRESS_PCI_CONFIG; in ixgbe_attach()
494 if (ixgbe_identify_hardware(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
495 ixgbe_error(ixgbe, "Failed to identify hardware"); in ixgbe_attach()
502 if (ixgbe_regs_map(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
503 ixgbe_error(ixgbe, "Failed to map device registers"); in ixgbe_attach()
506 ixgbe->attach_progress |= ATTACH_PROGRESS_REGS_MAP; in ixgbe_attach()
511 ixgbe_init_properties(ixgbe); in ixgbe_attach()
512 ixgbe->attach_progress |= ATTACH_PROGRESS_PROPS; in ixgbe_attach()
517 if (ixgbe_intr_cb_register(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
518 ixgbe_error(ixgbe, "Failed to register interrupt callback"); in ixgbe_attach()
525 if (ixgbe_alloc_intrs(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
526 ixgbe_error(ixgbe, "Failed to allocate interrupts"); in ixgbe_attach()
529 ixgbe->attach_progress |= ATTACH_PROGRESS_ALLOC_INTR; in ixgbe_attach()
537 if (ixgbe_alloc_rings(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
538 ixgbe_error(ixgbe, "Failed to allocate rx and tx rings"); in ixgbe_attach()
541 ixgbe->attach_progress |= ATTACH_PROGRESS_ALLOC_RINGS; in ixgbe_attach()
546 if (ixgbe_map_intrs_to_vectors(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
547 ixgbe_error(ixgbe, "Failed to map interrupts to vectors"); in ixgbe_attach()
554 if (ixgbe_add_intr_handlers(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
555 ixgbe_error(ixgbe, "Failed to add interrupt handlers"); in ixgbe_attach()
558 ixgbe->attach_progress |= ATTACH_PROGRESS_ADD_INTR; in ixgbe_attach()
564 if ((ixgbe->sfp_taskq = ddi_taskq_create(devinfo, taskqname, in ixgbe_attach()
566 ixgbe_error(ixgbe, "sfp_taskq create failed"); in ixgbe_attach()
569 ixgbe->attach_progress |= ATTACH_PROGRESS_SFP_TASKQ; in ixgbe_attach()
575 if ((ixgbe->overtemp_taskq = ddi_taskq_create(devinfo, taskqname, in ixgbe_attach()
577 ixgbe_error(ixgbe, "overtemp_taskq create failed"); in ixgbe_attach()
580 ixgbe->attach_progress |= ATTACH_PROGRESS_OVERTEMP_TASKQ; in ixgbe_attach()
586 if ((ixgbe->phy_taskq = ddi_taskq_create(devinfo, taskqname, in ixgbe_attach()
588 ixgbe_error(ixgbe, "phy_taskq create failed"); in ixgbe_attach()
591 ixgbe->attach_progress |= ATTACH_PROGRESS_PHY_TASKQ; in ixgbe_attach()
596 if (ixgbe_init_driver_settings(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
597 ixgbe_error(ixgbe, "Failed to initialize driver settings"); in ixgbe_attach()
607 ixgbe_init_locks(ixgbe); in ixgbe_attach()
608 ixgbe->attach_progress |= ATTACH_PROGRESS_LOCKS; in ixgbe_attach()
613 if (ixgbe_init(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
614 ixgbe_error(ixgbe, "Failed to initialize adapter"); in ixgbe_attach()
617 ixgbe->link_check_complete = B_FALSE; in ixgbe_attach()
618 ixgbe->link_check_hrtime = gethrtime() + in ixgbe_attach()
620 ixgbe->attach_progress |= ATTACH_PROGRESS_INIT; in ixgbe_attach()
622 if (ixgbe_check_acc_handle(ixgbe->osdep.cfg_handle) != DDI_FM_OK) { in ixgbe_attach()
623 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_LOST); in ixgbe_attach()
630 ixgbe_init_params(ixgbe); in ixgbe_attach()
635 if (ixgbe_init_stats(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
636 ixgbe_error(ixgbe, "Failed to initialize statistics"); in ixgbe_attach()
639 ixgbe->attach_progress |= ATTACH_PROGRESS_STATS; in ixgbe_attach()
644 if (ixgbe_register_mac(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
645 ixgbe_error(ixgbe, "Failed to register MAC"); in ixgbe_attach()
648 mac_link_update(ixgbe->mac_hdl, LINK_STATE_UNKNOWN); in ixgbe_attach()
649 ixgbe->attach_progress |= ATTACH_PROGRESS_MAC; in ixgbe_attach()
651 ixgbe->periodic_id = ddi_periodic_add(ixgbe_link_timer, ixgbe, in ixgbe_attach()
653 if (ixgbe->periodic_id == 0) { in ixgbe_attach()
654 ixgbe_error(ixgbe, "Failed to add the link check timer"); in ixgbe_attach()
657 ixgbe->attach_progress |= ATTACH_PROGRESS_LINK_TIMER; in ixgbe_attach()
663 if (ixgbe_enable_intrs(ixgbe) != IXGBE_SUCCESS) { in ixgbe_attach()
664 ixgbe_error(ixgbe, "Failed to enable DDI interrupts"); in ixgbe_attach()
667 ixgbe->attach_progress |= ATTACH_PROGRESS_ENABLE_INTR; in ixgbe_attach()
669 if (ixgbe->hw.bus.func == 0) { in ixgbe_attach()
671 &ixgbe_ufm_ops, &ixgbe->ixgbe_ufmh, ixgbe) != 0) { in ixgbe_attach()
672 ixgbe_error(ixgbe, "Failed to enable DDI UFM support"); in ixgbe_attach()
675 ixgbe->attach_progress |= ATTACH_PROGRESS_UFM; in ixgbe_attach()
676 ddi_ufm_update(ixgbe->ixgbe_ufmh); in ixgbe_attach()
679 ixgbe_log(ixgbe, "%s", ixgbe_ident); in ixgbe_attach()
680 atomic_or_32(&ixgbe->ixgbe_state, IXGBE_INITIALIZED); in ixgbe_attach()
685 ixgbe_unconfigure(devinfo, ixgbe); in ixgbe_attach()
707 ixgbe_t *ixgbe; in ixgbe_detach() local
726 ixgbe = (ixgbe_t *)ddi_get_driver_private(devinfo); in ixgbe_detach()
727 if (ixgbe == NULL) in ixgbe_detach()
736 if (ixgbe->ixgbe_state & IXGBE_STARTED) { in ixgbe_detach()
737 atomic_and_32(&ixgbe->ixgbe_state, ~IXGBE_STARTED); in ixgbe_detach()
738 mutex_enter(&ixgbe->gen_lock); in ixgbe_detach()
739 ixgbe_stop(ixgbe, B_TRUE); in ixgbe_detach()
740 mutex_exit(&ixgbe->gen_lock); in ixgbe_detach()
742 ixgbe_disable_watchdog_timer(ixgbe); in ixgbe_detach()
749 if (!ixgbe_rx_drain(ixgbe)) in ixgbe_detach()
755 ixgbe_unconfigure(devinfo, ixgbe); in ixgbe_detach()
773 ixgbe_t *ixgbe; in ixgbe_quiesce() local
776 ixgbe = (ixgbe_t *)ddi_get_driver_private(devinfo); in ixgbe_quiesce()
778 if (ixgbe == NULL) in ixgbe_quiesce()
781 hw = &ixgbe->hw; in ixgbe_quiesce()
786 ixgbe_disable_adapter_interrupts(ixgbe); in ixgbe_quiesce()
807 ixgbe_unconfigure(dev_info_t *devinfo, ixgbe_t *ixgbe) in ixgbe_unconfigure() argument
812 if (ixgbe->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) { in ixgbe_unconfigure()
813 (void) ixgbe_disable_intrs(ixgbe); in ixgbe_unconfigure()
819 if (ixgbe->attach_progress & ATTACH_PROGRESS_LINK_TIMER) { in ixgbe_unconfigure()
820 if (ixgbe->periodic_id != NULL) { in ixgbe_unconfigure()
821 ddi_periodic_delete(ixgbe->periodic_id); in ixgbe_unconfigure()
822 ixgbe->periodic_id = NULL; in ixgbe_unconfigure()
829 if (ixgbe->attach_progress & ATTACH_PROGRESS_UFM) { in ixgbe_unconfigure()
830 ddi_ufm_fini(ixgbe->ixgbe_ufmh); in ixgbe_unconfigure()
836 if (ixgbe->attach_progress & ATTACH_PROGRESS_MAC) { in ixgbe_unconfigure()
837 (void) mac_unregister(ixgbe->mac_hdl); in ixgbe_unconfigure()
843 if (ixgbe->attach_progress & ATTACH_PROGRESS_STATS) { in ixgbe_unconfigure()
844 kstat_delete((kstat_t *)ixgbe->ixgbe_ks); in ixgbe_unconfigure()
850 if (ixgbe->attach_progress & ATTACH_PROGRESS_ADD_INTR) { in ixgbe_unconfigure()
851 ixgbe_rem_intr_handlers(ixgbe); in ixgbe_unconfigure()
857 if (ixgbe->attach_progress & ATTACH_PROGRESS_SFP_TASKQ) { in ixgbe_unconfigure()
858 ddi_taskq_destroy(ixgbe->sfp_taskq); in ixgbe_unconfigure()
864 if (ixgbe->attach_progress & ATTACH_PROGRESS_OVERTEMP_TASKQ) { in ixgbe_unconfigure()
865 ddi_taskq_destroy(ixgbe->overtemp_taskq); in ixgbe_unconfigure()
871 if (ixgbe->attach_progress & ATTACH_PROGRESS_PHY_TASKQ) { in ixgbe_unconfigure()
872 ddi_taskq_destroy(ixgbe->phy_taskq); in ixgbe_unconfigure()
878 if (ixgbe->attach_progress & ATTACH_PROGRESS_ALLOC_INTR) { in ixgbe_unconfigure()
879 ixgbe_rem_intrs(ixgbe); in ixgbe_unconfigure()
885 if (ixgbe->cb_hdl != NULL) { in ixgbe_unconfigure()
886 (void) ddi_cb_unregister(ixgbe->cb_hdl); in ixgbe_unconfigure()
892 if (ixgbe->attach_progress & ATTACH_PROGRESS_PROPS) { in ixgbe_unconfigure()
899 if (ixgbe->attach_progress & ATTACH_PROGRESS_INIT) { in ixgbe_unconfigure()
900 mutex_enter(&ixgbe->gen_lock); in ixgbe_unconfigure()
901 ixgbe_chip_stop(ixgbe); in ixgbe_unconfigure()
902 mutex_exit(&ixgbe->gen_lock); in ixgbe_unconfigure()
908 if (ixgbe->attach_progress & ATTACH_PROGRESS_REGS_MAP) { in ixgbe_unconfigure()
909 if (ixgbe->osdep.reg_handle != NULL) in ixgbe_unconfigure()
910 ddi_regs_map_free(&ixgbe->osdep.reg_handle); in ixgbe_unconfigure()
916 if (ixgbe->attach_progress & ATTACH_PROGRESS_PCI_CONFIG) { in ixgbe_unconfigure()
917 if (ixgbe->osdep.cfg_handle != NULL) in ixgbe_unconfigure()
918 pci_config_teardown(&ixgbe->osdep.cfg_handle); in ixgbe_unconfigure()
924 if (ixgbe->attach_progress & ATTACH_PROGRESS_LOCKS) { in ixgbe_unconfigure()
925 ixgbe_destroy_locks(ixgbe); in ixgbe_unconfigure()
931 if (ixgbe->attach_progress & ATTACH_PROGRESS_ALLOC_RINGS) { in ixgbe_unconfigure()
932 ixgbe_free_rings(ixgbe); in ixgbe_unconfigure()
938 if (ixgbe->attach_progress & ATTACH_PROGRESS_FM_INIT) { in ixgbe_unconfigure()
939 ixgbe_fm_fini(ixgbe); in ixgbe_unconfigure()
945 kmem_free(ixgbe, sizeof (ixgbe_t)); in ixgbe_unconfigure()
955 ixgbe_register_mac(ixgbe_t *ixgbe) in ixgbe_register_mac() argument
957 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_register_mac()
965 mac->m_driver = ixgbe; in ixgbe_register_mac()
966 mac->m_dip = ixgbe->dip; in ixgbe_register_mac()
970 mac->m_max_sdu = ixgbe->default_mtu; in ixgbe_register_mac()
975 status = mac_register(mac, &ixgbe->mac_hdl); in ixgbe_register_mac()
986 ixgbe_identify_hardware(ixgbe_t *ixgbe) in ixgbe_identify_hardware() argument
988 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_identify_hardware()
989 struct ixgbe_osdep *osdep = &ixgbe->osdep; in ixgbe_identify_hardware()
1017 IXGBE_DEBUGLOG_0(ixgbe, "identify 82598 adapter\n"); in ixgbe_identify_hardware()
1018 ixgbe->capab = &ixgbe_82598eb_cap; in ixgbe_identify_hardware()
1021 ixgbe->capab->flags |= IXGBE_FLAG_FAN_FAIL_CAPABLE; in ixgbe_identify_hardware()
1022 ixgbe->capab->other_intr |= IXGBE_EICR_GPI_SDP1; in ixgbe_identify_hardware()
1023 ixgbe->capab->other_gpie |= IXGBE_SDP1_GPIEN; in ixgbe_identify_hardware()
1028 IXGBE_DEBUGLOG_0(ixgbe, "identify 82599 adapter\n"); in ixgbe_identify_hardware()
1029 ixgbe->capab = &ixgbe_82599eb_cap; in ixgbe_identify_hardware()
1032 ixgbe->capab->flags |= IXGBE_FLAG_TEMP_SENSOR_CAPABLE; in ixgbe_identify_hardware()
1033 ixgbe->capab->other_intr |= IXGBE_EICR_GPI_SDP0; in ixgbe_identify_hardware()
1034 ixgbe->capab->other_gpie |= IXGBE_SDP0_GPIEN; in ixgbe_identify_hardware()
1039 IXGBE_DEBUGLOG_0(ixgbe, "identify X540 adapter\n"); in ixgbe_identify_hardware()
1040 ixgbe->capab = &ixgbe_X540_cap; in ixgbe_identify_hardware()
1050 IXGBE_DEBUGLOG_0(ixgbe, "identify X550 adapter\n"); in ixgbe_identify_hardware()
1051 ixgbe->capab = &ixgbe_X550_cap; in ixgbe_identify_hardware()
1058 ixgbe->capab->flags |= IXGBE_FLAG_SFP_PLUG_CAPABLE; in ixgbe_identify_hardware()
1068 ixgbe->capab->other_intr |= in ixgbe_identify_hardware()
1072 ixgbe->capab->other_gpie |= IXGBE_SDP0_GPIEN_X540; in ixgbe_identify_hardware()
1077 IXGBE_DEBUGLOG_1(ixgbe, in ixgbe_identify_hardware()
1091 ixgbe_regs_map(ixgbe_t *ixgbe) in ixgbe_regs_map() argument
1093 dev_info_t *devinfo = ixgbe->dip; in ixgbe_regs_map()
1094 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_regs_map()
1095 struct ixgbe_osdep *osdep = &ixgbe->osdep; in ixgbe_regs_map()
1123 ixgbe_init_properties(ixgbe_t *ixgbe) in ixgbe_init_properties() argument
1129 ixgbe_get_conf(ixgbe); in ixgbe_init_properties()
1140 ixgbe_init_driver_settings(ixgbe_t *ixgbe) in ixgbe_init_driver_settings() argument
1142 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_init_driver_settings()
1143 dev_info_t *devinfo = ixgbe->dip; in ixgbe_init_driver_settings()
1162 ixgbe->sys_page_size = ddi_ptob(devinfo, (ulong_t)1); in ixgbe_init_driver_settings()
1171 rx_size = ixgbe->max_frame_size + IPHDR_ALIGN_ROOM; in ixgbe_init_driver_settings()
1172 ixgbe->rx_buf_size = ((rx_size >> 10) + in ixgbe_init_driver_settings()
1178 tx_size = ixgbe->max_frame_size; in ixgbe_init_driver_settings()
1179 ixgbe->tx_buf_size = ((tx_size >> 10) + in ixgbe_init_driver_settings()
1185 ring_per_group = ixgbe->num_rx_rings / ixgbe->num_rx_groups; in ixgbe_init_driver_settings()
1186 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_init_driver_settings()
1187 rx_ring = &ixgbe->rx_rings[i]; in ixgbe_init_driver_settings()
1189 rx_ring->ixgbe = ixgbe; in ixgbe_init_driver_settings()
1191 rx_ring->hw_index = ixgbe_get_hw_rx_index(ixgbe, i); in ixgbe_init_driver_settings()
1194 for (i = 0; i < ixgbe->num_rx_groups; i++) { in ixgbe_init_driver_settings()
1195 rx_group = &ixgbe->rx_groups[i]; in ixgbe_init_driver_settings()
1197 rx_group->ixgbe = ixgbe; in ixgbe_init_driver_settings()
1202 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_init_driver_settings()
1203 tx_ring = &ixgbe->tx_rings[i]; in ixgbe_init_driver_settings()
1205 tx_ring->ixgbe = ixgbe; in ixgbe_init_driver_settings()
1206 if (ixgbe->tx_head_wb_enable) in ixgbe_init_driver_settings()
1211 tx_ring->ring_size = ixgbe->tx_ring_size; in ixgbe_init_driver_settings()
1212 tx_ring->free_list_size = ixgbe->tx_ring_size + in ixgbe_init_driver_settings()
1213 (ixgbe->tx_ring_size >> 1); in ixgbe_init_driver_settings()
1220 ixgbe->intr_throttling[i] = ixgbe->intr_throttling[0]; in ixgbe_init_driver_settings()
1225 ixgbe->link_state = LINK_STATE_UNKNOWN; in ixgbe_init_driver_settings()
1234 ixgbe_init_locks(ixgbe_t *ixgbe) in ixgbe_init_locks() argument
1240 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_init_locks()
1241 rx_ring = &ixgbe->rx_rings[i]; in ixgbe_init_locks()
1243 MUTEX_DRIVER, DDI_INTR_PRI(ixgbe->intr_pri)); in ixgbe_init_locks()
1246 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_init_locks()
1247 tx_ring = &ixgbe->tx_rings[i]; in ixgbe_init_locks()
1249 MUTEX_DRIVER, DDI_INTR_PRI(ixgbe->intr_pri)); in ixgbe_init_locks()
1251 MUTEX_DRIVER, DDI_INTR_PRI(ixgbe->intr_pri)); in ixgbe_init_locks()
1253 MUTEX_DRIVER, DDI_INTR_PRI(ixgbe->intr_pri)); in ixgbe_init_locks()
1255 MUTEX_DRIVER, DDI_INTR_PRI(ixgbe->intr_pri)); in ixgbe_init_locks()
1258 mutex_init(&ixgbe->gen_lock, NULL, in ixgbe_init_locks()
1259 MUTEX_DRIVER, DDI_INTR_PRI(ixgbe->intr_pri)); in ixgbe_init_locks()
1261 mutex_init(&ixgbe->watchdog_lock, NULL, in ixgbe_init_locks()
1262 MUTEX_DRIVER, DDI_INTR_PRI(ixgbe->intr_pri)); in ixgbe_init_locks()
1269 ixgbe_destroy_locks(ixgbe_t *ixgbe) in ixgbe_destroy_locks() argument
1275 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_destroy_locks()
1276 rx_ring = &ixgbe->rx_rings[i]; in ixgbe_destroy_locks()
1280 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_destroy_locks()
1281 tx_ring = &ixgbe->tx_rings[i]; in ixgbe_destroy_locks()
1288 mutex_destroy(&ixgbe->gen_lock); in ixgbe_destroy_locks()
1289 mutex_destroy(&ixgbe->watchdog_lock); in ixgbe_destroy_locks()
1298 ixgbe_led_init(ixgbe_t *ixgbe) in ixgbe_led_init() argument
1301 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_led_init()
1307 ixgbe->ixgbe_led_index = i; in ixgbe_led_init()
1319 ixgbe->ixgbe_led_index = 0; in ixgbe_led_init()
1322 ixgbe->ixgbe_led_index = 1; in ixgbe_led_init()
1325 ixgbe->ixgbe_led_index = 2; in ixgbe_led_init()
1333 ixgbe_t *ixgbe; in ixgbe_resume() local
1336 ixgbe = (ixgbe_t *)ddi_get_driver_private(devinfo); in ixgbe_resume()
1337 if (ixgbe == NULL) in ixgbe_resume()
1340 mutex_enter(&ixgbe->gen_lock); in ixgbe_resume()
1342 if (ixgbe->ixgbe_state & IXGBE_STARTED) { in ixgbe_resume()
1343 if (ixgbe_start(ixgbe, B_FALSE) != IXGBE_SUCCESS) { in ixgbe_resume()
1344 mutex_exit(&ixgbe->gen_lock); in ixgbe_resume()
1351 ixgbe_enable_watchdog_timer(ixgbe); in ixgbe_resume()
1354 atomic_and_32(&ixgbe->ixgbe_state, ~IXGBE_SUSPENDED); in ixgbe_resume()
1356 if (ixgbe->ixgbe_state & IXGBE_STARTED) { in ixgbe_resume()
1357 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_resume()
1358 mac_tx_ring_update(ixgbe->mac_hdl, in ixgbe_resume()
1359 ixgbe->tx_rings[i].ring_handle); in ixgbe_resume()
1363 mutex_exit(&ixgbe->gen_lock); in ixgbe_resume()
1371 ixgbe_t *ixgbe; in ixgbe_suspend() local
1373 ixgbe = (ixgbe_t *)ddi_get_driver_private(devinfo); in ixgbe_suspend()
1374 if (ixgbe == NULL) in ixgbe_suspend()
1377 mutex_enter(&ixgbe->gen_lock); in ixgbe_suspend()
1379 atomic_or_32(&ixgbe->ixgbe_state, IXGBE_SUSPENDED); in ixgbe_suspend()
1380 if (!(ixgbe->ixgbe_state & IXGBE_STARTED)) { in ixgbe_suspend()
1381 mutex_exit(&ixgbe->gen_lock); in ixgbe_suspend()
1384 ixgbe_stop(ixgbe, B_FALSE); in ixgbe_suspend()
1386 mutex_exit(&ixgbe->gen_lock); in ixgbe_suspend()
1391 ixgbe_disable_watchdog_timer(ixgbe); in ixgbe_suspend()
1400 ixgbe_init(ixgbe_t *ixgbe) in ixgbe_init() argument
1402 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_init()
1406 mutex_enter(&ixgbe->gen_lock); in ixgbe_init()
1425 ixgbe_error(ixgbe, in ixgbe_init()
1431 ixgbe_error(ixgbe, in ixgbe_init()
1437 ixgbe_error(ixgbe, in ixgbe_init()
1444 ixgbe_error(ixgbe, in ixgbe_init()
1447 ixgbe_fm_ereport(ixgbe, DDI_FM_DEVICE_INVAL_STATE); in ixgbe_init()
1456 ixgbe_error(ixgbe, in ixgbe_init()
1458 ixgbe_fm_ereport(ixgbe, DDI_FM_DEVICE_INVAL_STATE); in ixgbe_init()
1472 ixgbe_error(ixgbe, in ixgbe_init()
1475 ixgbe_fm_ereport(ixgbe, DDI_FM_DEVICE_INVAL_STATE); in ixgbe_init()
1497 (void) ixgbe_driver_setup_link(ixgbe, B_FALSE); in ixgbe_init()
1502 if (ixgbe_chip_start(ixgbe) != IXGBE_SUCCESS) { in ixgbe_init()
1503 ixgbe_fm_ereport(ixgbe, DDI_FM_DEVICE_INVAL_STATE); in ixgbe_init()
1513 (void) ddi_prop_update_string(DDI_DEV_T_NONE, ixgbe->dip, in ixgbe_init()
1520 ixgbe_led_init(ixgbe); in ixgbe_init()
1522 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK) { in ixgbe_init()
1526 mutex_exit(&ixgbe->gen_lock); in ixgbe_init()
1535 mutex_exit(&ixgbe->gen_lock); in ixgbe_init()
1536 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_LOST); in ixgbe_init()
1544 ixgbe_chip_start(ixgbe_t *ixgbe) in ixgbe_chip_start() argument
1546 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_chip_start()
1549 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_chip_start()
1555 if (!ixgbe_find_mac_address(ixgbe)) { in ixgbe_chip_start()
1556 ixgbe_error(ixgbe, "Failed to get the mac address"); in ixgbe_chip_start()
1565 ixgbe_error(ixgbe, "Invalid mac address"); in ixgbe_chip_start()
1573 if (ixgbe->relax_order_enable == B_TRUE) in ixgbe_chip_start()
1579 ixgbe_setup_adapter_vector(ixgbe); in ixgbe_chip_start()
1584 ixgbe_init_unicst(ixgbe); in ixgbe_chip_start()
1589 ixgbe_setup_multicst(ixgbe); in ixgbe_chip_start()
1594 for (i = 0; i < ixgbe->intr_cnt; i++) { in ixgbe_chip_start()
1595 IXGBE_WRITE_REG(hw, IXGBE_EITR(i), ixgbe->intr_throttling[i]); in ixgbe_chip_start()
1625 ixgbe_get_hw_state(ixgbe); in ixgbe_chip_start()
1639 ixgbe_chip_stop(ixgbe_t *ixgbe) in ixgbe_chip_stop() argument
1641 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_chip_stop()
1644 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_chip_stop()
1670 ixgbe_error(ixgbe, "Error while entering LPLU: %d", rv); in ixgbe_chip_stop()
1696 ixgbe_reset(ixgbe_t *ixgbe) in ixgbe_reset() argument
1703 ixgbe_disable_watchdog_timer(ixgbe); in ixgbe_reset()
1705 mutex_enter(&ixgbe->gen_lock); in ixgbe_reset()
1707 ASSERT(ixgbe->ixgbe_state & IXGBE_STARTED); in ixgbe_reset()
1708 atomic_and_32(&ixgbe->ixgbe_state, ~IXGBE_STARTED); in ixgbe_reset()
1710 ixgbe_stop(ixgbe, B_FALSE); in ixgbe_reset()
1712 if (ixgbe_start(ixgbe, B_FALSE) != IXGBE_SUCCESS) { in ixgbe_reset()
1713 mutex_exit(&ixgbe->gen_lock); in ixgbe_reset()
1720 ixgbe->link_check_complete = B_FALSE; in ixgbe_reset()
1721 ixgbe->link_check_hrtime = gethrtime() + in ixgbe_reset()
1724 atomic_or_32(&ixgbe->ixgbe_state, IXGBE_STARTED); in ixgbe_reset()
1726 if (!(ixgbe->ixgbe_state & IXGBE_SUSPENDED)) { in ixgbe_reset()
1727 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_reset()
1728 mac_tx_ring_update(ixgbe->mac_hdl, in ixgbe_reset()
1729 ixgbe->tx_rings[i].ring_handle); in ixgbe_reset()
1733 mutex_exit(&ixgbe->gen_lock); in ixgbe_reset()
1738 ixgbe_enable_watchdog_timer(ixgbe); in ixgbe_reset()
1747 ixgbe_tx_clean(ixgbe_t *ixgbe) in ixgbe_tx_clean() argument
1757 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_tx_clean()
1758 tx_ring = &ixgbe->tx_rings[i]; in ixgbe_tx_clean()
1793 if (ixgbe->tx_head_wb_enable) in ixgbe_tx_clean()
1796 IXGBE_WRITE_REG(&ixgbe->hw, in ixgbe_tx_clean()
1798 IXGBE_WRITE_REG(&ixgbe->hw, in ixgbe_tx_clean()
1817 ixgbe_tx_drain(ixgbe_t *ixgbe) in ixgbe_tx_drain() argument
1836 for (j = 0; j < ixgbe->num_tx_rings; j++) { in ixgbe_tx_drain()
1837 tx_ring = &ixgbe->tx_rings[j]; in ixgbe_tx_drain()
1855 ixgbe_rx_drain(ixgbe_t *ixgbe) in ixgbe_rx_drain() argument
1871 done = (ixgbe->rcb_pending == 0); in ixgbe_rx_drain()
1886 ixgbe_start(ixgbe_t *ixgbe, boolean_t alloc_buffer) in ixgbe_start() argument
1888 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_start()
1891 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_start()
1894 if (ixgbe_alloc_rx_data(ixgbe) != IXGBE_SUCCESS) { in ixgbe_start()
1895 ixgbe_error(ixgbe, in ixgbe_start()
1901 if (ixgbe_alloc_dma(ixgbe) != IXGBE_SUCCESS) { in ixgbe_start()
1902 ixgbe_error(ixgbe, "Failed to allocate DMA resource"); in ixgbe_start()
1906 ixgbe->tx_ring_init = B_TRUE; in ixgbe_start()
1908 ixgbe->tx_ring_init = B_FALSE; in ixgbe_start()
1911 for (i = 0; i < ixgbe->num_rx_rings; i++) in ixgbe_start()
1912 mutex_enter(&ixgbe->rx_rings[i].rx_lock); in ixgbe_start()
1913 for (i = 0; i < ixgbe->num_tx_rings; i++) in ixgbe_start()
1914 mutex_enter(&ixgbe->tx_rings[i].tx_lock); in ixgbe_start()
1919 if (ixgbe_chip_start(ixgbe) != IXGBE_SUCCESS) { in ixgbe_start()
1920 ixgbe_fm_ereport(ixgbe, DDI_FM_DEVICE_INVAL_STATE); in ixgbe_start()
1939 (void) ixgbe_driver_setup_link(ixgbe, B_TRUE); in ixgbe_start()
1940 ixgbe_get_hw_state(ixgbe); in ixgbe_start()
1943 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK) { in ixgbe_start()
1950 if (ixgbe_setup_rings(ixgbe) != IXGBE_SUCCESS) in ixgbe_start()
1958 atomic_and_32(&ixgbe->ixgbe_state, ~(IXGBE_ERROR in ixgbe_start()
1965 ixgbe_enable_adapter_interrupts(ixgbe); in ixgbe_start()
1967 for (i = ixgbe->num_tx_rings - 1; i >= 0; i--) in ixgbe_start()
1968 mutex_exit(&ixgbe->tx_rings[i].tx_lock); in ixgbe_start()
1969 for (i = ixgbe->num_rx_rings - 1; i >= 0; i--) in ixgbe_start()
1970 mutex_exit(&ixgbe->rx_rings[i].rx_lock); in ixgbe_start()
1975 for (i = ixgbe->num_tx_rings - 1; i >= 0; i--) in ixgbe_start()
1976 mutex_exit(&ixgbe->tx_rings[i].tx_lock); in ixgbe_start()
1977 for (i = ixgbe->num_rx_rings - 1; i >= 0; i--) in ixgbe_start()
1978 mutex_exit(&ixgbe->rx_rings[i].rx_lock); in ixgbe_start()
1980 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_LOST); in ixgbe_start()
1989 ixgbe_stop(ixgbe_t *ixgbe, boolean_t free_buffer) in ixgbe_stop() argument
1993 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_stop()
1998 ixgbe_disable_adapter_interrupts(ixgbe); in ixgbe_stop()
2003 (void) ixgbe_tx_drain(ixgbe); in ixgbe_stop()
2005 for (i = 0; i < ixgbe->num_rx_rings; i++) in ixgbe_stop()
2006 mutex_enter(&ixgbe->rx_rings[i].rx_lock); in ixgbe_stop()
2007 for (i = 0; i < ixgbe->num_tx_rings; i++) in ixgbe_stop()
2008 mutex_enter(&ixgbe->tx_rings[i].tx_lock); in ixgbe_stop()
2013 ixgbe_chip_stop(ixgbe); in ixgbe_stop()
2015 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK) { in ixgbe_stop()
2016 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_LOST); in ixgbe_stop()
2022 ixgbe_tx_clean(ixgbe); in ixgbe_stop()
2024 for (i = ixgbe->num_tx_rings - 1; i >= 0; i--) in ixgbe_stop()
2025 mutex_exit(&ixgbe->tx_rings[i].tx_lock); in ixgbe_stop()
2026 for (i = ixgbe->num_rx_rings - 1; i >= 0; i--) in ixgbe_stop()
2027 mutex_exit(&ixgbe->rx_rings[i].rx_lock); in ixgbe_stop()
2029 if (ixgbe->link_state == LINK_STATE_UP) { in ixgbe_stop()
2030 ixgbe->link_state = LINK_STATE_UNKNOWN; in ixgbe_stop()
2031 mac_link_update(ixgbe->mac_hdl, ixgbe->link_state); in ixgbe_stop()
2038 ixgbe_free_dma(ixgbe); in ixgbe_stop()
2039 ixgbe_free_rx_data(ixgbe); in ixgbe_stop()
2051 ixgbe_t *ixgbe = (ixgbe_t *)arg1; in ixgbe_cbfunc() local
2059 ASSERT(ixgbe->intr_type == DDI_INTR_TYPE_MSIX); in ixgbe_cbfunc()
2061 int, ixgbe->intr_cnt); in ixgbe_cbfunc()
2062 if (ixgbe_intr_adjust(ixgbe, cbaction, count) != in ixgbe_cbfunc()
2064 ixgbe_error(ixgbe, in ixgbe_cbfunc()
2070 IXGBE_DEBUGLOG_1(ixgbe, "DDI CB: action 0x%x NOT supported", in ixgbe_cbfunc()
2083 ixgbe_intr_adjust(ixgbe_t *ixgbe, ddi_cb_action_t cbaction, int count) in ixgbe_intr_adjust() argument
2091 ixgbe->intr_cnt + count > ixgbe->intr_cnt_max) || in ixgbe_intr_adjust()
2093 ixgbe->intr_cnt - count < ixgbe->intr_cnt_min)) in ixgbe_intr_adjust()
2096 if (!(ixgbe->ixgbe_state & IXGBE_STARTED)) { in ixgbe_intr_adjust()
2100 for (i = 0; i < ixgbe->num_rx_rings; i++) in ixgbe_intr_adjust()
2101 mac_ring_intr_set(ixgbe->rx_rings[i].ring_handle, NULL); in ixgbe_intr_adjust()
2102 for (i = 0; i < ixgbe->num_tx_rings; i++) in ixgbe_intr_adjust()
2103 mac_ring_intr_set(ixgbe->tx_rings[i].ring_handle, NULL); in ixgbe_intr_adjust()
2105 mutex_enter(&ixgbe->gen_lock); in ixgbe_intr_adjust()
2106 ixgbe->ixgbe_state &= ~IXGBE_STARTED; in ixgbe_intr_adjust()
2107 ixgbe->ixgbe_state |= IXGBE_INTR_ADJUST; in ixgbe_intr_adjust()
2108 ixgbe->ixgbe_state |= IXGBE_SUSPENDED; in ixgbe_intr_adjust()
2109 mac_link_update(ixgbe->mac_hdl, LINK_STATE_UNKNOWN); in ixgbe_intr_adjust()
2111 ixgbe_stop(ixgbe, B_FALSE); in ixgbe_intr_adjust()
2115 if (ixgbe->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) { in ixgbe_intr_adjust()
2116 rc = ixgbe_disable_intrs(ixgbe); in ixgbe_intr_adjust()
2119 ixgbe->attach_progress &= ~ATTACH_PROGRESS_ENABLE_INTR; in ixgbe_intr_adjust()
2124 if (ixgbe->attach_progress & ATTACH_PROGRESS_ADD_INTR) { in ixgbe_intr_adjust()
2125 ixgbe_rem_intr_handlers(ixgbe); in ixgbe_intr_adjust()
2127 ixgbe->attach_progress &= ~ATTACH_PROGRESS_ADD_INTR; in ixgbe_intr_adjust()
2132 bzero(&ixgbe->vect_map, sizeof (ixgbe->vect_map)); in ixgbe_intr_adjust()
2135 rc = ddi_intr_alloc(ixgbe->dip, ixgbe->htable, in ixgbe_intr_adjust()
2136 DDI_INTR_TYPE_MSIX, ixgbe->intr_cnt, count, &actual, in ixgbe_intr_adjust()
2139 ixgbe_log(ixgbe, "Adjust interrupts failed." in ixgbe_intr_adjust()
2144 ixgbe->intr_cnt += count; in ixgbe_intr_adjust()
2148 for (i = ixgbe->intr_cnt - count; in ixgbe_intr_adjust()
2149 i < ixgbe->intr_cnt; i ++) { in ixgbe_intr_adjust()
2150 rc = ddi_intr_free(ixgbe->htable[i]); in ixgbe_intr_adjust()
2151 ixgbe->htable[i] = NULL; in ixgbe_intr_adjust()
2153 ixgbe_log(ixgbe, "Adjust interrupts failed." in ixgbe_intr_adjust()
2159 ixgbe->intr_cnt -= count; in ixgbe_intr_adjust()
2166 rc = ddi_intr_get_pri(ixgbe->htable[0], &ixgbe->intr_pri); in ixgbe_intr_adjust()
2168 ixgbe_log(ixgbe, in ixgbe_intr_adjust()
2172 rc = ddi_intr_get_cap(ixgbe->htable[0], &ixgbe->intr_cap); in ixgbe_intr_adjust()
2174 ixgbe_log(ixgbe, "Get interrupt cap failed: %d", rc); in ixgbe_intr_adjust()
2177 ixgbe->attach_progress |= ATTACH_PROGRESS_ALLOC_INTR; in ixgbe_intr_adjust()
2182 if (ixgbe_map_intrs_to_vectors(ixgbe) != IXGBE_SUCCESS) { in ixgbe_intr_adjust()
2183 ixgbe_error(ixgbe, in ixgbe_intr_adjust()
2191 if (ixgbe_add_intr_handlers(ixgbe) != IXGBE_SUCCESS) { in ixgbe_intr_adjust()
2192 ixgbe_error(ixgbe, "IRM CB: Failed to add interrupt handlers"); in ixgbe_intr_adjust()
2195 ixgbe->attach_progress |= ATTACH_PROGRESS_ADD_INTR; in ixgbe_intr_adjust()
2201 if (ixgbe_enable_intrs(ixgbe) != IXGBE_SUCCESS) { in ixgbe_intr_adjust()
2202 ixgbe_error(ixgbe, "IRM CB: Failed to enable DDI interrupts"); in ixgbe_intr_adjust()
2205 ixgbe->attach_progress |= ATTACH_PROGRESS_ENABLE_INTR; in ixgbe_intr_adjust()
2206 if (ixgbe_start(ixgbe, B_FALSE) != IXGBE_SUCCESS) { in ixgbe_intr_adjust()
2207 ixgbe_error(ixgbe, "IRM CB: Failed to start"); in ixgbe_intr_adjust()
2210 ixgbe->ixgbe_state &= ~IXGBE_INTR_ADJUST; in ixgbe_intr_adjust()
2211 ixgbe->ixgbe_state &= ~IXGBE_SUSPENDED; in ixgbe_intr_adjust()
2212 ixgbe->ixgbe_state |= IXGBE_STARTED; in ixgbe_intr_adjust()
2213 mutex_exit(&ixgbe->gen_lock); in ixgbe_intr_adjust()
2215 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_intr_adjust()
2216 mac_ring_intr_set(ixgbe->rx_rings[i].ring_handle, in ixgbe_intr_adjust()
2217 ixgbe->htable[ixgbe->rx_rings[i].intr_vector]); in ixgbe_intr_adjust()
2219 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_intr_adjust()
2220 mac_ring_intr_set(ixgbe->tx_rings[i].ring_handle, in ixgbe_intr_adjust()
2221 ixgbe->htable[ixgbe->tx_rings[i].intr_vector]); in ixgbe_intr_adjust()
2225 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_intr_adjust()
2226 mac_tx_ring_update(ixgbe->mac_hdl, in ixgbe_intr_adjust()
2227 ixgbe->tx_rings[i].ring_handle); in ixgbe_intr_adjust()
2230 IXGBE_DEBUGLOG_3(ixgbe, in ixgbe_intr_adjust()
2232 ixgbe->intr_cnt, ixgbe->intr_cnt_min, ixgbe->intr_cnt_max); in ixgbe_intr_adjust()
2236 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_LOST); in ixgbe_intr_adjust()
2237 mutex_exit(&ixgbe->gen_lock); in ixgbe_intr_adjust()
2245 ixgbe_intr_cb_register(ixgbe_t *ixgbe) in ixgbe_intr_cb_register() argument
2247 if (ddi_cb_register(ixgbe->dip, DDI_CB_FLAG_INTR, ixgbe_cbfunc, in ixgbe_intr_cb_register()
2248 ixgbe, NULL, &ixgbe->cb_hdl) != DDI_SUCCESS) { in ixgbe_intr_cb_register()
2251 IXGBE_DEBUGLOG_0(ixgbe, "Interrupt callback function registered."); in ixgbe_intr_cb_register()
2259 ixgbe_alloc_rings(ixgbe_t *ixgbe) in ixgbe_alloc_rings() argument
2264 ixgbe->rx_rings = kmem_zalloc( in ixgbe_alloc_rings()
2265 sizeof (ixgbe_rx_ring_t) * ixgbe->num_rx_rings, in ixgbe_alloc_rings()
2268 if (ixgbe->rx_rings == NULL) { in ixgbe_alloc_rings()
2275 ixgbe->tx_rings = kmem_zalloc( in ixgbe_alloc_rings()
2276 sizeof (ixgbe_tx_ring_t) * ixgbe->num_tx_rings, in ixgbe_alloc_rings()
2279 if (ixgbe->tx_rings == NULL) { in ixgbe_alloc_rings()
2280 kmem_free(ixgbe->rx_rings, in ixgbe_alloc_rings()
2281 sizeof (ixgbe_rx_ring_t) * ixgbe->num_rx_rings); in ixgbe_alloc_rings()
2282 ixgbe->rx_rings = NULL; in ixgbe_alloc_rings()
2289 ixgbe->rx_groups = kmem_zalloc( in ixgbe_alloc_rings()
2290 sizeof (ixgbe_rx_group_t) * ixgbe->num_rx_groups, in ixgbe_alloc_rings()
2293 if (ixgbe->rx_groups == NULL) { in ixgbe_alloc_rings()
2294 kmem_free(ixgbe->rx_rings, in ixgbe_alloc_rings()
2295 sizeof (ixgbe_rx_ring_t) * ixgbe->num_rx_rings); in ixgbe_alloc_rings()
2296 kmem_free(ixgbe->tx_rings, in ixgbe_alloc_rings()
2297 sizeof (ixgbe_tx_ring_t) * ixgbe->num_tx_rings); in ixgbe_alloc_rings()
2298 ixgbe->rx_rings = NULL; in ixgbe_alloc_rings()
2299 ixgbe->tx_rings = NULL; in ixgbe_alloc_rings()
2310 ixgbe_free_rings(ixgbe_t *ixgbe) in ixgbe_free_rings() argument
2312 if (ixgbe->rx_rings != NULL) { in ixgbe_free_rings()
2313 kmem_free(ixgbe->rx_rings, in ixgbe_free_rings()
2314 sizeof (ixgbe_rx_ring_t) * ixgbe->num_rx_rings); in ixgbe_free_rings()
2315 ixgbe->rx_rings = NULL; in ixgbe_free_rings()
2318 if (ixgbe->tx_rings != NULL) { in ixgbe_free_rings()
2319 kmem_free(ixgbe->tx_rings, in ixgbe_free_rings()
2320 sizeof (ixgbe_tx_ring_t) * ixgbe->num_tx_rings); in ixgbe_free_rings()
2321 ixgbe->tx_rings = NULL; in ixgbe_free_rings()
2324 for (uint_t i = 0; i < ixgbe->num_rx_groups; i++) { in ixgbe_free_rings()
2326 ixgbe_rx_group_t *rx_group = &ixgbe->rx_groups[i]; in ixgbe_free_rings()
2334 if (ixgbe->rx_groups != NULL) { in ixgbe_free_rings()
2335 kmem_free(ixgbe->rx_groups, in ixgbe_free_rings()
2336 sizeof (ixgbe_rx_group_t) * ixgbe->num_rx_groups); in ixgbe_free_rings()
2337 ixgbe->rx_groups = NULL; in ixgbe_free_rings()
2342 ixgbe_alloc_rx_data(ixgbe_t *ixgbe) in ixgbe_alloc_rx_data() argument
2347 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_alloc_rx_data()
2348 rx_ring = &ixgbe->rx_rings[i]; in ixgbe_alloc_rx_data()
2355 ixgbe_free_rx_data(ixgbe); in ixgbe_alloc_rx_data()
2360 ixgbe_free_rx_data(ixgbe_t *ixgbe) in ixgbe_free_rx_data() argument
2366 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_free_rx_data()
2367 rx_ring = &ixgbe->rx_rings[i]; in ixgbe_free_rx_data()
2369 mutex_enter(&ixgbe->rx_pending_lock); in ixgbe_free_rx_data()
2381 mutex_exit(&ixgbe->rx_pending_lock); in ixgbe_free_rx_data()
2389 ixgbe_setup_rings(ixgbe_t *ixgbe) in ixgbe_setup_rings() argument
2398 if (ixgbe_setup_rx(ixgbe) != IXGBE_SUCCESS) in ixgbe_setup_rings()
2401 ixgbe_setup_tx(ixgbe); in ixgbe_setup_rings()
2409 ixgbe_t *ixgbe = rx_ring->ixgbe; in ixgbe_setup_rx_ring() local
2411 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_rx_ring()
2421 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_setup_rx_ring()
2423 for (i = 0; i < ixgbe->rx_ring_size; i++) { in ixgbe_setup_rx_ring()
2484 reg_val = (ixgbe->rx_buf_size >> IXGBE_SRRCTL_BSIZEPKT_SHIFT) | in ixgbe_setup_rx_ring()
2491 ixgbe_setup_rx(ixgbe_t *ixgbe) in ixgbe_setup_rx() argument
2494 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_rx()
2506 if (ixgbe->classify_mode != IXGBE_CLASSIFY_VMDQ && in ixgbe_setup_rx()
2507 ixgbe->classify_mode != IXGBE_CLASSIFY_VMDQ_RSS) { in ixgbe_setup_rx()
2514 if (ixgbe->num_rx_groups > 32) { in ixgbe_setup_rx()
2519 for (i = 0; i < ixgbe->capab->max_rx_grp_num; i++) { in ixgbe_setup_rx()
2544 if (ixgbe->rx_hcksum_enable) { in ixgbe_setup_rx()
2553 switch (ixgbe->classify_mode) { in ixgbe_setup_rx()
2559 ixgbe_setup_rss(ixgbe); in ixgbe_setup_rx()
2567 ixgbe_setup_vmdq(ixgbe); in ixgbe_setup_rx()
2575 ixgbe_setup_vmdq_rss(ixgbe); in ixgbe_setup_rx()
2586 if (ixgbe->vlft_enabled) { in ixgbe_setup_rx()
2587 if (ixgbe_init_vlan(ixgbe) != IXGBE_SUCCESS) in ixgbe_setup_rx()
2605 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_setup_rx()
2606 rx_ring = &ixgbe->rx_rings[i]; in ixgbe_setup_rx()
2625 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_setup_rx()
2626 uint32_t index = ixgbe->rx_rings[i].hw_index; in ixgbe_setup_rx()
2638 reg_val |= (ixgbe->default_mtu + sizeof (struct ether_header) in ixgbe_setup_rx()
2646 if (ixgbe->default_mtu > ETHERMTU) in ixgbe_setup_rx()
2655 if (ixgbe->lro_enable) { in ixgbe_setup_rx()
2656 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_setup_rx()
2664 if (ixgbe->rx_buf_size == IXGBE_PKG_BUF_16k) in ixgbe_setup_rx()
2689 ixgbe_t *ixgbe = tx_ring->ixgbe; in ixgbe_setup_tx_ring() local
2690 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_tx_ring()
2697 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_setup_tx_ring()
2722 if (ixgbe->tx_head_wb_enable) { in ixgbe_setup_tx_ring()
2766 if (ixgbe->tx_ring_init == B_TRUE) { in ixgbe_setup_tx_ring()
2779 ixgbe_setup_tx(ixgbe_t *ixgbe) in ixgbe_setup_tx() argument
2781 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_tx()
2786 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_setup_tx()
2787 tx_ring = &ixgbe->tx_rings[i]; in ixgbe_setup_tx()
2795 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_setup_tx()
2840 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_setup_tx()
2841 tx_ring = &ixgbe->tx_rings[i]; in ixgbe_setup_tx()
2852 ixgbe_setup_rss(ixgbe_t *ixgbe) in ixgbe_setup_rss() argument
2854 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_rss()
2860 ixgbe_setup_rss_table(ixgbe); in ixgbe_setup_rss()
2882 ixgbe_setup_vmdq(ixgbe_t *ixgbe) in ixgbe_setup_vmdq() argument
2884 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_vmdq()
2922 ixgbe->rx_def_group = vtctl & IXGBE_VT_CTL_POOL_MASK; in ixgbe_setup_vmdq()
2932 ixgbe->vlft_enabled = B_TRUE; in ixgbe_setup_vmdq()
2950 ixgbe_setup_vmdq_rss(ixgbe_t *ixgbe) in ixgbe_setup_vmdq_rss() argument
2952 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_vmdq_rss()
2959 ixgbe_setup_rss_table(ixgbe); in ixgbe_setup_vmdq_rss()
3011 if (ixgbe->num_rx_groups > 32) { in ixgbe_setup_vmdq_rss()
3039 ixgbe->rx_def_group = vtctl & IXGBE_VT_CTL_POOL_MASK; in ixgbe_setup_vmdq_rss()
3050 ixgbe->vlft_enabled = B_TRUE; in ixgbe_setup_vmdq_rss()
3064 ixgbe_setup_rss_table(ixgbe_t *ixgbe) in ixgbe_setup_rss_table() argument
3066 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_rss_table()
3085 switch (ixgbe->hw.mac.type) { in ixgbe_setup_rss_table()
3107 ring_per_group = ixgbe->num_rx_rings / ixgbe->num_rx_groups; in ixgbe_setup_rss_table()
3159 ixgbe_init_unicst(ixgbe_t *ixgbe) in ixgbe_init_unicst() argument
3161 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_init_unicst()
3174 if (!ixgbe->unicst_init) { in ixgbe_init_unicst()
3178 ixgbe->unicst_total = hw->mac.num_rar_entries; in ixgbe_init_unicst()
3179 ixgbe->unicst_avail = ixgbe->unicst_total; in ixgbe_init_unicst()
3180 for (slot = 0; slot < ixgbe->unicst_total; slot++) { in ixgbe_init_unicst()
3181 mac_addr = ixgbe->unicst_addr[slot].mac.addr; in ixgbe_init_unicst()
3184 ixgbe->unicst_addr[slot].mac.set = 0; in ixgbe_init_unicst()
3186 ixgbe->unicst_init = B_TRUE; in ixgbe_init_unicst()
3189 for (slot = 0; slot < ixgbe->unicst_total; slot++) { in ixgbe_init_unicst()
3190 mac_addr = ixgbe->unicst_addr[slot].mac.addr; in ixgbe_init_unicst()
3191 if (ixgbe->unicst_addr[slot].mac.set == 1) { in ixgbe_init_unicst()
3193 ixgbe->unicst_addr[slot].mac.group_index, in ixgbe_init_unicst()
3207 ixgbe_unicst_find(ixgbe_t *ixgbe, const uint8_t *mac_addr) in ixgbe_unicst_find() argument
3211 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_unicst_find()
3213 for (slot = 0; slot < ixgbe->unicst_total; slot++) { in ixgbe_unicst_find()
3214 if (bcmp(ixgbe->unicst_addr[slot].mac.addr, in ixgbe_unicst_find()
3226 ixgbe_init_vlan(ixgbe_t *ixgbe) in ixgbe_init_vlan() argument
3232 if (!ixgbe->vlft_init) { in ixgbe_init_vlan()
3233 ixgbe->vlft_init = B_TRUE; in ixgbe_init_vlan()
3237 for (uint_t i = 0; i < ixgbe->num_rx_groups; i++) { in ixgbe_init_vlan()
3240 ixgbe_rx_group_t *rxg = &ixgbe->rx_groups[i]; in ixgbe_init_vlan()
3241 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_init_vlan()
3251 vlvf_bypass = (rxg->index == ixgbe->rx_def_group); in ixgbe_init_vlan()
3258 ixgbe_error(ixgbe, "Failed to program VFTA" in ixgbe_init_vlan()
3273 ixgbe_multicst_add(ixgbe_t *ixgbe, const uint8_t *multiaddr) in ixgbe_multicst_add() argument
3275 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_multicst_add()
3281 if (ixgbe->mcast_count >= MAX_NUM_MULTICAST_ADDRESSES) { in ixgbe_multicst_add()
3286 &ixgbe->mcast_table[ixgbe->mcast_count], ETHERADDRL); in ixgbe_multicst_add()
3287 ixgbe->mcast_count++; in ixgbe_multicst_add()
3292 ixgbe_setup_multicst(ixgbe); in ixgbe_multicst_add()
3294 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK) { in ixgbe_multicst_add()
3295 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_DEGRADED); in ixgbe_multicst_add()
3306 ixgbe_multicst_remove(ixgbe_t *ixgbe, const uint8_t *multiaddr) in ixgbe_multicst_remove() argument
3310 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_multicst_remove()
3312 for (i = 0; i < ixgbe->mcast_count; i++) { in ixgbe_multicst_remove()
3313 if (bcmp(multiaddr, &ixgbe->mcast_table[i], in ixgbe_multicst_remove()
3315 for (i++; i < ixgbe->mcast_count; i++) { in ixgbe_multicst_remove()
3316 ixgbe->mcast_table[i - 1] = in ixgbe_multicst_remove()
3317 ixgbe->mcast_table[i]; in ixgbe_multicst_remove()
3319 ixgbe->mcast_count--; in ixgbe_multicst_remove()
3327 ixgbe_setup_multicst(ixgbe); in ixgbe_multicst_remove()
3329 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK) { in ixgbe_multicst_remove()
3330 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_DEGRADED); in ixgbe_multicst_remove()
3344 ixgbe_setup_multicst(ixgbe_t *ixgbe) in ixgbe_setup_multicst() argument
3348 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_multicst()
3350 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_setup_multicst()
3352 ASSERT(ixgbe->mcast_count <= MAX_NUM_MULTICAST_ADDRESSES); in ixgbe_setup_multicst()
3354 mc_addr_list = (uint8_t *)ixgbe->mcast_table; in ixgbe_setup_multicst()
3355 mc_addr_count = ixgbe->mcast_count; in ixgbe_setup_multicst()
3371 ixgbe_setup_vmdq_rss_conf(ixgbe_t *ixgbe) in ixgbe_setup_vmdq_rss_conf() argument
3373 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_vmdq_rss_conf()
3386 ring_per_group = ixgbe->num_rx_rings / ixgbe->num_rx_groups; in ixgbe_setup_vmdq_rss_conf()
3387 if (ixgbe->num_rx_groups > 4) { in ixgbe_setup_vmdq_rss_conf()
3388 ixgbe->num_rx_rings = ixgbe->num_rx_groups; in ixgbe_setup_vmdq_rss_conf()
3390 ixgbe->num_rx_rings = ixgbe->num_rx_groups * in ixgbe_setup_vmdq_rss_conf()
3412 ring_per_group = ixgbe->num_rx_rings / ixgbe->num_rx_groups; in ixgbe_setup_vmdq_rss_conf()
3413 if (ixgbe->num_rx_groups == 1) { in ixgbe_setup_vmdq_rss_conf()
3414 ixgbe->num_rx_rings = min(8, ring_per_group); in ixgbe_setup_vmdq_rss_conf()
3415 } else if (ixgbe->num_rx_groups <= 32) { in ixgbe_setup_vmdq_rss_conf()
3416 ixgbe->num_rx_rings = ixgbe->num_rx_groups * in ixgbe_setup_vmdq_rss_conf()
3418 } else if (ixgbe->num_rx_groups <= 64) { in ixgbe_setup_vmdq_rss_conf()
3419 ixgbe->num_rx_rings = ixgbe->num_rx_groups * in ixgbe_setup_vmdq_rss_conf()
3428 ring_per_group = ixgbe->num_rx_rings / ixgbe->num_rx_groups; in ixgbe_setup_vmdq_rss_conf()
3430 if (ixgbe->num_rx_groups == 1 && ring_per_group == 1) { in ixgbe_setup_vmdq_rss_conf()
3431 ixgbe->classify_mode = IXGBE_CLASSIFY_NONE; in ixgbe_setup_vmdq_rss_conf()
3432 } else if (ixgbe->num_rx_groups != 1 && ring_per_group == 1) { in ixgbe_setup_vmdq_rss_conf()
3433 ixgbe->classify_mode = IXGBE_CLASSIFY_VMDQ; in ixgbe_setup_vmdq_rss_conf()
3434 } else if (ixgbe->num_rx_groups != 1 && ring_per_group != 1) { in ixgbe_setup_vmdq_rss_conf()
3435 ixgbe->classify_mode = IXGBE_CLASSIFY_VMDQ_RSS; in ixgbe_setup_vmdq_rss_conf()
3437 ixgbe->classify_mode = IXGBE_CLASSIFY_RSS; in ixgbe_setup_vmdq_rss_conf()
3440 IXGBE_DEBUGLOG_2(ixgbe, "rx group number:%d, rx ring number:%d", in ixgbe_setup_vmdq_rss_conf()
3441 ixgbe->num_rx_groups, ixgbe->num_rx_rings); in ixgbe_setup_vmdq_rss_conf()
3457 ixgbe_get_conf(ixgbe_t *ixgbe) in ixgbe_get_conf() argument
3459 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_get_conf()
3486 ixgbe->default_mtu = ixgbe_get_prop(ixgbe, PROP_DEFAULT_MTU, in ixgbe_get_conf()
3487 MIN_MTU, ixgbe->capab->max_mtu, DEFAULT_MTU); in ixgbe_get_conf()
3489 ixgbe->max_frame_size = ixgbe->default_mtu + in ixgbe_get_conf()
3495 flow_control = ixgbe_get_prop(ixgbe, PROP_FLOW_CONTROL, in ixgbe_get_conf()
3509 ixgbe->num_tx_rings = ixgbe_get_prop(ixgbe, PROP_TX_QUEUE_NUM, in ixgbe_get_conf()
3510 ixgbe->capab->min_tx_que_num, in ixgbe_get_conf()
3511 ixgbe->capab->max_tx_que_num, in ixgbe_get_conf()
3512 ixgbe->capab->def_tx_que_num); in ixgbe_get_conf()
3513 ixgbe->tx_ring_size = ixgbe_get_prop(ixgbe, PROP_TX_RING_SIZE, in ixgbe_get_conf()
3516 ixgbe->num_rx_rings = ixgbe_get_prop(ixgbe, PROP_RX_QUEUE_NUM, in ixgbe_get_conf()
3517 ixgbe->capab->min_rx_que_num, in ixgbe_get_conf()
3518 ixgbe->capab->max_rx_que_num, in ixgbe_get_conf()
3519 ixgbe->capab->def_rx_que_num); in ixgbe_get_conf()
3520 ixgbe->rx_ring_size = ixgbe_get_prop(ixgbe, PROP_RX_RING_SIZE, in ixgbe_get_conf()
3526 ixgbe->num_rx_groups = ixgbe_get_prop(ixgbe, PROP_RX_GROUP_NUM, in ixgbe_get_conf()
3527 ixgbe->capab->min_rx_grp_num, ixgbe->capab->max_rx_grp_num, in ixgbe_get_conf()
3528 ixgbe->capab->def_rx_grp_num); in ixgbe_get_conf()
3530 ixgbe->mr_enable = ixgbe_get_prop(ixgbe, PROP_MR_ENABLE, in ixgbe_get_conf()
3533 if (ixgbe->mr_enable == B_FALSE) { in ixgbe_get_conf()
3534 ixgbe->num_tx_rings = 1; in ixgbe_get_conf()
3535 ixgbe->num_rx_rings = 1; in ixgbe_get_conf()
3536 ixgbe->num_rx_groups = 1; in ixgbe_get_conf()
3537 ixgbe->classify_mode = IXGBE_CLASSIFY_NONE; in ixgbe_get_conf()
3539 ixgbe->num_rx_rings = ixgbe->num_rx_groups * in ixgbe_get_conf()
3540 max(ixgbe->num_rx_rings / ixgbe->num_rx_groups, 1); in ixgbe_get_conf()
3546 ixgbe_setup_vmdq_rss_conf(ixgbe); in ixgbe_get_conf()
3557 ixgbe->intr_force = ixgbe_get_prop(ixgbe, PROP_INTR_FORCE, in ixgbe_get_conf()
3560 ixgbe->tx_hcksum_enable = ixgbe_get_prop(ixgbe, PROP_TX_HCKSUM_ENABLE, in ixgbe_get_conf()
3562 ixgbe->rx_hcksum_enable = ixgbe_get_prop(ixgbe, PROP_RX_HCKSUM_ENABLE, in ixgbe_get_conf()
3564 ixgbe->lso_enable = ixgbe_get_prop(ixgbe, PROP_LSO_ENABLE, in ixgbe_get_conf()
3566 ixgbe->lro_enable = ixgbe_get_prop(ixgbe, PROP_LRO_ENABLE, in ixgbe_get_conf()
3568 ixgbe->tx_head_wb_enable = ixgbe_get_prop(ixgbe, PROP_TX_HEAD_WB_ENABLE, in ixgbe_get_conf()
3570 ixgbe->relax_order_enable = ixgbe_get_prop(ixgbe, in ixgbe_get_conf()
3579 ixgbe->tx_head_wb_enable = B_FALSE; in ixgbe_get_conf()
3587 if (ixgbe->tx_hcksum_enable == B_FALSE) { in ixgbe_get_conf()
3588 ixgbe->lso_enable = B_FALSE; in ixgbe_get_conf()
3596 if (ixgbe->rx_hcksum_enable == B_FALSE) { in ixgbe_get_conf()
3597 ixgbe->lro_enable = B_FALSE; in ixgbe_get_conf()
3604 ixgbe->lro_enable = B_FALSE; in ixgbe_get_conf()
3606 ixgbe->tx_copy_thresh = ixgbe_get_prop(ixgbe, PROP_TX_COPY_THRESHOLD, in ixgbe_get_conf()
3609 ixgbe->tx_recycle_thresh = ixgbe_get_prop(ixgbe, in ixgbe_get_conf()
3612 ixgbe->tx_overload_thresh = ixgbe_get_prop(ixgbe, in ixgbe_get_conf()
3615 ixgbe->tx_resched_thresh = ixgbe_get_prop(ixgbe, in ixgbe_get_conf()
3619 ixgbe->rx_copy_thresh = ixgbe_get_prop(ixgbe, PROP_RX_COPY_THRESHOLD, in ixgbe_get_conf()
3622 ixgbe->rx_limit_per_intr = ixgbe_get_prop(ixgbe, PROP_RX_LIMIT_PER_INTR, in ixgbe_get_conf()
3626 ixgbe->intr_throttling[0] = ixgbe_get_prop(ixgbe, PROP_INTR_THROTTLING, in ixgbe_get_conf()
3627 ixgbe->capab->min_intr_throttle, in ixgbe_get_conf()
3628 ixgbe->capab->max_intr_throttle, in ixgbe_get_conf()
3629 ixgbe->capab->def_intr_throttle); in ixgbe_get_conf()
3639 ixgbe->intr_throttling[0] = ixgbe->intr_throttling[0] & 0xFF8; in ixgbe_get_conf()
3641 hw->allow_unsupported_sfp = ixgbe_get_prop(ixgbe, in ixgbe_get_conf()
3646 ixgbe_init_params(ixgbe_t *ixgbe) in ixgbe_init_params() argument
3648 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_init_params()
3679 ixgbe->speeds_supported = speeds_supported; in ixgbe_init_params()
3685 ixgbe->param_en_10000fdx_cap = 1; in ixgbe_init_params()
3686 ixgbe->param_adv_10000fdx_cap = 1; in ixgbe_init_params()
3688 ixgbe->param_en_10000fdx_cap = 0; in ixgbe_init_params()
3689 ixgbe->param_adv_10000fdx_cap = 0; in ixgbe_init_params()
3693 ixgbe->param_en_5000fdx_cap = 1; in ixgbe_init_params()
3694 ixgbe->param_adv_5000fdx_cap = 1; in ixgbe_init_params()
3696 ixgbe->param_en_5000fdx_cap = 0; in ixgbe_init_params()
3697 ixgbe->param_adv_5000fdx_cap = 0; in ixgbe_init_params()
3701 ixgbe->param_en_2500fdx_cap = 1; in ixgbe_init_params()
3702 ixgbe->param_adv_2500fdx_cap = 1; in ixgbe_init_params()
3704 ixgbe->param_en_2500fdx_cap = 0; in ixgbe_init_params()
3705 ixgbe->param_adv_2500fdx_cap = 0; in ixgbe_init_params()
3709 ixgbe->param_en_1000fdx_cap = 1; in ixgbe_init_params()
3710 ixgbe->param_adv_1000fdx_cap = 1; in ixgbe_init_params()
3712 ixgbe->param_en_1000fdx_cap = 0; in ixgbe_init_params()
3713 ixgbe->param_adv_1000fdx_cap = 0; in ixgbe_init_params()
3717 ixgbe->param_en_100fdx_cap = 1; in ixgbe_init_params()
3718 ixgbe->param_adv_100fdx_cap = 1; in ixgbe_init_params()
3720 ixgbe->param_en_100fdx_cap = 0; in ixgbe_init_params()
3721 ixgbe->param_adv_100fdx_cap = 0; in ixgbe_init_params()
3724 ixgbe->param_pause_cap = 1; in ixgbe_init_params()
3725 ixgbe->param_asym_pause_cap = 1; in ixgbe_init_params()
3726 ixgbe->param_rem_fault = 0; in ixgbe_init_params()
3728 ixgbe->param_adv_autoneg_cap = 1; in ixgbe_init_params()
3729 ixgbe->param_adv_pause_cap = 1; in ixgbe_init_params()
3730 ixgbe->param_adv_asym_pause_cap = 1; in ixgbe_init_params()
3731 ixgbe->param_adv_rem_fault = 0; in ixgbe_init_params()
3733 ixgbe->param_lp_10000fdx_cap = 0; in ixgbe_init_params()
3734 ixgbe->param_lp_5000fdx_cap = 0; in ixgbe_init_params()
3735 ixgbe->param_lp_2500fdx_cap = 0; in ixgbe_init_params()
3736 ixgbe->param_lp_1000fdx_cap = 0; in ixgbe_init_params()
3737 ixgbe->param_lp_100fdx_cap = 0; in ixgbe_init_params()
3738 ixgbe->param_lp_autoneg_cap = 0; in ixgbe_init_params()
3739 ixgbe->param_lp_pause_cap = 0; in ixgbe_init_params()
3740 ixgbe->param_lp_asym_pause_cap = 0; in ixgbe_init_params()
3741 ixgbe->param_lp_rem_fault = 0; in ixgbe_init_params()
3755 ixgbe_get_prop(ixgbe_t *ixgbe, in ixgbe_get_prop() argument
3766 value = ddi_prop_get_int(DDI_DEV_T_ANY, ixgbe->dip, in ixgbe_get_prop()
3781 ixgbe_driver_setup_link(ixgbe_t *ixgbe, boolean_t setup_hw) in ixgbe_driver_setup_link() argument
3783 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_driver_setup_link()
3789 if (ixgbe->param_en_10000fdx_cap == 1) in ixgbe_driver_setup_link()
3792 if (ixgbe->param_en_5000fdx_cap == 1) in ixgbe_driver_setup_link()
3795 if (ixgbe->param_en_2500fdx_cap == 1) in ixgbe_driver_setup_link()
3798 if (ixgbe->param_en_1000fdx_cap == 1) in ixgbe_driver_setup_link()
3801 if (ixgbe->param_en_100fdx_cap == 1) in ixgbe_driver_setup_link()
3807 if (ixgbe->param_adv_autoneg_cap == 1 && advertised == 0) { in ixgbe_driver_setup_link()
3808 ixgbe_notice(ixgbe, "Invalid link settings. Setting link " in ixgbe_driver_setup_link()
3818 if (ixgbe_setup_link(&ixgbe->hw, advertised, in ixgbe_driver_setup_link()
3819 ixgbe->param_adv_autoneg_cap) != IXGBE_SUCCESS) { in ixgbe_driver_setup_link()
3820 ixgbe_notice(ixgbe, "Setup link failed on this " in ixgbe_driver_setup_link()
3835 ixgbe_driver_link_check(ixgbe_t *ixgbe) in ixgbe_driver_link_check() argument
3837 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_driver_link_check()
3842 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_driver_link_check()
3846 ixgbe->link_check_complete = B_TRUE; in ixgbe_driver_link_check()
3854 if (ixgbe->link_state != LINK_STATE_UP) { in ixgbe_driver_link_check()
3857 ixgbe->link_speed = SPEED_10GB; in ixgbe_driver_link_check()
3860 ixgbe->link_speed = SPEED_5GB; in ixgbe_driver_link_check()
3863 ixgbe->link_speed = SPEED_2_5GB; in ixgbe_driver_link_check()
3866 ixgbe->link_speed = SPEED_1GB; in ixgbe_driver_link_check()
3869 ixgbe->link_speed = SPEED_100; in ixgbe_driver_link_check()
3871 ixgbe->link_duplex = LINK_DUPLEX_FULL; in ixgbe_driver_link_check()
3872 ixgbe->link_state = LINK_STATE_UP; in ixgbe_driver_link_check()
3876 if (ixgbe->link_check_complete == B_TRUE || in ixgbe_driver_link_check()
3877 (ixgbe->link_check_complete == B_FALSE && in ixgbe_driver_link_check()
3878 gethrtime() >= ixgbe->link_check_hrtime)) { in ixgbe_driver_link_check()
3882 ixgbe->link_check_complete = B_TRUE; in ixgbe_driver_link_check()
3884 if (ixgbe->link_state != LINK_STATE_DOWN) { in ixgbe_driver_link_check()
3885 ixgbe->link_speed = 0; in ixgbe_driver_link_check()
3886 ixgbe->link_duplex = LINK_DUPLEX_UNKNOWN; in ixgbe_driver_link_check()
3887 ixgbe->link_state = LINK_STATE_DOWN; in ixgbe_driver_link_check()
3898 ixgbe->eims |= IXGBE_EICR_LSC; in ixgbe_driver_link_check()
3899 IXGBE_WRITE_REG(hw, IXGBE_EIMS, ixgbe->eims); in ixgbe_driver_link_check()
3903 mac_link_update(ixgbe->mac_hdl, ixgbe->link_state); in ixgbe_driver_link_check()
3913 ixgbe_t *ixgbe = (ixgbe_t *)arg; in ixgbe_sfp_check() local
3914 uint32_t eicr = ixgbe->eicr; in ixgbe_sfp_check()
3915 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_sfp_check()
3917 mutex_enter(&ixgbe->gen_lock); in ixgbe_sfp_check()
3926 ixgbe_driver_link_check(ixgbe); in ixgbe_sfp_check()
3927 ixgbe_get_hw_state(ixgbe); in ixgbe_sfp_check()
3938 ixgbe_driver_link_check(ixgbe); in ixgbe_sfp_check()
3939 ixgbe_get_hw_state(ixgbe); in ixgbe_sfp_check()
3941 mutex_exit(&ixgbe->gen_lock); in ixgbe_sfp_check()
3946 ixgbe->link_check_complete = B_FALSE; in ixgbe_sfp_check()
3947 ixgbe->link_check_hrtime = gethrtime() + in ixgbe_sfp_check()
3961 ixgbe_t *ixgbe = (ixgbe_t *)arg; in ixgbe_overtemp_check() local
3962 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_overtemp_check()
3963 uint32_t eicr = ixgbe->eicr; in ixgbe_overtemp_check()
3967 mutex_enter(&ixgbe->gen_lock); in ixgbe_overtemp_check()
3976 atomic_or_32(&ixgbe->ixgbe_state, IXGBE_OVERTEMP); in ixgbe_overtemp_check()
3981 ixgbe_disable_adapter_interrupts(ixgbe); in ixgbe_overtemp_check()
3988 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_LOST); in ixgbe_overtemp_check()
3989 ixgbe_error(ixgbe, in ixgbe_overtemp_check()
3992 ixgbe_error(ixgbe, in ixgbe_overtemp_check()
4002 mutex_exit(&ixgbe->gen_lock); in ixgbe_overtemp_check()
4017 ixgbe_t *ixgbe = (ixgbe_t *)arg; in ixgbe_phy_check() local
4018 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_phy_check()
4021 mutex_enter(&ixgbe->gen_lock); in ixgbe_phy_check()
4039 atomic_or_32(&ixgbe->ixgbe_state, IXGBE_OVERTEMP); in ixgbe_phy_check()
4044 ixgbe_disable_adapter_interrupts(ixgbe); in ixgbe_phy_check()
4051 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_LOST); in ixgbe_phy_check()
4052 ixgbe_error(ixgbe, in ixgbe_phy_check()
4055 ixgbe_error(ixgbe, in ixgbe_phy_check()
4061 mutex_exit(&ixgbe->gen_lock); in ixgbe_phy_check()
4070 ixgbe_t *ixgbe = (ixgbe_t *)arg; in ixgbe_link_timer() local
4072 mutex_enter(&ixgbe->gen_lock); in ixgbe_link_timer()
4073 ixgbe_driver_link_check(ixgbe); in ixgbe_link_timer()
4074 mutex_exit(&ixgbe->gen_lock); in ixgbe_link_timer()
4085 ixgbe_t *ixgbe = (ixgbe_t *)arg; in ixgbe_local_timer() local
4087 if (ixgbe->ixgbe_state & IXGBE_OVERTEMP) in ixgbe_local_timer()
4090 if (ixgbe->ixgbe_state & IXGBE_ERROR) { in ixgbe_local_timer()
4091 ixgbe->reset_count++; in ixgbe_local_timer()
4092 if (ixgbe_reset(ixgbe) == IXGBE_SUCCESS) in ixgbe_local_timer()
4093 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_RESTORED); in ixgbe_local_timer()
4097 if (ixgbe_stall_check(ixgbe)) { in ixgbe_local_timer()
4098 atomic_or_32(&ixgbe->ixgbe_state, IXGBE_STALL); in ixgbe_local_timer()
4099 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_DEGRADED); in ixgbe_local_timer()
4101 ixgbe->reset_count++; in ixgbe_local_timer()
4102 if (ixgbe_reset(ixgbe) == IXGBE_SUCCESS) in ixgbe_local_timer()
4103 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_RESTORED); in ixgbe_local_timer()
4107 ixgbe_restart_watchdog_timer(ixgbe); in ixgbe_local_timer()
4122 ixgbe_stall_check(ixgbe_t *ixgbe) in ixgbe_stall_check() argument
4128 if (ixgbe->link_state != LINK_STATE_UP) in ixgbe_stall_check()
4135 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_stall_check()
4136 tx_ring = &ixgbe->tx_rings[i]; in ixgbe_stall_check()
4137 if (tx_ring->tbd_free <= ixgbe->tx_recycle_thresh) { in ixgbe_stall_check()
4179 ixgbe_find_mac_address(ixgbe_t *ixgbe) in ixgbe_find_mac_address() argument
4182 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_find_mac_address()
4198 err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, ixgbe->dip, in ixgbe_find_mac_address()
4213 if (ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, ixgbe->dip, 0, in ixgbe_find_mac_address()
4230 err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, ixgbe->dip, in ixgbe_find_mac_address()
4246 _NOTE(ARGUNUSED(ixgbe)); in ixgbe_find_mac_address()
4254 ixgbe_arm_watchdog_timer(ixgbe_t *ixgbe) in ixgbe_arm_watchdog_timer() argument
4259 ixgbe->watchdog_tid = in ixgbe_arm_watchdog_timer()
4261 (void *)ixgbe, 1 * drv_usectohz(1000000)); in ixgbe_arm_watchdog_timer()
4269 ixgbe_enable_watchdog_timer(ixgbe_t *ixgbe) in ixgbe_enable_watchdog_timer() argument
4271 mutex_enter(&ixgbe->watchdog_lock); in ixgbe_enable_watchdog_timer()
4273 if (!ixgbe->watchdog_enable) { in ixgbe_enable_watchdog_timer()
4274 ixgbe->watchdog_enable = B_TRUE; in ixgbe_enable_watchdog_timer()
4275 ixgbe->watchdog_start = B_TRUE; in ixgbe_enable_watchdog_timer()
4276 ixgbe_arm_watchdog_timer(ixgbe); in ixgbe_enable_watchdog_timer()
4279 mutex_exit(&ixgbe->watchdog_lock); in ixgbe_enable_watchdog_timer()
4286 ixgbe_disable_watchdog_timer(ixgbe_t *ixgbe) in ixgbe_disable_watchdog_timer() argument
4290 mutex_enter(&ixgbe->watchdog_lock); in ixgbe_disable_watchdog_timer()
4292 ixgbe->watchdog_enable = B_FALSE; in ixgbe_disable_watchdog_timer()
4293 ixgbe->watchdog_start = B_FALSE; in ixgbe_disable_watchdog_timer()
4294 tid = ixgbe->watchdog_tid; in ixgbe_disable_watchdog_timer()
4295 ixgbe->watchdog_tid = 0; in ixgbe_disable_watchdog_timer()
4297 mutex_exit(&ixgbe->watchdog_lock); in ixgbe_disable_watchdog_timer()
4307 ixgbe_start_watchdog_timer(ixgbe_t *ixgbe) in ixgbe_start_watchdog_timer() argument
4309 mutex_enter(&ixgbe->watchdog_lock); in ixgbe_start_watchdog_timer()
4311 if (ixgbe->watchdog_enable) { in ixgbe_start_watchdog_timer()
4312 if (!ixgbe->watchdog_start) { in ixgbe_start_watchdog_timer()
4313 ixgbe->watchdog_start = B_TRUE; in ixgbe_start_watchdog_timer()
4314 ixgbe_arm_watchdog_timer(ixgbe); in ixgbe_start_watchdog_timer()
4318 mutex_exit(&ixgbe->watchdog_lock); in ixgbe_start_watchdog_timer()
4325 ixgbe_restart_watchdog_timer(ixgbe_t *ixgbe) in ixgbe_restart_watchdog_timer() argument
4327 mutex_enter(&ixgbe->watchdog_lock); in ixgbe_restart_watchdog_timer()
4329 if (ixgbe->watchdog_start) in ixgbe_restart_watchdog_timer()
4330 ixgbe_arm_watchdog_timer(ixgbe); in ixgbe_restart_watchdog_timer()
4332 mutex_exit(&ixgbe->watchdog_lock); in ixgbe_restart_watchdog_timer()
4339 ixgbe_stop_watchdog_timer(ixgbe_t *ixgbe) in ixgbe_stop_watchdog_timer() argument
4343 mutex_enter(&ixgbe->watchdog_lock); in ixgbe_stop_watchdog_timer()
4345 ixgbe->watchdog_start = B_FALSE; in ixgbe_stop_watchdog_timer()
4346 tid = ixgbe->watchdog_tid; in ixgbe_stop_watchdog_timer()
4347 ixgbe->watchdog_tid = 0; in ixgbe_stop_watchdog_timer()
4349 mutex_exit(&ixgbe->watchdog_lock); in ixgbe_stop_watchdog_timer()
4359 ixgbe_disable_adapter_interrupts(ixgbe_t *ixgbe) in ixgbe_disable_adapter_interrupts() argument
4361 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_disable_adapter_interrupts()
4371 if (ixgbe->intr_type == DDI_INTR_TYPE_MSIX) { in ixgbe_disable_adapter_interrupts()
4382 ixgbe_enable_adapter_interrupts(ixgbe_t *ixgbe) in ixgbe_enable_adapter_interrupts() argument
4384 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_enable_adapter_interrupts()
4389 ixgbe->eims = IXGBE_EIMS_ENABLE_MASK; /* shared code default */ in ixgbe_enable_adapter_interrupts()
4390 ixgbe->eims &= ~IXGBE_EIMS_TCP_TIMER; /* minus tcp timer */ in ixgbe_enable_adapter_interrupts()
4391 ixgbe->eims |= ixgbe->capab->other_intr; /* "other" interrupt types */ in ixgbe_enable_adapter_interrupts()
4394 eiam = ixgbe->capab->other_intr; in ixgbe_enable_adapter_interrupts()
4399 if (ixgbe->intr_type == DDI_INTR_TYPE_MSIX) { in ixgbe_enable_adapter_interrupts()
4401 eiac = (ixgbe->eims & ~IXGBE_OTHER_INTR); in ixgbe_enable_adapter_interrupts()
4422 (ixgbe->intr_type == DDI_INTR_TYPE_MSI)) { in ixgbe_enable_adapter_interrupts()
4430 gpie |= ixgbe->capab->other_gpie; in ixgbe_enable_adapter_interrupts()
4438 gpie |= ixgbe->capab->other_gpie; in ixgbe_enable_adapter_interrupts()
4441 if (ixgbe->lro_enable) { in ixgbe_enable_adapter_interrupts()
4451 IXGBE_WRITE_REG(hw, IXGBE_EIMS, ixgbe->eims); in ixgbe_enable_adapter_interrupts()
4462 ixgbe_loopback_ioctl(ixgbe_t *ixgbe, struct iocblk *iocp, mblk_t *mp) in ixgbe_loopback_ioctl() argument
4513 *lbmp = ixgbe->loopback_mode; in ixgbe_loopback_ioctl()
4522 if (!ixgbe_set_loopback_mode(ixgbe, *lbmp)) in ixgbe_loopback_ioctl()
4530 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK) { in ixgbe_loopback_ioctl()
4531 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_DEGRADED); in ixgbe_loopback_ioctl()
4542 ixgbe_set_loopback_mode(ixgbe_t *ixgbe, uint32_t mode) in ixgbe_set_loopback_mode() argument
4544 if (mode == ixgbe->loopback_mode) in ixgbe_set_loopback_mode()
4547 ixgbe->loopback_mode = mode; in ixgbe_set_loopback_mode()
4553 (void) ixgbe_reset(ixgbe); in ixgbe_set_loopback_mode()
4557 mutex_enter(&ixgbe->gen_lock); in ixgbe_set_loopback_mode()
4561 mutex_exit(&ixgbe->gen_lock); in ixgbe_set_loopback_mode()
4568 ixgbe_set_internal_mac_loopback(ixgbe); in ixgbe_set_loopback_mode()
4572 mutex_exit(&ixgbe->gen_lock); in ixgbe_set_loopback_mode()
4581 ixgbe_set_internal_mac_loopback(ixgbe_t *ixgbe) in ixgbe_set_internal_mac_loopback() argument
4587 hw = &ixgbe->hw; in ixgbe_set_internal_mac_loopback()
4592 reg = IXGBE_READ_REG(&ixgbe->hw, IXGBE_HLREG0); in ixgbe_set_internal_mac_loopback()
4594 IXGBE_WRITE_REG(&ixgbe->hw, IXGBE_HLREG0, reg); in ixgbe_set_internal_mac_loopback()
4596 reg = IXGBE_READ_REG(&ixgbe->hw, IXGBE_AUTOC); in ixgbe_set_internal_mac_loopback()
4598 IXGBE_WRITE_REG(&ixgbe->hw, IXGBE_AUTOC, reg); in ixgbe_set_internal_mac_loopback()
4605 (void) ixgbe_read_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_LPBK, in ixgbe_set_internal_mac_loopback()
4608 (void) ixgbe_write_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_LPBK, in ixgbe_set_internal_mac_loopback()
4611 (void) ixgbe_read_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_10G, in ixgbe_set_internal_mac_loopback()
4614 (void) ixgbe_write_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_10G, in ixgbe_set_internal_mac_loopback()
4617 (void) ixgbe_read_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_1G, in ixgbe_set_internal_mac_loopback()
4620 (void) ixgbe_write_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_1G, in ixgbe_set_internal_mac_loopback()
4623 (void) ixgbe_read_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_AN, in ixgbe_set_internal_mac_loopback()
4626 (void) ixgbe_write_analog_reg8(&ixgbe->hw, IXGBE_ATLAS_PDN_AN, in ixgbe_set_internal_mac_loopback()
4635 reg = IXGBE_READ_REG(&ixgbe->hw, IXGBE_AUTOC); in ixgbe_set_internal_mac_loopback()
4638 IXGBE_WRITE_REG(&ixgbe->hw, IXGBE_AUTOC, reg); in ixgbe_set_internal_mac_loopback()
4640 (void) ixgbe_setup_link(&ixgbe->hw, IXGBE_LINK_SPEED_10GB_FULL, in ixgbe_set_internal_mac_loopback()
4664 mac_rx_ring(rx_ring->ixgbe->mac_hdl, rx_ring->ring_handle, mp, in ixgbe_intr_rx_work()
4675 ixgbe_t *ixgbe = tx_ring->ixgbe; in ixgbe_intr_tx_work() local
4686 (tx_ring->tbd_free >= ixgbe->tx_resched_thresh)) { in ixgbe_intr_tx_work()
4688 mac_tx_ring_update(tx_ring->ixgbe->mac_hdl, in ixgbe_intr_tx_work()
4699 ixgbe_intr_other_work(ixgbe_t *ixgbe, uint32_t eicr) in ixgbe_intr_other_work() argument
4701 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_intr_other_work()
4703 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_intr_other_work()
4709 ixgbe_driver_link_check(ixgbe); in ixgbe_intr_other_work()
4710 ixgbe_get_hw_state(ixgbe); in ixgbe_intr_other_work()
4716 if ((ixgbe->capab->flags & IXGBE_FLAG_FAN_FAIL_CAPABLE) && in ixgbe_intr_other_work()
4718 atomic_or_32(&ixgbe->ixgbe_state, IXGBE_OVERTEMP); in ixgbe_intr_other_work()
4723 ixgbe_disable_adapter_interrupts(ixgbe); in ixgbe_intr_other_work()
4728 (void) ixgbe_stop_adapter(&ixgbe->hw); in ixgbe_intr_other_work()
4730 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_LOST); in ixgbe_intr_other_work()
4731 ixgbe_error(ixgbe, in ixgbe_intr_other_work()
4734 ixgbe_error(ixgbe, in ixgbe_intr_other_work()
4738 ixgbe->eims |= IXGBE_EICR_GPI_SDP1; in ixgbe_intr_other_work()
4744 if ((ixgbe->capab->flags & IXGBE_FLAG_SFP_PLUG_CAPABLE) && in ixgbe_intr_other_work()
4747 ixgbe->eicr = eicr; in ixgbe_intr_other_work()
4748 if ((ddi_taskq_dispatch(ixgbe->sfp_taskq, in ixgbe_intr_other_work()
4749 ixgbe_sfp_check, (void *)ixgbe, in ixgbe_intr_other_work()
4751 ixgbe_log(ixgbe, "No memory available to dispatch " in ixgbe_intr_other_work()
4759 if ((ixgbe->capab->flags & IXGBE_FLAG_TEMP_SENSOR_CAPABLE) && in ixgbe_intr_other_work()
4762 ixgbe->eicr = eicr; in ixgbe_intr_other_work()
4763 if ((ddi_taskq_dispatch(ixgbe->overtemp_taskq, in ixgbe_intr_other_work()
4764 ixgbe_overtemp_check, (void *)ixgbe, in ixgbe_intr_other_work()
4766 ixgbe_log(ixgbe, "No memory available to dispatch " in ixgbe_intr_other_work()
4776 ixgbe->eicr = eicr; in ixgbe_intr_other_work()
4777 if ((ddi_taskq_dispatch(ixgbe->phy_taskq, in ixgbe_intr_other_work()
4778 ixgbe_phy_check, (void *)ixgbe, in ixgbe_intr_other_work()
4780 ixgbe_log(ixgbe, "No memory available to dispatch " in ixgbe_intr_other_work()
4792 ixgbe_t *ixgbe = (ixgbe_t *)arg1; in ixgbe_intr_legacy() local
4793 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_intr_legacy()
4803 mutex_enter(&ixgbe->gen_lock); in ixgbe_intr_legacy()
4804 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { in ixgbe_intr_legacy()
4805 mutex_exit(&ixgbe->gen_lock); in ixgbe_intr_legacy()
4817 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK) { in ixgbe_intr_legacy()
4818 mutex_exit(&ixgbe->gen_lock); in ixgbe_intr_legacy()
4819 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_DEGRADED); in ixgbe_intr_legacy()
4820 atomic_or_32(&ixgbe->ixgbe_state, IXGBE_ERROR); in ixgbe_intr_legacy()
4829 ASSERT(ixgbe->num_rx_rings == 1); in ixgbe_intr_legacy()
4830 ASSERT(ixgbe->num_tx_rings == 1); in ixgbe_intr_legacy()
4836 ixgbe->eimc |= IXGBE_EICR_RTX_QUEUE; in ixgbe_intr_legacy()
4837 IXGBE_WRITE_REG(hw, IXGBE_EIMC, ixgbe->eimc); in ixgbe_intr_legacy()
4838 ixgbe->eims |= IXGBE_EICR_RTX_QUEUE; in ixgbe_intr_legacy()
4842 rx_ring = &ixgbe->rx_rings[0]; in ixgbe_intr_legacy()
4853 tx_ring = &ixgbe->tx_rings[0]; in ixgbe_intr_legacy()
4860 (tx_ring->tbd_free >= ixgbe->tx_resched_thresh)); in ixgbe_intr_legacy()
4864 if (eicr & ixgbe->capab->other_intr) { in ixgbe_intr_legacy()
4867 ixgbe->eims &= ~(eicr & IXGBE_OTHER_INTR); in ixgbe_intr_legacy()
4875 ixgbe->eimc = IXGBE_82599_OTHER_INTR; in ixgbe_intr_legacy()
4876 IXGBE_WRITE_REG(hw, IXGBE_EIMC, ixgbe->eimc); in ixgbe_intr_legacy()
4882 ixgbe_intr_other_work(ixgbe, eicr); in ixgbe_intr_legacy()
4883 ixgbe->eims &= ~(eicr & IXGBE_OTHER_INTR); in ixgbe_intr_legacy()
4886 mutex_exit(&ixgbe->gen_lock); in ixgbe_intr_legacy()
4890 mutex_exit(&ixgbe->gen_lock); in ixgbe_intr_legacy()
4899 IXGBE_WRITE_REG(hw, IXGBE_EIMS, ixgbe->eims); in ixgbe_intr_legacy()
4905 mac_rx_ring(rx_ring->ixgbe->mac_hdl, rx_ring->ring_handle, mp, in ixgbe_intr_legacy()
4911 mac_tx_ring_update(ixgbe->mac_hdl, tx_ring->ring_handle); in ixgbe_intr_legacy()
4924 ixgbe_t *ixgbe = (ixgbe_t *)arg1; in ixgbe_intr_msi() local
4925 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_intr_msi()
4932 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != DDI_FM_OK) { in ixgbe_intr_msi()
4933 ddi_fm_service_impact(ixgbe->dip, DDI_SERVICE_DEGRADED); in ixgbe_intr_msi()
4934 atomic_or_32(&ixgbe->ixgbe_state, IXGBE_ERROR); in ixgbe_intr_msi()
4942 ASSERT(ixgbe->num_rx_rings == 1); in ixgbe_intr_msi()
4943 ASSERT(ixgbe->num_tx_rings == 1); in ixgbe_intr_msi()
4949 ixgbe_intr_rx_work(&ixgbe->rx_rings[0]); in ixgbe_intr_msi()
4956 ixgbe_intr_tx_work(&ixgbe->tx_rings[0]); in ixgbe_intr_msi()
4960 if (eicr & ixgbe->capab->other_intr) { in ixgbe_intr_msi()
4961 mutex_enter(&ixgbe->gen_lock); in ixgbe_intr_msi()
4964 ixgbe->eims &= ~(eicr & IXGBE_OTHER_INTR); in ixgbe_intr_msi()
4972 ixgbe->eimc = IXGBE_82599_OTHER_INTR; in ixgbe_intr_msi()
4973 IXGBE_WRITE_REG(hw, IXGBE_EIMC, ixgbe->eimc); in ixgbe_intr_msi()
4979 ixgbe_intr_other_work(ixgbe, eicr); in ixgbe_intr_msi()
4980 ixgbe->eims &= ~(eicr & IXGBE_OTHER_INTR); in ixgbe_intr_msi()
4981 mutex_exit(&ixgbe->gen_lock); in ixgbe_intr_msi()
4985 IXGBE_WRITE_REG(hw, IXGBE_EIMS, ixgbe->eims); in ixgbe_intr_msi()
4997 ixgbe_t *ixgbe = vect->ixgbe; in ixgbe_intr_msix() local
4998 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_intr_msix()
5007 r_idx = bt_getlowbit(vect->rx_map, 0, (ixgbe->num_rx_rings - 1)); in ixgbe_intr_msix()
5009 ixgbe_intr_rx_work(&ixgbe->rx_rings[r_idx]); in ixgbe_intr_msix()
5011 (ixgbe->num_rx_rings - 1)); in ixgbe_intr_msix()
5017 r_idx = bt_getlowbit(vect->tx_map, 0, (ixgbe->num_tx_rings - 1)); in ixgbe_intr_msix()
5019 ixgbe_intr_tx_work(&ixgbe->tx_rings[r_idx]); in ixgbe_intr_msix()
5021 (ixgbe->num_tx_rings - 1)); in ixgbe_intr_msix()
5031 if (ixgbe_check_acc_handle(ixgbe->osdep.reg_handle) != in ixgbe_intr_msix()
5033 ddi_fm_service_impact(ixgbe->dip, in ixgbe_intr_msix()
5035 atomic_or_32(&ixgbe->ixgbe_state, IXGBE_ERROR); in ixgbe_intr_msix()
5042 if (eicr & ixgbe->capab->other_intr) { in ixgbe_intr_msix()
5043 mutex_enter(&ixgbe->gen_lock); in ixgbe_intr_msix()
5046 ixgbe->eims &= ~(eicr & IXGBE_OTHER_INTR); in ixgbe_intr_msix()
5047 ixgbe_intr_other_work(ixgbe, eicr); in ixgbe_intr_msix()
5055 ixgbe->eims |= IXGBE_EICR_RTX_QUEUE; in ixgbe_intr_msix()
5056 ixgbe_intr_other_work(ixgbe, eicr); in ixgbe_intr_msix()
5062 mutex_exit(&ixgbe->gen_lock); in ixgbe_intr_msix()
5066 IXGBE_WRITE_REG(hw, IXGBE_EIMS, ixgbe->eims); in ixgbe_intr_msix()
5082 ixgbe_alloc_intrs(ixgbe_t *ixgbe) in ixgbe_alloc_intrs() argument
5088 devinfo = ixgbe->dip; in ixgbe_alloc_intrs()
5096 ixgbe_log(ixgbe, in ixgbe_alloc_intrs()
5100 IXGBE_DEBUGLOG_1(ixgbe, "Supported interrupt types: %x", intr_types); in ixgbe_alloc_intrs()
5102 ixgbe->intr_type = 0; in ixgbe_alloc_intrs()
5108 (ixgbe->intr_force <= IXGBE_INTR_MSIX)) { in ixgbe_alloc_intrs()
5109 rc = ixgbe_alloc_intr_handles(ixgbe, DDI_INTR_TYPE_MSIX); in ixgbe_alloc_intrs()
5113 ixgbe_log(ixgbe, in ixgbe_alloc_intrs()
5120 ixgbe->num_rx_rings = 1; in ixgbe_alloc_intrs()
5121 ixgbe->num_rx_groups = 1; in ixgbe_alloc_intrs()
5122 ixgbe->num_tx_rings = 1; in ixgbe_alloc_intrs()
5123 ixgbe->classify_mode = IXGBE_CLASSIFY_NONE; in ixgbe_alloc_intrs()
5124 ixgbe_log(ixgbe, in ixgbe_alloc_intrs()
5131 (ixgbe->intr_force <= IXGBE_INTR_MSI)) { in ixgbe_alloc_intrs()
5132 rc = ixgbe_alloc_intr_handles(ixgbe, DDI_INTR_TYPE_MSI); in ixgbe_alloc_intrs()
5136 ixgbe_log(ixgbe, in ixgbe_alloc_intrs()
5152 if (ixgbe->hw.mac.type == ixgbe_mac_X550 || in ixgbe_alloc_intrs()
5153 ixgbe->hw.mac.type == ixgbe_mac_X550EM_x || in ixgbe_alloc_intrs()
5154 ixgbe->hw.mac.type == ixgbe_mac_X550EM_a || in ixgbe_alloc_intrs()
5155 ixgbe->hw.mac.type == ixgbe_mac_X550_vf || in ixgbe_alloc_intrs()
5156 ixgbe->hw.mac.type == ixgbe_mac_X550EM_x_vf || in ixgbe_alloc_intrs()
5157 ixgbe->hw.mac.type == ixgbe_mac_X550EM_a_vf) { in ixgbe_alloc_intrs()
5158 ixgbe_log(ixgbe, in ixgbe_alloc_intrs()
5163 rc = ixgbe_alloc_intr_handles(ixgbe, DDI_INTR_TYPE_FIXED); in ixgbe_alloc_intrs()
5167 ixgbe_log(ixgbe, in ixgbe_alloc_intrs()
5186 ixgbe_alloc_intr_handles(ixgbe_t *ixgbe, int intr_type) in ixgbe_alloc_intr_handles() argument
5194 devinfo = ixgbe->dip; in ixgbe_alloc_intr_handles()
5200 IXGBE_DEBUGLOG_0(ixgbe, "interrupt type: legacy"); in ixgbe_alloc_intr_handles()
5206 IXGBE_DEBUGLOG_0(ixgbe, "interrupt type: MSI"); in ixgbe_alloc_intr_handles()
5215 request = min(16, ixgbe->num_rx_rings + ixgbe->num_tx_rings); in ixgbe_alloc_intr_handles()
5216 if (request > ixgbe->capab->max_ring_vect) in ixgbe_alloc_intr_handles()
5217 request = ixgbe->capab->max_ring_vect; in ixgbe_alloc_intr_handles()
5219 IXGBE_DEBUGLOG_0(ixgbe, "interrupt type: MSI-X"); in ixgbe_alloc_intr_handles()
5223 ixgbe_log(ixgbe, in ixgbe_alloc_intr_handles()
5228 IXGBE_DEBUGLOG_2(ixgbe, "interrupt handles requested: %d minimum: %d", in ixgbe_alloc_intr_handles()
5236 ixgbe_log(ixgbe, in ixgbe_alloc_intr_handles()
5241 IXGBE_DEBUGLOG_1(ixgbe, "interrupts supported: %d", count); in ixgbe_alloc_intr_handles()
5244 ixgbe->intr_cnt = 0; in ixgbe_alloc_intr_handles()
5245 ixgbe->intr_cnt_max = 0; in ixgbe_alloc_intr_handles()
5246 ixgbe->intr_cnt_min = 0; in ixgbe_alloc_intr_handles()
5251 ixgbe->intr_size = request * sizeof (ddi_intr_handle_t); in ixgbe_alloc_intr_handles()
5252 ixgbe->htable = kmem_alloc(ixgbe->intr_size, KM_SLEEP); in ixgbe_alloc_intr_handles()
5254 rc = ddi_intr_alloc(devinfo, ixgbe->htable, intr_type, 0, in ixgbe_alloc_intr_handles()
5257 ixgbe_log(ixgbe, "Allocate interrupts failed. " in ixgbe_alloc_intr_handles()
5262 IXGBE_DEBUGLOG_1(ixgbe, "interrupts actually allocated: %d", actual); in ixgbe_alloc_intr_handles()
5267 ixgbe->intr_cnt = actual; in ixgbe_alloc_intr_handles()
5268 ixgbe->intr_cnt_max = request; in ixgbe_alloc_intr_handles()
5269 ixgbe->intr_cnt_min = minimum; in ixgbe_alloc_intr_handles()
5275 ring_per_group = ixgbe->num_rx_rings / ixgbe->num_rx_groups; in ixgbe_alloc_intr_handles()
5276 ASSERT((ixgbe->num_rx_rings % ixgbe->num_rx_groups) == 0); in ixgbe_alloc_intr_handles()
5278 ixgbe->num_rx_rings = ixgbe->num_rx_groups * actual; in ixgbe_alloc_intr_handles()
5279 ixgbe_setup_vmdq_rss_conf(ixgbe); in ixgbe_alloc_intr_handles()
5287 ixgbe_log(ixgbe, "Insufficient interrupt handles available: %d", in ixgbe_alloc_intr_handles()
5295 rc = ddi_intr_get_pri(ixgbe->htable[0], &ixgbe->intr_pri); in ixgbe_alloc_intr_handles()
5297 ixgbe_log(ixgbe, in ixgbe_alloc_intr_handles()
5302 rc = ddi_intr_get_cap(ixgbe->htable[0], &ixgbe->intr_cap); in ixgbe_alloc_intr_handles()
5304 ixgbe_log(ixgbe, in ixgbe_alloc_intr_handles()
5309 ixgbe->intr_type = intr_type; in ixgbe_alloc_intr_handles()
5314 ixgbe_rem_intrs(ixgbe); in ixgbe_alloc_intr_handles()
5326 ixgbe_add_intr_handlers(ixgbe_t *ixgbe) in ixgbe_add_intr_handlers() argument
5331 switch (ixgbe->intr_type) { in ixgbe_add_intr_handlers()
5336 for (vector = 0; vector < ixgbe->intr_cnt; vector++) { in ixgbe_add_intr_handlers()
5340 rc = ddi_intr_add_handler(ixgbe->htable[vector], in ixgbe_add_intr_handlers()
5342 (void *)&ixgbe->vect_map[vector], NULL); in ixgbe_add_intr_handlers()
5345 ixgbe_log(ixgbe, in ixgbe_add_intr_handlers()
5350 ixgbe->htable[vector]); in ixgbe_add_intr_handlers()
5362 rc = ddi_intr_add_handler(ixgbe->htable[vector], in ixgbe_add_intr_handlers()
5364 (void *)ixgbe, NULL); in ixgbe_add_intr_handlers()
5367 ixgbe_log(ixgbe, in ixgbe_add_intr_handlers()
5378 rc = ddi_intr_add_handler(ixgbe->htable[vector], in ixgbe_add_intr_handlers()
5380 (void *)ixgbe, NULL); in ixgbe_add_intr_handlers()
5383 ixgbe_log(ixgbe, in ixgbe_add_intr_handlers()
5402 ixgbe_map_rxring_to_vector(ixgbe_t *ixgbe, int r_idx, int v_idx) in ixgbe_map_rxring_to_vector() argument
5407 BT_SET(ixgbe->vect_map[v_idx].rx_map, r_idx); in ixgbe_map_rxring_to_vector()
5412 ixgbe->vect_map[v_idx].rxr_cnt++; in ixgbe_map_rxring_to_vector()
5417 ixgbe->rx_rings[r_idx].intr_vector = v_idx; in ixgbe_map_rxring_to_vector()
5418 ixgbe->rx_rings[r_idx].vect_bit = 1 << v_idx; in ixgbe_map_rxring_to_vector()
5426 ixgbe_map_txring_to_vector(ixgbe_t *ixgbe, int t_idx, int v_idx) in ixgbe_map_txring_to_vector() argument
5431 BT_SET(ixgbe->vect_map[v_idx].tx_map, t_idx); in ixgbe_map_txring_to_vector()
5436 ixgbe->vect_map[v_idx].txr_cnt++; in ixgbe_map_txring_to_vector()
5441 ixgbe->tx_rings[t_idx].intr_vector = v_idx; in ixgbe_map_txring_to_vector()
5442 ixgbe->tx_rings[t_idx].vect_bit = 1 << v_idx; in ixgbe_map_txring_to_vector()
5454 ixgbe_setup_ivar(ixgbe_t *ixgbe, uint16_t intr_alloc_entry, uint8_t msix_vector, in ixgbe_setup_ivar() argument
5457 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_ivar()
5513 ixgbe_enable_ivar(ixgbe_t *ixgbe, uint16_t intr_alloc_entry, int8_t cause) in ixgbe_enable_ivar() argument
5515 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_enable_ivar()
5566 ixgbe_disable_ivar(ixgbe_t *ixgbe, uint16_t intr_alloc_entry, int8_t cause) in ixgbe_disable_ivar() argument
5568 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_disable_ivar()
5615 ixgbe_get_hw_rx_index(ixgbe_t *ixgbe, uint32_t sw_rx_index) in ixgbe_get_hw_rx_index() argument
5618 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_get_hw_rx_index()
5621 if (ixgbe->classify_mode == IXGBE_CLASSIFY_RSS || in ixgbe_get_hw_rx_index()
5622 ixgbe->classify_mode == IXGBE_CLASSIFY_NONE) { in ixgbe_get_hw_rx_index()
5624 } else if (ixgbe->classify_mode == IXGBE_CLASSIFY_VMDQ) { in ixgbe_get_hw_rx_index()
5639 } else if (ixgbe->classify_mode == IXGBE_CLASSIFY_VMDQ_RSS) { in ixgbe_get_hw_rx_index()
5640 rx_ring_per_group = ixgbe->num_rx_rings / ixgbe->num_rx_groups; in ixgbe_get_hw_rx_index()
5653 if (ixgbe->num_rx_groups > 32) { in ixgbe_get_hw_rx_index()
5682 ixgbe_map_intrs_to_vectors(ixgbe_t *ixgbe) in ixgbe_map_intrs_to_vectors() argument
5687 bzero(&ixgbe->vect_map, sizeof (ixgbe->vect_map)); in ixgbe_map_intrs_to_vectors()
5688 for (i = 0; i < ixgbe->intr_cnt; i++) { in ixgbe_map_intrs_to_vectors()
5689 ixgbe->vect_map[i].ixgbe = ixgbe; in ixgbe_map_intrs_to_vectors()
5696 if (ixgbe->intr_type != DDI_INTR_TYPE_MSIX) { in ixgbe_map_intrs_to_vectors()
5697 ixgbe_map_rxring_to_vector(ixgbe, 0, 0); in ixgbe_map_intrs_to_vectors()
5698 ixgbe_map_txring_to_vector(ixgbe, 0, 1); in ixgbe_map_intrs_to_vectors()
5710 BT_SET(ixgbe->vect_map[vector].other_map, 0); in ixgbe_map_intrs_to_vectors()
5711 ixgbe->vect_map[vector].other_cnt++; in ixgbe_map_intrs_to_vectors()
5716 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_map_intrs_to_vectors()
5717 ixgbe_map_rxring_to_vector(ixgbe, i, vector); in ixgbe_map_intrs_to_vectors()
5718 vector = (vector +1) % ixgbe->intr_cnt; in ixgbe_map_intrs_to_vectors()
5724 for (i = 0; i < ixgbe->num_tx_rings; i++) { in ixgbe_map_intrs_to_vectors()
5725 ixgbe_map_txring_to_vector(ixgbe, i, vector); in ixgbe_map_intrs_to_vectors()
5726 vector = (vector +1) % ixgbe->intr_cnt; in ixgbe_map_intrs_to_vectors()
5739 ixgbe_setup_adapter_vector(ixgbe_t *ixgbe) in ixgbe_setup_adapter_vector() argument
5741 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_setup_adapter_vector()
5774 if (ixgbe->intr_type != DDI_INTR_TYPE_MSIX) { in ixgbe_setup_adapter_vector()
5775 ixgbe_setup_ivar(ixgbe, 0, 0, 0); in ixgbe_setup_adapter_vector()
5776 ixgbe_setup_ivar(ixgbe, 0, 1, 1); in ixgbe_setup_adapter_vector()
5783 ixgbe_setup_ivar(ixgbe, IXGBE_IVAR_OTHER_CAUSES_INDEX, 0, -1); in ixgbe_setup_adapter_vector()
5788 for (v_idx = 0; v_idx < ixgbe->intr_cnt; v_idx++) { in ixgbe_setup_adapter_vector()
5789 vect = &ixgbe->vect_map[v_idx]; in ixgbe_setup_adapter_vector()
5795 (ixgbe->num_rx_rings - 1)); in ixgbe_setup_adapter_vector()
5798 hw_index = ixgbe->rx_rings[r_idx].hw_index; in ixgbe_setup_adapter_vector()
5799 ixgbe_setup_ivar(ixgbe, hw_index, v_idx, 0); in ixgbe_setup_adapter_vector()
5801 (ixgbe->num_rx_rings - 1)); in ixgbe_setup_adapter_vector()
5808 (ixgbe->num_tx_rings - 1)); in ixgbe_setup_adapter_vector()
5811 ixgbe_setup_ivar(ixgbe, r_idx, v_idx, 1); in ixgbe_setup_adapter_vector()
5813 (ixgbe->num_tx_rings - 1)); in ixgbe_setup_adapter_vector()
5822 ixgbe_rem_intr_handlers(ixgbe_t *ixgbe) in ixgbe_rem_intr_handlers() argument
5827 for (i = 0; i < ixgbe->intr_cnt; i++) { in ixgbe_rem_intr_handlers()
5828 rc = ddi_intr_remove_handler(ixgbe->htable[i]); in ixgbe_rem_intr_handlers()
5830 IXGBE_DEBUGLOG_1(ixgbe, in ixgbe_rem_intr_handlers()
5840 ixgbe_rem_intrs(ixgbe_t *ixgbe) in ixgbe_rem_intrs() argument
5845 for (i = 0; i < ixgbe->intr_cnt; i++) { in ixgbe_rem_intrs()
5846 rc = ddi_intr_free(ixgbe->htable[i]); in ixgbe_rem_intrs()
5848 IXGBE_DEBUGLOG_1(ixgbe, in ixgbe_rem_intrs()
5853 kmem_free(ixgbe->htable, ixgbe->intr_size); in ixgbe_rem_intrs()
5854 ixgbe->htable = NULL; in ixgbe_rem_intrs()
5861 ixgbe_enable_intrs(ixgbe_t *ixgbe) in ixgbe_enable_intrs() argument
5869 if (ixgbe->intr_cap & DDI_INTR_FLAG_BLOCK) { in ixgbe_enable_intrs()
5873 rc = ddi_intr_block_enable(ixgbe->htable, ixgbe->intr_cnt); in ixgbe_enable_intrs()
5875 ixgbe_log(ixgbe, in ixgbe_enable_intrs()
5883 for (i = 0; i < ixgbe->intr_cnt; i++) { in ixgbe_enable_intrs()
5884 rc = ddi_intr_enable(ixgbe->htable[i]); in ixgbe_enable_intrs()
5886 ixgbe_log(ixgbe, in ixgbe_enable_intrs()
5900 ixgbe_disable_intrs(ixgbe_t *ixgbe) in ixgbe_disable_intrs() argument
5908 if (ixgbe->intr_cap & DDI_INTR_FLAG_BLOCK) { in ixgbe_disable_intrs()
5909 rc = ddi_intr_block_disable(ixgbe->htable, ixgbe->intr_cnt); in ixgbe_disable_intrs()
5911 ixgbe_log(ixgbe, in ixgbe_disable_intrs()
5916 for (i = 0; i < ixgbe->intr_cnt; i++) { in ixgbe_disable_intrs()
5917 rc = ddi_intr_disable(ixgbe->htable[i]); in ixgbe_disable_intrs()
5919 ixgbe_log(ixgbe, in ixgbe_disable_intrs()
5933 ixgbe_get_hw_state(ixgbe_t *ixgbe) in ixgbe_get_hw_state() argument
5935 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_get_hw_state()
5940 ASSERT(mutex_owned(&ixgbe->gen_lock)); in ixgbe_get_hw_state()
5941 ixgbe->param_lp_1000fdx_cap = 0; in ixgbe_get_hw_state()
5942 ixgbe->param_lp_100fdx_cap = 0; in ixgbe_get_hw_state()
5946 ixgbe->phys_supported = ixgbe_get_supported_physical_layer(hw); in ixgbe_get_hw_state()
5956 ixgbe->param_lp_1000fdx_cap = in ixgbe_get_hw_state()
5958 ixgbe->param_lp_100fdx_cap = in ixgbe_get_hw_state()
5980 speed = ixgbe->speeds_supported; in ixgbe_get_hw_state()
5982 ixgbe->param_adv_10000fdx_cap = in ixgbe_get_hw_state()
5984 ixgbe->param_adv_5000fdx_cap = in ixgbe_get_hw_state()
5986 ixgbe->param_adv_2500fdx_cap = in ixgbe_get_hw_state()
5988 ixgbe->param_adv_1000fdx_cap = in ixgbe_get_hw_state()
5990 ixgbe->param_adv_100fdx_cap = in ixgbe_get_hw_state()
6104 ixgbe_fm_init(ixgbe_t *ixgbe) in ixgbe_fm_init() argument
6112 if (ixgbe->fm_capabilities & DDI_FM_ACCCHK_CAPABLE) { in ixgbe_fm_init()
6118 if (ixgbe->fm_capabilities & DDI_FM_DMACHK_CAPABLE) { in ixgbe_fm_init()
6126 if (ixgbe->fm_capabilities) { in ixgbe_fm_init()
6131 ddi_fm_init(ixgbe->dip, &ixgbe->fm_capabilities, &iblk); in ixgbe_fm_init()
6136 if (DDI_FM_EREPORT_CAP(ixgbe->fm_capabilities) || in ixgbe_fm_init()
6137 DDI_FM_ERRCB_CAP(ixgbe->fm_capabilities)) in ixgbe_fm_init()
6138 pci_ereport_setup(ixgbe->dip); in ixgbe_fm_init()
6143 if (DDI_FM_ERRCB_CAP(ixgbe->fm_capabilities)) in ixgbe_fm_init()
6144 ddi_fm_handler_register(ixgbe->dip, in ixgbe_fm_init()
6145 ixgbe_fm_error_cb, (void*) ixgbe); in ixgbe_fm_init()
6150 ixgbe_fm_fini(ixgbe_t *ixgbe) in ixgbe_fm_fini() argument
6155 if (ixgbe->fm_capabilities) { in ixgbe_fm_fini()
6160 if (DDI_FM_EREPORT_CAP(ixgbe->fm_capabilities) || in ixgbe_fm_fini()
6161 DDI_FM_ERRCB_CAP(ixgbe->fm_capabilities)) in ixgbe_fm_fini()
6162 pci_ereport_teardown(ixgbe->dip); in ixgbe_fm_fini()
6167 if (DDI_FM_ERRCB_CAP(ixgbe->fm_capabilities)) in ixgbe_fm_fini()
6168 ddi_fm_handler_unregister(ixgbe->dip); in ixgbe_fm_fini()
6173 ddi_fm_fini(ixgbe->dip); in ixgbe_fm_fini()
6178 ixgbe_fm_ereport(ixgbe_t *ixgbe, char *detail) in ixgbe_fm_ereport() argument
6185 if (DDI_FM_EREPORT_CAP(ixgbe->fm_capabilities)) { in ixgbe_fm_ereport()
6186 ddi_fm_ereport_post(ixgbe->dip, buf, ena, DDI_NOSLEEP, in ixgbe_fm_ereport()
6206 ixgbe_get_rx_ring_index(ixgbe_t *ixgbe, int gindex, int rindex) in ixgbe_get_rx_ring_index() argument
6211 for (i = 0; i < ixgbe->num_rx_rings; i++) { in ixgbe_get_rx_ring_index()
6212 rx_ring = &ixgbe->rx_rings[i]; in ixgbe_get_rx_ring_index()
6230 ixgbe_t *ixgbe = (ixgbe_t *)arg; in ixgbe_fill_ring() local
6240 ixgbe, group_index, ring_index); in ixgbe_fill_ring()
6244 ixgbe_rx_ring_t *rx_ring = &ixgbe->rx_rings[global_ring_index]; in ixgbe_fill_ring()
6256 if (ixgbe->intr_type & in ixgbe_fill_ring()
6259 ixgbe->htable[rx_ring->intr_vector]; in ixgbe_fill_ring()
6266 ASSERT(ring_index < ixgbe->num_tx_rings); in ixgbe_fill_ring()
6268 ixgbe_tx_ring_t *tx_ring = &ixgbe->tx_rings[ring_index]; in ixgbe_fill_ring()
6276 if (ixgbe->intr_type & in ixgbe_fill_ring()
6279 ixgbe->htable[tx_ring->intr_vector]; in ixgbe_fill_ring()
6295 ixgbe_t *ixgbe = (ixgbe_t *)arg; in ixgbe_fill_group() local
6296 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_fill_group()
6302 rx_group = &ixgbe->rx_groups[index]; in ixgbe_fill_group()
6311 if ((ixgbe->classify_mode == IXGBE_CLASSIFY_VMDQ || in ixgbe_fill_group()
6312 ixgbe->classify_mode == IXGBE_CLASSIFY_VMDQ_RSS) && in ixgbe_fill_group()
6324 infop->mgi_count = (ixgbe->num_rx_rings / ixgbe->num_rx_groups); in ixgbe_fill_group()
6342 ixgbe_t *ixgbe = rx_ring->ixgbe; in ixgbe_rx_ring_intr_enable() local
6347 mutex_enter(&ixgbe->gen_lock); in ixgbe_rx_ring_intr_enable()
6348 if (ixgbe->ixgbe_state & IXGBE_INTR_ADJUST) { in ixgbe_rx_ring_intr_enable()
6349 mutex_exit(&ixgbe->gen_lock); in ixgbe_rx_ring_intr_enable()
6363 ixgbe_enable_ivar(ixgbe, hw_r_idx, 0); in ixgbe_rx_ring_intr_enable()
6365 BT_SET(ixgbe->vect_map[v_idx].rx_map, r_idx); in ixgbe_rx_ring_intr_enable()
6370 IXGBE_WRITE_REG(&ixgbe->hw, IXGBE_EICS, (1 << v_idx)); in ixgbe_rx_ring_intr_enable()
6371 IXGBE_WRITE_FLUSH(&ixgbe->hw); in ixgbe_rx_ring_intr_enable()
6373 mutex_exit(&ixgbe->gen_lock); in ixgbe_rx_ring_intr_enable()
6385 ixgbe_t *ixgbe = rx_ring->ixgbe; in ixgbe_rx_ring_intr_disable() local
6390 mutex_enter(&ixgbe->gen_lock); in ixgbe_rx_ring_intr_disable()
6391 if (ixgbe->ixgbe_state & IXGBE_INTR_ADJUST) { in ixgbe_rx_ring_intr_disable()
6392 mutex_exit(&ixgbe->gen_lock); in ixgbe_rx_ring_intr_disable()
6414 ixgbe_disable_ivar(ixgbe, hw_r_idx, 0); in ixgbe_rx_ring_intr_disable()
6416 BT_CLEAR(ixgbe->vect_map[v_idx].rx_map, r_idx); in ixgbe_rx_ring_intr_disable()
6418 mutex_exit(&ixgbe->gen_lock); in ixgbe_rx_ring_intr_disable()
6445 ixgbe_t *ixgbe = rx_group->ixgbe; in ixgbe_addvlan() local
6446 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_addvlan()
6451 mutex_enter(&ixgbe->gen_lock); in ixgbe_addvlan()
6453 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { in ixgbe_addvlan()
6454 mutex_exit(&ixgbe->gen_lock); in ixgbe_addvlan()
6461 VERIFY3B(ixgbe->vlft_enabled, ==, B_TRUE); in ixgbe_addvlan()
6462 is_def_grp = (rx_group->index == ixgbe->rx_def_group); in ixgbe_addvlan()
6487 mutex_exit(&ixgbe->gen_lock); in ixgbe_addvlan()
6496 mutex_exit(&ixgbe->gen_lock); in ixgbe_addvlan()
6518 mutex_exit(&ixgbe->gen_lock); in ixgbe_addvlan()
6534 mutex_exit(&ixgbe->gen_lock); in ixgbe_addvlan()
6549 ixgbe_t *ixgbe = rx_group->ixgbe; in ixgbe_remvlan() local
6550 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_remvlan()
6555 mutex_enter(&ixgbe->gen_lock); in ixgbe_remvlan()
6557 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { in ixgbe_remvlan()
6558 mutex_exit(&ixgbe->gen_lock); in ixgbe_remvlan()
6562 is_def_grp = (rx_group->index == ixgbe->rx_def_group); in ixgbe_remvlan()
6576 mutex_exit(&ixgbe->gen_lock); in ixgbe_remvlan()
6582 mutex_exit(&ixgbe->gen_lock); in ixgbe_remvlan()
6602 mutex_exit(&ixgbe->gen_lock); in ixgbe_remvlan()
6607 mutex_exit(&ixgbe->gen_lock); in ixgbe_remvlan()
6632 defgrp = &ixgbe->rx_groups[ixgbe->rx_def_group]; in ixgbe_remvlan()
6639 mutex_exit(&ixgbe->gen_lock); in ixgbe_remvlan()
6645 mutex_exit(&ixgbe->gen_lock); in ixgbe_remvlan()
6656 ixgbe_t *ixgbe = rx_group->ixgbe; in ixgbe_addmac() local
6657 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_addmac()
6660 mutex_enter(&ixgbe->gen_lock); in ixgbe_addmac()
6662 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { in ixgbe_addmac()
6663 mutex_exit(&ixgbe->gen_lock); in ixgbe_addmac()
6667 if (ixgbe->unicst_avail == 0) { in ixgbe_addmac()
6669 mutex_exit(&ixgbe->gen_lock); in ixgbe_addmac()
6680 if (ixgbe->unicst_addr[rx_group->index].mac.set == 1) { in ixgbe_addmac()
6681 for (i = ixgbe->num_rx_groups; i < ixgbe->unicst_total; i++) { in ixgbe_addmac()
6682 if (ixgbe->unicst_addr[i].mac.set == 0) { in ixgbe_addmac()
6693 mutex_exit(&ixgbe->gen_lock); in ixgbe_addmac()
6697 bcopy(mac_addr, ixgbe->unicst_addr[slot].mac.addr, ETHERADDRL); in ixgbe_addmac()
6698 (void) ixgbe_set_rar(hw, slot, ixgbe->unicst_addr[slot].mac.addr, in ixgbe_addmac()
6700 ixgbe->unicst_addr[slot].mac.set = 1; in ixgbe_addmac()
6701 ixgbe->unicst_addr[slot].mac.group_index = rx_group->index; in ixgbe_addmac()
6702 ixgbe->unicst_avail--; in ixgbe_addmac()
6704 mutex_exit(&ixgbe->gen_lock); in ixgbe_addmac()
6716 ixgbe_t *ixgbe = rx_group->ixgbe; in ixgbe_remmac() local
6717 struct ixgbe_hw *hw = &ixgbe->hw; in ixgbe_remmac()
6720 mutex_enter(&ixgbe->gen_lock); in ixgbe_remmac()
6722 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) { in ixgbe_remmac()
6723 mutex_exit(&ixgbe->gen_lock); in ixgbe_remmac()
6727 slot = ixgbe_unicst_find(ixgbe, mac_addr); in ixgbe_remmac()
6729 mutex_exit(&ixgbe->gen_lock); in ixgbe_remmac()
6733 if (ixgbe->unicst_addr[slot].mac.set == 0) { in ixgbe_remmac()
6734 mutex_exit(&ixgbe->gen_lock); in ixgbe_remmac()
6738 bzero(ixgbe->unicst_addr[slot].mac.addr, ETHERADDRL); in ixgbe_remmac()
6740 ixgbe->unicst_addr[slot].mac.set = 0; in ixgbe_remmac()
6741 ixgbe->unicst_avail++; in ixgbe_remmac()
6743 mutex_exit(&ixgbe->gen_lock); in ixgbe_remmac()
6752 ixgbe_t *ixgbe = arg; in ixgbe_ufm_fill_image() local
6761 switch (ixgbe->hw.eeprom.type) { in ixgbe_ufm_fill_image()
6791 ixgbe_t *ixgbe = arg; in ixgbe_ufm_fill_slot() local
6804 ddi_ufm_slot_set_imgsize(slotp, ixgbe->hw.eeprom.word_size * 2); in ixgbe_ufm_fill_slot()
6812 ixgbe_t *ixgbe = arg; in ixgbe_ufm_getcaps() local
6815 switch (ixgbe->hw.eeprom.type) { in ixgbe_ufm_getcaps()
6819 if (ixgbe->hw.eeprom.ops.read_buffer != NULL) { in ixgbe_ufm_getcaps()
6836 ixgbe_t *ixgbe = arg; in ixgbe_ufm_readimg() local
6837 uint32_t imgsize = ixgbe->hw.eeprom.word_size * 2; in ixgbe_ufm_readimg()
6847 if (ixgbe->hw.eeprom.ops.read_buffer == NULL) { in ixgbe_ufm_readimg()
6863 mutex_enter(&ixgbe->gen_lock); in ixgbe_ufm_readimg()
6864 ret = ixgbe_read_eeprom_buffer(&ixgbe->hw, wordoff, nwords, buf16); in ixgbe_ufm_readimg()
6865 mutex_exit(&ixgbe->gen_lock); in ixgbe_ufm_readimg()