diff options
author | David S. Miller <davem@davemloft.net> | 2023-02-17 14:06:39 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-02-17 14:06:39 +0300 |
commit | 675f176b4dcc2b75adbcea7ba0e9a649527f53bd (patch) | |
tree | dc5eea870c19b405bb6558964e5367bb6c9205c5 /include/net/sock.h | |
parent | 84cb1b53cdbad52642571e31a8aee301206d2043 (diff) | |
parent | ec35307e18ba8174e2a3f701956059f6a36f22fb (diff) | |
download | linux-675f176b4dcc2b75adbcea7ba0e9a649527f53bd.tar.xz |
Merge ra.kernel.org:/pub/scm/linux/kernel/git/netdev/net
Some of the devlink bits were tricky, but I think I got it right.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 2cb258fde072..573f2bf7e0de 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2411,6 +2411,19 @@ static inline __must_check bool skb_set_owner_sk_safe(struct sk_buff *skb, struc return false; } +static inline struct sk_buff *skb_clone_and_charge_r(struct sk_buff *skb, struct sock *sk) +{ + skb = skb_clone(skb, sk_gfp_mask(sk, GFP_ATOMIC)); + if (skb) { + if (sk_rmem_schedule(sk, skb, skb->truesize)) { + skb_set_owner_r(skb, sk); + return skb; + } + __kfree_skb(skb); + } + return NULL; +} + static inline void skb_prepare_for_gro(struct sk_buff *skb) { if (skb->destructor != sock_wfree) { |