Softnet_data

Softnet_data的初始化:
每个CPU的softnet_data是在net_dev_init中初始化的,代码如下:
"/net/core/dev.c" "static int __init net_dev_init(void)"
for_each_possible_cpu(i) {
struct softnet_data *queue;
queue = &per_cpu(softnet_data, i);
skb_queue_head_init(&queue->input_pkt_queue);
queue->completion_queue = NULL;
INIT_LIST_HEAD(&queue->poll_list); queue->backlog.poll = process_backlog;
queue->backlog.weight = weight_p;
queue->backlog.gro_list = NULL;
queue->backlog.gro_count = ;
} "include/linux/netdevice.h"
struct softnet_data
{
struct Qdisc *output_queue;
struct sk_buff_head input_pkt_queue;
struct list_head poll_list;
struct sk_buff *completion_queue; struct napi_struct backlog;
}; struct napi_struct {
/* The poll_list must only be managed by the entity which
29 * changes the state of the NAPI_STATE_SCHED bit. This means
30 * whoever atomically sets that bit can add this napi_struct
31 * to the per-cpu poll_list, and whoever clears that bit
32 * can remove from the list right before clearing the bit.
33 */
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;
};
上一篇:L9-1-安装Apache


下一篇:动态规划——Palindrome Partitioning II