~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/rxrpc/skbuff.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /net/rxrpc/skbuff.c (Version linux-6.11.5) and /net/rxrpc/skbuff.c (Version linux-4.18.20)


  1 // SPDX-License-Identifier: GPL-2.0-or-later   !!   1 /* ar-skbuff.c: socket buffer destruction handling
  2 /* Socket buffer accounting                    << 
  3  *                                                  2  *
  4  * Copyright (C) 2007 Red Hat, Inc. All Rights      3  * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  5  * Written by David Howells (dhowells@redhat.c      4  * Written by David Howells (dhowells@redhat.com)
                                                   >>   5  *
                                                   >>   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.
  6  */                                                10  */
  7                                                    11 
  8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt        12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  9                                                    13 
 10 #include <linux/module.h>                          14 #include <linux/module.h>
 11 #include <linux/net.h>                             15 #include <linux/net.h>
 12 #include <linux/skbuff.h>                          16 #include <linux/skbuff.h>
 13 #include <net/sock.h>                              17 #include <net/sock.h>
 14 #include <net/af_rxrpc.h>                          18 #include <net/af_rxrpc.h>
 15 #include "ar-internal.h"                           19 #include "ar-internal.h"
 16                                                    20 
 17 #define select_skb_count(skb) (&rxrpc_n_rx_skb !!  21 #define select_skb_count(op) (op >= rxrpc_skb_tx_cleaned ? &rxrpc_n_tx_skbs : &rxrpc_n_rx_skbs)
 18                                                    22 
 19 /*                                                 23 /*
 20  * Note the allocation or reception of a socke     24  * Note the allocation or reception of a socket buffer.
 21  */                                                25  */
 22 void rxrpc_new_skb(struct sk_buff *skb, enum r !!  26 void rxrpc_new_skb(struct sk_buff *skb, enum rxrpc_skb_trace op)
 23 {                                                  27 {
 24         int n = atomic_inc_return(select_skb_c !!  28         const void *here = __builtin_return_address(0);
 25         trace_rxrpc_skb(skb, refcount_read(&sk !!  29         int n = atomic_inc_return(select_skb_count(op));
                                                   >>  30         trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, here);
 26 }                                                  31 }
 27                                                    32 
 28 /*                                                 33 /*
 29  * Note the re-emergence of a socket buffer fr     34  * Note the re-emergence of a socket buffer from a queue or buffer.
 30  */                                                35  */
 31 void rxrpc_see_skb(struct sk_buff *skb, enum r !!  36 void rxrpc_see_skb(struct sk_buff *skb, enum rxrpc_skb_trace op)
 32 {                                                  37 {
                                                   >>  38         const void *here = __builtin_return_address(0);
 33         if (skb) {                                 39         if (skb) {
 34                 int n = atomic_read(select_skb !!  40                 int n = atomic_read(select_skb_count(op));
 35                 trace_rxrpc_skb(skb, refcount_ !!  41                 trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, here);
 36         }                                          42         }
 37 }                                                  43 }
 38                                                    44 
 39 /*                                                 45 /*
 40  * Note the addition of a ref on a socket buff     46  * Note the addition of a ref on a socket buffer.
 41  */                                                47  */
 42 void rxrpc_get_skb(struct sk_buff *skb, enum r !!  48 void rxrpc_get_skb(struct sk_buff *skb, enum rxrpc_skb_trace op)
 43 {                                                  49 {
 44         int n = atomic_inc_return(select_skb_c !!  50         const void *here = __builtin_return_address(0);
 45         trace_rxrpc_skb(skb, refcount_read(&sk !!  51         int n = atomic_inc_return(select_skb_count(op));
                                                   >>  52         trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, here);
 46         skb_get(skb);                              53         skb_get(skb);
 47 }                                                  54 }
 48                                                    55 
 49 /*                                                 56 /*
 50  * Note the dropping of a ref on a socket buff !!  57  * Note the destruction of a socket buffer.
 51  */                                                58  */
 52 void rxrpc_eaten_skb(struct sk_buff *skb, enum !!  59 void rxrpc_free_skb(struct sk_buff *skb, enum rxrpc_skb_trace op)
 53 {                                                  60 {
 54         int n = atomic_inc_return(&rxrpc_n_rx_ !!  61         const void *here = __builtin_return_address(0);
 55         trace_rxrpc_skb(skb, 0, n, why);       !!  62         if (skb) {
                                                   >>  63                 int n;
                                                   >>  64                 CHECK_SLAB_OKAY(&skb->users);
                                                   >>  65                 n = atomic_dec_return(select_skb_count(op));
                                                   >>  66                 trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, here);
                                                   >>  67                 kfree_skb(skb);
                                                   >>  68         }
 56 }                                                  69 }
 57                                                    70 
 58 /*                                                 71 /*
 59  * Note the destruction of a socket buffer.    !!  72  * Note the injected loss of a socket buffer.
 60  */                                                73  */
 61 void rxrpc_free_skb(struct sk_buff *skb, enum  !!  74 void rxrpc_lose_skb(struct sk_buff *skb, enum rxrpc_skb_trace op)
 62 {                                                  75 {
                                                   >>  76         const void *here = __builtin_return_address(0);
 63         if (skb) {                                 77         if (skb) {
 64                 int n = atomic_dec_return(sele !!  78                 int n;
 65                 trace_rxrpc_skb(skb, refcount_ !!  79                 CHECK_SLAB_OKAY(&skb->users);
 66                 consume_skb(skb);              !!  80                 n = atomic_dec_return(select_skb_count(op));
                                                   >>  81                 trace_rxrpc_skb(skb, op, refcount_read(&skb->users), n, here);
                                                   >>  82                 kfree_skb(skb);
 67         }                                          83         }
 68 }                                                  84 }
 69                                                    85 
 70 /*                                                 86 /*
 71  * Clear a queue of socket buffers.                87  * Clear a queue of socket buffers.
 72  */                                                88  */
 73 void rxrpc_purge_queue(struct sk_buff_head *li     89 void rxrpc_purge_queue(struct sk_buff_head *list)
 74 {                                                  90 {
                                                   >>  91         const void *here = __builtin_return_address(0);
 75         struct sk_buff *skb;                       92         struct sk_buff *skb;
 76                                                << 
 77         while ((skb = skb_dequeue((list))) !=      93         while ((skb = skb_dequeue((list))) != NULL) {
 78                 int n = atomic_dec_return(sele !!  94                 int n = atomic_dec_return(select_skb_count(rxrpc_skb_rx_purged));
 79                 trace_rxrpc_skb(skb, refcount_ !!  95                 trace_rxrpc_skb(skb, rxrpc_skb_rx_purged,
 80                                 rxrpc_skb_put_ !!  96                                 refcount_read(&skb->users), n, here);
 81                 consume_skb(skb);              !!  97                 kfree_skb(skb);
 82         }                                          98         }
 83 }                                                  99 }
 84                                                   100 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php