Commit 04c2d33e authored by Jonathan Lemon's avatar Jonathan Lemon Committed by Jakub Kicinski

skbuff: add flags to ubuf_info for ubuf setup

Currently, when an ubuf is attached to a new skb, the shared
flags word is initialized to a fixed value.  Instead of doing
this, set the default flags in the ubuf, and have new skbs
inherit from this default.

This is needed when setting up different zerocopy types.
Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 06b4feb3
...@@ -480,6 +480,7 @@ struct ubuf_info { ...@@ -480,6 +480,7 @@ struct ubuf_info {
}; };
}; };
refcount_t refcnt; refcount_t refcnt;
u8 flags;
struct mmpin { struct mmpin {
struct user_struct *user; struct user_struct *user;
...@@ -1456,7 +1457,7 @@ static inline void skb_zcopy_set(struct sk_buff *skb, struct ubuf_info *uarg, ...@@ -1456,7 +1457,7 @@ static inline void skb_zcopy_set(struct sk_buff *skb, struct ubuf_info *uarg,
else else
skb_zcopy_get(uarg); skb_zcopy_get(uarg);
skb_shinfo(skb)->destructor_arg = uarg; skb_shinfo(skb)->destructor_arg = uarg;
skb_shinfo(skb)->flags |= SKBFL_ZEROCOPY_FRAG; skb_shinfo(skb)->flags |= uarg->flags;
} }
} }
......
...@@ -1119,6 +1119,7 @@ struct ubuf_info *msg_zerocopy_alloc(struct sock *sk, size_t size) ...@@ -1119,6 +1119,7 @@ struct ubuf_info *msg_zerocopy_alloc(struct sock *sk, size_t size)
uarg->len = 1; uarg->len = 1;
uarg->bytelen = size; uarg->bytelen = size;
uarg->zerocopy = 1; uarg->zerocopy = 1;
uarg->flags = SKBFL_ZEROCOPY_FRAG;
refcount_set(&uarg->refcnt, 1); refcount_set(&uarg->refcnt, 1);
sock_hold(sk); sock_hold(sk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment