struct net_device — The DEVICE structure. Actually, this whole structure is a big mistake. It mixes I/O data with strictly “high-level” data, and it has to know about almost every data structure used in the INET module.
struct net_device {
char name[IFNAMSIZ];
struct hlist_node name_hlist;
char * ifalias;
unsigned long mem_end;
unsigned long mem_start;
unsigned long base_addr;
int irq;
atomic_t carrier_changes;
unsigned long state;
struct list_head dev_list;
struct list_head napi_list;
struct list_head unreg_list;
struct list_head close_list;
struct list_head ptype_all;
struct list_head ptype_specific;
struct {unnamed_struct};
#if IS_ENABLED(CONFIG_GARP)
struct garp_port __rcu * garp_port;
#endif
#if IS_ENABLED(CONFIG_MRP)
struct mrp_port __rcu * mrp_port;
#endif
struct device dev;
const struct attribute_group * sysfs_groups[4];
const struct attribute_group * sysfs_rx_queue_group;
const struct rtnl_link_ops * rtnl_link_ops;
#define GSO_MAX_SIZE 65536
unsigned int gso_max_size;
#define GSO_MAX_SEGS 65535
u16 gso_max_segs;
#ifdef CONFIG_DCB
const struct dcbnl_rtnl_ops * dcbnl_ops;
#endif
u8 num_tc;
struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
u8 prio_tc_map[TC_BITMASK + 1];
#if IS_ENABLED(CONFIG_FCOE)
unsigned int fcoe_ddp_xid;
#endif
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
struct netprio_map __rcu * priomap;
#endif
struct phy_device * phydev;
struct lock_class_key * qdisc_tx_busylock;
struct lock_class_key * qdisc_running_key;
bool proto_down;
}; char name[IFNAMSIZ]This is the first field of the “visible” part of this structure (i.e. as seen by users in the “Space.c” file). It is the name of the interface.
struct hlist_node name_hlistDevice name hash chain, please keep it close to name[]
char * ifaliasSNMP alias
unsigned long mem_endShared memory end
unsigned long mem_startShared memory start
unsigned long base_addrDevice I/O address
int irqDevice IRQ number
atomic_t carrier_changesStats to monitor carrier on<->off transitions
unsigned long stateGeneric network queuing layer state, see netdev_state_t
struct list_head dev_listThe global list of network devices
struct list_head napi_listList entry used for polling NAPI devices
struct list_head unreg_listList entry when we are unregistering the device; see the function unregister_netdev
struct list_head close_listList entry used when we are closing the device
struct list_head ptype_allDevice-specific packet handlers for all protocols
struct list_head ptype_specificDevice-specific, protocol-specific packet handlers
struct {unnamed_struct}anonymous
struct garp_port __rcu * garp_portGARP
struct mrp_port __rcu * mrp_portMRP
struct device devClass/net/name entry
const struct attribute_group * sysfs_groups[4]Space for optional device, statistics and wireless sysfs groups
const struct attribute_group * sysfs_rx_queue_groupSpace for optional per-rx queue attributes
const struct rtnl_link_ops * rtnl_link_opsRtnl_link_ops
unsigned int gso_max_sizeMaximum size of generic segmentation offload
u16 gso_max_segsMaximum number of segments that can be passed to the NIC for GSO
const struct dcbnl_rtnl_ops * dcbnl_opsData Center Bridging netlink ops
u8 num_tcNumber of traffic classes in the net device
struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE]XXX: need comments on this one
u8 prio_tc_map[TC_BITMASK + 1]XXX: need comments on this one
unsigned int fcoe_ddp_xidMax exchange id for FCoE LRO by ddp
struct netprio_map __rcu * priomapXXX: need comments on this one
struct phy_device * phydevPhysical device may attach itself for hardware timestamping
struct lock_class_key * qdisc_tx_busylocklockdep class annotating Qdisc->busylock spinlock
struct lock_class_key * qdisc_running_keylockdep class annotating Qdisc->running seqcount
bool proto_downprotocol port state information can be sent to the switch driver and used to set the phys state of the switch port.