*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.
*
*@name: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.
*
*@name_hlist: Device name hash chain, please keep it close to name[]
*@ifalias:SNMP alias
*@mem_end:Shared memory end
*@mem_start:Shared memory start
*@base_addr:Device I/O address
*@irq:Device IRQ number
*
*@carrier_changes:Stats to monitor carrier on<->off transitions
*
*@state:Generic network queuing layer state, see netdev_state_t
*@dev_list:The global list of network devices
*@napi_list:List entry used for polling NAPI devices
*@unreg_list:List entry when we are unregistering the
*device; see the function unregister_netdev
*@close_list:List entry used when we are closing the device
*@ptype_all: Device-specific packet handlers for all protocols
*@ptype_specific: Device-specific, protocol-specific packet handlers
*
*@adj_list:Directly linked devices, like slaves for bonding
*@all_adj_list:All linked devices, *including* neighbours
*@features:Currently active device features
*@hw_features:User-changeable features
*
*@wanted_features:User-requested features
*@vlan_features:Mask of features inheritable by VLAN devices
*
*@hw_enc_features:Mask of features inherited by encapsulating devices
*This field indicates what encapsulation
*offloads the hardware is capable of doing,
*and drivers will need to set them appropriately.
*
*@mpls_features:Mask of features inheritable by MPLS
*
*@ifindex:interface index
*@group:The group the device belongs to
*
*@stats:Statistics struct, which was left as a legacy, use
*rtnl_link_stats64 instead
*
*@rx_dropped:Dropped packets by core network,
*do not use this in drivers
*@tx_dropped:Dropped packets by core network,
*do not use this in drivers
*@rx_nohandler:nohandler dropped packets by core network on
*inactive devices, do not use this in drivers
*
*@wireless_handlers:List of functions to handle Wireless Extensions,
*instead of ioctl,
*see <net/iw_handler.h> for details.
*@wireless_data:Instance data managed by the core of wireless extensions
*
*@netdev_ops:Includes several pointers to callbacks,
*if one wants to override the ndo_*() functions
*@ethtool_ops:Management operations
*@ndisc_ops:Includes callbacks for different IPv6 neighbour
*discovery handling. Necessary for e.g. 6LoWPAN.
*@header_ops:Includes callbacks for creating,parsing,caching,etc
*of Layer 2 headers.
*
*@flags:Interface flags (a la BSD)
*@priv_flags:Like 'flags' but invisible to userspace,
*see if.h for the definitions
*@gflags:Global flags ( kept as legacy )
*@padded:How much padding added by alloc_netdev()
*@operstate:RFC2863 operstate
*@link_mode:Mapping policy to operstate
*@if_port:Selectable AUI, TP, ...
*@dma:DMA channel
*@mtu:Interface MTU value
*@type:Interface hardware type
*@hard_header_len: Maximum hardware header length.
*
*@needed_headroom: Extra headroom the hardware may need, but not in all
* cases can this be guaranteed
*@needed_tailroom: Extra tailroom the hardware may need, but not in all
* cases can this be guaranteed. Some cases also use
* LL_MAX_HEADER instead to allocate the skb
*
*interface address info:
*
* @perm_addr:Permanent hw address
* @addr_assign_type:Hw address assignment type
* @addr_len:Hardware address length
*@neigh_priv_len:Used in neigh_alloc()
* @dev_id:Used to differentiate devices that share
* the same link layer address
* @dev_port:Used to differentiate devices that share
* the same function
*@addr_list_lock:XXX: need comments on this one
*@uc_promisc:Counter that indicates promiscuous mode
*has been enabled due to the need to listen to
*additional unicast addresses in a device that
*does not implement ndo_set_rx_mode()
*@uc:unicast mac addresses
*@mc:multicast mac addresses
*@dev_addrs:list of device hw addresses
*@queues_kset:Group of all Kobjects in the Tx and RX queues
*@promiscuity:Number of times the NIC is told to work in
*promiscuous mode; if it becomes 0 the NIC will
*exit promiscuous mode
*@allmulti:Counter, enables or disables allmulticast mode
*
*@vlan_info:VLAN info
*@dsa_ptr:dsa specific data
*@tipc_ptr:TIPC specific data
*@atalk_ptr:AppleTalk link
*@ip_ptr:IPv4 specific data
*@dn_ptr:DECnet specific data
*@ip6_ptr:IPv6 specific data
*@ax25_ptr:AX.25 specific data
*@ieee80211_ptr:IEEE 802.11 specific data, assign before registering
*
*@last_rx:Time of last Rx
*@dev_addr:Hw address (before bcast,
*because most packets are unicast)
*
*@_rx:Array of RX queues
*@num_rx_queues:Number of RX queues
*allocated at register_netdev() time
*@real_num_rx_queues: Number of RX queues currently active in device
*
*@rx_handler:handler for received packets
*@rx_handler_data: XXX: need comments on this one
*@ingress_queue:XXX: need comments on this one
*@broadcast:hw bcast address
*
*@rx_cpu_rmap:CPU reverse-mapping for RX completion interrupts,
*indexed by RX queue number. Assigned by driver.
*This must only be set if the ndo_rx_flow_steer
*operation is defined
*@index_hlist:Device index hash chain
*
*@_tx:Array of TX queues
*@num_tx_queues:Number of TX queues allocated at alloc_netdev_mq() time
*@real_num_tx_queues: Number of TX queues currently active in device
*@qdisc:Root qdisc from userspace point of view
*@tx_queue_len:Max frames per queue allowed
*@tx_global_lock: XXX: need comments on this one
*
*@xps_maps:XXX: need comments on this one
*
*@watchdog_timeo:Represents the timeout that is used by
*the watchdog (see dev_watchdog())
*@watchdog_timer:List of timers
*
*@pcpu_refcnt:Number of references to this device
*@todo_list:Delayed register/unregister
*@link_watch_list:XXX: need comments on this one
*
*@reg_state:Register/unregister state machine
*@dismantle:Device is going to be freed
*@rtnl_link_state:This enum represents the phases of creating
*a new link
*
*@destructor:Called from unregister,
*can be used to call free_netdev
*@npinfo:XXX: need comments on this one
* @nd_net:Network namespace this network device is inside
*
* @ml_priv:Mid-layer private
* @lstats:Loopback statistics
* @tstats:Tunnel statistics
* @dstats:Dummy statistics
* @vstats:Virtual ethernet statistics
*
*@garp_port:GARP
*@mrp_port:MRP
*
*@dev:Class/net/name entry
*@sysfs_groups:Space for optional device, statistics and wireless
*sysfs groups
*
*@sysfs_rx_queue_group:Space for optional per-rx queue attributes
*@rtnl_link_ops:Rtnl_link_ops
*
*@gso_max_size:Maximum size of generic segmentation offload
*@gso_max_segs:Maximum number of segments that can be passed to the
*NIC for GSO
*
*@dcbnl_ops:Data Center Bridging netlink ops
*@num_tc:Number of traffic classes in the net device
*@tc_to_txq:XXX: need comments on this one
*@prio_tc_map:XXX: need comments on this one
*
*@fcoe_ddp_xid:Max exchange id for FCoE LRO by ddp
*
*@priomap:XXX: need comments on this one
*@phydev:Physical device may attach itself
*for hardware timestamping
*
*@qdisc_tx_busylock: lockdep class annotating Qdisc->busylock spinlock
*@qdisc_running_key: lockdep class annotating Qdisc->running seqcount
*
*@proto_down:protocol port state information can be sent to the
*switch driver and used to set the phys state of the
*switch port.
*
*FIXME: cleanup struct net_device such that network protocol info
*moves out.
*/
struct net_device {
charname[IFNAMSIZ];
struct hlist_nodename_hlist;
char *ifalias;
/*
*I/O specific fields
*FIXME: Merge these and struct ifmap into one
*/
unsigned longmem_end;
unsigned longmem_start;
unsigned longbase_addr;
intirq;
atomic_tcarrier_changes;
/*
*Some hardware also needs these fields (state,dev_list,
*napi_list,unreg_list,close_list) but they are not
*part of the usual set specified in Space.c.
*/
unsigned longstate;
struct list_headdev_list;
struct list_headnapi_list;
struct list_headunreg_list;
struct list_headclose_list;
struct list_headptype_all;
struct list_headptype_specific;
struct {
struct list_head upper;
struct list_head lower;
} adj_list;
struct {
struct list_head upper;
struct list_head lower;
} all_adj_list;
netdev_features_tfeatures;
netdev_features_thw_features;
netdev_features_twanted_features;
netdev_features_tvlan_features;
netdev_features_thw_enc_features;
netdev_features_tmpls_features;
netdev_features_tgso_partial_features;
intifindex;
intgroup;
struct net_device_statsstats;
atomic_long_trx_dropped;
atomic_long_ttx_dropped;
atomic_long_trx_nohandler;
#ifdef CONFIG_WIRELESS_EXT
const struct iw_handler_def *wireless_handlers;
struct iw_public_data*wireless_data;
#endif
const struct net_device_ops *netdev_ops;
const struct ethtool_ops *ethtool_ops;
#ifdef CONFIG_NET_SWITCHDEV
const struct switchdev_ops *switchdev_ops;
#endif
#ifdef CONFIG_NET_L3_MASTER_DEV
const struct l3mdev_ops*l3mdev_ops;
#endif
#if IS_ENABLED(CONFIG_IPV6)
const struct ndisc_ops *ndisc_ops;
#endif
const struct header_ops *header_ops;
unsigned intflags;
unsigned intpriv_flags;
unsigned shortgflags;
unsigned shortpadded;
unsigned charoperstate;
unsigned charlink_mode;
unsigned charif_port;
unsigned chardma;
unsigned intmtu;
unsigned shorttype;
unsigned shorthard_header_len;
unsigned shortneeded_headroom;
unsigned shortneeded_tailroom;
/* Interface address info. */
unsigned charperm_addr[MAX_ADDR_LEN];
unsigned charaddr_assign_type;
unsigned charaddr_len;
unsigned shortneigh_priv_len;
unsigned short dev_id;
unsigned short dev_port;
spinlock_taddr_list_lock;
unsigned charname_assign_type;
booluc_promisc;
struct netdev_hw_addr_listuc;
struct netdev_hw_addr_listmc;
struct netdev_hw_addr_listdev_addrs;
#ifdef CONFIG_SYSFS
struct kset*queues_kset;
#endif
unsigned intpromiscuity;
unsigned intallmulti;
/* Protocol-specific pointers */
#if IS_ENABLED(CONFIG_VLAN_8021Q)
struct vlan_info __rcu*vlan_info;
#endif
#if IS_ENABLED(CONFIG_NET_DSA)
struct dsa_switch_tree*dsa_ptr;
#endif
#if IS_ENABLED(CONFIG_TIPC)
struct tipc_bearer __rcu *tipc_ptr;
#endif
void *atalk_ptr;
struct in_device __rcu*ip_ptr;
struct dn_dev __rcu *dn_ptr;
struct inet6_dev __rcu*ip6_ptr;
void*ax25_ptr;
struct wireless_dev*ieee80211_ptr;
struct wpan_dev*ieee802154_ptr;
#if IS_ENABLED(CONFIG_MPLS_ROUTING)
struct mpls_dev __rcu*mpls_ptr;
#endif
/*
* Cache lines mostly used on receive path (including eth_type_trans())
*/
unsigned longlast_rx;
/* Interface address info used in eth_type_trans() */
unsigned char*dev_addr;
#ifdef CONFIG_SYSFS
struct netdev_rx_queue*_rx;
unsigned intnum_rx_queues;
unsigned intreal_num_rx_queues;
#endif
unsigned longgro_flush_timeout;
rx_handler_func_t __rcu*rx_handler;
void __rcu*rx_handler_data;
#ifdef CONFIG_NET_CLS_ACT
struct tcf_proto __rcu *ingress_cl_list;
#endif
struct netdev_queue __rcu *ingress_queue;
#ifdef CONFIG_NETFILTER_INGRESS
struct nf_hook_entry __rcu *nf_hooks_ingress;
#endif
unsigned charbroadcast[MAX_ADDR_LEN];
#ifdef CONFIG_RFS_ACCEL
struct cpu_rmap*rx_cpu_rmap;
#endif
struct hlist_nodeindex_hlist;
/*
* Cache lines mostly used on transmit path
*/
struct netdev_queue*_tx ____cacheline_aligned_in_smp;
unsigned intnum_tx_queues;
unsigned intreal_num_tx_queues;
struct Qdisc*qdisc;
#ifdef CONFIG_NET_SCHED
DECLARE_HASHTABLE(qdisc_hash, 4);
#endif
unsigned longtx_queue_len;
spinlock_ttx_global_lock;
intwatchdog_timeo;
#ifdef CONFIG_XPS
struct xps_dev_maps __rcu *xps_maps;
#endif
#ifdef CONFIG_NET_CLS_ACT
struct tcf_proto __rcu *egress_cl_list;
#endif
/* These may be needed for future network-power-down code. */
struct timer_listwatchdog_timer;
int __percpu*pcpu_refcnt;
struct list_headtodo_list;
struct list_headlink_watch_list;
enum { NETREG_UNINITIALIZED=0,
NETREG_REGISTERED,/* completed register_netdevice */
NETREG_UNREGISTERING,/* called unregister_netdevice */
NETREG_UNREGISTERED,/* completed unregister todo */
NETREG_RELEASED,/* called free_netdev */
NETREG_DUMMY,/* dummy device for NAPI poll */
} reg_state:8;
bool dismantle;
enum {
RTNL_LINK_INITIALIZED,
RTNL_LINK_INITIALIZING,
} rtnl_link_state:16;
void (*destructor)(struct net_device *dev);
#ifdef CONFIG_NETPOLL
struct netpoll_info __rcu*npinfo;
#endif
possible_net_tnd_net;
/* mid-layer private */
union {
void*ml_priv;
struct pcpu_lstats __percpu*lstats;
struct pcpu_sw_netstats __percpu*tstats;
struct pcpu_dstats __percpu*dstats;
struct pcpu_vstats __percpu*vstats;
};
struct garp_port __rcu*garp_port;
struct mrp_port __rcu*mrp_port;
struct devicedev;
const struct attribute_group *sysfs_groups[4];
const struct attribute_group *sysfs_rx_queue_group;
const struct rtnl_link_ops *rtnl_link_ops;
/* for setting kernel sock attribute on TCP connection setup */
#define GSO_MAX_SIZE65536
unsigned intgso_max_size;
#define GSO_MAX_SEGS65535
u16gso_max_segs;
#ifdef CONFIG_DCB
const struct dcbnl_rtnl_ops *dcbnl_ops;
#endif
u8num_tc;
struct netdev_tc_txqtc_to_txq[TC_MAX_QUEUE];
u8prio_tc_map[TC_BITMASK + 1];
#if IS_ENABLED(CONFIG_FCOE)
unsigned intfcoe_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;
boolproto_down;
};
/** * 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 ev