skb_reserve comment clarification
As per the source, 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}
But tailroom is only increased not "reduced" correct ?
If you look at the function right before that:
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 }
It becomes clear that "tail room" is the difference between end
and tail
, so the function in question does indeed reduces the tail room in the buffer.
精彩评论