、net_device
关于net_device一个非常庞大的结构体,定义在/inlcude/linux/netdevice.h中
如下:
view plainprint?
struct net_device {
char name[IFNAMSIZ];
struct pm_qos_request_list *pm_qos_req;
struct hlist_node name_hlist;
char *ifalias;
unsigned long mem_end;
unsigned long mem_start;
unsigned long base_addr;
unsigned int irq;
unsigned char if_port;
unsigned char dma;
unsigned long state;
struct list_head dev_list;
struct list_head napi_list;
struct list_head unreg_list;
unsigned long features;
#define NETIF_F_SG 1
#define NETIF_F_IP_CSUM 2
#define NETIF_F_NO_CSUM 4
#define NETIF_F_HW_CSUM 8
#define NETIF_F_IPV6_CSUM 16
#define NETIF_F_HIGHDMA 32
#define NETIF_F_FRAGLIST 64
#define NETIF_F_HW_VLAN_TX 128
#define NETIF_F_HW_VLAN_RX 256
#define NETIF_F_HW_VLAN_FILTER 512
#define NETIF_F_VLAN_CHALLENGED 1024
#define NETIF_F_GSO 2048
#define NETIF_F_LLTX 4096
#define NETIF_F_NETNS_LOCAL 8192
#define NETIF_F_GRO 16384
#define NETIF_F_LRO 32768
#define NETIF_F_FCOE_CRC (1 < 24)
#define NETIF_F_SCTP_CSUM (1 < 25)
#define NETIF_F_FCOE_MTU (1 < 26)
#define NETIF_F_NTUPLE (1 < 27)
#define NETIF_F_RXHASH (1 < 28)
#define NETIF_F_GSO_SHIFT 16
#define NETIF_F_GSO_MASK 0x00ff0000
#define NETIF_F_TSO (SKB_GSO_TCPV4 < NETIF_F_GSO_SHIFT)
#define NETIF_F_UFO (SKB_GSO_UDP < NETIF_F_GSO_SHIFT)
#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY < NETIF_F_GSO_SHIFT)
#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN < NETIF_F_GSO_SHIFT)
#define NETIF_F_TSO6 (SKB_GSO_TCPV6 < NETIF_F_GSO_SHIFT)
#define NETIF_F_FSO (SKB_GSO_FCOE < NETIF_F_GSO_SHIFT)
#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
NETIF_F_SG | NETIF_F_HIGHDMA | \
NETIF_F_FRAGLIST)
int ifindex;
int iflink;
struct net_device_stats stats;
#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;
const struct header_ops *header_ops;
unsigned int flags;
unsigned short gflags;
unsigned short priv_flags;
unsigned short padded;
unsigned char operstate;
unsigned char link_mode;
unsigned int mtu;
unsigned short type;
unsigned short hard_header_len;
unsigned short needed_headroom;
unsigned short needed_tailroom;
struct net_device *master;
unsigned char perm_addr[MAX_ADDR_LEN];
unsigned char addr_len;
unsigned short dev_id;
spinlock_t addr_list_lock;
struct netdev_hw_addr_list uc;
struct netdev_hw_addr_list mc;
int uc_promisc;
unsigned int promiscuity;
unsigned int allmulti;
#ifdef CONFIG_NET_DSA
void *dsa_ptr;
#endif
void *atalk_ptr;
void *ip_ptr;
void *dn_ptr;
void *ip6_ptr;
void *ec_ptr;
void *ax25_ptr;
struct wireless_dev *ieee80211_ptr;
unsigned long last_rx;
unsigned char *dev_addr;
struct netdev_hw_addr_list dev_addrs;
unsigned char broadcast[MAX_ADDR_LEN];
#ifdef CONFIG_RPS
struct kset *queues_kset;
struct netdev_rx_queue *_rx;