- 論壇徽章:
- 0
|
1、skb->hdr_len 的含義: writable header length of cloned skb. 不太理解, 因?yàn)閏lone的skb共享head buffer 和 fragment buffer. 不存在可寫的情況啊,要寫的話不是要分配獨(dú)立的緩沖區(qū)嗎?
2、接下來(lái)在網(wǎng)上著信息:http://957554.blog.51cto.com/947554/459334 該文章說hdr_len = tail-head. 存在兩個(gè)疑問:如果前面的等式成立,那么hdr_len保存的值沒什么意義,因?yàn)榭梢院茌p易的計(jì)算出來(lái)呀;同時(shí)tail-head又代表著什么含義?
3、查找使用hdr_len的內(nèi)核函數(shù)。在skb_copy函數(shù)中,發(fā)現(xiàn)n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len. 于是又牽扯到nohdr。nohdr的英文解釋是: Payload reference only, must not modify header.
還是根據(jù)上一個(gè)鏈接的解釋: nohdr = 0:dataref代表整個(gè)skb數(shù)據(jù)區(qū)的引用計(jì)數(shù); nohdr = 1:dataref的高16bits代表skb數(shù)據(jù)區(qū)“payload部分”的引用計(jì)數(shù),低16bits 代表整個(gè)skb數(shù)據(jù)區(qū)的引用計(jì)數(shù)。 這里又牽扯到了dataref,雖然它并不是sk_buff中的一個(gè)字段。
解釋為:
/* We divide dataref into two halves. The higher 16 bits hold references
* to the payload part of skb->data(應(yīng)該指的是fragment buffer). The lower 16 bits hold references to
* the entire skb->data(指的是所有數(shù)據(jù)緩沖區(qū)). A clone of a headerless skb holds the length of
* the header in skb->hdr_len.
*
* All users must obey the rule that the skb->data reference count must be
* greater than or equal to the payload reference count.(高16位-低16位就能獲得head buffer(線性緩沖區(qū))是否被克隆了.)
*
* Holding a reference to the payload part means that the user does not
* care about modifications to the header part of skb->data.
*/
倒是和鏈接中的內(nèi)容有些沾邊.
請(qǐng)各位大俠幫幫忙,解釋解釋這上面三個(gè)字段的關(guān)系? |
|