- 论坛徽章:
- 0
|
1、skb->hdr_len 的含义: writable header length of cloned skb. 不太理解, 因为clone的skb共享head buffer 和 fragment buffer. 不存在可写的情况啊,要写的话不是要分配独立的缓冲区吗?
2、接下来在网上着信息:http://957554.blog.51cto.com/947554/459334 该文章说hdr_len = tail-head. 存在两个疑问:如果前面的等式成立,那么hdr_len保存的值没什么意义,因为可以很轻易的计算出来呀;同时tail-head又代表着什么含义?
3、查找使用hdr_len的内核函数。在skb_copy函数中,发现n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len. 于是又牵扯到nohdr。nohdr的英文解释是: Payload reference only, must not modify header.
还是根据上一个链接的解释: nohdr = 0:dataref代表整个skb数据区的引用计数; nohdr = 1:dataref的高16bits代表skb数据区“payload部分”的引用计数,低16bits 代表整个skb数据区的引用计数。 这里又牵扯到了dataref,虽然它并不是sk_buff中的一个字段。
解释为:
/* We divide dataref into two halves. The higher 16 bits hold references
* to the payload part of skb->data(应该指的是fragment buffer). The lower 16 bits hold references to
* the entire skb->data(指的是所有数据缓冲区). 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(线性缓冲区)是否被克隆了.)
*
* Holding a reference to the payload part means that the user does not
* care about modifications to the header part of skb->data.
*/
倒是和链接中的内容有些沾边.
请各位大侠帮帮忙,解释解释这上面三个字段的关系? |
|