Re: Detecting state of iBook gmac ethernet
>Benjamin Herrenschmidt wrote:
>>Michel Lanners wrote:
>> > mods by BenH to make the GMAC driver compatible with ethtool
>> > and/or miitool.
>>Not gmac, but sungem, which will replace gmac soon.
>>However, there is a problem with using such tools. For power
>>management reasons, I shut down the chip when the interface is
>>closed (gmac) or a couple of seconds after it is closed (sungem).
>>So you can't use ethtool to get the link state.
>If "closing the interface" means doing something equivalent to
>"ifconfig eth0 down", then it should not be a problem at all. I have
>given this a little thought, and the argument runs as follows:
Yes, the chip is shut down when you ifconfig eth0 down.
>If there is mains power, then it is no trouble to keep the ethernet
>link powered up (in the sense of ifconfig eth0 up). If there is
>no mains power, then you would want to power it down anyway, so
>autodetection is not going to be possible without first turning
>everything back on anyway, and this is only a minor inconvenience
>requiring a small script which runs every so often, at the cost
>of using only a little precious energy, if this behaviour is
>desired. Moreover, usually, the important detection times would
>be in some reasonable period of time after the power source or
>sleep state changes anyway.
>Of course, if my assumption is wrong, I will need to do a little
>rethinking, and in extreme cases, some hacking.
No, it's ok. All you need is to leave the "unused" interface with
an unroutable IP (or no IP if possible) and remove all it's routes.