- 论坛徽章:
- 0
|
本帖最后由 rainballdh 于 2010-12-02 13:11 编辑
- static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
- {
- ...省略
- /* 头部不能被克隆,因为下面将可能对其进行修改. */
- if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC))
- goto out_nomem;
- /* If the first fragment is fragmented itself, we split
- * it to two chunks: the first with data and paged part
- * and the second, holding only fragments.
- */
- if (skb_shinfo(head)->frag_list) {
- struct sk_buff *clone;
- int i, plen = 0;
-
- if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL)
- goto out_nomem;
- clone->next = head->next;
- head->next = clone;
- /* clone指向frag_list */
- skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
- skb_shinfo(head)->frag_list = NULL;
- for (i=0; i<skb_shinfo(head)->nr_frags; i++)
- plen += skb_shinfo(head)->frags[i].size;
- clone->len = clone->data_len = head->data_len - plen;
- head->data_len -= clone->len;
- head->len -= clone->len;
- clone->csum = 0;
- clone->ip_summed = head->ip_summed;
- atomic_add(clone->truesize, &ip_frag_mem);
- }
- ...省略
- }
复制代码 代码部分我理解的是如果head存在从属的skbuff即frag_list不为空(skb_shinfo(head)->frag_list),就创建一个新的skbuff名为clone。clone指向从属的skbuff链表,而head就保存data和page缓冲区。
请问为什么要这么做?不懂其含义。
谢谢 |
|