Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phy: qcom: qca808x: Support PHY counter

Enable CRC checking for received and transmitted frames, and configure
counters to clear after being read within config_init() for accurate
counter recording. Additionally, add PHY counter operations and integrate
shared functions.

Signed-off-by: Luo Jie <quic_luoj@quicinc.com>
Link: https://patch.msgid.link/20250715-qcom_phy_counter-v3-2-8b0e460a527b@quicinc.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Luo Jie and committed by
Jakub Kicinski
3370e33a 22bf4bd8

+23
+23
drivers/net/phy/qcom/qca808x.c
··· 93 93 94 94 struct qca808x_priv { 95 95 int led_polarity_mode; 96 + struct qcom_phy_hw_stats hw_stats; 96 97 }; 97 98 98 99 static int qca808x_phy_fast_retrain_config(struct phy_device *phydev) ··· 243 242 } 244 243 245 244 qca808x_fill_possible_interfaces(phydev); 245 + 246 + ret = qcom_phy_counter_config(phydev); 247 + if (ret) 248 + return ret; 246 249 247 250 /* Configure adc threshold as 100mv for the link 10M */ 248 251 return at803x_debug_reg_mask(phydev, QCA808X_PHY_DEBUG_ADC_THRESHOLD, ··· 627 622 active_low ? 0 : QCA808X_LED_ACTIVE_HIGH); 628 623 } 629 624 625 + static int qca808x_update_stats(struct phy_device *phydev) 626 + { 627 + struct qca808x_priv *priv = phydev->priv; 628 + 629 + return qcom_phy_update_stats(phydev, &priv->hw_stats); 630 + } 631 + 632 + static void qca808x_get_phy_stats(struct phy_device *phydev, 633 + struct ethtool_eth_phy_stats *eth_stats, 634 + struct ethtool_phy_stats *stats) 635 + { 636 + struct qca808x_priv *priv = phydev->priv; 637 + 638 + qcom_phy_get_stats(stats, priv->hw_stats); 639 + } 640 + 630 641 static struct phy_driver qca808x_driver[] = { 631 642 { 632 643 /* Qualcomm QCA8081 */ ··· 672 651 .led_hw_control_set = qca808x_led_hw_control_set, 673 652 .led_hw_control_get = qca808x_led_hw_control_get, 674 653 .led_polarity_set = qca808x_led_polarity_set, 654 + .update_stats = qca808x_update_stats, 655 + .get_phy_stats = qca808x_get_phy_stats, 675 656 }, }; 676 657 677 658 module_phy_driver(qca808x_driver);