skb_reserve评论澄清

时间:2010-06-24 09:05:36

标签: linux-kernel

根据消息来源, http://lxr.linux.no/#linux+v2.6.31/include/linux/skbuff.h#L1204

1197 *      skb_reserve - adjust headroom
1198 *      @skb: buffer to alter
1199 *      @len: bytes to move
1200 *
1201 *      Increase the headroom of an empty &sk_buff by reducing the tail
1202 *      room. This is only allowed for an empty buffer.
1203 */
1204static inline void skb_reserve(struct sk_buff *skb, int len)
1205{
1206        skb->data += len;
1207        skb->tail += len;
1208}

但是尾部空间只是增加而不是“减少”正确吗?

1 个答案:

答案 0 :(得分:4)

如果你在此之前看一下这个功能:

1185 /**
1186  *      skb_tailroom - bytes at buffer end
1187  *      @skb: buffer to check
1188  *
1189  *      Return the number of bytes of free space at the tail of an sk_buff
1190  */
1191 static inline int skb_tailroom(const struct sk_buff *skb)
1192 {
1193         return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail;
1194 }

很明显,“尾部空间”是endtail之间的差异,因此所讨论的功能确实减少缓冲区中的尾部空间。 / p>