RE: Struct net_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-
> bounce@xxxxxxxxxxxx] On Behalf Of Tushar Dadlani
> Sent: Monday, September 13, 2010 8:56 PM
> To: kernelnewbies@xxxxxxxxxxxx
> Subject: Struct net_device
> 
> Hi ,
> 
> I wanted to know how do I use eth0 from kernel space. How do i get
> the
> information of running struct net_device references??
> 
> I wanted to capture the stats on eth0 from kernel space.
> 

I am really not sure what is required here. Please see if below info.
helps (not an expert comment, though :)).
You can get the netdev struct of the interface by name: 

struct net_device *netdev = dev_get_by_name("eth0"); // when
netdev->name is eth0.
struct e1000_adapter *adapter = netdev_priv(netdev); // obtain the
adapter.

And you also can take a look at e1000_ethtool.c to obtain the stats for
each interface using the adapter.
Hope it helps.

> --
> Tushar Dadlani
> Manipal Institute of Technology
> +919986292434
> 

--
Thanks,
Nilesh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux