Lines Matching +full:10 +full:gbase +full:- +full:kr
3 Copyright (c) 2001-2017, Intel Corporation
48 static const char ixgbe_driver_version[] = "4.0.1-k";
93 "Intel(R) X520-T 82599 LOM"),
105 "Intel(R) X520-1 82599EN (SFP+)"),
107 "Intel(R) X520-4 82599 (Quad SFP+)"),
109 "Intel(R) X520-Q1 82599 (QSFP+)"),
111 "Intel(R) X540-AT2"),
112 PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T1, "Intel(R) X540-T1"),
113 PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550T, "Intel(R) X550-T2"),
114 PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X550T1, "Intel(R) X550-T1"),
116 "Intel(R) X552 (KR Backplane)"),
120 "Intel(R) X552/X557-AT (10GBASE-T)"),
122 "Intel(R) X552 (1000BASE-T)"),
126 "Intel(R) X553 (KR Backplane)"),
128 "Intel(R) X553 L (KR Backplane)"),
138 "Intel(R) X553/X557-AT (10GBASE-T)"),
144 "Intel(R) X540-T2 (Bypass)"),
360 * MSI-X should be the default for best performance,
366 "Enable MSI-X interrupts");
387 /* Receive-Side Scaling */
391 "Enable Receive-Side Scaling (RSS)");
457 if_softc_ctx_t scctx = sc->shared; in ixgbe_if_tx_queues_alloc()
461 MPASS(sc->num_tx_queues > 0); in ixgbe_if_tx_queues_alloc()
462 MPASS(sc->num_tx_queues == ntxqsets); in ixgbe_if_tx_queues_alloc()
466 sc->tx_queues = in ixgbe_if_tx_queues_alloc()
469 if (!sc->tx_queues) { in ixgbe_if_tx_queues_alloc()
475 for (i = 0, que = sc->tx_queues; i < ntxqsets; i++, que++) { in ixgbe_if_tx_queues_alloc()
476 struct tx_ring *txr = &que->txr; in ixgbe_if_tx_queues_alloc()
478 /* In case SR-IOV is enabled, align the index properly */ in ixgbe_if_tx_queues_alloc()
479 txr->me = ixgbe_vf_que_index(sc->iov_mode, sc->pool, i); in ixgbe_if_tx_queues_alloc()
481 txr->sc = que->sc = sc; in ixgbe_if_tx_queues_alloc()
484 txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * in ixgbe_if_tx_queues_alloc()
485 scctx->isc_ntxd[0], M_IXGBE, M_NOWAIT | M_ZERO); in ixgbe_if_tx_queues_alloc()
486 if (txr->tx_rsq == NULL) { in ixgbe_if_tx_queues_alloc()
490 for (j = 0; j < scctx->isc_ntxd[0]; j++) in ixgbe_if_tx_queues_alloc()
491 txr->tx_rsq[j] = QIDX_INVALID; in ixgbe_if_tx_queues_alloc()
493 txr->tail = IXGBE_TDT(txr->me); in ixgbe_if_tx_queues_alloc()
494 txr->tx_base = (union ixgbe_adv_tx_desc *)vaddrs[i]; in ixgbe_if_tx_queues_alloc()
495 txr->tx_paddr = paddrs[i]; in ixgbe_if_tx_queues_alloc()
497 txr->bytes = 0; in ixgbe_if_tx_queues_alloc()
498 txr->total_packets = 0; in ixgbe_if_tx_queues_alloc()
501 if (sc->feat_en & IXGBE_FEATURE_FDIR) in ixgbe_if_tx_queues_alloc()
502 txr->atr_sample = atr_sample_rate; in ixgbe_if_tx_queues_alloc()
507 sc->num_tx_queues); in ixgbe_if_tx_queues_alloc()
528 MPASS(sc->num_rx_queues > 0); in ixgbe_if_rx_queues_alloc()
529 MPASS(sc->num_rx_queues == nrxqsets); in ixgbe_if_rx_queues_alloc()
533 sc->rx_queues = in ixgbe_if_rx_queues_alloc()
536 if (!sc->rx_queues) { in ixgbe_if_rx_queues_alloc()
542 for (i = 0, que = sc->rx_queues; i < nrxqsets; i++, que++) { in ixgbe_if_rx_queues_alloc()
543 struct rx_ring *rxr = &que->rxr; in ixgbe_if_rx_queues_alloc()
545 /* In case SR-IOV is enabled, align the index properly */ in ixgbe_if_rx_queues_alloc()
546 rxr->me = ixgbe_vf_que_index(sc->iov_mode, sc->pool, i); in ixgbe_if_rx_queues_alloc()
548 rxr->sc = que->sc = sc; in ixgbe_if_rx_queues_alloc()
551 rxr->tail = IXGBE_RDT(rxr->me); in ixgbe_if_rx_queues_alloc()
552 rxr->rx_base = (union ixgbe_adv_rx_desc *)vaddrs[i]; in ixgbe_if_rx_queues_alloc()
553 rxr->rx_paddr = paddrs[i]; in ixgbe_if_rx_queues_alloc()
554 rxr->bytes = 0; in ixgbe_if_rx_queues_alloc()
555 rxr->que = que; in ixgbe_if_rx_queues_alloc()
559 sc->num_rx_queues); in ixgbe_if_rx_queues_alloc()
571 struct ix_tx_queue *tx_que = sc->tx_queues; in ixgbe_if_queues_free()
572 struct ix_rx_queue *rx_que = sc->rx_queues; in ixgbe_if_queues_free()
576 for (i = 0; i < sc->num_tx_queues; i++, tx_que++) { in ixgbe_if_queues_free()
577 struct tx_ring *txr = &tx_que->txr; in ixgbe_if_queues_free()
578 if (txr->tx_rsq == NULL) in ixgbe_if_queues_free()
581 free(txr->tx_rsq, M_IXGBE); in ixgbe_if_queues_free()
582 txr->tx_rsq = NULL; in ixgbe_if_queues_free()
585 free(sc->tx_queues, M_IXGBE); in ixgbe_if_queues_free()
586 sc->tx_queues = NULL; in ixgbe_if_queues_free()
589 free(sc->rx_queues, M_IXGBE); in ixgbe_if_queues_free()
590 sc->rx_queues = NULL; in ixgbe_if_queues_free()
600 struct ixgbe_hw *hw = &sc->hw; in ixgbe_initialize_rss_mapping()
601 u32 reta = 0, mrqc, rss_key[10]; in ixgbe_initialize_rss_mapping()
606 if (sc->feat_en & IXGBE_FEATURE_RSS) { in ixgbe_initialize_rss_mapping()
617 switch (sc->hw.mac.type) { in ixgbe_initialize_rss_mapping()
632 if (j == sc->num_rx_queues) in ixgbe_initialize_rss_mapping()
635 if (sc->feat_en & IXGBE_FEATURE_RSS) { in ixgbe_initialize_rss_mapping()
642 queue_id = queue_id % sc->num_rx_queues; in ixgbe_initialize_rss_mapping()
657 IXGBE_ERETA((i >> 2) - 32), reta); in ixgbe_initialize_rss_mapping()
663 for (i = 0; i < 10; i++) in ixgbe_initialize_rss_mapping()
667 if (sc->feat_en & IXGBE_FEATURE_RSS) in ixgbe_initialize_rss_mapping()
671 * Disable UDP - IP fragments aren't currently being handled in ixgbe_initialize_rss_mapping()
672 * and so we end up with a mix of 2-tuple and 4-tuple in ixgbe_initialize_rss_mapping()
702 mrqc |= ixgbe_get_mrqc(sc->iov_mode); in ixgbe_initialize_rss_mapping()
707 * ixgbe_initialize_receive_units - Setup receive registers and features.
709 #define BSIZEPKT_ROUNDUP ((1<<IXGBE_SRRCTL_BSIZEPKT_SHIFT)-1)
715 if_softc_ctx_t scctx = sc->shared; in ixgbe_initialize_receive_units()
716 struct ixgbe_hw *hw = &sc->hw; in ixgbe_initialize_receive_units()
732 if (sc->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_initialize_receive_units()
746 bufsz = (sc->rx_mbuf_sz + BSIZEPKT_ROUNDUP) >> in ixgbe_initialize_receive_units()
750 for (i = 0, que = sc->rx_queues; i < sc->num_rx_queues; i++, que++) { in ixgbe_initialize_receive_units()
751 struct rx_ring *rxr = &que->rxr; in ixgbe_initialize_receive_units()
752 u64 rdba = rxr->rx_paddr; in ixgbe_initialize_receive_units()
754 j = rxr->me; in ixgbe_initialize_receive_units()
761 scctx->isc_nrxd[0] * sizeof(union ixgbe_adv_rx_desc)); in ixgbe_initialize_receive_units()
776 if (sc->num_rx_queues > 1 && in ixgbe_initialize_receive_units()
777 sc->hw.fc.requested_mode == ixgbe_fc_none) { in ixgbe_initialize_receive_units()
790 rxr->tail = IXGBE_RDT(rxr->me); in ixgbe_initialize_receive_units()
793 if (sc->hw.mac.type != ixgbe_mac_82598EB) { in ixgbe_initialize_receive_units()
805 if (sc->feat_en & IXGBE_FEATURE_RSS) { in ixgbe_initialize_receive_units()
822 * ixgbe_initialize_transmit_units - Enable transmit units.
828 struct ixgbe_hw *hw = &sc->hw; in ixgbe_initialize_transmit_units()
829 if_softc_ctx_t scctx = sc->shared; in ixgbe_initialize_transmit_units()
834 for (i = 0, que = sc->tx_queues; i < sc->num_tx_queues; in ixgbe_initialize_transmit_units()
836 struct tx_ring *txr = &que->txr; in ixgbe_initialize_transmit_units()
837 u64 tdba = txr->tx_paddr; in ixgbe_initialize_transmit_units()
839 int j = txr->me; in ixgbe_initialize_transmit_units()
845 scctx->isc_ntxd[0] * sizeof(union ixgbe_adv_tx_desc)); in ixgbe_initialize_transmit_units()
852 txr->tail = IXGBE_TDT(txr->me); in ixgbe_initialize_transmit_units()
854 txr->tx_rs_cidx = txr->tx_rs_pidx; in ixgbe_initialize_transmit_units()
855 txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1; in ixgbe_initialize_transmit_units()
856 for (int k = 0; k < scctx->isc_ntxd[0]; k++) in ixgbe_initialize_transmit_units()
857 txr->tx_rsq[k] = QIDX_INVALID; in ixgbe_initialize_transmit_units()
865 switch (hw->mac.type) { in ixgbe_initialize_transmit_units()
875 switch (hw->mac.type) { in ixgbe_initialize_transmit_units()
887 if (hw->mac.type != ixgbe_mac_82598EB) { in ixgbe_initialize_transmit_units()
898 ixgbe_get_mtqc(sc->iov_mode)); in ixgbe_initialize_transmit_units()
915 * ixgbe_if_attach_pre - Device initialization routine, part 1
939 sc->hw.back = sc; in ixgbe_if_attach_pre()
940 sc->ctx = ctx; in ixgbe_if_attach_pre()
941 sc->dev = dev; in ixgbe_if_attach_pre()
942 scctx = sc->shared = iflib_get_softc_ctx(ctx); in ixgbe_if_attach_pre()
943 sc->media = iflib_get_media(ctx); in ixgbe_if_attach_pre()
944 hw = &sc->hw; in ixgbe_if_attach_pre()
947 hw->vendor_id = pci_get_vendor(dev); in ixgbe_if_attach_pre()
948 hw->device_id = pci_get_device(dev); in ixgbe_if_attach_pre()
949 hw->revision_id = pci_get_revid(dev); in ixgbe_if_attach_pre()
950 hw->subsystem_vendor_id = pci_get_subvendor(dev); in ixgbe_if_attach_pre()
951 hw->subsystem_device_id = pci_get_subdevice(dev); in ixgbe_if_attach_pre()
953 /* Do base PCI setup - map BAR0 */ in ixgbe_if_attach_pre()
973 if (hw->mac.ops.fw_recovery_mode && in ixgbe_if_attach_pre()
974 hw->mac.ops.fw_recovery_mode(hw)) { in ixgbe_if_attach_pre()
984 /* 82598 Does not support SR-IOV, initialize everything else */ in ixgbe_if_attach_pre()
985 if (hw->mac.type >= ixgbe_mac_82599_vf) { in ixgbe_if_attach_pre()
986 for (i = 0; i < sc->num_vfs; i++) in ixgbe_if_attach_pre()
987 hw->mbx.ops[i].init_params(hw); in ixgbe_if_attach_pre()
990 hw->allow_unsupported_sfp = allow_unsupported_sfp; in ixgbe_if_attach_pre()
992 if (hw->mac.type != ixgbe_mac_82598EB) in ixgbe_if_attach_pre()
993 hw->phy.smart_speed = ixgbe_smart_speed; in ixgbe_if_attach_pre()
1001 if (sc->feat_en & IXGBE_FEATURE_FAN_FAIL) { in ixgbe_if_attach_pre()
1010 hw->fc.requested_mode = ixgbe_flow_control; in ixgbe_if_attach_pre()
1012 hw->phy.reset_if_overtemp = true; in ixgbe_if_attach_pre()
1014 hw->phy.reset_if_overtemp = false; in ixgbe_if_attach_pre()
1021 sc->sfp_probe = true; in ixgbe_if_attach_pre()
1034 if (ixgbe_validate_eeprom_checksum(&sc->hw, NULL) < 0) { in ixgbe_if_attach_pre()
1044 "This device is a pre-production adapter/LOM. Please be" in ixgbe_if_attach_pre()
1063 iflib_set_mac(ctx, hw->mac.addr); in ixgbe_if_attach_pre()
1064 switch (sc->hw.mac.type) { in ixgbe_if_attach_pre()
1068 scctx->isc_rss_table_size = 512; in ixgbe_if_attach_pre()
1069 scctx->isc_ntxqsets_max = scctx->isc_nrxqsets_max = 64; in ixgbe_if_attach_pre()
1072 scctx->isc_rss_table_size = 128; in ixgbe_if_attach_pre()
1073 scctx->isc_ntxqsets_max = scctx->isc_nrxqsets_max = 16; in ixgbe_if_attach_pre()
1079 scctx->isc_txqsizes[0] = in ixgbe_if_attach_pre()
1080 roundup2(scctx->isc_ntxd[0] * sizeof(union ixgbe_adv_tx_desc) + in ixgbe_if_attach_pre()
1082 scctx->isc_rxqsizes[0] = in ixgbe_if_attach_pre()
1083 roundup2(scctx->isc_nrxd[0] * sizeof(union ixgbe_adv_rx_desc), in ixgbe_if_attach_pre()
1087 scctx->isc_tx_csum_flags = CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_TSO | in ixgbe_if_attach_pre()
1089 if (sc->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_if_attach_pre()
1090 scctx->isc_tx_nsegments = IXGBE_82598_SCATTER; in ixgbe_if_attach_pre()
1092 scctx->isc_tx_csum_flags |= CSUM_SCTP |CSUM_IP6_SCTP; in ixgbe_if_attach_pre()
1093 scctx->isc_tx_nsegments = IXGBE_82599_SCATTER; in ixgbe_if_attach_pre()
1096 scctx->isc_msix_bar = pci_msix_table_bar(dev); in ixgbe_if_attach_pre()
1098 scctx->isc_tx_tso_segments_max = scctx->isc_tx_nsegments; in ixgbe_if_attach_pre()
1099 scctx->isc_tx_tso_size_max = IXGBE_TSO_SIZE; in ixgbe_if_attach_pre()
1100 scctx->isc_tx_tso_segsize_max = PAGE_SIZE; in ixgbe_if_attach_pre()
1102 scctx->isc_txrx = &ixgbe_txrx; in ixgbe_if_attach_pre()
1104 scctx->isc_capabilities = scctx->isc_capenable = IXGBE_CAPS; in ixgbe_if_attach_pre()
1109 ctrl_ext = IXGBE_READ_REG(&sc->hw, IXGBE_CTRL_EXT); in ixgbe_if_attach_pre()
1111 IXGBE_WRITE_REG(&sc->hw, IXGBE_CTRL_EXT, ctrl_ext); in ixgbe_if_attach_pre()
1118 * ixgbe_if_attach_post - Device initialization routine, part 2
1136 hw = &sc->hw; in ixgbe_if_attach_post()
1138 if (sc->intr_type == IFLIB_INTR_LEGACY && in ixgbe_if_attach_post()
1139 (sc->feat_cap & IXGBE_FEATURE_LEGACY_IRQ) == 0) { in ixgbe_if_attach_post()
1146 sc->mta = malloc(sizeof(*sc->mta) * MAX_NUM_MULTICAST_ADDRESSES, in ixgbe_if_attach_post()
1148 if (sc->mta == NULL) { in ixgbe_if_attach_post()
1191 sc->dmac = 0; in ixgbe_if_attach_post()
1193 sc->advertise = ixgbe_get_default_advertise(sc); in ixgbe_if_attach_post()
1195 if (sc->feat_cap & IXGBE_FEATURE_SRIOV) in ixgbe_if_attach_post()
1202 if (sc->feat_en & IXGBE_FEATURE_RECOVERY_MODE) { in ixgbe_if_attach_post()
1203 sc->recovery_mode = 0; in ixgbe_if_attach_post()
1206 callout_init(&sc->fw_mode_timer, true); in ixgbe_if_attach_post()
1209 callout_reset(&sc->fw_mode_timer, hz, ixgbe_fw_mode_timer, sc); in ixgbe_if_attach_post()
1223 * Sets each port's hw->wol_enabled value depending
1229 struct ixgbe_hw *hw = &sc->hw; in ixgbe_check_wol_support()
1233 sc->wol_support = hw->wol_enabled = 0; in ixgbe_check_wol_support()
1237 hw->bus.func == 0)) in ixgbe_check_wol_support()
1238 sc->wol_support = hw->wol_enabled = 1; in ixgbe_check_wol_support()
1241 sc->wufc = IXGBE_READ_REG(hw, IXGBE_WUFC); in ixgbe_check_wol_support()
1259 if_setbaudrate(ifp, IF_Gbps(10)); in ixgbe_setup_interface()
1261 sc->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; in ixgbe_setup_interface()
1263 sc->phy_layer = ixgbe_get_supported_physical_layer(&sc->hw); in ixgbe_setup_interface()
1268 ifmedia_set(sc->media, IFM_ETHER | IFM_AUTO); in ixgbe_setup_interface()
1284 return (sc->ipackets); in ixgbe_if_get_counter()
1286 return (sc->opackets); in ixgbe_if_get_counter()
1288 return (sc->ibytes); in ixgbe_if_get_counter()
1290 return (sc->obytes); in ixgbe_if_get_counter()
1292 return (sc->imcasts); in ixgbe_if_get_counter()
1294 return (sc->omcasts); in ixgbe_if_get_counter()
1298 return (sc->iqdrops); in ixgbe_if_get_counter()
1302 return (sc->ierrors); in ixgbe_if_get_counter()
1315 struct ixgbe_hw *hw = &sc->hw; in ixgbe_if_i2c_req()
1318 if (hw->phy.ops.read_i2c_byte == NULL) in ixgbe_if_i2c_req()
1320 for (i = 0; i < req->len; i++) in ixgbe_if_i2c_req()
1321 hw->phy.ops.read_i2c_byte(hw, req->offset + i, in ixgbe_if_i2c_req()
1322 req->dev_addr, &req->data[i]); in ixgbe_if_i2c_req()
1326 /* ixgbe_if_needs_restart - Tell iflib when the driver needs to be
1352 struct ixgbe_hw *hw = &sc->hw; in ixgbe_add_media_types()
1356 layer = sc->phy_layer = ixgbe_get_supported_physical_layer(hw); in ixgbe_add_media_types()
1360 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_T, 0, NULL); in ixgbe_add_media_types()
1362 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_T, 0, NULL); in ixgbe_add_media_types()
1364 ifmedia_add(sc->media, IFM_ETHER | IFM_100_TX, 0, NULL); in ixgbe_add_media_types()
1366 ifmedia_add(sc->media, IFM_ETHER | IFM_10_T, 0, NULL); in ixgbe_add_media_types()
1368 if (hw->mac.type == ixgbe_mac_X550) { in ixgbe_add_media_types()
1369 ifmedia_add(sc->media, IFM_ETHER | IFM_2500_T, 0, NULL); in ixgbe_add_media_types()
1370 ifmedia_add(sc->media, IFM_ETHER | IFM_5000_T, 0, NULL); in ixgbe_add_media_types()
1375 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_TWINAX, 0, in ixgbe_add_media_types()
1377 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_KX, 0, NULL); in ixgbe_add_media_types()
1381 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_LR, 0, NULL); in ixgbe_add_media_types()
1382 if (hw->phy.multispeed_fiber) in ixgbe_add_media_types()
1383 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_LX, 0, in ixgbe_add_media_types()
1387 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_SR, 0, NULL); in ixgbe_add_media_types()
1388 if (hw->phy.multispeed_fiber) in ixgbe_add_media_types()
1389 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_SX, 0, in ixgbe_add_media_types()
1392 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_SX, 0, NULL); in ixgbe_add_media_types()
1394 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_CX4, 0, NULL); in ixgbe_add_media_types()
1398 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_KR, 0, NULL); in ixgbe_add_media_types()
1400 ifmedia_add( sc->media, IFM_ETHER | IFM_10G_KX4, 0, NULL); in ixgbe_add_media_types()
1402 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_KX, 0, NULL); in ixgbe_add_media_types()
1404 ifmedia_add(sc->media, IFM_ETHER | IFM_2500_KX, 0, NULL); in ixgbe_add_media_types()
1407 device_printf(dev, "Media supported: 10GbaseKR\n"); in ixgbe_add_media_types()
1408 device_printf(dev, "10GbaseKR mapped to 10GbaseSR\n"); in ixgbe_add_media_types()
1409 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_SR, 0, NULL); in ixgbe_add_media_types()
1412 device_printf(dev, "Media supported: 10GbaseKX4\n"); in ixgbe_add_media_types()
1413 device_printf(dev, "10GbaseKX4 mapped to 10GbaseCX4\n"); in ixgbe_add_media_types()
1414 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_CX4, 0, NULL); in ixgbe_add_media_types()
1419 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_CX, 0, NULL); in ixgbe_add_media_types()
1424 ifmedia_add(sc->media, IFM_ETHER | IFM_2500_SX, 0, NULL); in ixgbe_add_media_types()
1429 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_BX, 0, NULL); in ixgbe_add_media_types()
1432 if (hw->device_id == IXGBE_DEV_ID_82598AT) { in ixgbe_add_media_types()
1433 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_T | IFM_FDX, in ixgbe_add_media_types()
1435 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_T, 0, NULL); in ixgbe_add_media_types()
1438 ifmedia_add(sc->media, IFM_ETHER | IFM_AUTO, 0, NULL); in ixgbe_add_media_types()
1447 switch (hw->mac.type) { in ixgbe_is_sfp()
1449 if (hw->phy.type == ixgbe_phy_nl) in ixgbe_is_sfp()
1453 switch (hw->mac.ops.get_media_type(hw)) { in ixgbe_is_sfp()
1462 if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) in ixgbe_is_sfp()
1477 struct ixgbe_hw *hw = &sc->hw; in ixgbe_config_link()
1484 sc->task_requests |= IXGBE_REQUEST_TASK_MOD; in ixgbe_config_link()
1487 if (hw->mac.ops.check_link) in ixgbe_config_link()
1488 err = ixgbe_check_link(hw, &sc->link_speed, in ixgbe_config_link()
1489 &sc->link_up, false); in ixgbe_config_link()
1492 autoneg = hw->phy.autoneg_advertised; in ixgbe_config_link()
1493 if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) in ixgbe_config_link()
1494 err = hw->mac.ops.get_link_capabilities(hw, &autoneg, in ixgbe_config_link()
1499 if (hw->mac.type == ixgbe_mac_X550 && in ixgbe_config_link()
1500 hw->phy.autoneg_advertised == 0) { in ixgbe_config_link()
1511 * If hw->phy.autoneg_advertised does not in ixgbe_config_link()
1519 * Otherwise (i.e. if hw->phy.autoneg_advertised in ixgbe_config_link()
1528 if (hw->mac.ops.setup_link) in ixgbe_config_link()
1529 err = hw->mac.ops.setup_link(hw, autoneg, in ixgbe_config_link()
1530 sc->link_up); in ixgbe_config_link()
1535 * ixgbe_update_stats_counters - Update board statistics counters.
1540 struct ixgbe_hw *hw = &sc->hw; in ixgbe_update_stats_counters()
1541 struct ixgbe_hw_stats *stats = &sc->stats.pf; in ixgbe_update_stats_counters()
1546 stats->crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); in ixgbe_update_stats_counters()
1547 stats->illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC); in ixgbe_update_stats_counters()
1548 stats->errbc += IXGBE_READ_REG(hw, IXGBE_ERRBC); in ixgbe_update_stats_counters()
1549 stats->mspdc += IXGBE_READ_REG(hw, IXGBE_MSPDC); in ixgbe_update_stats_counters()
1550 stats->mpc[0] += IXGBE_READ_REG(hw, IXGBE_MPC(0)); in ixgbe_update_stats_counters()
1553 stats->qprc[i] += IXGBE_READ_REG(hw, IXGBE_QPRC(i)); in ixgbe_update_stats_counters()
1554 stats->qptc[i] += IXGBE_READ_REG(hw, IXGBE_QPTC(i)); in ixgbe_update_stats_counters()
1555 stats->qprdc[i] += IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); in ixgbe_update_stats_counters()
1557 stats->mlfc += IXGBE_READ_REG(hw, IXGBE_MLFC); in ixgbe_update_stats_counters()
1558 stats->mrfc += IXGBE_READ_REG(hw, IXGBE_MRFC); in ixgbe_update_stats_counters()
1559 stats->rlec += IXGBE_READ_REG(hw, IXGBE_RLEC); in ixgbe_update_stats_counters()
1562 stats->gprc += IXGBE_READ_REG(hw, IXGBE_GPRC); in ixgbe_update_stats_counters()
1563 stats->gprc -= missed_rx; in ixgbe_update_stats_counters()
1565 if (hw->mac.type != ixgbe_mac_82598EB) { in ixgbe_update_stats_counters()
1566 stats->gorc += IXGBE_READ_REG(hw, IXGBE_GORCL) + in ixgbe_update_stats_counters()
1568 stats->gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL) + in ixgbe_update_stats_counters()
1570 stats->tor += IXGBE_READ_REG(hw, IXGBE_TORL) + in ixgbe_update_stats_counters()
1572 stats->lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); in ixgbe_update_stats_counters()
1574 stats->lxoffrxc += lxoffrxc; in ixgbe_update_stats_counters()
1576 stats->lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXC); in ixgbe_update_stats_counters()
1578 stats->lxoffrxc += lxoffrxc; in ixgbe_update_stats_counters()
1580 stats->gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); in ixgbe_update_stats_counters()
1581 stats->gotc += IXGBE_READ_REG(hw, IXGBE_GOTCH); in ixgbe_update_stats_counters()
1582 stats->tor += IXGBE_READ_REG(hw, IXGBE_TORH); in ixgbe_update_stats_counters()
1590 sc->shared->isc_pause_frames = 1; in ixgbe_update_stats_counters()
1597 stats->bprc += bprc; in ixgbe_update_stats_counters()
1598 stats->mprc += IXGBE_READ_REG(hw, IXGBE_MPRC); in ixgbe_update_stats_counters()
1599 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_update_stats_counters()
1600 stats->mprc -= bprc; in ixgbe_update_stats_counters()
1602 stats->prc64 += IXGBE_READ_REG(hw, IXGBE_PRC64); in ixgbe_update_stats_counters()
1603 stats->prc127 += IXGBE_READ_REG(hw, IXGBE_PRC127); in ixgbe_update_stats_counters()
1604 stats->prc255 += IXGBE_READ_REG(hw, IXGBE_PRC255); in ixgbe_update_stats_counters()
1605 stats->prc511 += IXGBE_READ_REG(hw, IXGBE_PRC511); in ixgbe_update_stats_counters()
1606 stats->prc1023 += IXGBE_READ_REG(hw, IXGBE_PRC1023); in ixgbe_update_stats_counters()
1607 stats->prc1522 += IXGBE_READ_REG(hw, IXGBE_PRC1522); in ixgbe_update_stats_counters()
1610 stats->lxontxc += lxon; in ixgbe_update_stats_counters()
1612 stats->lxofftxc += lxoff; in ixgbe_update_stats_counters()
1615 stats->gptc += IXGBE_READ_REG(hw, IXGBE_GPTC); in ixgbe_update_stats_counters()
1616 stats->mptc += IXGBE_READ_REG(hw, IXGBE_MPTC); in ixgbe_update_stats_counters()
1617 stats->ptc64 += IXGBE_READ_REG(hw, IXGBE_PTC64); in ixgbe_update_stats_counters()
1618 stats->gptc -= total; in ixgbe_update_stats_counters()
1619 stats->mptc -= total; in ixgbe_update_stats_counters()
1620 stats->ptc64 -= total; in ixgbe_update_stats_counters()
1621 stats->gotc -= total * ETHER_MIN_LEN; in ixgbe_update_stats_counters()
1623 stats->ruc += IXGBE_READ_REG(hw, IXGBE_RUC); in ixgbe_update_stats_counters()
1624 stats->rfc += IXGBE_READ_REG(hw, IXGBE_RFC); in ixgbe_update_stats_counters()
1625 stats->roc += IXGBE_READ_REG(hw, IXGBE_ROC); in ixgbe_update_stats_counters()
1626 stats->rjc += IXGBE_READ_REG(hw, IXGBE_RJC); in ixgbe_update_stats_counters()
1627 stats->mngprc += IXGBE_READ_REG(hw, IXGBE_MNGPRC); in ixgbe_update_stats_counters()
1628 stats->mngpdc += IXGBE_READ_REG(hw, IXGBE_MNGPDC); in ixgbe_update_stats_counters()
1629 stats->mngptc += IXGBE_READ_REG(hw, IXGBE_MNGPTC); in ixgbe_update_stats_counters()
1630 stats->tpr += IXGBE_READ_REG(hw, IXGBE_TPR); in ixgbe_update_stats_counters()
1631 stats->tpt += IXGBE_READ_REG(hw, IXGBE_TPT); in ixgbe_update_stats_counters()
1632 stats->ptc127 += IXGBE_READ_REG(hw, IXGBE_PTC127); in ixgbe_update_stats_counters()
1633 stats->ptc255 += IXGBE_READ_REG(hw, IXGBE_PTC255); in ixgbe_update_stats_counters()
1634 stats->ptc511 += IXGBE_READ_REG(hw, IXGBE_PTC511); in ixgbe_update_stats_counters()
1635 stats->ptc1023 += IXGBE_READ_REG(hw, IXGBE_PTC1023); in ixgbe_update_stats_counters()
1636 stats->ptc1522 += IXGBE_READ_REG(hw, IXGBE_PTC1522); in ixgbe_update_stats_counters()
1637 stats->bptc += IXGBE_READ_REG(hw, IXGBE_BPTC); in ixgbe_update_stats_counters()
1638 stats->xec += IXGBE_READ_REG(hw, IXGBE_XEC); in ixgbe_update_stats_counters()
1639 stats->fccrc += IXGBE_READ_REG(hw, IXGBE_FCCRC); in ixgbe_update_stats_counters()
1640 stats->fclast += IXGBE_READ_REG(hw, IXGBE_FCLAST); in ixgbe_update_stats_counters()
1642 if (hw->mac.type != ixgbe_mac_82598EB) { in ixgbe_update_stats_counters()
1643 stats->fcoerpdc += IXGBE_READ_REG(hw, IXGBE_FCOERPDC); in ixgbe_update_stats_counters()
1644 stats->fcoeprc += IXGBE_READ_REG(hw, IXGBE_FCOEPRC); in ixgbe_update_stats_counters()
1645 stats->fcoeptc += IXGBE_READ_REG(hw, IXGBE_FCOEPTC); in ixgbe_update_stats_counters()
1646 stats->fcoedwrc += IXGBE_READ_REG(hw, IXGBE_FCOEDWRC); in ixgbe_update_stats_counters()
1647 stats->fcoedwtc += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC); in ixgbe_update_stats_counters()
1651 IXGBE_SET_IPACKETS(sc, stats->gprc); in ixgbe_update_stats_counters()
1652 IXGBE_SET_OPACKETS(sc, stats->gptc); in ixgbe_update_stats_counters()
1653 IXGBE_SET_IBYTES(sc, stats->gorc); in ixgbe_update_stats_counters()
1654 IXGBE_SET_OBYTES(sc, stats->gotc); in ixgbe_update_stats_counters()
1655 IXGBE_SET_IMCASTS(sc, stats->mprc); in ixgbe_update_stats_counters()
1656 IXGBE_SET_OMCASTS(sc, stats->mptc); in ixgbe_update_stats_counters()
1662 * - CRC error count, in ixgbe_update_stats_counters()
1663 * - illegal byte error count, in ixgbe_update_stats_counters()
1664 * - missed packets count, in ixgbe_update_stats_counters()
1665 * - length error count, in ixgbe_update_stats_counters()
1666 * - undersized packets count, in ixgbe_update_stats_counters()
1667 * - fragmented packets count, in ixgbe_update_stats_counters()
1668 * - oversized packets count, in ixgbe_update_stats_counters()
1669 * - jabber count. in ixgbe_update_stats_counters()
1671 IXGBE_SET_IERRORS(sc, stats->crcerrs + stats->illerrc + in ixgbe_update_stats_counters()
1672 stats->mpc[0] + stats->rlec + stats->ruc + stats->rfc + in ixgbe_update_stats_counters()
1673 stats->roc + stats->rjc); in ixgbe_update_stats_counters()
1684 device_t dev = iflib_get_dev(sc->ctx); in ixgbe_add_hw_stats()
1690 struct ixgbe_hw_stats *stats = &sc->stats.pf; in ixgbe_add_hw_stats()
1700 CTLFLAG_RD, &sc->dropped_pkts, "Driver dropped packets"); in ixgbe_add_hw_stats()
1702 CTLFLAG_RD, &sc->watchdog_events, "Watchdog timeouts"); in ixgbe_add_hw_stats()
1704 CTLFLAG_RD, &sc->link_irq, "Link MSI-X IRQ Handled"); in ixgbe_add_hw_stats()
1706 for (i = 0, tx_que = sc->tx_queues; i < sc->num_tx_queues; in ixgbe_add_hw_stats()
1708 struct tx_ring *txr = &tx_que->txr; in ixgbe_add_hw_stats()
1723 CTLFLAG_RD, &txr->tso_tx, "TSO"); in ixgbe_add_hw_stats()
1725 CTLFLAG_RD, &txr->total_packets, in ixgbe_add_hw_stats()
1729 for (i = 0, rx_que = sc->rx_queues; i < sc->num_rx_queues; in ixgbe_add_hw_stats()
1731 struct rx_ring *rxr = &rx_que->rxr; in ixgbe_add_hw_stats()
1739 &sc->rx_queues[i], 0, in ixgbe_add_hw_stats()
1743 CTLFLAG_RD, &(sc->rx_queues[i].irqs), in ixgbe_add_hw_stats()
1754 CTLFLAG_RD, &rxr->rx_packets, "Queue Packets Received"); in ixgbe_add_hw_stats()
1756 CTLFLAG_RD, &rxr->rx_bytes, "Queue Bytes Received"); in ixgbe_add_hw_stats()
1758 CTLFLAG_RD, &rxr->rx_copies, "Copied RX Frames"); in ixgbe_add_hw_stats()
1760 CTLFLAG_RD, &rxr->rx_discarded, "Discarded RX packets"); in ixgbe_add_hw_stats()
1769 CTLFLAG_RD, &sc->ierrors, IXGBE_SYSCTL_DESC_RX_ERRS); in ixgbe_add_hw_stats()
1771 CTLFLAG_RD, &stats->crcerrs, "CRC Errors"); in ixgbe_add_hw_stats()
1773 CTLFLAG_RD, &stats->illerrc, "Illegal Byte Errors"); in ixgbe_add_hw_stats()
1775 CTLFLAG_RD, &stats->errbc, "Byte Errors"); in ixgbe_add_hw_stats()
1777 CTLFLAG_RD, &stats->mspdc, "MAC Short Packets Discarded"); in ixgbe_add_hw_stats()
1779 CTLFLAG_RD, &stats->mlfc, "MAC Local Faults"); in ixgbe_add_hw_stats()
1781 CTLFLAG_RD, &stats->mrfc, "MAC Remote Faults"); in ixgbe_add_hw_stats()
1783 CTLFLAG_RD, &stats->rlec, "Receive Length Errors"); in ixgbe_add_hw_stats()
1785 CTLFLAG_RD, &stats->mpc[0], "RX Missed Packet Count"); in ixgbe_add_hw_stats()
1789 CTLFLAG_RD, &stats->lxontxc, "Link XON Transmitted"); in ixgbe_add_hw_stats()
1791 CTLFLAG_RD, &stats->lxonrxc, "Link XON Received"); in ixgbe_add_hw_stats()
1793 CTLFLAG_RD, &stats->lxofftxc, "Link XOFF Transmitted"); in ixgbe_add_hw_stats()
1795 CTLFLAG_RD, &stats->lxoffrxc, "Link XOFF Received"); in ixgbe_add_hw_stats()
1799 CTLFLAG_RD, &stats->tor, "Total Octets Received"); in ixgbe_add_hw_stats()
1801 CTLFLAG_RD, &stats->gorc, "Good Octets Received"); in ixgbe_add_hw_stats()
1803 CTLFLAG_RD, &stats->tpr, "Total Packets Received"); in ixgbe_add_hw_stats()
1805 CTLFLAG_RD, &stats->gprc, "Good Packets Received"); in ixgbe_add_hw_stats()
1807 CTLFLAG_RD, &stats->mprc, "Multicast Packets Received"); in ixgbe_add_hw_stats()
1809 CTLFLAG_RD, &stats->bprc, "Broadcast Packets Received"); in ixgbe_add_hw_stats()
1811 CTLFLAG_RD, &stats->prc64, "64 byte frames received "); in ixgbe_add_hw_stats()
1813 CTLFLAG_RD, &stats->prc127, "65-127 byte frames received"); in ixgbe_add_hw_stats()
1815 CTLFLAG_RD, &stats->prc255, "128-255 byte frames received"); in ixgbe_add_hw_stats()
1817 CTLFLAG_RD, &stats->prc511, "256-511 byte frames received"); in ixgbe_add_hw_stats()
1819 CTLFLAG_RD, &stats->prc1023, "512-1023 byte frames received"); in ixgbe_add_hw_stats()
1821 CTLFLAG_RD, &stats->prc1522, "1023-1522 byte frames received"); in ixgbe_add_hw_stats()
1823 CTLFLAG_RD, &stats->ruc, "Receive Undersized"); in ixgbe_add_hw_stats()
1825 CTLFLAG_RD, &stats->rfc, "Fragmented Packets Received "); in ixgbe_add_hw_stats()
1827 CTLFLAG_RD, &stats->roc, "Oversized Packets Received"); in ixgbe_add_hw_stats()
1829 CTLFLAG_RD, &stats->rjc, "Received Jabber"); in ixgbe_add_hw_stats()
1831 CTLFLAG_RD, &stats->mngprc, "Management Packets Received"); in ixgbe_add_hw_stats()
1833 CTLFLAG_RD, &stats->mngptc, "Management Packets Dropped"); in ixgbe_add_hw_stats()
1835 CTLFLAG_RD, &stats->xec, "Checksum Errors"); in ixgbe_add_hw_stats()
1839 CTLFLAG_RD, &stats->gotc, "Good Octets Transmitted"); in ixgbe_add_hw_stats()
1841 CTLFLAG_RD, &stats->tpt, "Total Packets Transmitted"); in ixgbe_add_hw_stats()
1843 CTLFLAG_RD, &stats->gptc, "Good Packets Transmitted"); in ixgbe_add_hw_stats()
1845 CTLFLAG_RD, &stats->bptc, "Broadcast Packets Transmitted"); in ixgbe_add_hw_stats()
1847 CTLFLAG_RD, &stats->mptc, "Multicast Packets Transmitted"); in ixgbe_add_hw_stats()
1849 CTLFLAG_RD, &stats->mngptc, "Management Packets Transmitted"); in ixgbe_add_hw_stats()
1851 CTLFLAG_RD, &stats->ptc64, "64 byte frames transmitted "); in ixgbe_add_hw_stats()
1853 CTLFLAG_RD, &stats->ptc127, "65-127 byte frames transmitted"); in ixgbe_add_hw_stats()
1855 CTLFLAG_RD, &stats->ptc255, "128-255 byte frames transmitted"); in ixgbe_add_hw_stats()
1857 CTLFLAG_RD, &stats->ptc511, "256-511 byte frames transmitted"); in ixgbe_add_hw_stats()
1859 CTLFLAG_RD, &stats->ptc1023, "512-1023 byte frames transmitted"); in ixgbe_add_hw_stats()
1861 CTLFLAG_RD, &stats->ptc1522, "1024-1522 byte frames transmitted"); in ixgbe_add_hw_stats()
1865 * ixgbe_sysctl_tdh_handler - Transmit Descriptor Head handler function
1872 struct tx_ring *txr = ((struct tx_ring *)oidp->oid_arg1); in ixgbe_sysctl_tdh_handler()
1880 if (atomic_load_acq_int(&txr->sc->recovery_mode)) in ixgbe_sysctl_tdh_handler()
1883 val = IXGBE_READ_REG(&txr->sc->hw, IXGBE_TDH(txr->me)); in ixgbe_sysctl_tdh_handler()
1885 if (error || !req->newptr) in ixgbe_sysctl_tdh_handler()
1892 * ixgbe_sysctl_tdt_handler - Transmit Descriptor Tail handler function
1899 struct tx_ring *txr = ((struct tx_ring *)oidp->oid_arg1); in ixgbe_sysctl_tdt_handler()
1906 if (atomic_load_acq_int(&txr->sc->recovery_mode)) in ixgbe_sysctl_tdt_handler()
1909 val = IXGBE_READ_REG(&txr->sc->hw, IXGBE_TDT(txr->me)); in ixgbe_sysctl_tdt_handler()
1911 if (error || !req->newptr) in ixgbe_sysctl_tdt_handler()
1918 * ixgbe_sysctl_rdh_handler - Receive Descriptor Head handler function
1925 struct rx_ring *rxr = ((struct rx_ring *)oidp->oid_arg1); in ixgbe_sysctl_rdh_handler()
1932 if (atomic_load_acq_int(&rxr->sc->recovery_mode)) in ixgbe_sysctl_rdh_handler()
1935 val = IXGBE_READ_REG(&rxr->sc->hw, IXGBE_RDH(rxr->me)); in ixgbe_sysctl_rdh_handler()
1937 if (error || !req->newptr) in ixgbe_sysctl_rdh_handler()
1944 * ixgbe_sysctl_rdt_handler - Receive Descriptor Tail handler function
1951 struct rx_ring *rxr = ((struct rx_ring *)oidp->oid_arg1); in ixgbe_sysctl_rdt_handler()
1958 if (atomic_load_acq_int(&rxr->sc->recovery_mode)) in ixgbe_sysctl_rdt_handler()
1961 val = IXGBE_READ_REG(&rxr->sc->hw, IXGBE_RDT(rxr->me)); in ixgbe_sysctl_rdt_handler()
1963 if (error || !req->newptr) in ixgbe_sysctl_rdt_handler()
1985 sc->shadow_vfta[index] |= (1 << bit); in ixgbe_if_vlan_register()
1986 ++sc->num_vlans; in ixgbe_if_vlan_register()
2003 sc->shadow_vfta[index] &= ~(1 << bit); in ixgbe_if_vlan_unregister()
2004 --sc->num_vlans; in ixgbe_if_vlan_unregister()
2005 /* Re-init to load the changes */ in ixgbe_if_vlan_unregister()
2017 struct ixgbe_hw *hw = &sc->hw; in ixgbe_setup_vlan_hw_support()
2029 if (sc->num_vlans == 0 || in ixgbe_setup_vlan_hw_support()
2032 for (i = 0; i < sc->num_rx_queues; i++) { in ixgbe_setup_vlan_hw_support()
2033 rxr = &sc->rx_queues[i].rxr; in ixgbe_setup_vlan_hw_support()
2035 if (hw->mac.type != ixgbe_mac_82598EB) { in ixgbe_setup_vlan_hw_support()
2037 IXGBE_RXDCTL(rxr->me)); in ixgbe_setup_vlan_hw_support()
2039 IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxr->me), in ixgbe_setup_vlan_hw_support()
2042 rxr->vtag_strip = false; in ixgbe_setup_vlan_hw_support()
2048 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_setup_vlan_hw_support()
2056 for (i = 0; i < sc->num_rx_queues; i++) { in ixgbe_setup_vlan_hw_support()
2057 rxr = &sc->rx_queues[i].rxr; in ixgbe_setup_vlan_hw_support()
2059 if (hw->mac.type != ixgbe_mac_82598EB) { in ixgbe_setup_vlan_hw_support()
2061 IXGBE_RXDCTL(rxr->me)); in ixgbe_setup_vlan_hw_support()
2063 IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxr->me), in ixgbe_setup_vlan_hw_support()
2066 rxr->vtag_strip = true; in ixgbe_setup_vlan_hw_support()
2077 if (sc->shadow_vfta[i] != 0) in ixgbe_setup_vlan_hw_support()
2079 sc->shadow_vfta[i]); in ixgbe_setup_vlan_hw_support()
2087 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_setup_vlan_hw_support()
2101 device_t dev = iflib_get_dev(sc->ctx); in ixgbe_get_slot_info()
2102 struct ixgbe_hw *hw = &sc->hw; in ixgbe_get_slot_info()
2108 switch (hw->device_id) { in ixgbe_get_slot_info()
2119 * Some devices don't use PCI-E, but there is no need in ixgbe_get_slot_info()
2122 switch (hw->mac.type) { in ixgbe_get_slot_info()
2149 * Hmm...can't get PCI-Express capabilities. in ixgbe_get_slot_info()
2162 ((hw->bus.speed == ixgbe_bus_speed_8000) ? "8.0GT/s" : in ixgbe_get_slot_info()
2163 (hw->bus.speed == ixgbe_bus_speed_5000) ? "5.0GT/s" : in ixgbe_get_slot_info()
2164 (hw->bus.speed == ixgbe_bus_speed_2500) ? "2.5GT/s" : in ixgbe_get_slot_info()
2166 ((hw->bus.width == ixgbe_bus_width_pcie_x8) ? "Width x8" : in ixgbe_get_slot_info()
2167 (hw->bus.width == ixgbe_bus_width_pcie_x4) ? "Width x4" : in ixgbe_get_slot_info()
2168 (hw->bus.width == ixgbe_bus_width_pcie_x1) ? "Width x1" : in ixgbe_get_slot_info()
2172 if ((hw->device_id != IXGBE_DEV_ID_82599_SFP_SF_QP) && in ixgbe_get_slot_info()
2173 ((hw->bus.width <= ixgbe_bus_width_pcie_x4) && in ixgbe_get_slot_info()
2174 (hw->bus.speed == ixgbe_bus_speed_2500))) { in ixgbe_get_slot_info()
2176 "PCI-Express bandwidth available for this card" in ixgbe_get_slot_info()
2182 if ((hw->device_id == IXGBE_DEV_ID_82599_SFP_SF_QP) && in ixgbe_get_slot_info()
2183 ((hw->bus.width <= ixgbe_bus_width_pcie_x8) && in ixgbe_get_slot_info()
2184 (hw->bus.speed < ixgbe_bus_speed_8000))) { in ixgbe_get_slot_info()
2186 "PCI-Express bandwidth available for this card" in ixgbe_get_slot_info()
2203 * Setup MSI-X Interrupt resources and handlers
2209 struct ix_rx_queue *rx_que = sc->rx_queues; in ixgbe_if_msix_intr_assign()
2216 for (int i = 0; i < sc->num_rx_queues; i++, vector++, rx_que++) { in ixgbe_if_msix_intr_assign()
2220 error = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, in ixgbe_if_msix_intr_assign()
2221 IFLIB_INTR_RXTX, ixgbe_msix_que, rx_que, rx_que->rxr.me, in ixgbe_if_msix_intr_assign()
2228 sc->num_rx_queues = i + 1; in ixgbe_if_msix_intr_assign()
2232 rx_que->msix = vector; in ixgbe_if_msix_intr_assign()
2234 for (int i = 0; i < sc->num_tx_queues; i++) { in ixgbe_if_msix_intr_assign()
2236 tx_que = &sc->tx_queues[i]; in ixgbe_if_msix_intr_assign()
2237 tx_que->msix = i % sc->num_rx_queues; in ixgbe_if_msix_intr_assign()
2239 &sc->rx_queues[tx_que->msix].que_irq, in ixgbe_if_msix_intr_assign()
2240 IFLIB_INTR_TX, tx_que, tx_que->txr.me, buf); in ixgbe_if_msix_intr_assign()
2243 error = iflib_irq_alloc_generic(ctx, &sc->irq, rid, in ixgbe_if_msix_intr_assign()
2251 sc->vector = vector; in ixgbe_if_msix_intr_assign()
2255 iflib_irq_free(ctx, &sc->irq); in ixgbe_if_msix_intr_assign()
2256 rx_que = sc->rx_queues; in ixgbe_if_msix_intr_assign()
2257 for (int i = 0; i < sc->num_rx_queues; i++, rx_que++) in ixgbe_if_msix_intr_assign()
2258 iflib_irq_free(ctx, &rx_que->que_irq); in ixgbe_if_msix_intr_assign()
2267 struct rx_ring *rxr = &que->rxr; in ixgbe_perform_aim()
2268 /* FIXME struct tx_ring *txr = ... ->txr; */ in ixgbe_perform_aim()
2272 * - Write out last calculated setting in ixgbe_perform_aim()
2273 * - Calculate based on average size over in ixgbe_perform_aim()
2276 if (que->eitr_setting) { in ixgbe_perform_aim()
2277 IXGBE_WRITE_REG(&sc->hw, IXGBE_EITR(que->msix), in ixgbe_perform_aim()
2278 que->eitr_setting); in ixgbe_perform_aim()
2281 que->eitr_setting = 0; in ixgbe_perform_aim()
2283 if (rxr->bytes == 0) { in ixgbe_perform_aim()
2284 /* FIXME && txr->bytes == 0 */ in ixgbe_perform_aim()
2288 if ((rxr->bytes) && (rxr->packets)) in ixgbe_perform_aim()
2289 newitr = rxr->bytes / rxr->packets; in ixgbe_perform_aim()
2291 * if ((txr->bytes) && (txr->packets)) in ixgbe_perform_aim()
2292 * newitr = txr->bytes/txr->packets; in ixgbe_perform_aim()
2293 * if ((rxr->bytes) && (rxr->packets)) in ixgbe_perform_aim()
2294 * newitr = max(newitr, (rxr->bytes / rxr->packets)); in ixgbe_perform_aim()
2308 if (sc->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_perform_aim()
2315 que->eitr_setting = newitr; in ixgbe_perform_aim()
2318 /* FIXME txr->bytes = 0; */ in ixgbe_perform_aim()
2319 /* FIXME txr->packets = 0; */ in ixgbe_perform_aim()
2320 rxr->bytes = 0; in ixgbe_perform_aim()
2321 rxr->packets = 0; in ixgbe_perform_aim()
2327 * ixgbe_msix_que - MSI-X Queue Interrupt Service routine
2333 struct ixgbe_softc *sc = que->sc; in ixgbe_msix_que()
2334 if_t ifp = iflib_get_ifp(que->sc->ctx); in ixgbe_msix_que()
2340 ixgbe_disable_queue(sc, que->msix); in ixgbe_msix_que()
2341 ++que->irqs; in ixgbe_msix_que()
2344 if (sc->enable_aim) { in ixgbe_msix_que()
2352 * ixgbe_media_status - Media Ioctl callback
2361 struct ixgbe_hw *hw = &sc->hw; in ixgbe_if_media_status()
2366 ifmr->ifm_status = IFM_AVALID; in ixgbe_if_media_status()
2367 ifmr->ifm_active = IFM_ETHER; in ixgbe_if_media_status()
2369 if (!sc->link_active) in ixgbe_if_media_status()
2372 ifmr->ifm_status |= IFM_ACTIVE; in ixgbe_if_media_status()
2373 layer = sc->phy_layer; in ixgbe_if_media_status()
2379 switch (sc->link_speed) { in ixgbe_if_media_status()
2381 ifmr->ifm_active |= IFM_10G_T | IFM_FDX; in ixgbe_if_media_status()
2384 ifmr->ifm_active |= IFM_1000_T | IFM_FDX; in ixgbe_if_media_status()
2387 ifmr->ifm_active |= IFM_100_TX | IFM_FDX; in ixgbe_if_media_status()
2390 ifmr->ifm_active |= IFM_10_T | IFM_FDX; in ixgbe_if_media_status()
2393 if (hw->mac.type == ixgbe_mac_X550) in ixgbe_if_media_status()
2394 switch (sc->link_speed) { in ixgbe_if_media_status()
2396 ifmr->ifm_active |= IFM_5000_T | IFM_FDX; in ixgbe_if_media_status()
2399 ifmr->ifm_active |= IFM_2500_T | IFM_FDX; in ixgbe_if_media_status()
2404 switch (sc->link_speed) { in ixgbe_if_media_status()
2406 ifmr->ifm_active |= IFM_10G_TWINAX | IFM_FDX; in ixgbe_if_media_status()
2409 ifmr->ifm_active |= IFM_1000_KX | IFM_FDX; in ixgbe_if_media_status()
2413 switch (sc->link_speed) { in ixgbe_if_media_status()
2415 ifmr->ifm_active |= IFM_10G_LR | IFM_FDX; in ixgbe_if_media_status()
2418 ifmr->ifm_active |= IFM_1000_LX | IFM_FDX; in ixgbe_if_media_status()
2422 switch (sc->link_speed) { in ixgbe_if_media_status()
2424 ifmr->ifm_active |= IFM_10G_LRM | IFM_FDX; in ixgbe_if_media_status()
2427 ifmr->ifm_active |= IFM_1000_LX | IFM_FDX; in ixgbe_if_media_status()
2432 switch (sc->link_speed) { in ixgbe_if_media_status()
2434 ifmr->ifm_active |= IFM_10G_SR | IFM_FDX; in ixgbe_if_media_status()
2437 ifmr->ifm_active |= IFM_1000_SX | IFM_FDX; in ixgbe_if_media_status()
2441 switch (sc->link_speed) { in ixgbe_if_media_status()
2443 ifmr->ifm_active |= IFM_10G_CX4 | IFM_FDX; in ixgbe_if_media_status()
2452 switch (sc->link_speed) { in ixgbe_if_media_status()
2454 ifmr->ifm_active |= IFM_10G_SR | IFM_FDX; in ixgbe_if_media_status()
2457 ifmr->ifm_active |= IFM_2500_SX | IFM_FDX; in ixgbe_if_media_status()
2460 ifmr->ifm_active |= IFM_1000_CX | IFM_FDX; in ixgbe_if_media_status()
2466 switch (sc->link_speed) { in ixgbe_if_media_status()
2468 ifmr->ifm_active |= IFM_10G_CX4 | IFM_FDX; in ixgbe_if_media_status()
2471 ifmr->ifm_active |= IFM_2500_SX | IFM_FDX; in ixgbe_if_media_status()
2474 ifmr->ifm_active |= IFM_1000_CX | IFM_FDX; in ixgbe_if_media_status()
2479 switch (sc->link_speed) { in ixgbe_if_media_status()
2481 ifmr->ifm_active |= IFM_10G_KR | IFM_FDX; in ixgbe_if_media_status()
2484 ifmr->ifm_active |= IFM_2500_KX | IFM_FDX; in ixgbe_if_media_status()
2487 ifmr->ifm_active |= IFM_1000_KX | IFM_FDX; in ixgbe_if_media_status()
2493 switch (sc->link_speed) { in ixgbe_if_media_status()
2495 ifmr->ifm_active |= IFM_10G_KX4 | IFM_FDX; in ixgbe_if_media_status()
2498 ifmr->ifm_active |= IFM_2500_KX | IFM_FDX; in ixgbe_if_media_status()
2501 ifmr->ifm_active |= IFM_1000_KX | IFM_FDX; in ixgbe_if_media_status()
2507 if (IFM_SUBTYPE(ifmr->ifm_active) == 0) in ixgbe_if_media_status()
2508 ifmr->ifm_active |= IFM_UNKNOWN; in ixgbe_if_media_status()
2511 if (hw->fc.current_mode == ixgbe_fc_rx_pause || in ixgbe_if_media_status()
2512 hw->fc.current_mode == ixgbe_fc_full) in ixgbe_if_media_status()
2513 ifmr->ifm_active |= IFM_ETH_RXPAUSE; in ixgbe_if_media_status()
2514 if (hw->fc.current_mode == ixgbe_fc_tx_pause || in ixgbe_if_media_status()
2515 hw->fc.current_mode == ixgbe_fc_full) in ixgbe_if_media_status()
2516 ifmr->ifm_active |= IFM_ETH_TXPAUSE; in ixgbe_if_media_status()
2520 * ixgbe_media_change - Media Ioctl callback
2530 struct ixgbe_hw *hw = &sc->hw; in ixgbe_if_media_change()
2535 if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) in ixgbe_if_media_change()
2538 if (hw->phy.media_type == ixgbe_media_type_backplane) in ixgbe_if_media_change()
2546 switch (IFM_SUBTYPE(ifm->ifm_media)) { in ixgbe_if_media_change()
2556 case IFM_10G_SR: /* KR, too */ in ixgbe_if_media_change()
2598 hw->mac.autotry_restart = true; in ixgbe_if_media_change()
2599 hw->mac.ops.setup_link(hw, speed, true); in ixgbe_if_media_change()
2600 sc->advertise = in ixgbe_if_media_change()
2627 rctl = IXGBE_READ_REG(&sc->hw, IXGBE_FCTRL); in ixgbe_if_promisc_set()
2637 IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, rctl); in ixgbe_if_promisc_set()
2641 IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, rctl); in ixgbe_if_promisc_set()
2645 IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, rctl); in ixgbe_if_promisc_set()
2651 * ixgbe_msix_link - Link status change ISR (MSI/MSI-X)
2657 struct ixgbe_hw *hw = &sc->hw; in ixgbe_msix_link()
2661 ++sc->link_irq; in ixgbe_msix_link()
2676 sc->task_requests |= IXGBE_REQUEST_TASK_LSC; in ixgbe_msix_link()
2679 if (sc->hw.mac.type != ixgbe_mac_82598EB) { in ixgbe_msix_link()
2680 if ((sc->feat_en & IXGBE_FEATURE_FDIR) && in ixgbe_msix_link()
2683 if (!atomic_cmpset_int(&sc->fdir_reinit, 0, 1)) in ixgbe_msix_link()
2687 sc->task_requests |= IXGBE_REQUEST_TASK_FDIR; in ixgbe_msix_link()
2690 device_printf(iflib_get_dev(sc->ctx), in ixgbe_msix_link()
2692 hw->mac.flags |= in ixgbe_msix_link()
2700 if (sc->feat_en & IXGBE_FEATURE_TEMP_SENSOR) { in ixgbe_msix_link()
2701 switch (sc->hw.mac.type) { in ixgbe_msix_link()
2709 retval = hw->phy.ops.check_overtemp(hw); in ixgbe_msix_link()
2712 device_printf(iflib_get_dev(sc->ctx), in ixgbe_msix_link()
2715 device_printf(iflib_get_dev(sc->ctx), in ixgbe_msix_link()
2721 retval = hw->phy.ops.check_overtemp(hw); in ixgbe_msix_link()
2724 device_printf(iflib_get_dev(sc->ctx), in ixgbe_msix_link()
2727 device_printf(iflib_get_dev(sc->ctx), in ixgbe_msix_link()
2736 if ((sc->feat_en & IXGBE_FEATURE_SRIOV) && in ixgbe_msix_link()
2738 sc->task_requests |= IXGBE_REQUEST_TASK_MBX; in ixgbe_msix_link()
2742 /* Pluggable optics-related interrupt */ in ixgbe_msix_link()
2743 if (hw->mac.type >= ixgbe_mac_X540) in ixgbe_msix_link()
2750 sc->task_requests |= IXGBE_REQUEST_TASK_MOD; in ixgbe_msix_link()
2753 if ((hw->mac.type == ixgbe_mac_82599EB) && in ixgbe_msix_link()
2757 sc->task_requests |= IXGBE_REQUEST_TASK_MSF; in ixgbe_msix_link()
2762 if (sc->feat_en & IXGBE_FEATURE_FAN_FAIL) { in ixgbe_msix_link()
2769 if ((hw->phy.type == ixgbe_phy_x550em_ext_t) && in ixgbe_msix_link()
2772 sc->task_requests |= IXGBE_REQUEST_TASK_PHY; in ixgbe_msix_link()
2775 return (sc->task_requests != 0) ? in ixgbe_msix_link()
2785 struct ix_rx_queue *que = ((struct ix_rx_queue *)oidp->oid_arg1); in ixgbe_sysctl_interrupt_rate_handler()
2789 if (atomic_load_acq_int(&que->sc->recovery_mode)) in ixgbe_sysctl_interrupt_rate_handler()
2792 reg = IXGBE_READ_REG(&que->sc->hw, IXGBE_EITR(que->msix)); in ixgbe_sysctl_interrupt_rate_handler()
2799 if (error || !req->newptr) in ixgbe_sysctl_interrupt_rate_handler()
2809 IXGBE_WRITE_REG(&que->sc->hw, IXGBE_EITR(que->msix), reg); in ixgbe_sysctl_interrupt_rate_handler()
2822 struct ixgbe_hw *hw = &sc->hw; in ixgbe_add_device_sysctls()
2840 sc->enable_aim = ixgbe_enable_aim; in ixgbe_add_device_sysctls()
2842 &sc->enable_aim, 0, "Interrupt Moderation"); in ixgbe_add_device_sysctls()
2878 if (hw->mac.type >= ixgbe_mac_X550) in ixgbe_add_device_sysctls()
2884 /* for WoL-capable devices */ in ixgbe_add_device_sysctls()
2885 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T) { in ixgbe_add_device_sysctls()
2897 /* for X552/X557-AT devices */ in ixgbe_add_device_sysctls()
2898 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T) { in ixgbe_add_device_sysctls()
2919 if (sc->feat_cap & IXGBE_FEATURE_EEE) { in ixgbe_add_device_sysctls()
2937 sc->pci_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in ixgbe_allocate_pci_resources()
2940 if (!(sc->pci_mem)) { in ixgbe_allocate_pci_resources()
2947 sc->osdep.mem_bus_space_tag = rman_get_bustag(sc->pci_mem); in ixgbe_allocate_pci_resources()
2948 sc->osdep.mem_bus_space_handle = in ixgbe_allocate_pci_resources()
2949 rman_get_bushandle(sc->pci_mem); in ixgbe_allocate_pci_resources()
2951 sc->hw.hw_addr = (u8 *)&sc->osdep.mem_bus_space_handle; in ixgbe_allocate_pci_resources()
2957 * ixgbe_detach - Device removal routine
2975 device_printf(dev, "SR-IOV in use; detach first.\n"); in ixgbe_if_detach()
2982 ctrl_ext = IXGBE_READ_REG(&sc->hw, IXGBE_CTRL_EXT); in ixgbe_if_detach()
2984 IXGBE_WRITE_REG(&sc->hw, IXGBE_CTRL_EXT, ctrl_ext); in ixgbe_if_detach()
2986 callout_drain(&sc->fw_mode_timer); in ixgbe_if_detach()
2989 free(sc->mta, M_IXGBE); in ixgbe_if_detach()
2995 * ixgbe_setup_low_power_mode - LPLU/WoL preparation
3003 struct ixgbe_hw *hw = &sc->hw; in ixgbe_setup_low_power_mode()
3007 if (!hw->wol_enabled) in ixgbe_setup_low_power_mode()
3011 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T && in ixgbe_setup_low_power_mode()
3012 hw->phy.ops.enter_lplu) { in ixgbe_setup_low_power_mode()
3028 IXGBE_WRITE_REG(hw, IXGBE_WUFC, sc->wufc); in ixgbe_setup_low_power_mode()
3035 hw->phy.reset_disable = true; in ixgbe_setup_low_power_mode()
3037 error = hw->phy.ops.enter_lplu(hw); in ixgbe_setup_low_power_mode()
3041 hw->phy.reset_disable = false; in ixgbe_setup_low_power_mode()
3051 * ixgbe_shutdown - Shutdown entry point
3093 struct ixgbe_hw *hw = &sc->hw; in ixgbe_if_resume()
3104 /* And clear WUFC until next low-power transition */ in ixgbe_if_resume()
3108 * Required after D3->D0 transition; in ixgbe_if_resume()
3109 * will re-advertise all previous advertised speeds in ixgbe_if_resume()
3118 * ixgbe_if_mtu_set - Ioctl mtu entry point
3133 sc->max_frame_size = mtu + IXGBE_MTU_HDR; in ixgbe_if_mtu_set()
3146 struct ixgbe_hw *hw = &sc->hw; in ixgbe_if_crcstrip_set()
3186 * ixgbe_if_init - Init entry point
3201 struct ixgbe_hw *hw = &sc->hw; in ixgbe_if_init()
3216 ixgbe_set_rar(hw, 0, hw->mac.addr, sc->pool, IXGBE_RAH_AV); in ixgbe_if_init()
3219 bcopy(if_getlladdr(ifp), hw->mac.addr, IXGBE_ETH_LENGTH_OF_ADDRESS); in ixgbe_if_init()
3220 ixgbe_set_rar(hw, 0, hw->mac.addr, sc->pool, 1); in ixgbe_if_init()
3221 hw->addr_ctrl.rar_used_count = 1; in ixgbe_if_init()
3233 sc->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); in ixgbe_if_init()
3240 * from MSI-X interrupts in ixgbe_if_init()
3242 sc->task_requests = 0; in ixgbe_if_init()
3244 /* Enable SDP & MSI-X interrupts based on adapter */ in ixgbe_if_init()
3252 mhadd |= sc->max_frame_size << IXGBE_MHADD_MFS_SHIFT; in ixgbe_if_init()
3257 for (i = 0, tx_que = sc->tx_queues; i < sc->num_tx_queues; in ixgbe_if_init()
3259 struct tx_ring *txr = &tx_que->txr; in ixgbe_if_init()
3261 txdctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(txr->me)); in ixgbe_if_init()
3273 IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(txr->me), txdctl); in ixgbe_if_init()
3276 for (i = 0, rx_que = sc->rx_queues; i < sc->num_rx_queues; in ixgbe_if_init()
3278 struct rx_ring *rxr = &rx_que->rxr; in ixgbe_if_init()
3280 rxdctl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me)); in ixgbe_if_init()
3281 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_if_init()
3291 IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxr->me), rxdctl); in ixgbe_if_init()
3292 for (j = 0; j < 10; j++) { in ixgbe_if_init()
3293 if (IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me)) & in ixgbe_if_init()
3304 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_if_init()
3309 /* Set up MSI/MSI-X routing */ in ixgbe_if_init()
3312 /* Set up auto-mask */ in ixgbe_if_init()
3313 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_if_init()
3329 * need to be kick-started in ixgbe_if_init()
3331 if (hw->phy.type == ixgbe_phy_none) { in ixgbe_if_init()
3332 err = hw->phy.ops.identify(hw); in ixgbe_if_init()
3341 IXGBE_WRITE_REG(hw, IXGBE_EITR(sc->vector), IXGBE_LINK_ITR); in ixgbe_if_init()
3365 if (sc->feat_en & IXGBE_FEATURE_SRIOV) { in ixgbe_if_init()
3376 * Setup the correct IVAR register for a particular MSI-X interrupt
3378 * - entry is the register array entry
3379 * - vector is the MSI-X vector for this queue
3380 * - type is RX/TX/MISC
3385 struct ixgbe_hw *hw = &sc->hw; in ixgbe_set_ivar()
3390 switch (hw->mac.type) { in ixgbe_set_ivar()
3392 if (type == -1) in ixgbe_set_ivar()
3400 IXGBE_WRITE_REG(&sc->hw, IXGBE_IVAR(index), ivar); in ixgbe_set_ivar()
3407 if (type == -1) { /* MISC IVAR */ in ixgbe_set_ivar()
3431 struct ix_rx_queue *rx_que = sc->rx_queues; in ixgbe_configure_ivars()
3432 struct ix_tx_queue *tx_que = sc->tx_queues; in ixgbe_configure_ivars()
3442 sc->dmac = 0; in ixgbe_configure_ivars()
3446 for (int i = 0; i < sc->num_rx_queues; i++, rx_que++) { in ixgbe_configure_ivars()
3447 struct rx_ring *rxr = &rx_que->rxr; in ixgbe_configure_ivars()
3450 ixgbe_set_ivar(sc, rxr->me, rx_que->msix, 0); in ixgbe_configure_ivars()
3453 IXGBE_WRITE_REG(&sc->hw, IXGBE_EITR(rx_que->msix), newitr); in ixgbe_configure_ivars()
3455 for (int i = 0; i < sc->num_tx_queues; i++, tx_que++) { in ixgbe_configure_ivars()
3456 struct tx_ring *txr = &tx_que->txr; in ixgbe_configure_ivars()
3459 ixgbe_set_ivar(sc, txr->me, tx_que->msix, 1); in ixgbe_configure_ivars()
3462 ixgbe_set_ivar(sc, 1, sc->vector, -1); in ixgbe_configure_ivars()
3471 struct ixgbe_hw *hw = &sc->hw; in ixgbe_config_gpie()
3476 if (sc->intr_type == IFLIB_INTR_MSIX) { in ixgbe_config_gpie()
3477 /* Enable Enhanced MSI-X mode */ in ixgbe_config_gpie()
3485 if (sc->feat_en & IXGBE_FEATURE_FAN_FAIL) in ixgbe_config_gpie()
3489 if (sc->feat_en & IXGBE_FEATURE_TEMP_SENSOR) in ixgbe_config_gpie()
3493 switch (hw->mac.type) { in ixgbe_config_gpie()
3512 * Requires sc->max_frame_size to be set.
3517 struct ixgbe_hw *hw = &sc->hw; in ixgbe_config_delay_values()
3520 frame = sc->max_frame_size; in ixgbe_config_delay_values()
3523 switch (hw->mac.type) { in ixgbe_config_delay_values()
3535 rxpb = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(0)) >> 10; in ixgbe_config_delay_values()
3536 hw->fc.high_water[0] = rxpb - size; in ixgbe_config_delay_values()
3539 switch (hw->mac.type) { in ixgbe_config_delay_values()
3550 hw->fc.low_water[0] = IXGBE_BT2KB(tmp); in ixgbe_config_delay_values()
3552 hw->fc.pause_time = IXGBE_FC_PAUSE; in ixgbe_config_delay_values()
3553 hw->fc.send_xon = true; in ixgbe_config_delay_values()
3557 * ixgbe_set_multi - Multicast Update
3565 struct ixgbe_mc_addr *mta = sc->mta; in ixgbe_mc_filter_apply()
3570 mta[idx].vmdq = sc->pool; in ixgbe_mc_filter_apply()
3587 mta = sc->mta; in ixgbe_if_multi_set()
3595 ixgbe_update_mc_addr_list(&sc->hw, update_ptr, mcnt, in ixgbe_if_multi_set()
3599 fctrl = IXGBE_READ_REG(&sc->hw, IXGBE_FCTRL); in ixgbe_if_multi_set()
3610 IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, fctrl); in ixgbe_if_multi_set()
3626 *vmdq = mta->vmdq; in ixgbe_mc_array_itr()
3630 return (mta->addr); in ixgbe_mc_array_itr()
3634 * ixgbe_local_timer - Timer routine
3648 if (sc->sfp_probe) in ixgbe_if_timer()
3652 ixgbe_check_link(&sc->hw, &sc->link_speed, &sc->link_up, 0); in ixgbe_if_timer()
3660 * ixgbe_fw_mode_timer - FW mode timer routine
3666 struct ixgbe_hw *hw = &sc->hw; in ixgbe_fw_mode_timer()
3669 if (atomic_cmpset_acq_int(&sc->recovery_mode, 0, 1)) { in ixgbe_fw_mode_timer()
3671 device_printf(sc->dev, in ixgbe_fw_mode_timer()
3677 if (hw->adapter_stopped == FALSE) in ixgbe_fw_mode_timer()
3678 ixgbe_if_stop(sc->ctx); in ixgbe_fw_mode_timer()
3681 atomic_cmpset_acq_int(&sc->recovery_mode, 1, 0); in ixgbe_fw_mode_timer()
3684 callout_reset(&sc->fw_mode_timer, hz, in ixgbe_fw_mode_timer()
3697 struct ixgbe_hw *hw = &sc->hw; in ixgbe_sfp_probe()
3701 if ((hw->phy.type == ixgbe_phy_nl) && in ixgbe_sfp_probe()
3702 (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { in ixgbe_sfp_probe()
3703 s32 ret = hw->phy.ops.identify_sfp(hw); in ixgbe_sfp_probe()
3706 ret = hw->phy.ops.reset(hw); in ixgbe_sfp_probe()
3707 sc->sfp_probe = false; in ixgbe_sfp_probe()
3725 * ixgbe_handle_mod - Tasklet for SFP module interrupts
3732 struct ixgbe_hw *hw = &sc->hw; in ixgbe_handle_mod()
3736 if (sc->hw.need_crosstalk_fix) { in ixgbe_handle_mod()
3737 switch (hw->mac.type) { in ixgbe_handle_mod()
3755 err = hw->phy.ops.identify_sfp(hw); in ixgbe_handle_mod()
3762 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_handle_mod()
3763 err = hw->phy.ops.reset(hw); in ixgbe_handle_mod()
3765 err = hw->mac.ops.setup_sfp(hw); in ixgbe_handle_mod()
3769 "Setup failure - unsupported SFP+ module type.\n"); in ixgbe_handle_mod()
3772 sc->task_requests |= IXGBE_REQUEST_TASK_MSF; in ixgbe_handle_mod()
3776 sc->task_requests &= ~(IXGBE_REQUEST_TASK_MSF); in ixgbe_handle_mod()
3781 * ixgbe_handle_msf - Tasklet for MSF (multispeed fiber) interrupts
3788 struct ixgbe_hw *hw = &sc->hw; in ixgbe_handle_msf()
3792 /* get_supported_phy_layer will call hw->phy.ops.identify_sfp() */ in ixgbe_handle_msf()
3793 sc->phy_layer = ixgbe_get_supported_physical_layer(hw); in ixgbe_handle_msf()
3795 autoneg = hw->phy.autoneg_advertised; in ixgbe_handle_msf()
3796 if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) in ixgbe_handle_msf()
3797 hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiate); in ixgbe_handle_msf()
3798 if (hw->mac.ops.setup_link) in ixgbe_handle_msf()
3799 hw->mac.ops.setup_link(hw, autoneg, true); in ixgbe_handle_msf()
3802 ifmedia_removeall(sc->media); in ixgbe_handle_msf()
3803 ixgbe_add_media_types(sc->ctx); in ixgbe_handle_msf()
3804 ifmedia_set(sc->media, IFM_ETHER | IFM_AUTO); in ixgbe_handle_msf()
3808 * ixgbe_handle_phy - Tasklet for external PHY interrupts
3815 struct ixgbe_hw *hw = &sc->hw; in ixgbe_handle_phy()
3818 error = hw->phy.ops.handle_lasi(hw); in ixgbe_handle_phy()
3820 device_printf(sc->dev, in ixgbe_handle_phy()
3824 device_printf(sc->dev, in ixgbe_handle_phy()
3829 * ixgbe_if_stop - Stop the hardware
3838 struct ixgbe_hw *hw = &sc->hw; in ixgbe_if_stop()
3843 hw->adapter_stopped = false; in ixgbe_if_stop()
3845 if (hw->mac.type == ixgbe_mac_82599EB) in ixgbe_if_stop()
3847 /* Turn off the laser - noop with no optics */ in ixgbe_if_stop()
3851 sc->link_up = false; in ixgbe_if_stop()
3855 ixgbe_set_rar(&sc->hw, 0, sc->hw.mac.addr, 0, IXGBE_RAH_AV); in ixgbe_if_stop()
3861 * ixgbe_update_link_status - Update OS on link state
3873 if (sc->link_up) { in ixgbe_if_update_admin_status()
3874 if (sc->link_active == false) { in ixgbe_if_update_admin_status()
3877 ((sc->link_speed == 128) ? 10 : 1), in ixgbe_if_update_admin_status()
3879 sc->link_active = true; in ixgbe_if_update_admin_status()
3881 ixgbe_fc_enable(&sc->hw); in ixgbe_if_update_admin_status()
3885 ixgbe_link_speed_to_baudrate(sc->link_speed)); in ixgbe_if_update_admin_status()
3887 if (sc->feat_en & IXGBE_FEATURE_SRIOV) in ixgbe_if_update_admin_status()
3891 if (sc->link_active == true) { in ixgbe_if_update_admin_status()
3895 sc->link_active = false; in ixgbe_if_update_admin_status()
3896 if (sc->feat_en & IXGBE_FEATURE_SRIOV) in ixgbe_if_update_admin_status()
3902 if (sc->task_requests & IXGBE_REQUEST_TASK_MOD) in ixgbe_if_update_admin_status()
3904 if (sc->task_requests & IXGBE_REQUEST_TASK_MSF) in ixgbe_if_update_admin_status()
3906 if (sc->task_requests & IXGBE_REQUEST_TASK_MBX) in ixgbe_if_update_admin_status()
3908 if (sc->task_requests & IXGBE_REQUEST_TASK_FDIR) in ixgbe_if_update_admin_status()
3910 if (sc->task_requests & IXGBE_REQUEST_TASK_PHY) in ixgbe_if_update_admin_status()
3912 sc->task_requests = 0; in ixgbe_if_update_admin_status()
3918 * ixgbe_config_dmac - Configure DMA Coalescing
3923 struct ixgbe_hw *hw = &sc->hw; in ixgbe_config_dmac()
3924 struct ixgbe_dmac_config *dcfg = &hw->mac.dmac_config; in ixgbe_config_dmac()
3926 if (hw->mac.type < ixgbe_mac_X550 || !hw->mac.ops.dmac_config) in ixgbe_config_dmac()
3929 if (dcfg->watchdog_timer ^ sc->dmac || in ixgbe_config_dmac()
3930 dcfg->link_speed ^ sc->link_speed) { in ixgbe_config_dmac()
3931 dcfg->watchdog_timer = sc->dmac; in ixgbe_config_dmac()
3932 dcfg->fcoe_en = false; in ixgbe_config_dmac()
3933 dcfg->link_speed = sc->link_speed; in ixgbe_config_dmac()
3934 dcfg->num_tcs = 1; in ixgbe_config_dmac()
3937 dcfg->watchdog_timer, dcfg->link_speed); in ixgbe_config_dmac()
3939 hw->mac.ops.dmac_config(hw); in ixgbe_config_dmac()
3950 struct ixgbe_hw *hw = &sc->hw; in ixgbe_if_enable_intr()
3951 struct ix_rx_queue *que = sc->rx_queues; in ixgbe_if_enable_intr()
3956 switch (sc->hw.mac.type) { in ixgbe_if_enable_intr()
3980 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_SFP || in ixgbe_if_enable_intr()
3981 hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP || in ixgbe_if_enable_intr()
3982 hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP_N || in ixgbe_if_enable_intr()
3983 hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T) in ixgbe_if_enable_intr()
3985 if (hw->phy.type == ixgbe_phy_x550em_ext_t) in ixgbe_if_enable_intr()
3994 if (sc->feat_en & IXGBE_FEATURE_FAN_FAIL) in ixgbe_if_enable_intr()
3996 /* Enable SR-IOV */ in ixgbe_if_enable_intr()
3997 if (sc->feat_en & IXGBE_FEATURE_SRIOV) in ixgbe_if_enable_intr()
4000 if (sc->feat_en & IXGBE_FEATURE_FDIR) in ixgbe_if_enable_intr()
4005 /* With MSI-X we use auto clear */ in ixgbe_if_enable_intr()
4006 if (sc->intr_type == IFLIB_INTR_MSIX) { in ixgbe_if_enable_intr()
4011 if (sc->feat_cap & IXGBE_FEATURE_SRIOV) in ixgbe_if_enable_intr()
4018 * allow for handling the extended (beyond 32) MSI-X in ixgbe_if_enable_intr()
4021 for (int i = 0; i < sc->num_rx_queues; i++, que++) in ixgbe_if_enable_intr()
4022 ixgbe_enable_queue(sc, que->msix); in ixgbe_if_enable_intr()
4036 if (sc->intr_type == IFLIB_INTR_MSIX) in ixgbe_if_disable_intr()
4037 IXGBE_WRITE_REG(&sc->hw, IXGBE_EIAC, 0); in ixgbe_if_disable_intr()
4038 if (sc->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_if_disable_intr()
4039 IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMC, ~0); in ixgbe_if_disable_intr()
4041 IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMC, 0xFFFF0000); in ixgbe_if_disable_intr()
4042 IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMC_EX(0), ~0); in ixgbe_if_disable_intr()
4043 IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMC_EX(1), ~0); in ixgbe_if_disable_intr()
4045 IXGBE_WRITE_FLUSH(&sc->hw); in ixgbe_if_disable_intr()
4056 &((struct ixgbe_softc *)iflib_get_softc(ctx))->hw; in ixgbe_link_intr_enable()
4058 /* Re-enable other interrupts */ in ixgbe_link_intr_enable()
4069 struct ix_rx_queue *que = &sc->rx_queues[rxqid]; in ixgbe_if_rx_queue_intr_enable()
4071 ixgbe_enable_queue(sc, que->msix); in ixgbe_if_rx_queue_intr_enable()
4082 struct ixgbe_hw *hw = &sc->hw; in ixgbe_enable_queue()
4086 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_enable_queue()
4105 struct ixgbe_hw *hw = &sc->hw; in ixgbe_disable_queue()
4109 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_disable_queue()
4123 * ixgbe_intr - Legacy Interrupt Service Routine
4129 struct ix_rx_queue *que = sc->rx_queues; in ixgbe_intr()
4130 struct ixgbe_hw *hw = &sc->hw; in ixgbe_intr()
4131 if_ctx_t ctx = sc->ctx; in ixgbe_intr()
4136 ++que->irqs; in ixgbe_intr()
4143 if ((sc->feat_en & IXGBE_FEATURE_FAN_FAIL) && in ixgbe_intr()
4145 device_printf(sc->dev, in ixgbe_intr()
4158 /* Pluggable optics-related interrupt */ in ixgbe_intr()
4159 if (hw->mac.type >= ixgbe_mac_X540) in ixgbe_intr()
4166 sc->task_requests |= IXGBE_REQUEST_TASK_MOD; in ixgbe_intr()
4169 if ((hw->mac.type == ixgbe_mac_82599EB) && in ixgbe_intr()
4173 sc->task_requests |= IXGBE_REQUEST_TASK_MSF; in ixgbe_intr()
4178 if ((hw->phy.type == ixgbe_phy_x550em_ext_t) && in ixgbe_intr()
4180 sc->task_requests |= IXGBE_REQUEST_TASK_PHY; in ixgbe_intr()
4192 struct ix_rx_queue *que = sc->rx_queues; in ixgbe_free_pci_resources()
4195 /* Release all MSI-X queue resources */ in ixgbe_free_pci_resources()
4196 if (sc->intr_type == IFLIB_INTR_MSIX) in ixgbe_free_pci_resources()
4197 iflib_irq_free(ctx, &sc->irq); in ixgbe_free_pci_resources()
4200 for (int i = 0; i < sc->num_rx_queues; i++, que++) { in ixgbe_free_pci_resources()
4201 iflib_irq_free(ctx, &que->que_irq); in ixgbe_free_pci_resources()
4205 if (sc->pci_mem != NULL) in ixgbe_free_pci_resources()
4207 rman_get_rid(sc->pci_mem), sc->pci_mem); in ixgbe_free_pci_resources()
4222 fc = sc->hw.fc.current_mode; in ixgbe_sysctl_flowcntl()
4225 if ((error) || (req->newptr == NULL)) in ixgbe_sysctl_flowcntl()
4229 if (fc == sc->hw.fc.current_mode) in ixgbe_sysctl_flowcntl()
4236 * ixgbe_set_flowcntl - Set flow control
4239 * 0 - off
4240 * 1 - rx pause
4241 * 2 - tx pause
4242 * 3 - full
4251 sc->hw.fc.requested_mode = fc; in ixgbe_set_flowcntl()
4252 if (sc->num_rx_queues > 1) in ixgbe_set_flowcntl()
4256 sc->hw.fc.requested_mode = ixgbe_fc_none; in ixgbe_set_flowcntl()
4257 if (sc->num_rx_queues > 1) in ixgbe_set_flowcntl()
4265 sc->hw.fc.disable_fc_autoneg = true; in ixgbe_set_flowcntl()
4266 ixgbe_fc_enable(&sc->hw); in ixgbe_set_flowcntl()
4283 struct ixgbe_hw *hw = &sc->hw; in ixgbe_enable_rx_drop()
4287 for (int i = 0; i < sc->num_rx_queues; i++) { in ixgbe_enable_rx_drop()
4288 rxr = &sc->rx_queues[i].rxr; in ixgbe_enable_rx_drop()
4289 srrctl = IXGBE_READ_REG(hw, IXGBE_SRRCTL(rxr->me)); in ixgbe_enable_rx_drop()
4291 IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(rxr->me), srrctl); in ixgbe_enable_rx_drop()
4295 for (int i = 0; i < sc->num_vfs; i++) { in ixgbe_enable_rx_drop()
4309 struct ixgbe_hw *hw = &sc->hw; in ixgbe_disable_rx_drop()
4313 for (int i = 0; i < sc->num_rx_queues; i++) { in ixgbe_disable_rx_drop()
4314 rxr = &sc->rx_queues[i].rxr; in ixgbe_disable_rx_drop()
4315 srrctl = IXGBE_READ_REG(hw, IXGBE_SRRCTL(rxr->me)); in ixgbe_disable_rx_drop()
4317 IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(rxr->me), srrctl); in ixgbe_disable_rx_drop()
4321 for (int i = 0; i < sc->num_vfs; i++) { in ixgbe_disable_rx_drop()
4339 if (atomic_load_acq_int(&sc->recovery_mode)) in ixgbe_sysctl_advertise()
4342 advertise = sc->advertise; in ixgbe_sysctl_advertise()
4345 if ((error) || (req->newptr == NULL)) in ixgbe_sysctl_advertise()
4352 * ixgbe_set_advertise - Control advertised link speed
4355 * 0x1 - advertise 100 Mb
4356 * 0x2 - advertise 1G
4357 * 0x4 - advertise 10G
4358 * 0x8 - advertise 10 Mb (yes, Mb)
4359 * 0x10 - advertise 2.5G (disabled by default)
4360 * 0x20 - advertise 5G (disabled by default)
4366 device_t dev = iflib_get_dev(sc->ctx); in ixgbe_set_advertise()
4374 if (sc->advertise == advertise) /* no change */ in ixgbe_set_advertise()
4377 hw = &sc->hw; in ixgbe_set_advertise()
4380 if (hw->phy.media_type == ixgbe_media_type_backplane) in ixgbe_set_advertise()
4383 if (!((hw->phy.media_type == ixgbe_media_type_copper) || in ixgbe_set_advertise()
4384 (hw->phy.multispeed_fiber))) { in ixgbe_set_advertise()
4398 if (hw->mac.ops.get_link_capabilities) { in ixgbe_set_advertise()
4399 err = hw->mac.ops.get_link_capabilities(hw, &link_caps, in ixgbe_set_advertise()
4431 "Interface does not support 10Gb advertised speed" in ixgbe_set_advertise()
4440 "Interface does not support 10Mb advertised speed" in ixgbe_set_advertise()
4465 hw->mac.autotry_restart = true; in ixgbe_set_advertise()
4466 hw->mac.ops.setup_link(hw, speed, true); in ixgbe_set_advertise()
4467 sc->advertise = advertise; in ixgbe_set_advertise()
4473 * ixgbe_get_default_advertise - Get default advertised speed settings
4477 * 0x1 - advertise 100 Mb
4478 * 0x2 - advertise 1G
4479 * 0x4 - advertise 10G
4480 * 0x8 - advertise 10 Mb (yes, Mb)
4481 * 0x10 - advertise 2.5G (disabled by default)
4482 * 0x20 - advertise 5G (disabled by default)
4487 struct ixgbe_hw *hw = &sc->hw; in ixgbe_get_default_advertise()
4495 * multi-speed fiber in ixgbe_get_default_advertise()
4497 if (!(hw->phy.media_type == ixgbe_media_type_copper) && in ixgbe_get_default_advertise()
4498 !(hw->phy.multispeed_fiber)) in ixgbe_get_default_advertise()
4501 err = hw->mac.ops.get_link_capabilities(hw, &link_caps, &negotiate); in ixgbe_get_default_advertise()
4505 if (hw->mac.type == ixgbe_mac_X550) { in ixgbe_get_default_advertise()
4527 * ixgbe_sysctl_dmac - Manage DMA Coalescing
4530 * 0/1 - off / on (use default value of 1000)
4541 if_t ifp = iflib_get_ifp(sc->ctx); in ixgbe_sysctl_dmac()
4545 newval = sc->dmac; in ixgbe_sysctl_dmac()
4547 if ((error) || (req->newptr == NULL)) in ixgbe_sysctl_dmac()
4553 sc->dmac = 0; in ixgbe_sysctl_dmac()
4557 sc->dmac = 1000; in ixgbe_sysctl_dmac()
4567 /* Legal values - allow */ in ixgbe_sysctl_dmac()
4568 sc->dmac = newval; in ixgbe_sysctl_dmac()
4575 /* Re-initialize hardware if it's already running */ in ixgbe_sysctl_dmac()
4588 * 0 - set device to D0
4589 * 3 - set device to D3
4590 * (none) - get current device power state
4596 device_t dev = sc->dev; in ixgbe_sysctl_power_state()
4602 if ((error) || (req->newptr == NULL)) in ixgbe_sysctl_power_state()
4628 * 0 - disabled
4629 * 1 - enabled
4635 struct ixgbe_hw *hw = &sc->hw; in ixgbe_sysctl_wol_enable()
4639 new_wol_enabled = hw->wol_enabled; in ixgbe_sysctl_wol_enable()
4641 if ((error) || (req->newptr == NULL)) in ixgbe_sysctl_wol_enable()
4644 if (new_wol_enabled == hw->wol_enabled) in ixgbe_sysctl_wol_enable()
4647 if (new_wol_enabled > 0 && !sc->wol_support) in ixgbe_sysctl_wol_enable()
4650 hw->wol_enabled = new_wol_enabled; in ixgbe_sysctl_wol_enable()
4656 * ixgbe_sysctl_wufc - Wake Up Filter Control
4661 * 0x1 - Link Status Change
4662 * 0x2 - Magic Packet
4663 * 0x4 - Direct Exact
4664 * 0x8 - Directed Multicast
4665 * 0x10 - Broadcast
4666 * 0x20 - ARP/IPv4 Request Packet
4667 * 0x40 - Direct IPv4 Packet
4668 * 0x80 - Direct IPv6 Packet
4679 new_wufc = sc->wufc; in ixgbe_sysctl_wufc()
4682 if ((error) || (req->newptr == NULL)) in ixgbe_sysctl_wufc()
4684 if (new_wufc == sc->wufc) in ixgbe_sysctl_wufc()
4691 new_wufc |= (0xffffff & sc->wufc); in ixgbe_sysctl_wufc()
4692 sc->wufc = new_wufc; in ixgbe_sysctl_wufc()
4705 struct ixgbe_hw *hw = &sc->hw; in ixgbe_sysctl_print_rss_config()
4706 device_t dev = sc->dev; in ixgbe_sysctl_print_rss_config()
4711 if (atomic_load_acq_int(&sc->recovery_mode)) in ixgbe_sysctl_print_rss_config()
4722 switch (sc->hw.mac.type) { in ixgbe_sysctl_print_rss_config()
4740 reg = IXGBE_READ_REG(hw, IXGBE_ERETA(i - 32)); in ixgbe_sysctl_print_rss_config()
4741 sbuf_printf(buf, "ERETA(%2d): 0x%08x\n", i - 32, reg); in ixgbe_sysctl_print_rss_config()
4758 * ixgbe_sysctl_phy_temp - Retrieve temperature of PHY
4760 * For X552/X557-AT devices using an external PHY
4766 struct ixgbe_hw *hw = &sc->hw; in ixgbe_sysctl_phy_temp()
4769 if (atomic_load_acq_int(&sc->recovery_mode)) in ixgbe_sysctl_phy_temp()
4772 if (hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) { in ixgbe_sysctl_phy_temp()
4773 device_printf(iflib_get_dev(sc->ctx), in ixgbe_sysctl_phy_temp()
4778 if (hw->phy.ops.read_reg(hw, IXGBE_PHY_CURRENT_TEMP, in ixgbe_sysctl_phy_temp()
4780 device_printf(iflib_get_dev(sc->ctx), in ixgbe_sysctl_phy_temp()
4802 struct ixgbe_hw *hw = &sc->hw; in ixgbe_sysctl_phy_overtemp_occurred()
4805 if (atomic_load_acq_int(&sc->recovery_mode)) in ixgbe_sysctl_phy_overtemp_occurred()
4808 if (hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) { in ixgbe_sysctl_phy_overtemp_occurred()
4809 device_printf(iflib_get_dev(sc->ctx), in ixgbe_sysctl_phy_overtemp_occurred()
4814 if (hw->phy.ops.read_reg(hw, IXGBE_PHY_OVERTEMP_STATUS, in ixgbe_sysctl_phy_overtemp_occurred()
4816 device_printf(iflib_get_dev(sc->ctx), in ixgbe_sysctl_phy_overtemp_occurred()
4832 * 0 - disable EEE
4833 * 1 - enable EEE
4834 * (none) - get current device EEE state
4840 device_t dev = sc->dev; in ixgbe_sysctl_eee_state()
4841 if_t ifp = iflib_get_ifp(sc->ctx); in ixgbe_sysctl_eee_state()
4845 if (atomic_load_acq_int(&sc->recovery_mode)) in ixgbe_sysctl_eee_state()
4848 curr_eee = new_eee = !!(sc->feat_en & IXGBE_FEATURE_EEE); in ixgbe_sysctl_eee_state()
4851 if ((error) || (req->newptr == NULL)) in ixgbe_sysctl_eee_state()
4859 if (!(sc->feat_cap & IXGBE_FEATURE_EEE)) in ixgbe_sysctl_eee_state()
4866 retval = ixgbe_setup_eee(&sc->hw, new_eee); in ixgbe_sysctl_eee_state()
4872 /* Restart auto-neg */ in ixgbe_sysctl_eee_state()
4879 sc->feat_en |= IXGBE_FEATURE_EEE; in ixgbe_sysctl_eee_state()
4881 sc->feat_en &= ~IXGBE_FEATURE_EEE; in ixgbe_sysctl_eee_state()
4893 sc = oidp->oid_arg1; in ixgbe_sysctl_tso_tcp_flags_mask()
4894 switch (oidp->oid_arg2) { in ixgbe_sysctl_tso_tcp_flags_mask()
4911 val = IXGBE_READ_REG(&sc->hw, reg); in ixgbe_sysctl_tso_tcp_flags_mask()
4914 if (error != 0 || req->newptr == NULL) in ixgbe_sysctl_tso_tcp_flags_mask()
4919 IXGBE_WRITE_REG(&sc->hw, reg, val); in ixgbe_sysctl_tso_tcp_flags_mask()
4929 sc->feat_cap = IXGBE_FEATURE_NETMAP | in ixgbe_init_device_features()
4936 switch (sc->hw.mac.type) { in ixgbe_init_device_features()
4938 if (sc->hw.device_id == IXGBE_DEV_ID_82598AT) in ixgbe_init_device_features()
4939 sc->feat_cap |= IXGBE_FEATURE_FAN_FAIL; in ixgbe_init_device_features()
4942 sc->feat_cap |= IXGBE_FEATURE_SRIOV; in ixgbe_init_device_features()
4943 sc->feat_cap |= IXGBE_FEATURE_FDIR; in ixgbe_init_device_features()
4944 if ((sc->hw.device_id == IXGBE_DEV_ID_X540_BYPASS) && in ixgbe_init_device_features()
4945 (sc->hw.bus.func == 0)) in ixgbe_init_device_features()
4946 sc->feat_cap |= IXGBE_FEATURE_BYPASS; in ixgbe_init_device_features()
4949 sc->feat_cap |= IXGBE_FEATURE_RECOVERY_MODE; in ixgbe_init_device_features()
4950 sc->feat_cap |= IXGBE_FEATURE_TEMP_SENSOR; in ixgbe_init_device_features()
4951 sc->feat_cap |= IXGBE_FEATURE_SRIOV; in ixgbe_init_device_features()
4952 sc->feat_cap |= IXGBE_FEATURE_FDIR; in ixgbe_init_device_features()
4955 sc->feat_cap |= IXGBE_FEATURE_RECOVERY_MODE; in ixgbe_init_device_features()
4956 sc->feat_cap |= IXGBE_FEATURE_SRIOV; in ixgbe_init_device_features()
4957 sc->feat_cap |= IXGBE_FEATURE_FDIR; in ixgbe_init_device_features()
4958 if (sc->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR) in ixgbe_init_device_features()
4959 sc->feat_cap |= IXGBE_FEATURE_EEE; in ixgbe_init_device_features()
4962 sc->feat_cap |= IXGBE_FEATURE_RECOVERY_MODE; in ixgbe_init_device_features()
4963 sc->feat_cap |= IXGBE_FEATURE_SRIOV; in ixgbe_init_device_features()
4964 sc->feat_cap |= IXGBE_FEATURE_FDIR; in ixgbe_init_device_features()
4965 sc->feat_cap &= ~IXGBE_FEATURE_LEGACY_IRQ; in ixgbe_init_device_features()
4966 if ((sc->hw.device_id == IXGBE_DEV_ID_X550EM_A_1G_T) || in ixgbe_init_device_features()
4967 (sc->hw.device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L)) { in ixgbe_init_device_features()
4968 sc->feat_cap |= IXGBE_FEATURE_TEMP_SENSOR; in ixgbe_init_device_features()
4969 sc->feat_cap |= IXGBE_FEATURE_EEE; in ixgbe_init_device_features()
4973 sc->feat_cap |= IXGBE_FEATURE_SRIOV; in ixgbe_init_device_features()
4974 sc->feat_cap |= IXGBE_FEATURE_FDIR; in ixgbe_init_device_features()
4975 if ((sc->hw.device_id == IXGBE_DEV_ID_82599_BYPASS) && in ixgbe_init_device_features()
4976 (sc->hw.bus.func == 0)) in ixgbe_init_device_features()
4977 sc->feat_cap |= IXGBE_FEATURE_BYPASS; in ixgbe_init_device_features()
4978 if (sc->hw.device_id == IXGBE_DEV_ID_82599_QSFP_SF_QP) in ixgbe_init_device_features()
4979 sc->feat_cap &= ~IXGBE_FEATURE_LEGACY_IRQ; in ixgbe_init_device_features()
4987 if (sc->feat_cap & IXGBE_FEATURE_FAN_FAIL) in ixgbe_init_device_features()
4988 sc->feat_en |= IXGBE_FEATURE_FAN_FAIL; in ixgbe_init_device_features()
4990 if (sc->feat_cap & IXGBE_FEATURE_NETMAP) in ixgbe_init_device_features()
4991 sc->feat_en |= IXGBE_FEATURE_NETMAP; in ixgbe_init_device_features()
4993 if (sc->feat_cap & IXGBE_FEATURE_EEE) in ixgbe_init_device_features()
4994 sc->feat_en |= IXGBE_FEATURE_EEE; in ixgbe_init_device_features()
4996 if (sc->feat_cap & IXGBE_FEATURE_TEMP_SENSOR) in ixgbe_init_device_features()
4997 sc->feat_en |= IXGBE_FEATURE_TEMP_SENSOR; in ixgbe_init_device_features()
4999 if (sc->feat_cap & IXGBE_FEATURE_RECOVERY_MODE) in ixgbe_init_device_features()
5000 sc->feat_en |= IXGBE_FEATURE_RECOVERY_MODE; in ixgbe_init_device_features()
5005 if (sc->feat_cap & IXGBE_FEATURE_FDIR) in ixgbe_init_device_features()
5006 sc->feat_en |= IXGBE_FEATURE_FDIR; in ixgbe_init_device_features()
5008 device_printf(sc->dev, in ixgbe_init_device_features()
5013 * Message Signal Interrupts - Extended (MSI-X) in ixgbe_init_device_features()
5014 * Normal MSI is only enabled if MSI-X calls fail. in ixgbe_init_device_features()
5017 sc->feat_cap &= ~IXGBE_FEATURE_MSIX; in ixgbe_init_device_features()
5018 /* Receive-Side Scaling (RSS) */ in ixgbe_init_device_features()
5019 if ((sc->feat_cap & IXGBE_FEATURE_RSS) && ixgbe_enable_rss) in ixgbe_init_device_features()
5020 sc->feat_en |= IXGBE_FEATURE_RSS; in ixgbe_init_device_features()
5023 /* No MSI-X */ in ixgbe_init_device_features()
5024 if (!(sc->feat_cap & IXGBE_FEATURE_MSIX)) { in ixgbe_init_device_features()
5025 sc->feat_cap &= ~IXGBE_FEATURE_RSS; in ixgbe_init_device_features()
5026 sc->feat_cap &= ~IXGBE_FEATURE_SRIOV; in ixgbe_init_device_features()
5027 sc->feat_en &= ~IXGBE_FEATURE_RSS; in ixgbe_init_device_features()
5028 sc->feat_en &= ~IXGBE_FEATURE_SRIOV; in ixgbe_init_device_features()
5040 mask = (in_interrupt) ? IXGBE_EICR_GPI_SDP1_BY_MAC(&sc->hw) : in ixgbe_check_fan_failure()
5044 device_printf(sc->dev, in ixgbe_check_fan_failure()
5100 sbuf_printf(buf, "%sOption ROM V%d-b%d-p%d", in ixgbe_sbuf_fw_version()
5119 struct ixgbe_hw *hw = &sc->hw; in ixgbe_print_fw_version()
5120 device_t dev = sc->dev; in ixgbe_print_fw_version()
5148 struct ixgbe_hw *hw = &sc->hw; in ixgbe_sysctl_print_fw_version()
5149 device_t dev = sc->dev; in ixgbe_sysctl_print_fw_version()