Skip to contentSkip to conversation

phydev: Add sysctl variable for polling interval of phy

PATCH New EUNBONG SONG 1 participant 1 message Mar 10, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phydev: Add sysctl variable for polling interval of phy

Quoted 2 lines

From d55a22be52e5a768409aa0999d6636cdfc369676 Mon Sep 17 00:00:00 2001

From: eunbonsong <[email protected]>
Date: Sun, 10 Mar 2013 04:57:39 -0700
Subject: [PATCH] phydev: Add sysctl variable for polling interval of phy state

This adds a dev.phy.phy_poll_interval sysctl variable. This value is represented in milliseconds. And phy_state_machine() is scheduled as this variable.
I think HZ is enough for PC. But sometimes especially in network devices
such as switches,routers, needs more granularity for detecting phy state change.

---
 drivers/net/phy/phy.c        |    4 +++-
 drivers/net/phy/phy_device.c |   43 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/phy.h          |    1 -
 3 files changed, 46 insertions(+), 2 deletions(-)
drivers/net/phy/phy.c +3 -1
index ef9ea92..126a69f 100644
@@ -42,6 +42,8 @@
 #include <asm/irq.h>
 #include <asm/uaccess.h>
 
+extern unsigned long sysctl_phy_poll_interval;
+
 /**
  * phy_print_status - Convenience function to print out the current phy status
  * @phydev: the phy_device struct
@@ -966,7 +968,7 @@ void phy_state_machine(struct work_struct *work)
        if (err < 0)
                phy_error(phydev);
 
-       schedule_delayed_work(&phydev->state_queue, PHY_STATE_TIME * HZ);
+       schedule_delayed_work(&phydev->state_queue, msecs_to_jiffies(sysctl_phy_poll_interval));
 }
 
 static inline void mmd_phy_indirect(struct mii_bus *bus, int prtad, int devad,
drivers/net/phy/phy_device.c +43 -0

67 lines not on this page · raw message

include/linux/phy.h +0 -1
index 33999ad..0cbc1fe 100644
@@ -68,7 +68,6 @@ typedef enum {
 
 
 #define PHY_INIT_TIMEOUT       100000
-#define PHY_STATE_TIME         1
 #define PHY_FORCE_TIMEOUT      10
 #define PHY_AN_TIMEOUT         10
 
Signature · 2 lines
1.7.10.4
�淸�{.n�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m����띠�◀?뻀�