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 0ba687454267..0d1b2c3f127b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1326,6 +1326,22 @@ static inline void skb_zcopy_set(struct sk_buff *skb, struct ubuf_info *uarg) | |||
1326 | } | 1326 | } |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | static inline void skb_zcopy_set_nouarg(struct sk_buff *skb, void *val) | ||
1330 | { | ||
1331 | skb_shinfo(skb)->destructor_arg = (void *)((uintptr_t) val | 0x1UL); | ||
1332 | skb_shinfo(skb)->tx_flags |= SKBTX_ZEROCOPY_FRAG; | ||
1333 | } | ||
1334 | |||
1335 | static inline bool skb_zcopy_is_nouarg(struct sk_buff *skb) | ||
1336 | { | ||
1337 | return (uintptr_t) skb_shinfo(skb)->destructor_arg & 0x1UL; | ||
1338 | } | ||
1339 | |||
1340 | static inline void *skb_zcopy_get_nouarg(struct sk_buff *skb) | ||
1341 | { | ||
1342 | return (void *)((uintptr_t) skb_shinfo(skb)->destructor_arg & ~0x1UL); | ||
1343 | } | ||
1344 | |||
1329 | /* Release a reference on a zerocopy structure */ | 1345 | /* Release a reference on a zerocopy structure */ |
1330 | static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) | 1346 | static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) |
1331 | { | 1347 | { |
@@ -1335,7 +1351,7 @@ static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) | |||
1335 | if (uarg->callback == sock_zerocopy_callback) { | 1351 | if (uarg->callback == sock_zerocopy_callback) { |
1336 | uarg->zerocopy = uarg->zerocopy && zerocopy; | 1352 | uarg->zerocopy = uarg->zerocopy && zerocopy; |
1337 | sock_zerocopy_put(uarg); | 1353 | sock_zerocopy_put(uarg); |
1338 | } else { | 1354 | } else if (!skb_zcopy_is_nouarg(skb)) { |
1339 | uarg->callback(uarg, zerocopy); | 1355 | uarg->callback(uarg, zerocopy); |
1340 | } | 1356 | } |
1341 | 1357 | ||