亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 980 | 回復: 0
打印 上一主題 下一主題

LINUX協(xié)議棧之(3): How to 'receive' SKB how to organize [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2007-12-17 15:47 |只看該作者 |倒序瀏覽

                How to 'receive' SKB how to organize the received SKBs ???
1.
    The function : netif_rx(struct sk_buff *skb) do this work, so every network driver needs this function !!!
2.
    In the beginning of this function is the checking of
netpoll mechanism, while we'll not discuss netpoll in this paper, so
we'll ignore it. Just go on!
3.
    Now, this function will set the timestamp for this
SKB buffer, it calls function : net_timestamp(skb) to set
the     skb->tstamp's value !!!
4.
    Now the wonderful things is coming here : the receive queue and the softIRQ.
4.1 the receive queue definition
    the definition : struct softnet_data *queue;
    /*
     * Incoming packets are placed on per-cpu queues so that
     * no locking is needed.
     */
    struct softnet_data
    {
        struct net_device        *output_queue;
        struct sk_buff_head        input_pkt_queue;
        struct list_head        poll_list;
        struct sk_buff        *completion_queue;
   
        struct net_device    backlog_dev;    /* Sorry. 8) */
    };
    So what can we concluded from its definition ???
    SKBs are queued into the list input_pkt_queue.
    Notice : Each CPU has its own queue so no locking mechanism is needed.
4.2 push SKB into receive queue
    This function first check the receive queue's
length, if the qlen is bigger than or equal to netdev_max_backlog, then
updating the dropped statistics and free the SKB, return the
NET_RX_DROP; else if the qlen equal 0, this function will call
netif_rx_schedule() function first and then put the SKB into the
receive queue; else if the qlen is bigger than 0 then this function
will call function __skb_queue_tail() directly to put the SKB into the
queue tail, then return NET_RX_SUCCESS.
    Notice : the SKB can not be freed when this function return NET_RX_SUCCESS.
4.3 the soft IRQ
    The soft IRQ is drived by netif_rx_schedule(struct net_device *dev);
    If the dev is running and its is not scheduled, then
the netif_rx_schedule() calls __netif_rx_schedule(dev) function. And
then the function __netif_rx_schedule() set the dev->quota value to
64 and insert the dev->poll_list to receive queue's poll_list, then
it raise the soft IRQ : NET_RX_SOFTIRQ.
    This soft IRQ(NET_RX_SOFTIRQ) is handled by function : net_rx_action().
    The net_rx_action() then calls process_backlog() to handle the SKB in the receive queue.
4.4 The process_backlog() function
    This function is simple, it main framework is a
forever loop. It fetches each SKB from the receive queue and calls
function : netif_receive_skb() to handle it!
    The function netif_receive_skb() do the real work of putting the SKB to IP layer and we'll discuss it next.
            
   

               
               

本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u/26397/showart_444275.html
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP