1
2
3
4
5
6
7
8
9
10
11
12#include <rxrpc/packet.h>
13
14#if 0
15#define CHECK_SLAB_OKAY(X) \
16 BUG_ON(atomic_read((X)) >> (sizeof(atomic_t) - 2) == \
17 (POISON_FREE << 8 | POISON_FREE))
18#else
19#define CHECK_SLAB_OKAY(X) do {} while(0)
20#endif
21
22#define FCRYPT_BSIZE 8
23struct rxrpc_crypt {
24 union {
25 u8 x[FCRYPT_BSIZE];
26 __be32 n[2];
27 };
28} __attribute__((aligned(8)));
29
30#define rxrpc_queue_work(WS) queue_work(rxrpc_workqueue, (WS))
31#define rxrpc_queue_delayed_work(WS,D) \
32 queue_delayed_work(rxrpc_workqueue, (WS), (D))
33
34#define rxrpc_queue_call(CALL) rxrpc_queue_work(&(CALL)->processor)
35#define rxrpc_queue_conn(CONN) rxrpc_queue_work(&(CONN)->processor)
36
37
38
39
40enum {
41 RXRPC_UNCONNECTED = 0,
42 RXRPC_CLIENT_BOUND,
43 RXRPC_CLIENT_CONNECTED,
44 RXRPC_SERVER_BOUND,
45 RXRPC_SERVER_LISTENING,
46 RXRPC_CLOSE,
47};
48
49
50
51
52struct rxrpc_sock {
53
54 struct sock sk;
55 rxrpc_interceptor_t interceptor;
56 struct rxrpc_local *local;
57 struct rxrpc_transport *trans;
58 struct rxrpc_conn_bundle *bundle;
59 struct rxrpc_connection *conn;
60 struct list_head listen_link;
61 struct list_head secureq;
62 struct list_head acceptq;
63 struct key *key;
64 struct key *securities;
65 struct rb_root calls;
66 unsigned long flags;
67#define RXRPC_SOCK_EXCLUSIVE_CONN 1
68 rwlock_t call_lock;
69 u32 min_sec_level;
70#define RXRPC_SECURITY_MAX RXRPC_SECURITY_ENCRYPT
71 struct sockaddr_rxrpc srx;
72 sa_family_t proto;
73 __be16 service_id;
74};
75
76#define rxrpc_sk(__sk) container_of((__sk), struct rxrpc_sock, sk)
77
78
79
80
81
82struct rxrpc_skb_priv {
83 struct rxrpc_call *call;
84 unsigned long resend_at;
85 union {
86 unsigned int offset;
87 int remain;
88 u32 error;
89 bool need_resend;
90 };
91
92 struct rxrpc_header hdr;
93};
94
95#define rxrpc_skb(__skb) ((struct rxrpc_skb_priv *) &(__skb)->cb)
96
97enum rxrpc_command {
98 RXRPC_CMD_SEND_DATA,
99 RXRPC_CMD_SEND_ABORT,
100 RXRPC_CMD_ACCEPT,
101 RXRPC_CMD_REJECT_BUSY,
102};
103
104
105
106
107struct rxrpc_security {
108 struct module *owner;
109 struct list_head link;
110 const char *name;
111 u8 security_index;
112
113
114 int (*init_connection_security)(struct rxrpc_connection *);
115
116
117 void (*prime_packet_security)(struct rxrpc_connection *);
118
119
120 int (*secure_packet)(const struct rxrpc_call *,
121 struct sk_buff *,
122 size_t,
123 void *);
124
125
126 int (*verify_packet)(const struct rxrpc_call *, struct sk_buff *,
127 u32 *);
128
129
130 int (*issue_challenge)(struct rxrpc_connection *);
131
132
133 int (*respond_to_challenge)(struct rxrpc_connection *,
134 struct sk_buff *,
135 u32 *);
136
137
138 int (*verify_response)(struct rxrpc_connection *,
139 struct sk_buff *,
140 u32 *);
141
142
143 void (*clear)(struct rxrpc_connection *);
144};
145
146
147
148
149
150struct rxrpc_local {
151 struct socket *socket;
152 struct work_struct destroyer;
153 struct work_struct acceptor;
154 struct work_struct rejecter;
155 struct list_head services;
156 struct list_head link;
157 struct rw_semaphore defrag_sem;
158 struct sk_buff_head accept_queue;
159 struct sk_buff_head reject_queue;
160 spinlock_t lock;
161 rwlock_t services_lock;
162 atomic_t usage;
163 int debug_id;
164 volatile char error_rcvd;
165 struct sockaddr_rxrpc srx;
166};
167
168
169
170
171
172
173struct rxrpc_peer {
174 struct work_struct destroyer;
175 struct list_head link;
176 struct list_head error_targets;
177 spinlock_t lock;
178 atomic_t usage;
179 unsigned int if_mtu;
180 unsigned int mtu;
181 unsigned int maxdata;
182 unsigned short hdrsize;
183 int debug_id;
184 int net_error;
185 struct sockaddr_rxrpc srx;
186
187
188#define RXRPC_RTT_CACHE_SIZE 32
189 suseconds_t rtt;
190 unsigned int rtt_point;
191 unsigned int rtt_usage;
192 suseconds_t rtt_cache[RXRPC_RTT_CACHE_SIZE];
193};
194
195
196
197
198
199
200struct rxrpc_transport {
201 struct rxrpc_local *local;
202 struct rxrpc_peer *peer;
203 struct work_struct error_handler;
204 struct rb_root bundles;
205 struct rb_root client_conns;
206 struct rb_root server_conns;
207 struct list_head link;
208 struct sk_buff_head error_queue;
209 time_t put_time;
210 spinlock_t client_lock;
211 rwlock_t conn_lock;
212 atomic_t usage;
213 int debug_id;
214 unsigned int conn_idcounter;
215};
216
217
218
219
220
221struct rxrpc_conn_bundle {
222 struct rb_node node;
223 struct list_head unused_conns;
224 struct list_head avail_conns;
225 struct list_head busy_conns;
226 struct key *key;
227 wait_queue_head_t chanwait;
228 atomic_t usage;
229 int debug_id;
230 unsigned short num_conns;
231 __be16 service_id;
232 u8 security_ix;
233};
234
235
236
237
238
239
240struct rxrpc_connection {
241 struct rxrpc_transport *trans;
242 struct rxrpc_conn_bundle *bundle;
243 struct work_struct processor;
244 struct rb_node node;
245 struct list_head link;
246 struct list_head bundle_link;
247 struct rb_root calls;
248 struct sk_buff_head rx_queue;
249 struct rxrpc_call *channels[RXRPC_MAXCALLS];
250 struct rxrpc_security *security;
251 struct key *key;
252 struct key *server_key;
253 struct crypto_blkcipher *cipher;
254 struct rxrpc_crypt csum_iv;
255 unsigned long events;
256#define RXRPC_CONN_CHALLENGE 0
257 time_t put_time;
258 rwlock_t lock;
259 spinlock_t state_lock;
260 atomic_t usage;
261 u32 real_conn_id;
262 enum {
263 RXRPC_CONN_UNUSED,
264 RXRPC_CONN_CLIENT,
265 RXRPC_CONN_SERVER_UNSECURED,
266 RXRPC_CONN_SERVER_CHALLENGING,
267 RXRPC_CONN_SERVER,
268 RXRPC_CONN_REMOTELY_ABORTED,
269 RXRPC_CONN_LOCALLY_ABORTED,
270 RXRPC_CONN_NETWORK_ERROR,
271 } state;
272 int error;
273 int debug_id;
274 unsigned int call_counter;
275 atomic_t serial;
276 atomic_t hi_serial;
277 u8 avail_calls;
278 u8 size_align;
279 u8 header_size;
280 u8 security_size;
281 u32 security_level;
282 u32 security_nonce;
283
284
285 __be32 epoch;
286 __be32 cid;
287 __be16 service_id;
288 u8 security_ix;
289 u8 in_clientflag;
290 u8 out_clientflag;
291};
292
293
294
295
296
297struct rxrpc_call {
298 struct rxrpc_connection *conn;
299 struct rxrpc_sock *socket;
300 struct timer_list lifetimer;
301 struct timer_list deadspan;
302 struct timer_list ack_timer;
303 struct timer_list resend_timer;
304 struct work_struct destroyer;
305 struct work_struct processor;
306 struct list_head link;
307 struct list_head error_link;
308 struct list_head accept_link;
309 struct rb_node sock_node;
310 struct rb_node conn_node;
311 struct sk_buff_head rx_queue;
312 struct sk_buff_head rx_oos_queue;
313 struct sk_buff *tx_pending;
314 wait_queue_head_t tx_waitq;
315 unsigned long user_call_ID;
316 unsigned long creation_jif;
317 unsigned long flags;
318#define RXRPC_CALL_RELEASED 0
319#define RXRPC_CALL_TERMINAL_MSG 1
320#define RXRPC_CALL_RCVD_LAST 2
321#define RXRPC_CALL_RUN_RTIMER 3
322#define RXRPC_CALL_TX_SOFT_ACK 4
323#define RXRPC_CALL_PROC_BUSY 5
324#define RXRPC_CALL_INIT_ACCEPT 6
325#define RXRPC_CALL_HAS_USERID 7
326#define RXRPC_CALL_EXPECT_OOS 8
327 unsigned long events;
328#define RXRPC_CALL_RCVD_ACKALL 0
329#define RXRPC_CALL_RCVD_BUSY 1
330#define RXRPC_CALL_RCVD_ABORT 2
331#define RXRPC_CALL_RCVD_ERROR 3
332#define RXRPC_CALL_ACK_FINAL 4
333#define RXRPC_CALL_ACK 5
334#define RXRPC_CALL_REJECT_BUSY 6
335#define RXRPC_CALL_ABORT 7
336#define RXRPC_CALL_CONN_ABORT 8
337#define RXRPC_CALL_RESEND_TIMER 9
338#define RXRPC_CALL_RESEND 10
339#define RXRPC_CALL_DRAIN_RX_OOS 11
340#define RXRPC_CALL_LIFE_TIMER 12
341#define RXRPC_CALL_ACCEPTED 13
342#define RXRPC_CALL_SECURED 14
343#define RXRPC_CALL_POST_ACCEPT 15
344#define RXRPC_CALL_RELEASE 16
345
346 spinlock_t lock;
347 rwlock_t state_lock;
348 atomic_t usage;
349 atomic_t sequence;
350 u32 abort_code;
351 enum {
352 RXRPC_CALL_CLIENT_SEND_REQUEST,
353 RXRPC_CALL_CLIENT_AWAIT_REPLY,
354 RXRPC_CALL_CLIENT_RECV_REPLY,
355 RXRPC_CALL_CLIENT_FINAL_ACK,
356 RXRPC_CALL_SERVER_SECURING,
357 RXRPC_CALL_SERVER_ACCEPTING,
358 RXRPC_CALL_SERVER_RECV_REQUEST,
359 RXRPC_CALL_SERVER_ACK_REQUEST,
360 RXRPC_CALL_SERVER_SEND_REPLY,
361 RXRPC_CALL_SERVER_AWAIT_ACK,
362 RXRPC_CALL_COMPLETE,
363 RXRPC_CALL_SERVER_BUSY,
364 RXRPC_CALL_REMOTELY_ABORTED,
365 RXRPC_CALL_LOCALLY_ABORTED,
366 RXRPC_CALL_NETWORK_ERROR,
367 RXRPC_CALL_DEAD,
368 } state;
369 int debug_id;
370 u8 channel;
371
372
373 u8 acks_head;
374 u8 acks_tail;
375 u8 acks_winsz;
376 u8 acks_unacked;
377 int acks_latest;
378 rxrpc_seq_t acks_hard;
379 unsigned long *acks_window;
380
381
382
383
384 rxrpc_seq_t rx_data_expect;
385 rxrpc_seq_t rx_data_post;
386 rxrpc_seq_t rx_data_recv;
387 rxrpc_seq_t rx_data_eaten;
388 rxrpc_seq_t rx_first_oos;
389 rxrpc_seq_t ackr_win_top;
390 rxrpc_seq_net_t ackr_prev_seq;
391 u8 ackr_reason;
392 __be32 ackr_serial;
393 atomic_t ackr_not_idle;
394
395
396#define RXRPC_ACKR_WINDOW_ASZ DIV_ROUND_UP(RXRPC_MAXACKS, BITS_PER_LONG)
397 unsigned long ackr_window[RXRPC_ACKR_WINDOW_ASZ + 1];
398
399
400 __be32 cid;
401 __be32 call_id;
402};
403
404
405
406
407static inline void rxrpc_abort_call(struct rxrpc_call *call, u32 abort_code)
408{
409 write_lock_bh(&call->state_lock);
410 if (call->state < RXRPC_CALL_COMPLETE) {
411 call->abort_code = abort_code;
412 call->state = RXRPC_CALL_LOCALLY_ABORTED;
413 set_bit(RXRPC_CALL_ABORT, &call->events);
414 }
415 write_unlock_bh(&call->state_lock);
416}
417
418
419
420
421extern atomic_t rxrpc_n_skbs;
422extern __be32 rxrpc_epoch;
423extern atomic_t rxrpc_debug_id;
424extern struct workqueue_struct *rxrpc_workqueue;
425
426
427
428
429extern void rxrpc_accept_incoming_calls(struct work_struct *);
430extern struct rxrpc_call *rxrpc_accept_call(struct rxrpc_sock *,
431 unsigned long);
432extern int rxrpc_reject_call(struct rxrpc_sock *);
433
434
435
436
437extern void __rxrpc_propose_ACK(struct rxrpc_call *, u8, __be32, bool);
438extern void rxrpc_propose_ACK(struct rxrpc_call *, u8, __be32, bool);
439extern void rxrpc_process_call(struct work_struct *);
440
441
442
443
444extern struct kmem_cache *rxrpc_call_jar;
445extern struct list_head rxrpc_calls;
446extern rwlock_t rxrpc_call_lock;
447
448extern struct rxrpc_call *rxrpc_get_client_call(struct rxrpc_sock *,
449 struct rxrpc_transport *,
450 struct rxrpc_conn_bundle *,
451 unsigned long, int, gfp_t);
452extern struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *,
453 struct rxrpc_connection *,
454 struct rxrpc_header *, gfp_t);
455extern struct rxrpc_call *rxrpc_find_server_call(struct rxrpc_sock *,
456 unsigned long);
457extern void rxrpc_release_call(struct rxrpc_call *);
458extern void rxrpc_release_calls_on_socket(struct rxrpc_sock *);
459extern void __rxrpc_put_call(struct rxrpc_call *);
460extern void __exit rxrpc_destroy_all_calls(void);
461
462
463
464
465extern struct list_head rxrpc_connections;
466extern rwlock_t rxrpc_connection_lock;
467
468extern struct rxrpc_conn_bundle *rxrpc_get_bundle(struct rxrpc_sock *,
469 struct rxrpc_transport *,
470 struct key *,
471 __be16, gfp_t);
472extern void rxrpc_put_bundle(struct rxrpc_transport *,
473 struct rxrpc_conn_bundle *);
474extern int rxrpc_connect_call(struct rxrpc_sock *, struct rxrpc_transport *,
475 struct rxrpc_conn_bundle *, struct rxrpc_call *,
476 gfp_t);
477extern void rxrpc_put_connection(struct rxrpc_connection *);
478extern void __exit rxrpc_destroy_all_connections(void);
479extern struct rxrpc_connection *rxrpc_find_connection(struct rxrpc_transport *,
480 struct rxrpc_header *);
481extern struct rxrpc_connection *
482rxrpc_incoming_connection(struct rxrpc_transport *, struct rxrpc_header *,
483 gfp_t);
484
485
486
487
488extern void rxrpc_process_connection(struct work_struct *);
489extern void rxrpc_reject_packet(struct rxrpc_local *, struct sk_buff *);
490extern void rxrpc_reject_packets(struct work_struct *);
491
492
493
494
495extern void rxrpc_UDP_error_report(struct sock *);
496extern void rxrpc_UDP_error_handler(struct work_struct *);
497
498
499
500
501extern unsigned long rxrpc_ack_timeout;
502extern const char *rxrpc_pkts[];
503
504extern void rxrpc_data_ready(struct sock *, int);
505extern int rxrpc_queue_rcv_skb(struct rxrpc_call *, struct sk_buff *, bool,
506 bool);
507extern void rxrpc_fast_process_packet(struct rxrpc_call *, struct sk_buff *);
508
509
510
511
512extern rwlock_t rxrpc_local_lock;
513extern struct rxrpc_local *rxrpc_lookup_local(struct sockaddr_rxrpc *);
514extern void rxrpc_put_local(struct rxrpc_local *);
515extern void __exit rxrpc_destroy_all_locals(void);
516
517
518
519
520extern struct key_type key_type_rxrpc;
521extern struct key_type key_type_rxrpc_s;
522
523extern int rxrpc_request_key(struct rxrpc_sock *, char __user *, int);
524extern int rxrpc_server_keyring(struct rxrpc_sock *, char __user *, int);
525extern int rxrpc_get_server_data_key(struct rxrpc_connection *, const void *,
526 time_t, u32);
527
528
529
530
531extern int rxrpc_resend_timeout;
532
533extern int rxrpc_send_packet(struct rxrpc_transport *, struct sk_buff *);
534extern int rxrpc_client_sendmsg(struct kiocb *, struct rxrpc_sock *,
535 struct rxrpc_transport *, struct msghdr *,
536 size_t);
537extern int rxrpc_server_sendmsg(struct kiocb *, struct rxrpc_sock *,
538 struct msghdr *, size_t);
539
540
541
542
543extern struct rxrpc_peer *rxrpc_get_peer(struct sockaddr_rxrpc *, gfp_t);
544extern void rxrpc_put_peer(struct rxrpc_peer *);
545extern struct rxrpc_peer *rxrpc_find_peer(struct rxrpc_local *,
546 __be32, __be16);
547extern void __exit rxrpc_destroy_all_peers(void);
548
549
550
551
552extern const char *const rxrpc_call_states[];
553extern const struct file_operations rxrpc_call_seq_fops;
554extern const struct file_operations rxrpc_connection_seq_fops;
555
556
557
558
559extern void rxrpc_remove_user_ID(struct rxrpc_sock *, struct rxrpc_call *);
560extern int rxrpc_recvmsg(struct kiocb *, struct socket *, struct msghdr *,
561 size_t, int);
562
563
564
565
566extern int rxrpc_register_security(struct rxrpc_security *);
567extern void rxrpc_unregister_security(struct rxrpc_security *);
568extern int rxrpc_init_client_conn_security(struct rxrpc_connection *);
569extern int rxrpc_init_server_conn_security(struct rxrpc_connection *);
570extern int rxrpc_secure_packet(const struct rxrpc_call *, struct sk_buff *,
571 size_t, void *);
572extern int rxrpc_verify_packet(const struct rxrpc_call *, struct sk_buff *,
573 u32 *);
574extern void rxrpc_clear_conn_security(struct rxrpc_connection *);
575
576
577
578
579extern void rxrpc_packet_destructor(struct sk_buff *);
580
581
582
583
584extern struct rxrpc_transport *rxrpc_get_transport(struct rxrpc_local *,
585 struct rxrpc_peer *,
586 gfp_t);
587extern void rxrpc_put_transport(struct rxrpc_transport *);
588extern void __exit rxrpc_destroy_all_transports(void);
589extern struct rxrpc_transport *rxrpc_find_transport(struct rxrpc_local *,
590 struct rxrpc_peer *);
591
592
593
594
595extern unsigned int rxrpc_debug;
596
597#define dbgprintk(FMT,...) \
598 printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__)
599
600#define kenter(FMT,...) dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
601#define kleave(FMT,...) dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
602#define kdebug(FMT,...) dbgprintk(" "FMT ,##__VA_ARGS__)
603#define kproto(FMT,...) dbgprintk("### "FMT ,##__VA_ARGS__)
604#define knet(FMT,...) dbgprintk("@@@ "FMT ,##__VA_ARGS__)
605
606
607#if defined(__KDEBUG)
608#define _enter(FMT,...) kenter(FMT,##__VA_ARGS__)
609#define _leave(FMT,...) kleave(FMT,##__VA_ARGS__)
610#define _debug(FMT,...) kdebug(FMT,##__VA_ARGS__)
611#define _proto(FMT,...) kproto(FMT,##__VA_ARGS__)
612#define _net(FMT,...) knet(FMT,##__VA_ARGS__)
613
614#elif defined(CONFIG_AF_RXRPC_DEBUG)
615#define RXRPC_DEBUG_KENTER 0x01
616#define RXRPC_DEBUG_KLEAVE 0x02
617#define RXRPC_DEBUG_KDEBUG 0x04
618#define RXRPC_DEBUG_KPROTO 0x08
619#define RXRPC_DEBUG_KNET 0x10
620
621#define _enter(FMT,...) \
622do { \
623 if (unlikely(rxrpc_debug & RXRPC_DEBUG_KENTER)) \
624 kenter(FMT,##__VA_ARGS__); \
625} while (0)
626
627#define _leave(FMT,...) \
628do { \
629 if (unlikely(rxrpc_debug & RXRPC_DEBUG_KLEAVE)) \
630 kleave(FMT,##__VA_ARGS__); \
631} while (0)
632
633#define _debug(FMT,...) \
634do { \
635 if (unlikely(rxrpc_debug & RXRPC_DEBUG_KDEBUG)) \
636 kdebug(FMT,##__VA_ARGS__); \
637} while (0)
638
639#define _proto(FMT,...) \
640do { \
641 if (unlikely(rxrpc_debug & RXRPC_DEBUG_KPROTO)) \
642 kproto(FMT,##__VA_ARGS__); \
643} while (0)
644
645#define _net(FMT,...) \
646do { \
647 if (unlikely(rxrpc_debug & RXRPC_DEBUG_KNET)) \
648 knet(FMT,##__VA_ARGS__); \
649} while (0)
650
651#else
652#define _enter(FMT,...) no_printk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
653#define _leave(FMT,...) no_printk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
654#define _debug(FMT,...) no_printk(" "FMT ,##__VA_ARGS__)
655#define _proto(FMT,...) no_printk("### "FMT ,##__VA_ARGS__)
656#define _net(FMT,...) no_printk("@@@ "FMT ,##__VA_ARGS__)
657#endif
658
659
660
661
662#if 1
663
664#define ASSERT(X) \
665do { \
666 if (unlikely(!(X))) { \
667 printk(KERN_ERR "\n"); \
668 printk(KERN_ERR "RxRPC: Assertion failed\n"); \
669 BUG(); \
670 } \
671} while(0)
672
673#define ASSERTCMP(X, OP, Y) \
674do { \
675 if (unlikely(!((X) OP (Y)))) { \
676 printk(KERN_ERR "\n"); \
677 printk(KERN_ERR "RxRPC: Assertion failed\n"); \
678 printk(KERN_ERR "%lu " #OP " %lu is false\n", \
679 (unsigned long)(X), (unsigned long)(Y)); \
680 printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n", \
681 (unsigned long)(X), (unsigned long)(Y)); \
682 BUG(); \
683 } \
684} while(0)
685
686#define ASSERTIF(C, X) \
687do { \
688 if (unlikely((C) && !(X))) { \
689 printk(KERN_ERR "\n"); \
690 printk(KERN_ERR "RxRPC: Assertion failed\n"); \
691 BUG(); \
692 } \
693} while(0)
694
695#define ASSERTIFCMP(C, X, OP, Y) \
696do { \
697 if (unlikely((C) && !((X) OP (Y)))) { \
698 printk(KERN_ERR "\n"); \
699 printk(KERN_ERR "RxRPC: Assertion failed\n"); \
700 printk(KERN_ERR "%lu " #OP " %lu is false\n", \
701 (unsigned long)(X), (unsigned long)(Y)); \
702 printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n", \
703 (unsigned long)(X), (unsigned long)(Y)); \
704 BUG(); \
705 } \
706} while(0)
707
708#else
709
710#define ASSERT(X) \
711do { \
712} while(0)
713
714#define ASSERTCMP(X, OP, Y) \
715do { \
716} while(0)
717
718#define ASSERTIF(C, X) \
719do { \
720} while(0)
721
722#define ASSERTIFCMP(C, X, OP, Y) \
723do { \
724} while(0)
725
726#endif
727
728
729
730
731static inline void __rxrpc_new_skb(struct sk_buff *skb, const char *fn)
732{
733
734
735}
736
737#define rxrpc_new_skb(skb) __rxrpc_new_skb((skb), __func__)
738
739static inline void __rxrpc_kill_skb(struct sk_buff *skb, const char *fn)
740{
741
742
743}
744
745#define rxrpc_kill_skb(skb) __rxrpc_kill_skb((skb), __func__)
746
747static inline void __rxrpc_free_skb(struct sk_buff *skb, const char *fn)
748{
749 if (skb) {
750 CHECK_SLAB_OKAY(&skb->users);
751
752
753
754 kfree_skb(skb);
755 }
756}
757
758#define rxrpc_free_skb(skb) __rxrpc_free_skb((skb), __func__)
759
760static inline void rxrpc_purge_queue(struct sk_buff_head *list)
761{
762 struct sk_buff *skb;
763 while ((skb = skb_dequeue((list))) != NULL)
764 rxrpc_free_skb(skb);
765}
766
767static inline void __rxrpc_get_local(struct rxrpc_local *local, const char *f)
768{
769 CHECK_SLAB_OKAY(&local->usage);
770 if (atomic_inc_return(&local->usage) == 1)
771 printk("resurrected (%s)\n", f);
772}
773
774#define rxrpc_get_local(LOCAL) __rxrpc_get_local((LOCAL), __func__)
775
776#define rxrpc_get_call(CALL) \
777do { \
778 CHECK_SLAB_OKAY(&(CALL)->usage); \
779 if (atomic_inc_return(&(CALL)->usage) == 1) \
780 BUG(); \
781} while(0)
782
783#define rxrpc_put_call(CALL) \
784do { \
785 __rxrpc_put_call(CALL); \
786} while(0)
787