net_device结构

结构体定义位置:linux/include/linux/netdevice.h

1.net_device代表所有的网络设备,包括其硬件和软件配置

net_device: Each network device is represented in the Linuxkernel by this data structure, which contains information aboutboth its hardware and its software configuration.

 

2.linux中的网络设备分为两种类型,即real的和virtual的,real的入以太网卡,virtual的则又有两种类型:bonding和vlan

 

3.bonding,思科术语叫做EtherChannel,Sun术语叫做trunking,是将一组网络设备整合在一起,并提供一个虚拟的接口

a set of interfaces to be grouped together and be treated as asingle interface.

 

4.linux中的网络设备被组织成一个链表(net_device类型),并用一个全局指针dev_base指向该链表

The net_device structures for all devices are put into a globallist to which the global
variable dev_base points.

 

5.网络设备可以被分为以太网卡和令牌环网卡两类,相应地net_device结构体中有一些字段与网卡类型有关,另一些则是与类型无关的通用字段

Network devices can be classified into types such as Ethernetcards and Token Ring cards

 

6.The fields of the net_device structure can be classified intothe following categories:
· Configuration 用户层可以通过ifconfig、ip等指令进行配置的字段
· Statistics:void *priv字段
· Device status
· List management
· Traffic management
· Feature specific
· Generic
· Function pointers (or VFT)

 

7.net_device结构体有三个标识字段,不要弄混了:

int ifindex:每个设备的唯一ID
A unique ID, assigned to each device when it is registered with acall to
dev_new_index.
int iflink:用于虚拟设备,标识真实设备
This field is mainly used by (virtual) tunnel devices andidentifies the real device
that will be used to reach the other end of the tunnel.
unsigned short dev_id:用于IPV6
Currently usedby IPv6 with the zSeries OSA NICs. The field is used todifferentiate between virtual instances of the same device that canbe shared between different OSes concurrently. See comments innet/ipv6/addrconf.c.

 

8.unsigned long mem_start
unsigned longmem_end:用于描述设备使用的共享内存(用于联系内核),仅会被驱动程序初始化和访问
Thesefields describe the shared memory used by the device to communicatewith
the kernel. They are initialized and accessed only within thedevice driver; higher
layers do not need to care about them.

 

9.unsigned longbase_addr:映射到设备内存的I/O内存起始地址
The beginning of the I/O memory mapped to the device's ownmemory.

 

10.unsigned intirq:中断编号,驱动程序使用request_irq和free_irq函数来分配和释放其值
The interrupt number used by the device to talk to the kernel. Itcan be shared
among multiple devices. Drivers use the request_irq function toallocate this
variable and free_irq to release it.

 

11.流量控制相关的编译选项

The Traffic Control subsystem of Linux has grown quite a lot andrepresents one of the strengths of the Linux kernel. The associatedkernel option is "Device drivers Networking support Networkingoptions QoS and/or fair queueing."

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值