Re: Struct net_device

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

 



On Mon, Sep 13, 2010 at 8:26 AM, Tushar Dadlani <tush726@xxxxxxxxx> wrote:
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.

You can access all "net_dev"s in the kernel by using the macro for_each_netdev or any of its variants if thats what you intended to ask.

The following variants of for_each_netdev macros is defined in include/linux/netdevice.h in the kernel source tree

1226#define for_each_netdev(net, d) \

1227                list_for_each_entry(d, &(net)->dev_base_head, dev_list)
1228#define for_each_netdev_reverse(net, d) \
1229                list_for_each_entry_reverse(d, &(net)->dev_base_head, dev_list)
1230#define for_each_netdev_rcu(net, d)             \
1231                list_for_each_entry_rcu(d, &(net)->dev_base_head, dev_list)
1232#define for_each_netdev_safe(net, d, n) \
1233                list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list)
1234#define for_each_netdev_continue(net, d)                \
1235                list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
1236#define for_each_netdev_continue_rcu(net, d)            \ 
1237 list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) 

Venkatram Tummala 
--
Tushar Dadlani
Manipal Institute of Technology
+919986292434

--
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