Lines Matching +full:pa +full:- +full:stats

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
54 #include "xgbe-common.h"
138 * MSI-X table bar (BAR5) to iflib. iflib will do the allocation for MSI-X
144 { -1, 0 }
320 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_miibus_readreg()
335 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_miibus_writereg()
348 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_miibus_statchg()
349 struct mii_data *mii = device_get_softc(pdata->axgbe_miibus); in axgbe_miibus_statchg()
350 if_t ifp = pdata->netdev; in axgbe_miibus_statchg()
353 axgbe_printf(2, "%s: Link %d/%d\n", __func__, pdata->phy.link, in axgbe_miibus_statchg()
354 pdata->phy_link); in axgbe_miibus_statchg()
360 if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == in axgbe_miibus_statchg()
363 switch (IFM_SUBTYPE(mii->mii_media_active)) { in axgbe_miibus_statchg()
366 pdata->phy.link = 1; in axgbe_miibus_statchg()
371 pdata->phy.link = 1; in axgbe_miibus_statchg()
374 pdata->phy.link = 0; in axgbe_miibus_statchg()
378 pdata->phy_link = 0; in axgbe_miibus_statchg()
380 bmsr = axgbe_miibus_readreg(pdata->dev, pdata->mdio_addr, MII_BMSR); in axgbe_miibus_statchg()
406 sc->pdata.dev = dev = iflib_get_dev(ctx); in axgbe_if_attach_pre()
407 sc->sctx = sctx = iflib_get_sctx(ctx); in axgbe_if_attach_pre()
408 sc->scctx = scctx = iflib_get_softc_ctx(ctx); in axgbe_if_attach_pre()
409 sc->media = iflib_get_media(ctx); in axgbe_if_attach_pre()
410 sc->ctx = ctx; in axgbe_if_attach_pre()
411 sc->link_status = LINK_STATE_DOWN; in axgbe_if_attach_pre()
412 pdata = &sc->pdata; in axgbe_if_attach_pre()
413 pdata->netdev = iflib_get_ifp(ctx); in axgbe_if_attach_pre()
415 spin_lock_init(&pdata->xpcs_lock); in axgbe_if_attach_pre()
418 mtx_init(&pdata->rss_mutex, "xgbe rss mutex lock", NULL, MTX_DEF); in axgbe_if_attach_pre()
419 mtx_init(&pdata->mdio_mutex, "xgbe MDIO mutex lock", NULL, MTX_SPIN); in axgbe_if_attach_pre()
422 pdata->active_vlans = bit_alloc(VLAN_NVID, M_AXGBE, M_WAITOK|M_ZERO); in axgbe_if_attach_pre()
423 pdata->num_active_vlans = 0; in axgbe_if_attach_pre()
428 sc->pdata.vdata = &xgbe_v2a; in axgbe_if_attach_pre()
430 sc->pdata.vdata = &xgbe_v2b; in axgbe_if_attach_pre()
439 sc->pdata.xgmac_res = mac_res[0]; in axgbe_if_attach_pre()
440 sc->pdata.xpcs_res = mac_res[1]; in axgbe_if_attach_pre()
453 pdata->xpcs_window_def_reg = PCS_V2_RV_WINDOW_DEF; in axgbe_if_attach_pre()
454 pdata->xpcs_window_sel_reg = PCS_V2_RV_WINDOW_SELECT; in axgbe_if_attach_pre()
456 pdata->xpcs_window_def_reg = PCS_V2_WINDOW_DEF; in axgbe_if_attach_pre()
457 pdata->xpcs_window_sel_reg = PCS_V2_WINDOW_SELECT; in axgbe_if_attach_pre()
461 reg = XPCS32_IOREAD(pdata, pdata->xpcs_window_def_reg); in axgbe_if_attach_pre()
462 pdata->xpcs_window = XPCS_GET_BITS(reg, PCS_V2_WINDOW_DEF, OFFSET); in axgbe_if_attach_pre()
463 pdata->xpcs_window <<= 6; in axgbe_if_attach_pre()
464 pdata->xpcs_window_size = XPCS_GET_BITS(reg, PCS_V2_WINDOW_DEF, SIZE); in axgbe_if_attach_pre()
465 pdata->xpcs_window_size = 1 << (pdata->xpcs_window_size + 7); in axgbe_if_attach_pre()
466 pdata->xpcs_window_mask = pdata->xpcs_window_size - 1; in axgbe_if_attach_pre()
468 pdata->xpcs_window_def_reg); in axgbe_if_attach_pre()
470 pdata->xpcs_window_sel_reg); in axgbe_if_attach_pre()
472 pdata->xpcs_window); in axgbe_if_attach_pre()
474 pdata->xpcs_window_size); in axgbe_if_attach_pre()
476 pdata->xpcs_window_mask); in axgbe_if_attach_pre()
484 pdata->mac_addr[0] = ma_lo & 0xff; in axgbe_if_attach_pre()
485 pdata->mac_addr[1] = (ma_lo >> 8) & 0xff; in axgbe_if_attach_pre()
486 pdata->mac_addr[2] = (ma_lo >>16) & 0xff; in axgbe_if_attach_pre()
487 pdata->mac_addr[3] = (ma_lo >> 24) & 0xff; in axgbe_if_attach_pre()
488 pdata->mac_addr[4] = ma_hi & 0xff; in axgbe_if_attach_pre()
489 pdata->mac_addr[5] = (ma_hi >> 8) & 0xff; in axgbe_if_attach_pre()
495 iflib_set_mac(ctx, pdata->mac_addr); in axgbe_if_attach_pre()
498 pdata->sysclk_rate = XGBE_V2_DMA_CLOCK_FREQ; in axgbe_if_attach_pre()
499 pdata->ptpclk_rate = XGBE_V2_PTP_CLOCK_FREQ; in axgbe_if_attach_pre()
502 pdata->coherent = 1; in axgbe_if_attach_pre()
503 pdata->arcr = XGBE_DMA_PCI_ARCR; in axgbe_if_attach_pre()
504 pdata->awcr = XGBE_DMA_PCI_AWCR; in axgbe_if_attach_pre()
505 pdata->awarcr = XGBE_DMA_PCI_AWARCR; in axgbe_if_attach_pre()
508 pdata->pp0 = XP_IOREAD(pdata, XP_PROP_0); in axgbe_if_attach_pre()
509 pdata->pp1 = XP_IOREAD(pdata, XP_PROP_1); in axgbe_if_attach_pre()
510 pdata->pp2 = XP_IOREAD(pdata, XP_PROP_2); in axgbe_if_attach_pre()
511 pdata->pp3 = XP_IOREAD(pdata, XP_PROP_3); in axgbe_if_attach_pre()
512 pdata->pp4 = XP_IOREAD(pdata, XP_PROP_4); in axgbe_if_attach_pre()
513 DBGPR("port property 0 = %#010x\n", pdata->pp0); in axgbe_if_attach_pre()
514 DBGPR("port property 1 = %#010x\n", pdata->pp1); in axgbe_if_attach_pre()
515 DBGPR("port property 2 = %#010x\n", pdata->pp2); in axgbe_if_attach_pre()
516 DBGPR("port property 3 = %#010x\n", pdata->pp3); in axgbe_if_attach_pre()
517 DBGPR("port property 4 = %#010x\n", pdata->pp4); in axgbe_if_attach_pre()
520 pdata->tx_max_channel_count = XP_GET_BITS(pdata->pp1, XP_PROP_1, in axgbe_if_attach_pre()
522 pdata->rx_max_channel_count = XP_GET_BITS(pdata->pp1, XP_PROP_1, in axgbe_if_attach_pre()
524 pdata->tx_max_q_count = XP_GET_BITS(pdata->pp1, XP_PROP_1, in axgbe_if_attach_pre()
526 pdata->rx_max_q_count = XP_GET_BITS(pdata->pp1, XP_PROP_1, in axgbe_if_attach_pre()
529 pdata->tx_max_channel_count, pdata->rx_max_channel_count); in axgbe_if_attach_pre()
531 pdata->tx_max_q_count, pdata->rx_max_q_count); in axgbe_if_attach_pre()
536 pdata->tx_max_fifo_size = XP_GET_BITS(pdata->pp2, XP_PROP_2, in axgbe_if_attach_pre()
538 pdata->tx_max_fifo_size *= 16384; in axgbe_if_attach_pre()
539 pdata->tx_max_fifo_size = min(pdata->tx_max_fifo_size, in axgbe_if_attach_pre()
540 pdata->vdata->tx_max_fifo_size); in axgbe_if_attach_pre()
541 pdata->rx_max_fifo_size = XP_GET_BITS(pdata->pp2, XP_PROP_2, in axgbe_if_attach_pre()
543 pdata->rx_max_fifo_size *= 16384; in axgbe_if_attach_pre()
544 pdata->rx_max_fifo_size = min(pdata->rx_max_fifo_size, in axgbe_if_attach_pre()
545 pdata->vdata->rx_max_fifo_size); in axgbe_if_attach_pre()
547 pdata->tx_max_fifo_size, pdata->rx_max_fifo_size); in axgbe_if_attach_pre()
559 TASK_INIT(&pdata->service_work, 0, xgbe_service, pdata); in axgbe_if_attach_pre()
562 pdata->dev_workqueue = taskqueue_create("axgbe", M_WAITOK, in axgbe_if_attach_pre()
563 taskqueue_thread_enqueue, &pdata->dev_workqueue); in axgbe_if_attach_pre()
564 ret = taskqueue_start_threads(&pdata->dev_workqueue, 1, PI_NET, in axgbe_if_attach_pre()
578 taskqueue_free(pdata->dev_workqueue); in axgbe_if_attach_pre()
585 free(pdata->active_vlans, M_AXGBE); in axgbe_if_attach_pre()
593 xgbe_init_function_ptrs_dev(&pdata->hw_if); in xgbe_init_all_fptrs()
594 xgbe_init_function_ptrs_phy(&pdata->phy_if); in xgbe_init_all_fptrs()
595 xgbe_init_function_ptrs_i2c(&pdata->i2c_if); in xgbe_init_all_fptrs()
596 xgbe_init_function_ptrs_desc(&pdata->desc_if); in xgbe_init_all_fptrs()
598 pdata->vdata->init_function_ptrs_phy_impl(&pdata->phy_if); in xgbe_init_all_fptrs()
605 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_set_counts()
614 if (!pdata->tx_max_channel_count) in axgbe_set_counts()
615 pdata->tx_max_channel_count = pdata->hw_feat.tx_ch_cnt; in axgbe_set_counts()
616 if (!pdata->rx_max_channel_count) in axgbe_set_counts()
617 pdata->rx_max_channel_count = pdata->hw_feat.rx_ch_cnt; in axgbe_set_counts()
619 if (!pdata->tx_max_q_count) in axgbe_set_counts()
620 pdata->tx_max_q_count = pdata->hw_feat.tx_q_cnt; in axgbe_set_counts()
621 if (!pdata->rx_max_q_count) in axgbe_set_counts()
622 pdata->rx_max_q_count = pdata->hw_feat.rx_q_cnt; in axgbe_set_counts()
626 * -Tx (DMA) Channels map 1-to-1 to Tx Queues so set in axgbe_set_counts()
629 * -Rx (DMA) Channels do not map 1-to-1 so use the actual in axgbe_set_counts()
633 if (bus_get_cpus(pdata->dev, INTR_CPUS, sizeof(lcpus), &lcpus) != 0) { in axgbe_set_counts()
635 /* TODO - handle CPU_COPY(&all_cpus, &lcpus); */ in axgbe_set_counts()
640 pdata->tx_ring_count = min(CPU_COUNT(&lcpus), pdata->hw_feat.tx_ch_cnt); in axgbe_set_counts()
641 pdata->tx_ring_count = min(pdata->tx_ring_count, in axgbe_set_counts()
642 pdata->tx_max_channel_count); in axgbe_set_counts()
643 pdata->tx_ring_count = min(pdata->tx_ring_count, pdata->tx_max_q_count); in axgbe_set_counts()
645 pdata->tx_q_count = pdata->tx_ring_count; in axgbe_set_counts()
647 pdata->rx_ring_count = min(CPU_COUNT(&lcpus), pdata->hw_feat.rx_ch_cnt); in axgbe_set_counts()
648 pdata->rx_ring_count = min(pdata->rx_ring_count, in axgbe_set_counts()
649 pdata->rx_max_channel_count); in axgbe_set_counts()
651 pdata->rx_q_count = min(pdata->hw_feat.rx_q_cnt, pdata->rx_max_q_count); in axgbe_set_counts()
654 pdata->tx_max_channel_count, pdata->rx_max_channel_count); in axgbe_set_counts()
656 pdata->tx_max_q_count, pdata->rx_max_q_count); in axgbe_set_counts()
658 pdata->tx_ring_count, pdata->rx_ring_count); in axgbe_set_counts()
660 pdata->tx_q_count, pdata->rx_q_count); in axgbe_set_counts()
666 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_init_iflib_softc_ctx()
667 if_softc_ctx_t scctx = sc->scctx; in axgbe_init_iflib_softc_ctx()
668 if_shared_ctx_t sctx = sc->sctx; in axgbe_init_iflib_softc_ctx()
671 scctx->isc_nrxqsets = pdata->rx_q_count; in axgbe_init_iflib_softc_ctx()
672 scctx->isc_ntxqsets = pdata->tx_q_count; in axgbe_init_iflib_softc_ctx()
673 scctx->isc_msix_bar = pci_msix_table_bar(pdata->dev); in axgbe_init_iflib_softc_ctx()
674 scctx->isc_tx_nsegments = 32; in axgbe_init_iflib_softc_ctx()
676 for (i = 0; i < sctx->isc_ntxqs; i++) { in axgbe_init_iflib_softc_ctx()
677 scctx->isc_txqsizes[i] = in axgbe_init_iflib_softc_ctx()
678 roundup2(scctx->isc_ntxd[i] * sizeof(struct xgbe_ring_desc), in axgbe_init_iflib_softc_ctx()
680 scctx->isc_txd_size[i] = sizeof(struct xgbe_ring_desc); in axgbe_init_iflib_softc_ctx()
683 for (i = 0; i < sctx->isc_nrxqs; i++) { in axgbe_init_iflib_softc_ctx()
684 scctx->isc_rxqsizes[i] = in axgbe_init_iflib_softc_ctx()
685 roundup2(scctx->isc_nrxd[i] * sizeof(struct xgbe_ring_desc), in axgbe_init_iflib_softc_ctx()
687 scctx->isc_rxd_size[i] = sizeof(struct xgbe_ring_desc); in axgbe_init_iflib_softc_ctx()
690 scctx->isc_tx_tso_segments_max = 32; in axgbe_init_iflib_softc_ctx()
691 scctx->isc_tx_tso_size_max = XGBE_TSO_MAX_SIZE; in axgbe_init_iflib_softc_ctx()
692 scctx->isc_tx_tso_segsize_max = PAGE_SIZE; in axgbe_init_iflib_softc_ctx()
700 scctx->isc_tx_csum_flags = (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_SCTP | in axgbe_init_iflib_softc_ctx()
703 scctx->isc_capenable = (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 | in axgbe_init_iflib_softc_ctx()
708 scctx->isc_capabilities = scctx->isc_capenable; in axgbe_init_iflib_softc_ctx()
714 scctx->isc_rss_table_size = XGBE_RSS_MAX_TABLE_SIZE; in axgbe_init_iflib_softc_ctx()
716 scctx->isc_ntxqsets_max = XGBE_MAX_QUEUES; in axgbe_init_iflib_softc_ctx()
717 scctx->isc_nrxqsets_max = XGBE_MAX_QUEUES; in axgbe_init_iflib_softc_ctx()
719 scctx->isc_txrx = &axgbe_txrx; in axgbe_init_iflib_softc_ctx()
732 rss_getkey((uint8_t *)&pdata->rss_key); in axgbe_initialize_rss_mapping()
737 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1); in axgbe_initialize_rss_mapping()
739 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1); in axgbe_initialize_rss_mapping()
741 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1); in axgbe_initialize_rss_mapping()
743 arc4rand(&pdata->rss_key, ARRAY_SIZE(pdata->rss_key), 0); in axgbe_initialize_rss_mapping()
745 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1); in axgbe_initialize_rss_mapping()
746 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1); in axgbe_initialize_rss_mapping()
747 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1); in axgbe_initialize_rss_mapping()
753 qid = rss_get_indirection_to_bucket(i) % pdata->rx_ring_count; in axgbe_initialize_rss_mapping()
754 XGMAC_SET_BITS(pdata->rss_table[i], MAC_RSSDR, DMCH, qid); in axgbe_initialize_rss_mapping()
756 XGMAC_SET_BITS(pdata->rss_table[i], MAC_RSSDR, DMCH, in axgbe_initialize_rss_mapping()
757 i % pdata->rx_ring_count); in axgbe_initialize_rss_mapping()
767 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_alloc_channels()
771 DBGPR("%s: txqs %d rxqs %d\n", __func__, pdata->tx_ring_count, in axgbe_alloc_channels()
772 pdata->rx_ring_count); in axgbe_alloc_channels()
775 count = max_t(unsigned int, pdata->tx_ring_count, pdata->rx_ring_count); in axgbe_alloc_channels()
784 free(pdata->channel[j], M_AXGBE); in axgbe_alloc_channels()
785 pdata->channel[j] = NULL; in axgbe_alloc_channels()
790 pdata->channel[i] = channel; in axgbe_alloc_channels()
793 pdata->total_channel_count = count; in axgbe_alloc_channels()
794 DBGPR("Channel count set to: %u\n", pdata->total_channel_count); in axgbe_alloc_channels()
798 channel = pdata->channel[i]; in axgbe_alloc_channels()
799 snprintf(channel->name, sizeof(channel->name), "channel-%d",i); in axgbe_alloc_channels()
801 channel->pdata = pdata; in axgbe_alloc_channels()
802 channel->queue_index = i; in axgbe_alloc_channels()
803 channel->dma_tag = rman_get_bustag(pdata->xgmac_res); in axgbe_alloc_channels()
804 bus_space_subregion(channel->dma_tag, in axgbe_alloc_channels()
805 rman_get_bushandle(pdata->xgmac_res), in axgbe_alloc_channels()
807 &channel->dma_handle); in axgbe_alloc_channels()
808 channel->tx_ring = NULL; in axgbe_alloc_channels()
809 channel->rx_ring = NULL; in axgbe_alloc_channels()
818 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_free_channels()
821 for (i = 0; i < pdata->total_channel_count ; i++) { in axgbe_free_channels()
822 free(pdata->channel[i], M_AXGBE); in axgbe_free_channels()
823 pdata->channel[i] = NULL; in axgbe_free_channels()
826 pdata->total_channel_count = 0; in axgbe_free_channels()
827 pdata->channel_count = 0; in axgbe_free_channels()
838 prev_state = pdata->phy.link; in xgbe_service()
840 pdata->phy_if.phy_status(pdata); in xgbe_service()
842 if (prev_state != pdata->phy.link) { in xgbe_service()
843 pdata->phy_link = pdata->phy.link; in xgbe_service()
844 axgbe_if_update_admin_status(sc->ctx); in xgbe_service()
847 callout_reset(&pdata->service_timer, 1*hz, xgbe_service_timer, pdata); in xgbe_service()
855 taskqueue_enqueue(pdata->dev_workqueue, &pdata->service_work); in xgbe_service_timer()
861 callout_init(&pdata->service_timer, 1); in xgbe_init_timers()
867 callout_reset(&pdata->service_timer, 1*hz, xgbe_service_timer, pdata); in xgbe_start_timers()
873 callout_drain(&pdata->service_timer); in xgbe_stop_timers()
874 callout_stop(&pdata->service_timer); in xgbe_stop_timers()
894 axgbe_printf(1, "Auto-Neg Control Reg (%#06x) = %#06x\n", MDIO_CTRL1, in xgbe_dump_phy_registers()
896 axgbe_printf(1, "Auto-Neg Status Reg (%#06x) = %#06x\n", MDIO_STAT1, in xgbe_dump_phy_registers()
898 axgbe_printf(1, "Auto-Neg Ad Reg 1 (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
901 axgbe_printf(1, "Auto-Neg Ad Reg 2 (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
904 axgbe_printf(1, "Auto-Neg Ad Reg 3 (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
907 axgbe_printf(1, "Auto-Neg Completion Reg (%#06x) = %#06x\n", in xgbe_dump_phy_registers()
970 channel = pdata->channel[i]; in xgbe_dump_dma_registers()
1237 struct xgbe_mmc_stats *stats = &pdata->mmc_stats; in xgbe_dump_rmon_counters() local
1241 pdata->hw_if.read_mmc_stats(pdata); in xgbe_dump_rmon_counters()
1244 MMC_TXOCTETCOUNT_GB_LO, stats->txoctetcount_gb); in xgbe_dump_rmon_counters()
1246 MMC_TXFRAMECOUNT_GB_LO, stats->txframecount_gb); in xgbe_dump_rmon_counters()
1248 MMC_TXBROADCASTFRAMES_G_LO, stats->txbroadcastframes_g); in xgbe_dump_rmon_counters()
1250 MMC_TXMULTICASTFRAMES_G_LO, stats->txmulticastframes_g); in xgbe_dump_rmon_counters()
1252 MMC_TX64OCTETS_GB_LO, stats->tx64octets_gb); in xgbe_dump_rmon_counters()
1254 MMC_TX65TO127OCTETS_GB_LO, stats->tx65to127octets_gb); in xgbe_dump_rmon_counters()
1256 MMC_TX128TO255OCTETS_GB_LO, stats->tx128to255octets_gb); in xgbe_dump_rmon_counters()
1258 MMC_TX256TO511OCTETS_GB_LO, stats->tx256to511octets_gb); in xgbe_dump_rmon_counters()
1260 MMC_TX512TO1023OCTETS_GB_LO, stats->tx512to1023octets_gb); in xgbe_dump_rmon_counters()
1262 MMC_TX1024TOMAXOCTETS_GB_LO, stats->tx1024tomaxoctets_gb); in xgbe_dump_rmon_counters()
1264 MMC_TXUNICASTFRAMES_GB_LO, stats->txunicastframes_gb); in xgbe_dump_rmon_counters()
1266 MMC_TXMULTICASTFRAMES_GB_LO, stats->txmulticastframes_gb); in xgbe_dump_rmon_counters()
1268 MMC_TXBROADCASTFRAMES_GB_LO, stats->txbroadcastframes_gb); in xgbe_dump_rmon_counters()
1270 MMC_TXUNDERFLOWERROR_LO, stats->txunderflowerror); in xgbe_dump_rmon_counters()
1272 MMC_TXOCTETCOUNT_G_LO, stats->txoctetcount_g); in xgbe_dump_rmon_counters()
1274 MMC_TXFRAMECOUNT_G_LO, stats->txframecount_g); in xgbe_dump_rmon_counters()
1276 MMC_TXPAUSEFRAMES_LO, stats->txpauseframes); in xgbe_dump_rmon_counters()
1278 MMC_TXVLANFRAMES_G_LO, stats->txvlanframes_g); in xgbe_dump_rmon_counters()
1280 MMC_RXFRAMECOUNT_GB_LO, stats->rxframecount_gb); in xgbe_dump_rmon_counters()
1282 MMC_RXOCTETCOUNT_GB_LO, stats->rxoctetcount_gb); in xgbe_dump_rmon_counters()
1284 MMC_RXOCTETCOUNT_G_LO, stats->rxoctetcount_g); in xgbe_dump_rmon_counters()
1286 MMC_RXBROADCASTFRAMES_G_LO, stats->rxbroadcastframes_g); in xgbe_dump_rmon_counters()
1288 MMC_RXMULTICASTFRAMES_G_LO, stats->rxmulticastframes_g); in xgbe_dump_rmon_counters()
1290 MMC_RXCRCERROR_LO, stats->rxcrcerror); in xgbe_dump_rmon_counters()
1292 MMC_RXRUNTERROR, stats->rxrunterror); in xgbe_dump_rmon_counters()
1294 MMC_RXJABBERERROR, stats->rxjabbererror); in xgbe_dump_rmon_counters()
1296 MMC_RXUNDERSIZE_G, stats->rxundersize_g); in xgbe_dump_rmon_counters()
1298 MMC_RXOVERSIZE_G, stats->rxoversize_g); in xgbe_dump_rmon_counters()
1300 MMC_RX64OCTETS_GB_LO, stats->rx64octets_gb); in xgbe_dump_rmon_counters()
1302 MMC_RX65TO127OCTETS_GB_LO, stats->rx65to127octets_gb); in xgbe_dump_rmon_counters()
1304 MMC_RX128TO255OCTETS_GB_LO, stats->rx128to255octets_gb); in xgbe_dump_rmon_counters()
1306 MMC_RX256TO511OCTETS_GB_LO, stats->rx256to511octets_gb); in xgbe_dump_rmon_counters()
1308 MMC_RX512TO1023OCTETS_GB_LO, stats->rx512to1023octets_gb); in xgbe_dump_rmon_counters()
1310 MMC_RX1024TOMAXOCTETS_GB_LO, stats->rx1024tomaxoctets_gb); in xgbe_dump_rmon_counters()
1312 MMC_RXUNICASTFRAMES_G_LO, stats->rxunicastframes_g); in xgbe_dump_rmon_counters()
1314 MMC_RXLENGTHERROR_LO, stats->rxlengtherror); in xgbe_dump_rmon_counters()
1316 MMC_RXOUTOFRANGETYPE_LO, stats->rxoutofrangetype); in xgbe_dump_rmon_counters()
1318 MMC_RXPAUSEFRAMES_LO, stats->rxpauseframes); in xgbe_dump_rmon_counters()
1320 MMC_RXFIFOOVERFLOW_LO, stats->rxfifooverflow); in xgbe_dump_rmon_counters()
1322 MMC_RXVLANFRAMES_GB_LO, stats->rxvlanframes_gb); in xgbe_dump_rmon_counters()
1324 MMC_RXWATCHDOGERROR, stats->rxwatchdogerror); in xgbe_dump_rmon_counters()
1369 axgbe_printf(1, "vlans[%d]: 0x%08lx ", i, pdata->active_vlans[i]); in xgbe_dump_active_vlans()
1377 pdata->blen = DMA_SBMR_BLEN_64; in xgbe_default_config()
1378 pdata->pbl = DMA_PBL_128; in xgbe_default_config()
1379 pdata->aal = 1; in xgbe_default_config()
1380 pdata->rd_osr_limit = 8; in xgbe_default_config()
1381 pdata->wr_osr_limit = 8; in xgbe_default_config()
1382 pdata->tx_sf_mode = MTL_TSF_ENABLE; in xgbe_default_config()
1383 pdata->tx_threshold = MTL_TX_THRESHOLD_64; in xgbe_default_config()
1384 pdata->tx_osp_mode = DMA_OSP_ENABLE; in xgbe_default_config()
1385 pdata->rx_sf_mode = MTL_RSF_ENABLE; in xgbe_default_config()
1386 pdata->rx_threshold = MTL_RX_THRESHOLD_64; in xgbe_default_config()
1387 pdata->pause_autoneg = 1; in xgbe_default_config()
1388 pdata->phy_speed = SPEED_UNKNOWN; in xgbe_default_config()
1389 pdata->power_down = 0; in xgbe_default_config()
1390 pdata->enable_rss = 1; in xgbe_default_config()
1397 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_attach_post()
1398 if_t ifp = pdata->netdev; in axgbe_if_attach_post()
1399 struct xgbe_phy_if *phy_if = &pdata->phy_if; in axgbe_if_attach_post()
1400 struct xgbe_hw_if *hw_if = &pdata->hw_if; in axgbe_if_attach_post()
1401 if_softc_ctx_t scctx = sc->scctx; in axgbe_if_attach_post()
1405 pdata->sph_enable = axgbe_sph_enable; in axgbe_if_attach_post()
1408 pdata->tx_sec_period = ticks; in axgbe_if_attach_post()
1409 pdata->tx_ded_period = ticks; in axgbe_if_attach_post()
1410 pdata->rx_sec_period = ticks; in axgbe_if_attach_post()
1411 pdata->rx_ded_period = ticks; in axgbe_if_attach_post()
1412 pdata->desc_sec_period = ticks; in axgbe_if_attach_post()
1413 pdata->desc_ded_period = ticks; in axgbe_if_attach_post()
1416 ret = hw_if->exit(&sc->pdata); in axgbe_if_attach_post()
1426 if (!pdata->tx_max_fifo_size) in axgbe_if_attach_post()
1427 pdata->tx_max_fifo_size = pdata->hw_feat.tx_fifo_size; in axgbe_if_attach_post()
1428 if (!pdata->rx_max_fifo_size) in axgbe_if_attach_post()
1429 pdata->rx_max_fifo_size = pdata->hw_feat.rx_fifo_size; in axgbe_if_attach_post()
1432 pdata->tx_max_fifo_size, pdata->rx_max_fifo_size); in axgbe_if_attach_post()
1436 pdata->tx_desc_count = XGBE_TX_DESC_CNT; in axgbe_if_attach_post()
1438 pdata->rx_desc_count = XGBE_RX_DESC_CNT; in axgbe_if_attach_post()
1441 if (pdata->channel_irq_count) { in axgbe_if_attach_post()
1442 pdata->tx_ring_count = min_t(unsigned int, pdata->tx_ring_count, in axgbe_if_attach_post()
1443 pdata->channel_irq_count); in axgbe_if_attach_post()
1444 pdata->rx_ring_count = min_t(unsigned int, pdata->rx_ring_count, in axgbe_if_attach_post()
1445 pdata->channel_irq_count); in axgbe_if_attach_post()
1448 pdata->tx_ring_count, pdata->tx_q_count, in axgbe_if_attach_post()
1449 pdata->rx_ring_count, pdata->rx_q_count); in axgbe_if_attach_post()
1453 pdata->channel_count = max_t(unsigned int, scctx->isc_ntxqsets, in axgbe_if_attach_post()
1454 scctx->isc_nrxqsets); in axgbe_if_attach_post()
1455 DBGPR("Channel count set to: %u\n", pdata->channel_count); in axgbe_if_attach_post()
1460 pdata->sysctl_an_cdr_workaround = pdata->vdata->an_cdr_workaround; in axgbe_if_attach_post()
1461 phy_if->phy_init(pdata); in axgbe_if_attach_post()
1464 xgbe_init_rx_coalesce(&sc->pdata); in axgbe_if_attach_post()
1465 xgbe_init_tx_coalesce(&sc->pdata); in axgbe_if_attach_post()
1467 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_KR, 0, NULL); in axgbe_if_attach_post()
1468 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_T, 0, NULL); in axgbe_if_attach_post()
1469 ifmedia_add(sc->media, IFM_ETHER | IFM_10G_SFI, 0, NULL); in axgbe_if_attach_post()
1470 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_KX, 0, NULL); in axgbe_if_attach_post()
1471 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_CX, 0, NULL); in axgbe_if_attach_post()
1472 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_LX, 0, NULL); in axgbe_if_attach_post()
1473 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_SX, 0, NULL); in axgbe_if_attach_post()
1474 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_T, 0, NULL); in axgbe_if_attach_post()
1475 ifmedia_add(sc->media, IFM_ETHER | IFM_1000_SGMII, 0, NULL); in axgbe_if_attach_post()
1476 ifmedia_add(sc->media, IFM_ETHER | IFM_100_TX, 0, NULL); in axgbe_if_attach_post()
1477 ifmedia_add(sc->media, IFM_ETHER | IFM_100_SGMII, 0, NULL); in axgbe_if_attach_post()
1478 ifmedia_add(sc->media, IFM_ETHER | IFM_AUTO, 0, NULL); in axgbe_if_attach_post()
1479 ifmedia_set(sc->media, IFM_ETHER | IFM_AUTO); in axgbe_if_attach_post()
1482 pdata->phy_link = -1; in axgbe_if_attach_post()
1483 pdata->phy_speed = SPEED_UNKNOWN; in axgbe_if_attach_post()
1484 ret = phy_if->phy_reset(pdata); in axgbe_if_attach_post()
1489 ret = xgbe_calc_rx_buf_size(pdata->netdev, if_getmtu(pdata->netdev)); in axgbe_if_attach_post()
1490 pdata->rx_buf_size = ret; in axgbe_if_attach_post()
1498 set_bit(XGBE_DOWN, &pdata->dev_state); in axgbe_if_attach_post()
1501 scctx->isc_max_frame_size = if_getmtu(ifp) + 18; in axgbe_if_attach_post()
1502 scctx->isc_min_frame_size = XGMAC_MIN_PACKET; in axgbe_if_attach_post()
1514 bus_teardown_intr(pdata->dev, res, tag); in xgbe_free_intr()
1517 bus_release_resource(pdata->dev, SYS_RES_IRQ, rid, res); in xgbe_free_intr()
1524 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_interrupts_free()
1525 if_softc_ctx_t scctx = sc->scctx; in axgbe_interrupts_free()
1530 axgbe_printf(2, "%s: mode %d\n", __func__, scctx->isc_intr); in axgbe_interrupts_free()
1533 iflib_irq_free(ctx, &pdata->dev_irq); in axgbe_interrupts_free()
1536 xgbe_free_intr(pdata, pdata->ecc_irq_res, pdata->ecc_irq_tag, in axgbe_interrupts_free()
1537 pdata->ecc_rid); in axgbe_interrupts_free()
1540 xgbe_free_intr(pdata, pdata->i2c_irq_res, pdata->i2c_irq_tag, in axgbe_interrupts_free()
1541 pdata->i2c_rid); in axgbe_interrupts_free()
1544 xgbe_free_intr(pdata, pdata->an_irq_res, pdata->an_irq_tag, in axgbe_interrupts_free()
1545 pdata->an_rid); in axgbe_interrupts_free()
1547 for (i = 0; i < scctx->isc_nrxqsets; i++) { in axgbe_interrupts_free()
1549 channel = pdata->channel[i]; in axgbe_interrupts_free()
1550 axgbe_printf(2, "%s: rid %d\n", __func__, channel->dma_irq_rid); in axgbe_interrupts_free()
1551 irq.ii_res = channel->dma_irq_res; in axgbe_interrupts_free()
1552 irq.ii_tag = channel->dma_irq_tag; in axgbe_interrupts_free()
1561 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_detach()
1562 struct xgbe_phy_if *phy_if = &pdata->phy_if; in axgbe_if_detach()
1565 mac_res[0] = pdata->xgmac_res; in axgbe_if_detach()
1566 mac_res[1] = pdata->xpcs_res; in axgbe_if_detach()
1568 phy_if->phy_stop(pdata); in axgbe_if_detach()
1569 phy_if->phy_exit(pdata); in axgbe_if_detach()
1575 taskqueue_free(pdata->dev_workqueue); in axgbe_if_detach()
1581 free(pdata->active_vlans, M_AXGBE); in axgbe_if_detach()
1591 struct xgbe_phy_if *phy_if = &pdata->phy_if; in axgbe_pci_init()
1592 struct xgbe_hw_if *hw_if = &pdata->hw_if; in axgbe_pci_init()
1595 if (!__predict_false((test_bit(XGBE_DOWN, &pdata->dev_state)))) { in axgbe_pci_init()
1600 hw_if->init(pdata); in axgbe_pci_init()
1602 ret = phy_if->phy_start(pdata); in axgbe_pci_init()
1605 ret = hw_if->exit(pdata); in axgbe_pci_init()
1611 hw_if->enable_tx(pdata); in axgbe_pci_init()
1612 hw_if->enable_rx(pdata); in axgbe_pci_init()
1616 clear_bit(XGBE_DOWN, &pdata->dev_state); in axgbe_pci_init()
1620 xgbe_dump_dma_registers(pdata, -1); in axgbe_pci_init()
1630 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_init()
1639 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_pci_stop()
1640 struct xgbe_hw_if *hw_if = &pdata->hw_if; in axgbe_pci_stop()
1643 if (__predict_false(test_bit(XGBE_DOWN, &pdata->dev_state))) { in axgbe_pci_stop()
1649 taskqueue_drain_all(pdata->dev_workqueue); in axgbe_pci_stop()
1651 hw_if->disable_tx(pdata); in axgbe_pci_stop()
1652 hw_if->disable_rx(pdata); in axgbe_pci_stop()
1654 ret = hw_if->exit(pdata); in axgbe_pci_stop()
1658 set_bit(XGBE_DOWN, &pdata->dev_state); in axgbe_pci_stop()
1670 /* TODO - implement */ in axgbe_if_disable_intr()
1676 /* TODO - implement */ in axgbe_if_enable_intr()
1680 axgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *va, uint64_t *pa, int ntxqs, in axgbe_if_tx_queues_alloc() argument
1684 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_tx_queues_alloc()
1685 if_softc_ctx_t scctx = sc->scctx; in axgbe_if_tx_queues_alloc()
1690 MPASS(scctx->isc_ntxqsets > 0); in axgbe_if_tx_queues_alloc()
1691 MPASS(scctx->isc_ntxqsets == ntxqsets); in axgbe_if_tx_queues_alloc()
1695 scctx->isc_ntxqsets, ntxqsets, ntxqs); in axgbe_if_tx_queues_alloc()
1699 channel = pdata->channel[i]; in axgbe_if_tx_queues_alloc()
1709 channel->tx_ring = tx_ring; in axgbe_if_tx_queues_alloc()
1712 tx_ring->rdata = in axgbe_if_tx_queues_alloc()
1713 (struct xgbe_ring_data*)malloc(scctx->isc_ntxd[j] * in axgbe_if_tx_queues_alloc()
1717 tx_ring->rdesc = (struct xgbe_ring_desc *)va[i*ntxqs + j]; in axgbe_if_tx_queues_alloc()
1718 tx_ring->rdesc_paddr = pa[i*ntxqs + j]; in axgbe_if_tx_queues_alloc()
1719 tx_ring->rdesc_count = scctx->isc_ntxd[j]; in axgbe_if_tx_queues_alloc()
1720 spin_lock_init(&tx_ring->lock); in axgbe_if_tx_queues_alloc()
1724 axgbe_printf(1, "allocated for %d tx queues\n", scctx->isc_ntxqsets); in axgbe_if_tx_queues_alloc()
1732 channel = pdata->channel[j]; in axgbe_if_tx_queues_alloc()
1734 tx_ring = channel->tx_ring; in axgbe_if_tx_queues_alloc()
1736 if (tx_ring && tx_ring->rdata) in axgbe_if_tx_queues_alloc()
1737 free(tx_ring->rdata, M_AXGBE); in axgbe_if_tx_queues_alloc()
1739 free(channel->tx_ring, M_AXGBE); in axgbe_if_tx_queues_alloc()
1741 channel->tx_ring = NULL; in axgbe_if_tx_queues_alloc()
1749 axgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *va, uint64_t *pa, int nrxqs, in axgbe_if_rx_queues_alloc() argument
1753 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_rx_queues_alloc()
1754 if_softc_ctx_t scctx = sc->scctx; in axgbe_if_rx_queues_alloc()
1759 MPASS(scctx->isc_nrxqsets > 0); in axgbe_if_rx_queues_alloc()
1760 MPASS(scctx->isc_nrxqsets == nrxqsets); in axgbe_if_rx_queues_alloc()
1761 if (!pdata->sph_enable) { in axgbe_if_rx_queues_alloc()
1768 scctx->isc_nrxqsets, nrxqsets, nrxqs); in axgbe_if_rx_queues_alloc()
1772 channel = pdata->channel[i]; in axgbe_if_rx_queues_alloc()
1782 channel->rx_ring = rx_ring; in axgbe_if_rx_queues_alloc()
1785 rx_ring->rdata = in axgbe_if_rx_queues_alloc()
1786 (struct xgbe_ring_data*)malloc(scctx->isc_nrxd[j] * in axgbe_if_rx_queues_alloc()
1790 rx_ring->rdesc = (struct xgbe_ring_desc *)va[i*nrxqs + j]; in axgbe_if_rx_queues_alloc()
1791 rx_ring->rdesc_paddr = pa[i*nrxqs + j]; in axgbe_if_rx_queues_alloc()
1792 rx_ring->rdesc_count = scctx->isc_nrxd[j]; in axgbe_if_rx_queues_alloc()
1793 spin_lock_init(&rx_ring->lock); in axgbe_if_rx_queues_alloc()
1797 axgbe_printf(2, "allocated for %d rx queues\n", scctx->isc_nrxqsets); in axgbe_if_rx_queues_alloc()
1805 channel = pdata->channel[j]; in axgbe_if_rx_queues_alloc()
1807 rx_ring = channel->rx_ring; in axgbe_if_rx_queues_alloc()
1809 if (rx_ring && rx_ring->rdata) in axgbe_if_rx_queues_alloc()
1810 free(rx_ring->rdata, M_AXGBE); in axgbe_if_rx_queues_alloc()
1812 free(channel->rx_ring, M_AXGBE); in axgbe_if_rx_queues_alloc()
1814 channel->rx_ring = NULL; in axgbe_if_rx_queues_alloc()
1825 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_queues_free()
1826 if_softc_ctx_t scctx = sc->scctx; in axgbe_if_queues_free()
1827 if_shared_ctx_t sctx = sc->sctx; in axgbe_if_queues_free()
1833 for (i = 0 ; i < scctx->isc_ntxqsets; i++) { in axgbe_if_queues_free()
1835 channel = pdata->channel[i]; in axgbe_if_queues_free()
1837 tx_ring = channel->tx_ring; in axgbe_if_queues_free()
1838 for (j = 0; j < sctx->isc_ntxqs ; j++, tx_ring++) { in axgbe_if_queues_free()
1839 if (tx_ring && tx_ring->rdata) in axgbe_if_queues_free()
1840 free(tx_ring->rdata, M_AXGBE); in axgbe_if_queues_free()
1842 free(channel->tx_ring, M_AXGBE); in axgbe_if_queues_free()
1843 channel->tx_ring = NULL; in axgbe_if_queues_free()
1846 for (i = 0 ; i < scctx->isc_nrxqsets; i++) { in axgbe_if_queues_free()
1848 channel = pdata->channel[i]; in axgbe_if_queues_free()
1850 rx_ring = channel->rx_ring; in axgbe_if_queues_free()
1851 for (j = 0; j < sctx->isc_nrxqs ; j++, rx_ring++) { in axgbe_if_queues_free()
1852 if (rx_ring && rx_ring->rdata) in axgbe_if_queues_free()
1853 free(rx_ring->rdata, M_AXGBE); in axgbe_if_queues_free()
1855 free(channel->rx_ring, M_AXGBE); in axgbe_if_queues_free()
1856 channel->rx_ring = NULL; in axgbe_if_queues_free()
1866 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_vlan_register()
1867 struct xgbe_hw_if *hw_if = &pdata->hw_if; in axgbe_if_vlan_register()
1869 if (!bit_test(pdata->active_vlans, vtag)) { in axgbe_if_vlan_register()
1872 bit_set(pdata->active_vlans, vtag); in axgbe_if_vlan_register()
1873 hw_if->update_vlan_hash_table(pdata); in axgbe_if_vlan_register()
1874 pdata->num_active_vlans++; in axgbe_if_vlan_register()
1877 pdata->num_active_vlans); in axgbe_if_vlan_register()
1888 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_vlan_unregister()
1889 struct xgbe_hw_if *hw_if = &pdata->hw_if; in axgbe_if_vlan_unregister()
1891 if (pdata->num_active_vlans == 0) { in axgbe_if_vlan_unregister()
1896 if (bit_test(pdata->active_vlans, vtag)){ in axgbe_if_vlan_unregister()
1897 axgbe_printf(0, "Un-Registering VLAN %d\n", vtag); in axgbe_if_vlan_unregister()
1899 bit_clear(pdata->active_vlans, vtag); in axgbe_if_vlan_unregister()
1900 hw_if->update_vlan_hash_table(pdata); in axgbe_if_vlan_unregister()
1901 pdata->num_active_vlans--; in axgbe_if_vlan_unregister()
1904 pdata->num_active_vlans); in axgbe_if_vlan_unregister()
1927 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_msix_intr_assign()
1928 if_softc_ctx_t scctx = sc->scctx; in axgbe_if_msix_intr_assign()
1934 MPASS(scctx->isc_intr != IFLIB_INTR_LEGACY); in axgbe_if_msix_intr_assign()
1936 pdata->isr_as_tasklet = 1; in axgbe_if_msix_intr_assign()
1938 if (scctx->isc_intr == IFLIB_INTR_MSI) { in axgbe_if_msix_intr_assign()
1939 pdata->irq_count = 1; in axgbe_if_msix_intr_assign()
1940 pdata->channel_irq_count = 1; in axgbe_if_msix_intr_assign()
1945 scctx->isc_ntxqsets, scctx->isc_nrxqsets); in axgbe_if_msix_intr_assign()
1951 error = iflib_irq_alloc_generic(ctx, &pdata->dev_irq, rid, in axgbe_if_msix_intr_assign()
1961 pdata->ecc_rid = rid; in axgbe_if_msix_intr_assign()
1962 pdata->ecc_irq_res = bus_alloc_resource_any(pdata->dev, SYS_RES_IRQ, in axgbe_if_msix_intr_assign()
1964 if (!pdata->ecc_irq_res) { in axgbe_if_msix_intr_assign()
1970 error = bus_setup_intr(pdata->dev, pdata->ecc_irq_res, INTR_MPSAFE | in axgbe_if_msix_intr_assign()
1971 INTR_TYPE_NET, NULL, axgbe_ecc_isr, sc, &pdata->ecc_irq_tag); in axgbe_if_msix_intr_assign()
1980 pdata->i2c_rid = rid; in axgbe_if_msix_intr_assign()
1981 pdata->i2c_irq_res = bus_alloc_resource_any(pdata->dev, SYS_RES_IRQ, in axgbe_if_msix_intr_assign()
1983 if (!pdata->i2c_irq_res) { in axgbe_if_msix_intr_assign()
1989 error = bus_setup_intr(pdata->dev, pdata->i2c_irq_res, INTR_MPSAFE | in axgbe_if_msix_intr_assign()
1990 INTR_TYPE_NET, NULL, axgbe_i2c_isr, sc, &pdata->i2c_irq_tag); in axgbe_if_msix_intr_assign()
1999 pdata->an_rid = rid; in axgbe_if_msix_intr_assign()
2000 pdata->an_irq_res = bus_alloc_resource_any(pdata->dev, SYS_RES_IRQ, in axgbe_if_msix_intr_assign()
2002 if (!pdata->an_irq_res) { in axgbe_if_msix_intr_assign()
2008 error = bus_setup_intr(pdata->dev, pdata->an_irq_res, INTR_MPSAFE | in axgbe_if_msix_intr_assign()
2009 INTR_TYPE_NET, NULL, axgbe_an_isr, sc, &pdata->an_irq_tag); in axgbe_if_msix_intr_assign()
2016 pdata->per_channel_irq = 1; in axgbe_if_msix_intr_assign()
2017 pdata->channel_irq_mode = XGBE_IRQ_MODE_LEVEL; in axgbe_if_msix_intr_assign()
2019 for (i = 0; i < scctx->isc_nrxqsets; i++, rid++) { in axgbe_if_msix_intr_assign()
2021 channel = pdata->channel[i]; in axgbe_if_msix_intr_assign()
2025 axgbe_msix_que, channel, channel->queue_index, buf); in axgbe_if_msix_intr_assign()
2033 channel->dma_irq_rid = rid; in axgbe_if_msix_intr_assign()
2034 channel->dma_irq_res = irq.ii_res; in axgbe_if_msix_intr_assign()
2035 channel->dma_irq_tag = irq.ii_tag; in axgbe_if_msix_intr_assign()
2037 __func__, scctx->isc_nrxqsets, i, rid); in axgbe_if_msix_intr_assign()
2039 pdata->irq_count = msix; in axgbe_if_msix_intr_assign()
2040 pdata->channel_irq_count = scctx->isc_nrxqsets; in axgbe_if_msix_intr_assign()
2042 for (i = 0; i < scctx->isc_ntxqsets; i++) { in axgbe_if_msix_intr_assign()
2044 channel = pdata->channel[i]; in axgbe_if_msix_intr_assign()
2047 irq.ii_res = channel->dma_irq_res; in axgbe_if_msix_intr_assign()
2049 channel->queue_index, buf); in axgbe_if_msix_intr_assign()
2058 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_enable_rx_tx_int()
2061 if (channel->tx_ring && channel->rx_ring) in xgbe_enable_rx_tx_int()
2063 else if (channel->tx_ring) in xgbe_enable_rx_tx_int()
2065 else if (channel->rx_ring) in xgbe_enable_rx_tx_int()
2068 return (-1); in xgbe_enable_rx_tx_int()
2071 __func__, channel->queue_index, int_id); in xgbe_enable_rx_tx_int()
2072 return (hw_if->enable_int(channel, int_id)); in xgbe_enable_rx_tx_int()
2078 struct xgbe_hw_if *hw_if = &pdata->hw_if; in xgbe_disable_rx_tx_int()
2081 if (channel->tx_ring && channel->rx_ring) in xgbe_disable_rx_tx_int()
2083 else if (channel->tx_ring) in xgbe_disable_rx_tx_int()
2085 else if (channel->rx_ring) in xgbe_disable_rx_tx_int()
2091 __func__, channel->queue_index, int_id); in xgbe_disable_rx_tx_int()
2092 hw_if->disable_int(channel, int_id); in xgbe_disable_rx_tx_int()
2100 for (i = 0; i < pdata->channel_count; i++) in xgbe_disable_rx_tx_ints()
2101 xgbe_disable_rx_tx_int(pdata, pdata->channel[i]); in xgbe_disable_rx_tx_ints()
2108 struct xgbe_prv_data *pdata = channel->pdata; in axgbe_msix_que()
2112 __func__, channel->queue_index, in axgbe_msix_que()
2137 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_dev_isr()
2139 struct xgbe_hw_if *hw_if = &pdata->hw_if; in axgbe_dev_isr()
2150 for (i = 0; i < pdata->channel_count; i++) { in axgbe_dev_isr()
2155 channel = pdata->channel[i]; in axgbe_dev_isr()
2159 channel->queue_index, dma_ch_isr, XGMAC_DMA_IOREAD(channel, in axgbe_dev_isr()
2167 if (!pdata->per_channel_irq && in axgbe_dev_isr()
2185 pdata->ext_stats.rx_buffer_unavailable++; in axgbe_dev_isr()
2204 hw_if->tx_mmc_int(pdata); in axgbe_dev_isr()
2207 hw_if->rx_mmc_int(pdata); in axgbe_dev_isr()
2227 sc->pdata.i2c_if.i2c_isr(&sc->pdata); in axgbe_i2c_isr()
2233 /* TODO - implement */ in axgbe_ecc_isr()
2241 sc->pdata.phy_if.an_isr(&sc->pdata); in axgbe_an_isr()
2248 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_tx_queue_intr_enable()
2251 if (qid < pdata->tx_q_count) { in axgbe_if_tx_queue_intr_enable()
2252 ret = xgbe_enable_rx_tx_int(pdata, pdata->channel[qid]); in axgbe_if_tx_queue_intr_enable()
2267 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_rx_queue_intr_enable()
2270 if (qid < pdata->rx_q_count) { in axgbe_if_rx_queue_intr_enable()
2271 ret = xgbe_enable_rx_tx_int(pdata, pdata->channel[qid]); in axgbe_if_rx_queue_intr_enable()
2286 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_update_admin_status()
2289 pdata->phy_link, sc->link_status, pdata->phy.speed); in axgbe_if_update_admin_status()
2291 if (pdata->phy_link < 0) in axgbe_if_update_admin_status()
2294 if (pdata->phy_link) { in axgbe_if_update_admin_status()
2295 if (sc->link_status == LINK_STATE_DOWN) { in axgbe_if_update_admin_status()
2296 sc->link_status = LINK_STATE_UP; in axgbe_if_update_admin_status()
2297 if (pdata->phy.speed & SPEED_10000) in axgbe_if_update_admin_status()
2300 else if (pdata->phy.speed & SPEED_2500) in axgbe_if_update_admin_status()
2303 else if (pdata->phy.speed & SPEED_1000) in axgbe_if_update_admin_status()
2306 else if (pdata->phy.speed & SPEED_100) in axgbe_if_update_admin_status()
2309 else if (pdata->phy.speed & SPEED_10) in axgbe_if_update_admin_status()
2314 if (sc->link_status == LINK_STATE_UP) { in axgbe_if_update_admin_status()
2315 sc->link_status = LINK_STATE_DOWN; in axgbe_if_update_admin_status()
2327 sx_xlock(&sc->pdata.an_mutex); in axgbe_if_media_change()
2328 if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) in axgbe_if_media_change()
2331 switch (IFM_SUBTYPE(ifm->ifm_media)) { in axgbe_if_media_change()
2333 sc->pdata.phy.speed = SPEED_10000; in axgbe_if_media_change()
2334 sc->pdata.phy.autoneg = AUTONEG_DISABLE; in axgbe_if_media_change()
2337 sc->pdata.phy.speed = SPEED_2500; in axgbe_if_media_change()
2338 sc->pdata.phy.autoneg = AUTONEG_DISABLE; in axgbe_if_media_change()
2341 sc->pdata.phy.speed = SPEED_1000; in axgbe_if_media_change()
2342 sc->pdata.phy.autoneg = AUTONEG_DISABLE; in axgbe_if_media_change()
2345 sc->pdata.phy.speed = SPEED_100; in axgbe_if_media_change()
2346 sc->pdata.phy.autoneg = AUTONEG_DISABLE; in axgbe_if_media_change()
2349 sc->pdata.phy.autoneg = AUTONEG_ENABLE; in axgbe_if_media_change()
2352 sx_xunlock(&sc->pdata.an_mutex); in axgbe_if_media_change()
2354 return (-sc->pdata.phy_if.phy_config_aneg(&sc->pdata)); in axgbe_if_media_change()
2361 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_promisc_set()
2362 if_t ifp = pdata->netdev; in axgbe_if_promisc_set()
2404 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_get_counter()
2405 struct xgbe_mmc_stats *pstats = &pdata->mmc_stats; in axgbe_if_get_counter()
2407 pdata->hw_if.read_mmc_stats(pdata); in axgbe_if_get_counter()
2411 return (pstats->rxframecount_gb); in axgbe_if_get_counter()
2413 return (pstats->rxframecount_gb - pstats->rxbroadcastframes_g - in axgbe_if_get_counter()
2414 pstats->rxmulticastframes_g - pstats->rxunicastframes_g); in axgbe_if_get_counter()
2416 return (pstats->txframecount_gb); in axgbe_if_get_counter()
2418 return (pstats->txframecount_gb - pstats->txframecount_g); in axgbe_if_get_counter()
2420 return (pstats->rxoctetcount_gb); in axgbe_if_get_counter()
2422 return (pstats->txoctetcount_gb); in axgbe_if_get_counter()
2432 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_mtu_set()
2438 ret = xgbe_calc_rx_buf_size(pdata->netdev, mtu); in axgbe_if_mtu_set()
2439 pdata->rx_buf_size = ret; in axgbe_if_mtu_set()
2442 sc->scctx->isc_max_frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; in axgbe_if_mtu_set()
2450 struct xgbe_prv_data *pdata = &sc->pdata; in axgbe_if_media_status()
2452 ifmr->ifm_status = IFM_AVALID; in axgbe_if_media_status()
2453 if (!sc->pdata.phy.link) in axgbe_if_media_status()
2456 ifmr->ifm_active = IFM_ETHER; in axgbe_if_media_status()
2457 ifmr->ifm_status |= IFM_ACTIVE; in axgbe_if_media_status()
2459 axgbe_printf(1, "Speed 0x%x Mode %d\n", sc->pdata.phy.speed, in axgbe_if_media_status()
2460 pdata->phy_if.phy_impl.cur_mode(pdata)); in axgbe_if_media_status()
2461 pdata->phy_if.phy_impl.get_type(pdata, ifmr); in axgbe_if_media_status()
2463 ifmr->ifm_active |= IFM_FDX; in axgbe_if_media_status()
2464 ifmr->ifm_active |= IFM_ETH_TXPAUSE; in axgbe_if_media_status()
2465 ifmr->ifm_active |= IFM_ETH_RXPAUSE; in axgbe_if_media_status()