aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/skbuff.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r--include/linux/skbuff.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6f0b2f7d0010..881fe80f01d0 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -147,8 +147,8 @@ struct skb_shared_info {
147 147
148/* We divide dataref into two halves. The higher 16 bits hold references 148/* We divide dataref into two halves. The higher 16 bits hold references
149 * to the payload part of skb->data. The lower 16 bits hold references to 149 * to the payload part of skb->data. The lower 16 bits hold references to
150 * the entire skb->data. It is up to the users of the skb to agree on 150 * the entire skb->data. A clone of a headerless skb holds the length of
151 * where the payload starts. 151 * the header in skb->hdr_len.
152 * 152 *
153 * All users must obey the rule that the skb->data reference count must be 153 * All users must obey the rule that the skb->data reference count must be
154 * greater than or equal to the payload reference count. 154 * greater than or equal to the payload reference count.
@@ -206,6 +206,7 @@ typedef unsigned char *sk_buff_data_t;
206 * @len: Length of actual data 206 * @len: Length of actual data
207 * @data_len: Data length 207 * @data_len: Data length
208 * @mac_len: Length of link layer header 208 * @mac_len: Length of link layer header
209 * @hdr_len: writable header length of cloned skb
209 * @csum: Checksum (must include start/offset pair) 210 * @csum: Checksum (must include start/offset pair)
210 * @csum_start: Offset from skb->head where checksumming should start 211 * @csum_start: Offset from skb->head where checksumming should start
211 * @csum_offset: Offset from csum_start where checksum should be stored 212 * @csum_offset: Offset from csum_start where checksum should be stored
@@ -260,8 +261,9 @@ struct sk_buff {
260 char cb[48]; 261 char cb[48];
261 262
262 unsigned int len, 263 unsigned int len,
263 data_len, 264 data_len;
264 mac_len; 265 __u16 mac_len,
266 hdr_len;
265 union { 267 union {
266 __wsum csum; 268 __wsum csum;
267 struct { 269 struct {
@@ -1322,6 +1324,20 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1322} 1324}
1323 1325
1324/** 1326/**
1327 * skb_clone_writable - is the header of a clone writable
1328 * @skb: buffer to check
1329 * @len: length up to which to write
1330 *
1331 * Returns true if modifying the header part of the cloned buffer
1332 * does not requires the data to be copied.
1333 */
1334static inline int skb_clone_writable(struct sk_buff *skb, int len)
1335{
1336 return !skb_header_cloned(skb) &&
1337 skb_headroom(skb) + len <= skb->hdr_len;
1338}
1339
1340/**
1325 * skb_cow - copy header of skb when it is required 1341 * skb_cow - copy header of skb when it is required
1326 * @skb: buffer to cow 1342 * @skb: buffer to cow
1327 * @headroom: needed headroom 1343 * @headroom: needed headroom