NAPI
来源:互联网 发布:中国电建华东院 知乎 编辑:程序博客网 时间:2024/06/05 20:32
内核为网络设备提供了NAPI机制来代替tasklet等。
=======napi_struct结构体======
【位置】include/linux/netdevice.h
/*
* Structure for NAPI scheduling similar to tasklet but with weighting
*/
struct napi_struct {
____/* The poll_list must only be managed by the entity which
____ * changes the state of the NAPI_STATE_SCHED bit. This means
____ * whoever atomically sets that bit can add this napi_struct
____ * to the per-cpu poll_list, and whoever clears that bit
____ * can remove from the list right before clearing the bit.
____ */
____struct list_head____poll_list;
____unsigned long_______state;
____int_________weight;
____int_________(*poll)(struct napi_struct *, int);
#ifdef CONFIG_NETPOLL
____spinlock_t______poll_lock;
____int_________poll_owner;
#endif
____unsigned int________gro_count;
____struct net_device___*dev;
____struct list_head____dev_list;
____struct sk_buff______*gro_list;
____struct sk_buff______*skb;
};
【poll_list】用来将当前设备放置到内核维护的一个轮询列表中。
【weight】设置当前设备的权重,如果某一设备上长时间连续接收分组,不至于使系统中其他设备失去被轮询的机会。
【poll】函数指针,设备驱动程序需要实现这个函数,它将在内核对当前设备轮询时被调用。
=========操作函数==========
netif_napi_add
【原型】void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int(*poll)(struct napi_struct *,int), int weight)
【作用】用于将napi指向的struct napi_struct对象进行初始化。将该napi_struct放入dev的napi_list列表中。将state设为NAPI_STATE_SCHED。
netif_napi_del
【原型】void netif_napi_del(struct napi_struct *napi)
【作用】netif_napi_add的反操作。
napi_enable
【作用】使能napi
【实现】将state的NAPI_STATE_SCHED位清0。
napi_disable
【作用】将napi不被轮询
napi_schedule_prep
【作用】测试napi能否被schedule。
napi_schedule
【作用】schedule NAPI poll
napi_complete
【作用】
- NAPI
- NAPI
- NAPI
- NAPI
- NAPI
- NAPI
- napi
- napi
- NAPI 技术
- napi解释
- NAPI 技术
- 什么是NAPI
- NAPI分析
- linux napi
- e1000 napi
- NAPI相关
- NAPI分析
- napi介绍
- 使用SQL返回按小时排序的统计数据
- Linux 系统设置 ulimit 以及 Core文件的生成
- ASCII码对应表chr(9)、chr(10)、chr(13)、chr(32)、chr(34)...
- Gcc 4.6 编译 Linux kernel时出现错误error: elf_i386: No such file or directory
- linux进程间通信
- NAPI
- MySQL性能优化
- C语言条件编译及编译预处理阶段
- scanf
- 解决三星S2 i9100声音播放崩溃(CocosDenshion)
- SSH框架配置log4j
- boost----windows下boost怎样安装与使用说明
- 深入理解指针函数
- android Toast大全(五种情形)建立属于你自己的Toast