linux-network

View the Project on GitHub super-learners/linux-network

Chapter 2. Critical Data Structures

net_device Structure

1. 식별자 (Identifiers)

1) int ifindex: dev_new_index 호출로 등록될 때 할당되는 유니크 ID 2) int iflink: 가상 터널 장치에서 다른 터널에 연결된 실제 장치를 식별 3) unsigned short dev_id: 서로 다른 OS간에 동시에 공유할 수 있는 동일한 장치의 가상 인스턴스를 구별하는 데 사용

2. 구성 (Configuration)

1) Interface types and ports

2) Promiscuous mode

3. 장치 상태 (Device Status)

4. 목록 관리 (List Management)

6. Traffic Management

7. Feature Specific

8. Generic

9. Function pointers (or VFT)

 struct ethtool_ops *ethtool_ops
 int (*init)(...)
 void (*uninit)(...)
 void (*destructor)(...)
 int (*open)(...)
 int (*stop)(...)
 struct net_device_stats* (*get_stats)(...)
 struct iw_statistics* (*get_wireless_stats)(...)
 int (*hard_start_xmit)(...)
 int (*hard_header)(...)
 int (*rebuild_header)(...)
 int (*hard_header_cache)(...)
 void (*header_cache_update)(...)
 int (*hard_header_parse)(...)
 int (*neigh_setup)(...)
 int (*do_ioctl)(...)
 void (*set_multicast_list)(...)
 int (*set_mac_address)(...)
 int (*set_config)(...)
 int (*change_mtu)(...)
 void (*tx_timeout)(...)
 int (*accept_fastpath)(...)