if (test_bit(NAPI_STATE_SCHED, &n->state)) {/*如果取得的napi状态是被调度的,就执行napi的轮询处理函数*/ /* NAPI的napi_struct是自己构造的,该结构上的poll钩子函数也是自己定义的。 非NAPI的napi_struct结构是默认的,也就是per cpu的softnet_data>backlog,起poll钩子函数为process_backlog */ work =...
netif_rx调用netif_rx_schedule可以将设备入队poll_list和设置软中断NET_RX_SOFTIRQ。注意,在netif_rx内调用netif_rx_schedule函数入poll_list队列的并不是设备本身,而是被替换为softnet_data->backlog_dev,这一点区别于NAPI设备。并且仅当input_pkt_queue队列为空时才需要将特殊设备backlog_dev入设备队列poll_list,...
的net_device结构,而不是queue中的backlog_dev。 netif_rx_schedule函数 Code 整个过程如下: 1.4、net_rx_action( )函数 net_rx_action为处理接收数据帧的下半部函数,输入的数据帧在两个地方等待net_rx_action来处理: (1) CPU的输入队列。这是针对NON-NAPI方式的,它调用netif_rx,将数据帧加入到Linux...
trace_napi_gro_receive_exit(ret); return ret; } gro主要是软件的数据合并机制,把相关联的数据进行合并,统一发送,减少小包发送频率,增加发送速度。 实际工作函数为napi_skb_finish static gro_result_t napi_skb_finish(struct napi_struct *napi, struct sk_buff *skb, gro_result_t ret) { switch (ret)...
__napi_poll static int __napi_poll(struct napi_struct *n, bool *repoll) { int work, weight; weight = n->weight; /* This NAPI_STATE_SCHED test is for avoiding a race * with netpoll's poll_napi(). Only the entity which * obtains the lock and sees NAPI_STATE_SCHED set will ...