On Thu, 2007-12-27 at 10:39 -0500, Robin Getz wrote:
> On Thu 27 Dec 2007 01:21, Bryan Wu pondered:
> > > I guess the question is how often are we polling the phy? It is every 
> second, 
> > > or every packet?
> > > 
> > 
> > A phy_timer will start to do some phy state machine control. Every
> > second, timer handler will be called. And I did some test, every second
> > the mdio_poll function will be called 8 times.
> > 
> > PHY control is no related with packet transmission, IMO.
> 
> If the phy & PHYLIB supports interrupt - why are we polling?
> 
> On the BF537-STAMP, the PHYINT is connected to PH6/MII_PHYINT. 
> 
> In the SMSC Phy driver, it sets up:
> 
> #define MII_LAN83C185_ISF_INT4 (1<<4) /* Link Down */
> #define MII_LAN83C185_ISF_INT6 (1<<6) /* Auto-Negotiation complete */
> 
> #define MII_LAN83C185_ISF_INT_PHYLIB_EVENTS \
>         (MII_LAN83C185_ISF_INT6 | MII_LAN83C185_ISF_INT4)
> 
> Which is all we need - isn't it? (be notified when someone unplugs the wire, 
> or when someone plugs it in).
> 
> So - I guess I understand the busy loop during the phy read/write - this 
> looks 
> like the right/only way to do it.
> 

OK, I am trying to do the profiling with your fancy Perl script, -:)).

> The question I have now - is what are we polling for every second? and can't 
> this be done with an interrupt?
> 

The phy_lib can support PHY_INT. I will update the code.
But even thought we enable the PHY_INT, the phy_timer is still there.
phy_timer controls a PHY state machine, which can be changed by upper
level application.

And the PHY interrupt handler only change the phydev->state to
ChangeLink, further state machine control is still in phy_timer.
drivers/net/phy/phy.c
phy_change()
---
        spin_lock(&phydev->lock);
        if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK ==
phydev->state))
                phydev->state = PHY_CHANGELINK;
        spin_unlock(&phydev->lock);
---

I guess, the reason we use phy_timer is the interrupt from PHY does not
indicate all link change event and different PHY device hardware has
different interrupt meaning. So phy_timer polls for generice abstraction
usage.

Thanks
-Bryan
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to