This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Re: How to get Ethernet link status?


You may also be able to use the SIOCGIFSTATS socket ioctl to retrieve the
eth_stats (struct ether_drv_stats) structure.  You can get the speed from
the speed member and the duplex from the duplex member.  Not all ethernet
drivers support the SIOCGIFSTATS ioctl.

Jay

-----Original Message-----
From: Gary Thomas [mailto:gary@mlbassoc.com]
Sent: Wednesday, December 17, 2008 9:47 AM
To: Kelvin Lawson
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] Re: How to get Ethernet link status?


Kelvin Lawson wrote:
> Hi Grant,
> 
>> What is the official method used to get the link status of an
>> interface (up/down, 10/100/1000, full/half duplex)?
>>
>> I don't see any hooks in the Ethernet driver API.  Are drivers
>> supposed to export that info as global variables somehow?  Are
>> they supposed to provide a global function to call?
> 
> A standard way of doing this would be to use the ioctl SIOCGETIFMEDIA,
> and check the IFM_AVALID and IFM_ACTIVE flags in the IFM status returned.
> 
> We did this by adding a new query "ETH_DRV_GET_MEDIA_STATUS" in the
> ethernet driver control function (xxx_control()) and adding support for
> SIOCGIFMEDIA in eth_drv_ioctl().

Can you share this code?  It's probably worth putting into
the mainline.

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]