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.h48
1 files changed, 27 insertions, 21 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bec1cc7d5e3c..6f69b3f914fb 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1638,6 +1638,11 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1638 skb->mac_header += offset; 1638 skb->mac_header += offset;
1639} 1639}
1640 1640
1641static inline void skb_pop_mac_header(struct sk_buff *skb)
1642{
1643 skb->mac_header = skb->network_header;
1644}
1645
1641static inline void skb_probe_transport_header(struct sk_buff *skb, 1646static inline void skb_probe_transport_header(struct sk_buff *skb,
1642 const int offset_hint) 1647 const int offset_hint)
1643{ 1648{
@@ -2263,6 +2268,24 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,
2263 2268
2264unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); 2269unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
2265 2270
2271/**
2272 * pskb_trim_rcsum - trim received skb and update checksum
2273 * @skb: buffer to trim
2274 * @len: new length
2275 *
2276 * This is exactly the same as pskb_trim except that it ensures the
2277 * checksum of received packets are still valid after the operation.
2278 */
2279
2280static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
2281{
2282 if (likely(len >= skb->len))
2283 return 0;
2284 if (skb->ip_summed == CHECKSUM_COMPLETE)
2285 skb->ip_summed = CHECKSUM_NONE;
2286 return __pskb_trim(skb, len);
2287}
2288
2266#define skb_queue_walk(queue, skb) \ 2289#define skb_queue_walk(queue, skb) \
2267 for (skb = (queue)->next; \ 2290 for (skb = (queue)->next; \
2268 skb != (struct sk_buff *)(queue); \ 2291 skb != (struct sk_buff *)(queue); \
@@ -2360,27 +2383,6 @@ __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
2360__wsum skb_checksum(const struct sk_buff *skb, int offset, int len, 2383__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
2361 __wsum csum); 2384 __wsum csum);
2362 2385
2363/**
2364 * pskb_trim_rcsum - trim received skb and update checksum
2365 * @skb: buffer to trim
2366 * @len: new length
2367 *
2368 * This is exactly the same as pskb_trim except that it ensures the
2369 * checksum of received packets are still valid after the operation.
2370 */
2371
2372static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
2373{
2374 if (likely(len >= skb->len))
2375 return 0;
2376 if (skb->ip_summed == CHECKSUM_COMPLETE) {
2377 __wsum adj = skb_checksum(skb, len, skb->len - len, 0);
2378
2379 skb->csum = csum_sub(skb->csum, adj);
2380 }
2381 return __pskb_trim(skb, len);
2382}
2383
2384static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2386static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2385 int len, void *buffer) 2387 int len, void *buffer)
2386{ 2388{
@@ -2529,6 +2531,10 @@ static inline void sw_tx_timestamp(struct sk_buff *skb)
2529 * Ethernet MAC Drivers should call this function in their hard_xmit() 2531 * Ethernet MAC Drivers should call this function in their hard_xmit()
2530 * function immediately before giving the sk_buff to the MAC hardware. 2532 * function immediately before giving the sk_buff to the MAC hardware.
2531 * 2533 *
2534 * Specifically, one should make absolutely sure that this function is
2535 * called before TX completion of this packet can trigger. Otherwise
2536 * the packet could potentially already be freed.
2537 *
2532 * @skb: A socket buffer. 2538 * @skb: A socket buffer.
2533 */ 2539 */
2534static inline void skb_tx_timestamp(struct sk_buff *skb) 2540static inline void skb_tx_timestamp(struct sk_buff *skb)