On Tue, Nov 25, 2008 at 2:17 PM, Paraneetharan Chandrasekaran <
[EMAIL PROTECTED]> wrote:

>
> Hi,           Thank you. But my intention is getting statistics in user
> space through ethtool. The ethtool_interfaces like get_ethtool_stats,
> get_drvinfo etc are in kernel space. If call the Ioctl with ETHTOOL_GSTATS,
> I dont know how to parse the returned data. What is the format of the
> returned statistics?  is there any format which all the drivers support?
>

 Return foramat is of a type struct  ethtool_stats (defined inside kernel
header  file include/linux/ethtool.h).
Unfortunately in user space you do not have such a header file available,
hence you should redifine those structure inside your code.

Just go through ethtool source code , it will really help you.
"http://www.sfr-fresh.com/linux/misc/ethtool-6.tar.gz/";
(Ethtool defines all the necessary structures like ethtool_stats inside
ethtool-copy.h file.)

Thanks,
Pranav

Thanks,
Pranav

>
> Thank you
> Paraneetharan C
>
> 2008/11/25 Pranav Sawargaonkar <[EMAIL PROTECTED]>
>
>
>>
>> On Tue, Nov 18, 2008 at 7:30 PM, Paraneetharan Chandrasekaran <
>> [EMAIL PROTECTED]> wrote:
>>
>>> Hi All,
>>> I am writing an user space application which gets the statistics from
>>> the NIC drivers. To do this, I am using Ethtool ioctl with Ioctl
>>> command SIOCETHTOOL and with ethtool command ETHTOOL_GSTATS along with
>>> the address of struct ethtool_stats variable. My question is:
>>>
>>> What would be the format of the statistics copied from the kernel
>>> space (to the address pointed by the data field of struct
>>> ethtool_stats) ?
>>>
>>> Do all the drivers implement the same data format when they copy the
>>> statistics to user space in response to this Ethtool ioctl?
>>>
>>> If not, how can I know what format used by the driver I am working on
>>> ( I am working on  Atheros driver)?
>>>
>>
>> You can get driver info from ethtool's get_drvinfo option.
>> Hence you can put a check in your application for a particular(like Intel
>> and Broadcom ) driver.
>>
>> Thanks,
>> Pranav
>>
>>>
>>> Thanks in advance,
>>> Paraneetharan C
>>>
>>> --
>>> To unsubscribe from this list: send an email with
>>> "unsubscribe kernelnewbies" to [EMAIL PROTECTED]
>>> Please read the FAQ at http://kernelnewbies.org/FAQ
>>>
>>>
>>
>

Reply via email to