欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
Android socket創(chuàng )建、綁定流程分析(三)
Android socket創(chuàng )建、綁定流程分析(三)
2011年08月01日 星期一 22:11

net_dev_init中通過(guò)open_softirq(NET_RX_SOFTIRQ, net_rx_action);注冊了軟中斷處理函數,napi調度中激發(fā)了軟中斷調用net_rx_action

static void net_rx_action(struct softirq_action *h)

{

       struct list_head *list = &__get_cpu_var(softnet_data).poll_list;

       unsigned long start_time = jiffies;

       int budget = netdev_budget;

       void *have;

 

       local_irq_disable();

 

       while (!list_empty(list)) {

              struct napi_struct *n;

              int work, weight;

 

              /* If softirq window is exhuasted then punt.

               *

               * Note that this is a slight policy change from the

               * previous NAPI code, which would allow up to 2

               * jiffies to pass before breaking out.  The test

               * used to be "jiffies - start_time > 1".

               */

              if (unlikely(budget <= 0 || jiffies != start_time))

                     goto softnet_break;

 

              local_irq_enable();

 

              /* Even though interrupts have been re-enabled, this

               * access is safe because interrupts can only add new

               * entries to the tail of this list, and only ->poll()

               * calls can remove this head entry from the list.

               */

              n = list_entry(list->next, struct napi_struct, poll_list);

 

              have = netpoll_poll_lock(n);

        //weight 每次輪詢(xún)最大數量

              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

               * actually make the ->poll() call.  Therefore we avoid

               * accidently calling ->poll() when NAPI is not scheduled.

               */

              work = 0;

              if (test_bit(NAPI_STATE_SCHED, &n->state)) //napi的狀態(tài)是否為NAPI_STATE_SCHED

                     work = n->poll(n, weight);             //執行輪詢(xún),輪詢(xún)函數初始化是在net_dev_init中:

                                              //queue->backlog.poll = process_backlog;(默認)

              WARN_ON_ONCE(work > weight);

 

              budget -= work;

 

              local_irq_disable();

 

              /* Drivers must not modify the NAPI state if they

               * consume the entire weight.  In such cases this code

               * still "owns" the NAPI instance and therefore can

               * move the instance around on the list at-will.

               */

              if (unlikely(work == weight)) {

                     if (unlikely(napi_disable_pending(n)))

                            __napi_complete(n);

                     else

                            list_move_tail(&n->poll_list, list);

              }

 

              netpoll_poll_unlock(have);

       }

out:

       local_irq_enable();

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

}

 

static int process_backlog(struct napi_struct *napi, int quota)

{

       int work = 0;

       struct softnet_data *queue = &__get_cpu_var(softnet_data);

       unsigned long start_time = jiffies;

 

       napi->weight = weight_p;

       do {

              struct sk_buff *skb;

 

              local_irq_disable();

              skb = __skb_dequeue(&queue->input_pkt_queue);

              if (!skb) {

                     __napi_complete(napi);  //poll隊列中刪除napi

                     local_irq_enable();

                     break;

              }

              local_irq_enable();

 

              netif_receive_skb(skb);

       } while (++work < quota && jiffies == start_time);

 

       return work;

}

netif_receive_skb中,會(huì )輪詢(xún)ptype_all list找到與packet_bind中協(xié)議類(lèi)型相符的packet_type,然后通過(guò)deliver_skb調用packet type所注冊的接收處理函數。

static inline int deliver_skb(struct sk_buff *skb,

                           struct packet_type *pt_prev,

                           struct net_device *orig_dev)

{

       atomic_inc(&skb->users);

       return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);   //packet_create時(shí)初始化func指向packet_rcv

}

 

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
十年碼農內功:收包(二)
數據報的接收過(guò)程詳解---從網(wǎng)卡到L3層(非NAPI,即接收數據采用中斷方式) - 技術(shù)文...
Linux內核napi機制分析
Linux內核二層數據包接收流程
NAPI 技術(shù)在 Linux 網(wǎng)絡(luò )驅動(dòng)上的應用和完善
服務(wù)器不丟包背后的兵法:Redis在萬(wàn)億級日訪(fǎng)問(wèn)量下的中斷優(yōu)化
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久