Lines Matching +full:eee +full:- +full:pcs
1 // SPDX-License-Identifier: GPL-2.0-only
5 Copyright (C) 2007-2009 STMicroelectronics Ltd
98 /* EEE */
130 /* PCS */
306 if (priv->plat->has_gmac || priv->plat->has_gmac4) in stmmac_ethtool_getdrvinfo()
307 strscpy(info->driver, GMAC_ETHTOOL_NAME, sizeof(info->driver)); in stmmac_ethtool_getdrvinfo()
308 else if (priv->plat->has_xgmac) in stmmac_ethtool_getdrvinfo()
309 strscpy(info->driver, XGMAC_ETHTOOL_NAME, sizeof(info->driver)); in stmmac_ethtool_getdrvinfo()
311 strscpy(info->driver, MAC100_ETHTOOL_NAME, in stmmac_ethtool_getdrvinfo()
312 sizeof(info->driver)); in stmmac_ethtool_getdrvinfo()
314 if (priv->plat->pdev) { in stmmac_ethtool_getdrvinfo()
315 strscpy(info->bus_info, pci_name(priv->plat->pdev), in stmmac_ethtool_getdrvinfo()
316 sizeof(info->bus_info)); in stmmac_ethtool_getdrvinfo()
325 if (!(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS) && in stmmac_ethtool_get_link_ksettings()
326 (priv->hw->pcs & STMMAC_PCS_RGMII || in stmmac_ethtool_get_link_ksettings()
327 priv->hw->pcs & STMMAC_PCS_SGMII)) { in stmmac_ethtool_get_link_ksettings()
331 if (!priv->xstats.pcs_link) { in stmmac_ethtool_get_link_ksettings()
332 cmd->base.speed = SPEED_UNKNOWN; in stmmac_ethtool_get_link_ksettings()
333 cmd->base.duplex = DUPLEX_UNKNOWN; in stmmac_ethtool_get_link_ksettings()
336 cmd->base.duplex = priv->xstats.pcs_duplex; in stmmac_ethtool_get_link_ksettings()
338 cmd->base.speed = priv->xstats.pcs_speed; in stmmac_ethtool_get_link_ksettings()
341 if (stmmac_pcs_get_adv_lp(priv, priv->ioaddr, &adv)) in stmmac_ethtool_get_link_ksettings()
342 return -EOPNOTSUPP; /* should never happen indeed */ in stmmac_ethtool_get_link_ksettings()
347 &supported, cmd->link_modes.supported); in stmmac_ethtool_get_link_ksettings()
349 &advertising, cmd->link_modes.advertising); in stmmac_ethtool_get_link_ksettings()
351 &lp_advertising, cmd->link_modes.lp_advertising); in stmmac_ethtool_get_link_ksettings()
363 cmd->base.autoneg = ADVERTISED_Autoneg; in stmmac_ethtool_get_link_ksettings()
391 cmd->base.port = PORT_OTHER; in stmmac_ethtool_get_link_ksettings()
394 cmd->link_modes.supported, supported); in stmmac_ethtool_get_link_ksettings()
396 cmd->link_modes.advertising, advertising); in stmmac_ethtool_get_link_ksettings()
398 cmd->link_modes.lp_advertising, lp_advertising); in stmmac_ethtool_get_link_ksettings()
403 return phylink_ethtool_ksettings_get(priv->phylink, cmd); in stmmac_ethtool_get_link_ksettings()
412 if (!(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS) && in stmmac_ethtool_set_link_ksettings()
413 (priv->hw->pcs & STMMAC_PCS_RGMII || in stmmac_ethtool_set_link_ksettings()
414 priv->hw->pcs & STMMAC_PCS_SGMII)) { in stmmac_ethtool_set_link_ksettings()
416 if (cmd->base.autoneg != AUTONEG_ENABLE) in stmmac_ethtool_set_link_ksettings()
417 return -EINVAL; in stmmac_ethtool_set_link_ksettings()
419 mutex_lock(&priv->lock); in stmmac_ethtool_set_link_ksettings()
420 stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, priv->hw->ps, 0); in stmmac_ethtool_set_link_ksettings()
421 mutex_unlock(&priv->lock); in stmmac_ethtool_set_link_ksettings()
426 return phylink_ethtool_ksettings_set(priv->phylink, cmd); in stmmac_ethtool_set_link_ksettings()
432 return priv->msg_enable; in stmmac_ethtool_getmsglevel()
438 priv->msg_enable = level; in stmmac_ethtool_setmsglevel()
446 if (priv->plat->has_xgmac) in stmmac_ethtool_get_regs_len()
448 else if (priv->plat->has_gmac4) in stmmac_ethtool_get_regs_len()
459 stmmac_dump_mac_regs(priv, priv->hw, reg_space); in stmmac_ethtool_gregs()
460 stmmac_dump_dma_regs(priv, priv->ioaddr, reg_space); in stmmac_ethtool_gregs()
463 if (priv->plat->has_gmac4) { in stmmac_ethtool_gregs()
468 } else if (!priv->plat->has_xgmac) { in stmmac_ethtool_gregs()
479 return phylink_ethtool_nway_reset(priv->phylink); in stmmac_nway_reset()
489 ring->rx_max_pending = DMA_MAX_RX_SIZE; in stmmac_get_ringparam()
490 ring->tx_max_pending = DMA_MAX_TX_SIZE; in stmmac_get_ringparam()
491 ring->rx_pending = priv->dma_conf.dma_rx_size; in stmmac_get_ringparam()
492 ring->tx_pending = priv->dma_conf.dma_tx_size; in stmmac_get_ringparam()
500 if (ring->rx_mini_pending || ring->rx_jumbo_pending || in stmmac_set_ringparam()
501 ring->rx_pending < DMA_MIN_RX_SIZE || in stmmac_set_ringparam()
502 ring->rx_pending > DMA_MAX_RX_SIZE || in stmmac_set_ringparam()
503 !is_power_of_2(ring->rx_pending) || in stmmac_set_ringparam()
504 ring->tx_pending < DMA_MIN_TX_SIZE || in stmmac_set_ringparam()
505 ring->tx_pending > DMA_MAX_TX_SIZE || in stmmac_set_ringparam()
506 !is_power_of_2(ring->tx_pending)) in stmmac_set_ringparam()
507 return -EINVAL; in stmmac_set_ringparam()
509 return stmmac_reinit_ringparam(netdev, ring->rx_pending, in stmmac_set_ringparam()
510 ring->tx_pending); in stmmac_set_ringparam()
520 if (priv->hw->pcs && !stmmac_pcs_get_adv_lp(priv, priv->ioaddr, &adv_lp)) { in stmmac_get_pauseparam()
521 pause->autoneg = 1; in stmmac_get_pauseparam()
525 phylink_ethtool_get_pauseparam(priv->phylink, pause); in stmmac_get_pauseparam()
536 if (priv->hw->pcs && !stmmac_pcs_get_adv_lp(priv, priv->ioaddr, &adv_lp)) { in stmmac_set_pauseparam()
537 pause->autoneg = 1; in stmmac_set_pauseparam()
539 return -EOPNOTSUPP; in stmmac_set_pauseparam()
542 return phylink_ethtool_set_pauseparam(priv->phylink, pause); in stmmac_set_pauseparam()
557 pcpu = per_cpu_ptr(priv->xstats.pcpu_stats, cpu); in stmmac_get_rx_normal_irq_n()
559 start = u64_stats_fetch_begin(&pcpu->syncp); in stmmac_get_rx_normal_irq_n()
560 irq_n = u64_stats_read(&pcpu->rx_normal_irq_n[q]); in stmmac_get_rx_normal_irq_n()
561 } while (u64_stats_fetch_retry(&pcpu->syncp, start)); in stmmac_get_rx_normal_irq_n()
578 pcpu = per_cpu_ptr(priv->xstats.pcpu_stats, cpu); in stmmac_get_tx_normal_irq_n()
580 start = u64_stats_fetch_begin(&pcpu->syncp); in stmmac_get_tx_normal_irq_n()
581 irq_n = u64_stats_read(&pcpu->tx_normal_irq_n[q]); in stmmac_get_tx_normal_irq_n()
582 } while (u64_stats_fetch_retry(&pcpu->syncp, start)); in stmmac_get_tx_normal_irq_n()
590 u32 tx_cnt = priv->plat->tx_queues_to_use; in stmmac_get_per_qstats()
591 u32 rx_cnt = priv->plat->rx_queues_to_use; in stmmac_get_per_qstats()
596 struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[q]; in stmmac_get_per_qstats()
600 start = u64_stats_fetch_begin(&txq_stats->napi_syncp); in stmmac_get_per_qstats()
601 pkt_n = u64_stats_read(&txq_stats->napi.tx_pkt_n); in stmmac_get_per_qstats()
602 } while (u64_stats_fetch_retry(&txq_stats->napi_syncp, start)); in stmmac_get_per_qstats()
609 struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[q]; in stmmac_get_per_qstats()
613 start = u64_stats_fetch_begin(&rxq_stats->napi_syncp); in stmmac_get_per_qstats()
614 pkt_n = u64_stats_read(&rxq_stats->napi.rx_pkt_n); in stmmac_get_per_qstats()
615 } while (u64_stats_fetch_retry(&rxq_stats->napi_syncp, start)); in stmmac_get_per_qstats()
626 u32 rx_queues_count = priv->plat->rx_queues_to_use; in stmmac_get_ethtool_stats()
627 u32 tx_queues_count = priv->plat->tx_queues_to_use; in stmmac_get_ethtool_stats()
633 if (priv->dma_cap.asp) { in stmmac_get_ethtool_stats()
635 if (!stmmac_safety_feat_dump(priv, &priv->sstats, i, in stmmac_get_ethtool_stats()
642 ret = stmmac_dma_diagnostic_fr(priv, &priv->xstats, priv->ioaddr); in stmmac_get_ethtool_stats()
645 if (priv->dma_cap.rmon) { in stmmac_get_ethtool_stats()
646 stmmac_mmc_read(priv, priv->mmcaddr, &priv->mmc); in stmmac_get_ethtool_stats()
657 if (priv->eee_enabled) { in stmmac_get_ethtool_stats()
658 int val = phylink_get_eee_err(priv->phylink); in stmmac_get_ethtool_stats()
660 priv->xstats.phy_eee_wakeup_error_n = val; in stmmac_get_ethtool_stats()
663 if (priv->synopsys_id >= DWMAC_CORE_3_50) in stmmac_get_ethtool_stats()
664 stmmac_mac_debug(priv, priv->ioaddr, in stmmac_get_ethtool_stats()
665 (void *)&priv->xstats, in stmmac_get_ethtool_stats()
676 struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[i]; in stmmac_get_ethtool_stats()
682 start = u64_stats_fetch_begin(&rxq_stats->napi_syncp); in stmmac_get_ethtool_stats()
683 snapshot = rxq_stats->napi; in stmmac_get_ethtool_stats()
684 } while (u64_stats_fetch_retry(&rxq_stats->napi_syncp, start)); in stmmac_get_ethtool_stats()
695 struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[i]; in stmmac_get_ethtool_stats()
702 start = u64_stats_fetch_begin(&txq_stats->q_syncp); in stmmac_get_ethtool_stats()
703 q_snapshot = txq_stats->q; in stmmac_get_ethtool_stats()
704 } while (u64_stats_fetch_retry(&txq_stats->q_syncp, start)); in stmmac_get_ethtool_stats()
706 start = u64_stats_fetch_begin(&txq_stats->napi_syncp); in stmmac_get_ethtool_stats()
707 napi_snapshot = txq_stats->napi; in stmmac_get_ethtool_stats()
708 } while (u64_stats_fetch_retry(&txq_stats->napi_syncp, start)); in stmmac_get_ethtool_stats()
721 normal_irq_n += priv->xstats.rx_early_irq; in stmmac_get_ethtool_stats()
731 u32 tx_cnt = priv->plat->tx_queues_to_use; in stmmac_get_sset_count()
732 u32 rx_cnt = priv->plat->rx_queues_to_use; in stmmac_get_sset_count()
741 if (priv->dma_cap.rmon) in stmmac_get_sset_count()
743 if (priv->dma_cap.asp) { in stmmac_get_sset_count()
746 &priv->sstats, i, in stmmac_get_sset_count()
758 return -EOPNOTSUPP; in stmmac_get_sset_count()
764 u32 tx_cnt = priv->plat->tx_queues_to_use; in stmmac_get_qstats_string()
765 u32 rx_cnt = priv->plat->rx_queues_to_use; in stmmac_get_qstats_string()
792 if (priv->dma_cap.asp) { in stmmac_get_strings()
796 &priv->sstats, i, in stmmac_get_strings()
803 if (priv->dma_cap.rmon) in stmmac_get_strings()
833 if (!priv->plat->pmt) in stmmac_get_wol()
834 return phylink_ethtool_get_wol(priv->phylink, wol); in stmmac_get_wol()
836 mutex_lock(&priv->lock); in stmmac_get_wol()
837 if (device_can_wakeup(priv->device)) { in stmmac_get_wol()
838 wol->supported = WAKE_MAGIC | WAKE_UCAST; in stmmac_get_wol()
839 if (priv->hw_cap_support && !priv->dma_cap.pmt_magic_frame) in stmmac_get_wol()
840 wol->supported &= ~WAKE_MAGIC; in stmmac_get_wol()
841 wol->wolopts = priv->wolopts; in stmmac_get_wol()
843 mutex_unlock(&priv->lock); in stmmac_get_wol()
851 if (!device_can_wakeup(priv->device)) in stmmac_set_wol()
852 return -EOPNOTSUPP; in stmmac_set_wol()
854 if (!priv->plat->pmt) { in stmmac_set_wol()
855 int ret = phylink_ethtool_set_wol(priv->phylink, wol); in stmmac_set_wol()
858 device_set_wakeup_enable(priv->device, !!wol->wolopts); in stmmac_set_wol()
865 if ((priv->hw_cap_support) && (!priv->dma_cap.pmt_magic_frame)) in stmmac_set_wol()
866 wol->wolopts &= ~WAKE_MAGIC; in stmmac_set_wol()
868 if (wol->wolopts & ~support) in stmmac_set_wol()
869 return -EINVAL; in stmmac_set_wol()
871 if (wol->wolopts) { in stmmac_set_wol()
873 device_set_wakeup_enable(priv->device, 1); in stmmac_set_wol()
875 if (priv->wol_irq_disabled) in stmmac_set_wol()
876 enable_irq_wake(priv->wol_irq); in stmmac_set_wol()
877 priv->wol_irq_disabled = false; in stmmac_set_wol()
879 device_set_wakeup_enable(priv->device, 0); in stmmac_set_wol()
881 if (!priv->wol_irq_disabled) in stmmac_set_wol()
882 disable_irq_wake(priv->wol_irq); in stmmac_set_wol()
883 priv->wol_irq_disabled = true; in stmmac_set_wol()
886 mutex_lock(&priv->lock); in stmmac_set_wol()
887 priv->wolopts = wol->wolopts; in stmmac_set_wol()
888 mutex_unlock(&priv->lock); in stmmac_set_wol()
898 if (!priv->dma_cap.eee) in stmmac_ethtool_op_get_eee()
899 return -EOPNOTSUPP; in stmmac_ethtool_op_get_eee()
901 edata->tx_lpi_timer = priv->tx_lpi_timer; in stmmac_ethtool_op_get_eee()
902 edata->tx_lpi_enabled = priv->tx_lpi_enabled; in stmmac_ethtool_op_get_eee()
904 return phylink_ethtool_get_eee(priv->phylink, edata); in stmmac_ethtool_op_get_eee()
913 if (!priv->dma_cap.eee) in stmmac_ethtool_op_set_eee()
914 return -EOPNOTSUPP; in stmmac_ethtool_op_set_eee()
916 if (priv->tx_lpi_enabled != edata->tx_lpi_enabled) in stmmac_ethtool_op_set_eee()
917 netdev_warn(priv->dev, in stmmac_ethtool_op_set_eee()
918 "Setting EEE tx-lpi is not supported\n"); in stmmac_ethtool_op_set_eee()
920 if (!edata->eee_enabled) in stmmac_ethtool_op_set_eee()
923 ret = phylink_ethtool_set_eee(priv->phylink, edata); in stmmac_ethtool_op_set_eee()
927 if (edata->eee_enabled && in stmmac_ethtool_op_set_eee()
928 priv->tx_lpi_timer != edata->tx_lpi_timer) { in stmmac_ethtool_op_set_eee()
929 priv->tx_lpi_timer = edata->tx_lpi_timer; in stmmac_ethtool_op_set_eee()
938 unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); in stmmac_usec2riwt()
941 clk = priv->plat->clk_ref_rate; in stmmac_usec2riwt()
951 unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); in stmmac_riwt2usec()
954 clk = priv->plat->clk_ref_rate; in stmmac_riwt2usec()
971 rx_cnt = priv->plat->rx_queues_to_use; in __stmmac_get_coalesce()
972 tx_cnt = priv->plat->tx_queues_to_use; in __stmmac_get_coalesce()
978 return -EINVAL; in __stmmac_get_coalesce()
981 ec->tx_coalesce_usecs = priv->tx_coal_timer[queue]; in __stmmac_get_coalesce()
982 ec->tx_max_coalesced_frames = priv->tx_coal_frames[queue]; in __stmmac_get_coalesce()
984 ec->tx_coalesce_usecs = 0; in __stmmac_get_coalesce()
985 ec->tx_max_coalesced_frames = 0; in __stmmac_get_coalesce()
988 if (priv->use_riwt && queue < rx_cnt) { in __stmmac_get_coalesce()
989 ec->rx_max_coalesced_frames = priv->rx_coal_frames[queue]; in __stmmac_get_coalesce()
990 ec->rx_coalesce_usecs = stmmac_riwt2usec(priv->rx_riwt[queue], in __stmmac_get_coalesce()
993 ec->rx_max_coalesced_frames = 0; in __stmmac_get_coalesce()
994 ec->rx_coalesce_usecs = 0; in __stmmac_get_coalesce()
1005 return __stmmac_get_coalesce(dev, ec, -1); in stmmac_get_coalesce()
1025 rx_cnt = priv->plat->rx_queues_to_use; in __stmmac_set_coalesce()
1026 tx_cnt = priv->plat->tx_queues_to_use; in __stmmac_set_coalesce()
1032 return -EINVAL; in __stmmac_set_coalesce()
1034 if (priv->use_riwt) { in __stmmac_set_coalesce()
1035 rx_riwt = stmmac_usec2riwt(ec->rx_coalesce_usecs, priv); in __stmmac_set_coalesce()
1038 return -EINVAL; in __stmmac_set_coalesce()
1044 priv->rx_riwt[i] = rx_riwt; in __stmmac_set_coalesce()
1045 stmmac_rx_watchdog(priv, priv->ioaddr, in __stmmac_set_coalesce()
1047 priv->rx_coal_frames[i] = in __stmmac_set_coalesce()
1048 ec->rx_max_coalesced_frames; in __stmmac_set_coalesce()
1051 priv->rx_riwt[queue] = rx_riwt; in __stmmac_set_coalesce()
1052 stmmac_rx_watchdog(priv, priv->ioaddr, in __stmmac_set_coalesce()
1054 priv->rx_coal_frames[queue] = in __stmmac_set_coalesce()
1055 ec->rx_max_coalesced_frames; in __stmmac_set_coalesce()
1059 if ((ec->tx_coalesce_usecs == 0) && in __stmmac_set_coalesce()
1060 (ec->tx_max_coalesced_frames == 0)) in __stmmac_set_coalesce()
1061 return -EINVAL; in __stmmac_set_coalesce()
1063 if ((ec->tx_coalesce_usecs > STMMAC_MAX_COAL_TX_TICK) || in __stmmac_set_coalesce()
1064 (ec->tx_max_coalesced_frames > STMMAC_TX_MAX_FRAMES)) in __stmmac_set_coalesce()
1065 return -EINVAL; in __stmmac_set_coalesce()
1071 priv->tx_coal_frames[i] = in __stmmac_set_coalesce()
1072 ec->tx_max_coalesced_frames; in __stmmac_set_coalesce()
1073 priv->tx_coal_timer[i] = in __stmmac_set_coalesce()
1074 ec->tx_coalesce_usecs; in __stmmac_set_coalesce()
1077 priv->tx_coal_frames[queue] = in __stmmac_set_coalesce()
1078 ec->tx_max_coalesced_frames; in __stmmac_set_coalesce()
1079 priv->tx_coal_timer[queue] = in __stmmac_set_coalesce()
1080 ec->tx_coalesce_usecs; in __stmmac_set_coalesce()
1091 return __stmmac_set_coalesce(dev, ec, -1); in stmmac_set_coalesce()
1105 switch (rxnfc->cmd) { in stmmac_get_rxnfc()
1107 rxnfc->data = priv->plat->rx_queues_to_use; in stmmac_get_rxnfc()
1110 return -EOPNOTSUPP; in stmmac_get_rxnfc()
1120 return sizeof(priv->rss.key); in stmmac_get_rxfh_key_size()
1127 return ARRAY_SIZE(priv->rss.table); in stmmac_get_rxfh_indir_size()
1136 if (rxfh->indir) { in stmmac_get_rxfh()
1137 for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++) in stmmac_get_rxfh()
1138 rxfh->indir[i] = priv->rss.table[i]; in stmmac_get_rxfh()
1141 if (rxfh->key) in stmmac_get_rxfh()
1142 memcpy(rxfh->key, priv->rss.key, sizeof(priv->rss.key)); in stmmac_get_rxfh()
1143 rxfh->hfunc = ETH_RSS_HASH_TOP; in stmmac_get_rxfh()
1155 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in stmmac_set_rxfh()
1156 rxfh->hfunc != ETH_RSS_HASH_TOP) in stmmac_set_rxfh()
1157 return -EOPNOTSUPP; in stmmac_set_rxfh()
1159 if (rxfh->indir) { in stmmac_set_rxfh()
1160 for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++) in stmmac_set_rxfh()
1161 priv->rss.table[i] = rxfh->indir[i]; in stmmac_set_rxfh()
1164 if (rxfh->key) in stmmac_set_rxfh()
1165 memcpy(priv->rss.key, rxfh->key, sizeof(priv->rss.key)); in stmmac_set_rxfh()
1167 return stmmac_rss_configure(priv, priv->hw, &priv->rss, in stmmac_set_rxfh()
1168 priv->plat->rx_queues_to_use); in stmmac_set_rxfh()
1176 chan->rx_count = priv->plat->rx_queues_to_use; in stmmac_get_channels()
1177 chan->tx_count = priv->plat->tx_queues_to_use; in stmmac_get_channels()
1178 chan->max_rx = priv->dma_cap.number_rx_queues; in stmmac_get_channels()
1179 chan->max_tx = priv->dma_cap.number_tx_queues; in stmmac_get_channels()
1187 if (chan->rx_count > priv->dma_cap.number_rx_queues || in stmmac_set_channels()
1188 chan->tx_count > priv->dma_cap.number_tx_queues || in stmmac_set_channels()
1189 !chan->rx_count || !chan->tx_count) in stmmac_set_channels()
1190 return -EINVAL; in stmmac_set_channels()
1192 return stmmac_reinit_queues(dev, chan->rx_count, chan->tx_count); in stmmac_set_channels()
1200 if ((priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) { in stmmac_get_ts_info()
1202 info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | in stmmac_get_ts_info()
1207 if (priv->ptp_clock) in stmmac_get_ts_info()
1208 info->phc_index = ptp_clock_index(priv->ptp_clock); in stmmac_get_ts_info()
1210 info->phc_index = 0; in stmmac_get_ts_info()
1212 info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON); in stmmac_get_ts_info()
1214 info->rx_filters = ((1 << HWTSTAMP_FILTER_NONE) | in stmmac_get_ts_info()
1236 switch (tuna->id) { in stmmac_get_tunable()
1238 *(u32 *)data = priv->rx_copybreak; in stmmac_get_tunable()
1241 ret = -EINVAL; in stmmac_get_tunable()
1255 switch (tuna->id) { in stmmac_set_tunable()
1257 priv->rx_copybreak = *(u32 *)data; in stmmac_set_tunable()
1260 ret = -EINVAL; in stmmac_set_tunable()
1274 if (!priv->dma_cap.fpesel) in stmmac_get_mm()
1275 return -EOPNOTSUPP; in stmmac_get_mm()
1277 spin_lock_irqsave(&priv->fpe_cfg.lock, flags); in stmmac_get_mm()
1279 state->max_verify_time = STMMAC_FPE_MM_MAX_VERIFY_TIME_MS; in stmmac_get_mm()
1280 state->verify_enabled = priv->fpe_cfg.verify_enabled; in stmmac_get_mm()
1281 state->pmac_enabled = priv->fpe_cfg.pmac_enabled; in stmmac_get_mm()
1282 state->verify_time = priv->fpe_cfg.verify_time; in stmmac_get_mm()
1283 state->tx_enabled = priv->fpe_cfg.tx_enabled; in stmmac_get_mm()
1284 state->verify_status = priv->fpe_cfg.status; in stmmac_get_mm()
1285 state->rx_min_frag_size = ETH_ZLEN; in stmmac_get_mm()
1290 if (state->tx_enabled && in stmmac_get_mm()
1291 (state->verify_status == ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED || in stmmac_get_mm()
1292 state->verify_status == ETHTOOL_MM_VERIFY_STATUS_DISABLED)) in stmmac_get_mm()
1293 state->tx_active = true; in stmmac_get_mm()
1295 state->tx_active = false; in stmmac_get_mm()
1297 frag_size = stmmac_fpe_get_add_frag_size(priv, priv->ioaddr); in stmmac_get_mm()
1298 state->tx_min_frag_size = ethtool_mm_frag_size_add_to_min(frag_size); in stmmac_get_mm()
1300 spin_unlock_irqrestore(&priv->fpe_cfg.lock, flags); in stmmac_get_mm()
1309 struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; in stmmac_set_mm()
1314 err = ethtool_mm_frag_size_min_to_add(cfg->tx_min_frag_size, in stmmac_set_mm()
1320 timer_shutdown_sync(&fpe_cfg->verify_timer); in stmmac_set_mm()
1322 spin_lock_irqsave(&fpe_cfg->lock, flags); in stmmac_set_mm()
1324 fpe_cfg->verify_enabled = cfg->verify_enabled; in stmmac_set_mm()
1325 fpe_cfg->pmac_enabled = cfg->pmac_enabled; in stmmac_set_mm()
1326 fpe_cfg->verify_time = cfg->verify_time; in stmmac_set_mm()
1327 fpe_cfg->tx_enabled = cfg->tx_enabled; in stmmac_set_mm()
1329 if (!cfg->verify_enabled) in stmmac_set_mm()
1330 fpe_cfg->status = ETHTOOL_MM_VERIFY_STATUS_DISABLED; in stmmac_set_mm()
1332 stmmac_fpe_set_add_frag_size(priv, priv->ioaddr, frag_size); in stmmac_set_mm()
1335 spin_unlock_irqrestore(&fpe_cfg->lock, flags); in stmmac_set_mm()
1344 struct stmmac_counters *mmc = &priv->mmc; in stmmac_get_mm_stats()
1346 if (!priv->dma_cap.rmon) in stmmac_get_mm_stats()
1349 stmmac_mmc_read(priv, priv->mmcaddr, mmc); in stmmac_get_mm_stats()
1351 s->MACMergeFrameAssErrorCount = mmc->mmc_rx_packet_assembly_err_cntr; in stmmac_get_mm_stats()
1352 s->MACMergeFrameAssOkCount = mmc->mmc_rx_packet_assembly_ok_cntr; in stmmac_get_mm_stats()
1353 s->MACMergeFrameSmdErrorCount = mmc->mmc_rx_packet_smd_err_cntr; in stmmac_get_mm_stats()
1354 s->MACMergeFragCountRx = mmc->mmc_rx_fpe_fragment_cntr; in stmmac_get_mm_stats()
1355 s->MACMergeFragCountTx = mmc->mmc_tx_fpe_fragment_cntr; in stmmac_get_mm_stats()
1356 s->MACMergeHoldCount = mmc->mmc_tx_hold_req_cntr; in stmmac_get_mm_stats()
1404 netdev->ethtool_ops = &stmmac_ethtool_ops; in stmmac_set_ethtool_ops()