3、skb_shared_info结构体


struct skb_shared_info {
 unsigned short nr_frags;
 unsigned short gso_size;//尺寸
 /* Warning: this field is not always filled in (UFO)! */
 unsigned short gso_segs;//顺序
 unsigned short  gso_type;
 __be32          ip6_frag_id;
 __u8  tx_flags;
 struct sk_buff *frag_list;//分片的sk_buff列表
 struct skb_shared_hwtstamps hwtstamps;//硬件时间戳

 /*
  * Warning : all fields before dataref are cleared in __alloc_skb()
  */
 atomic_t dataref;//使用计数

 /* Intermediate layers must ensure that destructor_arg
  * remains valid until skb destructor */
 void *  destructor_arg;

 /* must be last field, see pskb_expand_head() */
 skb_frag_t frags[MAX_SKB_FRAGS];
};
 


  该类型用来管理数据包分片信息,通过宏可以表示与skb的关系


#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB)))

 

#ifdef NET_SKBUFF_DATA_USES_OFFSET
static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
{
 return skb->head + skb->end;
}
#else
static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
{
 return skb->end;
}
#endif


  可以看到如果用户没有自己使用偏移量,是skb的end属性指针,也是该信息存储在缓冲区之后。

  下篇将看有关sk_buff的操作函数的实现。

  本文转自:http://blog.csdn.net/yming0221/article/details/7971463