1 /* ar-skbuff.c: socket buffer destruction handling
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14 #include <linux/module.h>
15 #include <linux/net.h>
16 #include <linux/skbuff.h>
18 #include <net/af_rxrpc.h>
19 #include "ar-internal.h"
22 * Note the existence of a new-to-us socket buffer (allocated or dequeued).
24 void rxrpc_new_skb(struct sk_buff
*skb
)
26 const void *here
= __builtin_return_address(0);
27 int n
= atomic_inc_return(&rxrpc_n_skbs
);
28 trace_rxrpc_skb(skb
, 0, atomic_read(&skb
->users
), n
, here
);
32 * Note the re-emergence of a socket buffer from a queue or buffer.
34 void rxrpc_see_skb(struct sk_buff
*skb
)
36 const void *here
= __builtin_return_address(0);
38 int n
= atomic_read(&rxrpc_n_skbs
);
39 trace_rxrpc_skb(skb
, 1, atomic_read(&skb
->users
), n
, here
);
44 * Note the addition of a ref on a socket buffer.
46 void rxrpc_get_skb(struct sk_buff
*skb
)
48 const void *here
= __builtin_return_address(0);
49 int n
= atomic_inc_return(&rxrpc_n_skbs
);
50 trace_rxrpc_skb(skb
, 2, atomic_read(&skb
->users
), n
, here
);
55 * Note the destruction of a socket buffer.
57 void rxrpc_free_skb(struct sk_buff
*skb
)
59 const void *here
= __builtin_return_address(0);
62 CHECK_SLAB_OKAY(&skb
->users
);
63 n
= atomic_dec_return(&rxrpc_n_skbs
);
64 trace_rxrpc_skb(skb
, 3, atomic_read(&skb
->users
), n
, here
);
70 * Clear a queue of socket buffers.
72 void rxrpc_purge_queue(struct sk_buff_head
*list
)
74 const void *here
= __builtin_return_address(0);
76 while ((skb
= skb_dequeue((list
))) != NULL
) {
77 int n
= atomic_dec_return(&rxrpc_n_skbs
);
78 trace_rxrpc_skb(skb
, 4, atomic_read(&skb
->users
), n
, here
);
This page took 0.03514 seconds and 6 git commands to generate.