diff options
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a2e8297a5b00..f17a7452ac7b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1334,6 +1334,22 @@ static inline void skb_zcopy_set(struct sk_buff *skb, struct ubuf_info *uarg) | |||
1334 | } | 1334 | } |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | static inline void skb_zcopy_set_nouarg(struct sk_buff *skb, void *val) | ||
1338 | { | ||
1339 | skb_shinfo(skb)->destructor_arg = (void *)((uintptr_t) val | 0x1UL); | ||
1340 | skb_shinfo(skb)->tx_flags |= SKBTX_ZEROCOPY_FRAG; | ||
1341 | } | ||
1342 | |||
1343 | static inline bool skb_zcopy_is_nouarg(struct sk_buff *skb) | ||
1344 | { | ||
1345 | return (uintptr_t) skb_shinfo(skb)->destructor_arg & 0x1UL; | ||
1346 | } | ||
1347 | |||
1348 | static inline void *skb_zcopy_get_nouarg(struct sk_buff *skb) | ||
1349 | { | ||
1350 | return (void *)((uintptr_t) skb_shinfo(skb)->destructor_arg & ~0x1UL); | ||
1351 | } | ||
1352 | |||
1337 | /* Release a reference on a zerocopy structure */ | 1353 | /* Release a reference on a zerocopy structure */ |
1338 | static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) | 1354 | static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) |
1339 | { | 1355 | { |
@@ -1343,7 +1359,7 @@ static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) | |||
1343 | if (uarg->callback == sock_zerocopy_callback) { | 1359 | if (uarg->callback == sock_zerocopy_callback) { |
1344 | uarg->zerocopy = uarg->zerocopy && zerocopy; | 1360 | uarg->zerocopy = uarg->zerocopy && zerocopy; |
1345 | sock_zerocopy_put(uarg); | 1361 | sock_zerocopy_put(uarg); |
1346 | } else { | 1362 | } else if (!skb_zcopy_is_nouarg(skb)) { |
1347 | uarg->callback(uarg, zerocopy); | 1363 | uarg->callback(uarg, zerocopy); |
1348 | } | 1364 | } |
1349 | 1365 | ||