Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: move pskb_put() to core code

This function has usage beside IPsec so move it to the core skbuff code.
While doing so, give it some documentation and change its return type to
'unsigned char *' to be in line with skb_put().

Signed-off-by: Mathias Krause <mathias.krause@secunet.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Mathias Krause and committed by
David S. Miller
0c7ddf36 b5ad795e

+24 -15
+1
include/linux/skbuff.h
··· 1417 1417 /* 1418 1418 * Add data to an sk_buff 1419 1419 */ 1420 + unsigned char *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); 1420 1421 unsigned char *skb_put(struct sk_buff *skb, unsigned int len); 1421 1422 static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 1422 1423 {
-2
include/net/esp.h
··· 3 3 4 4 #include <linux/skbuff.h> 5 5 6 - void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); 7 - 8 6 struct ip_esp_hdr; 9 7 10 8 static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
+23
net/core/skbuff.c
··· 1264 1264 EXPORT_SYMBOL(skb_pad); 1265 1265 1266 1266 /** 1267 + * pskb_put - add data to the tail of a potentially fragmented buffer 1268 + * @skb: start of the buffer to use 1269 + * @tail: tail fragment of the buffer to use 1270 + * @len: amount of data to add 1271 + * 1272 + * This function extends the used data area of the potentially 1273 + * fragmented buffer. @tail must be the last fragment of @skb -- or 1274 + * @skb itself. If this would exceed the total buffer size the kernel 1275 + * will panic. A pointer to the first byte of the extra data is 1276 + * returned. 1277 + */ 1278 + 1279 + unsigned char *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len) 1280 + { 1281 + if (tail != skb) { 1282 + skb->data_len += len; 1283 + skb->len += len; 1284 + } 1285 + return skb_put(tail, len); 1286 + } 1287 + EXPORT_SYMBOL_GPL(pskb_put); 1288 + 1289 + /** 1267 1290 * skb_put - add data to a buffer 1268 1291 * @skb: buffer to use 1269 1292 * @len: amount of data to add
-13
net/xfrm/xfrm_algo.c
··· 802 802 } 803 803 EXPORT_SYMBOL_GPL(xfrm_count_pfkey_enc_supported); 804 804 805 - #if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE) 806 - 807 - void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len) 808 - { 809 - if (tail != skb) { 810 - skb->data_len += len; 811 - skb->len += len; 812 - } 813 - return skb_put(tail, len); 814 - } 815 - EXPORT_SYMBOL_GPL(pskb_put); 816 - #endif 817 - 818 805 MODULE_LICENSE("GPL");