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

TOMOYO Linux Cross Reference
Linux/net/netrom/nr_loopback.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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/netrom/nr_loopback.c (Version linux-6.11-rc3) and /net/netrom/nr_loopback.c (Version linux-2.4.37.11)


  1 // SPDX-License-Identifier: GPL-2.0-or-later   << 
  2 /*                                                  1 /*
                                                   >>   2  *      NET/ROM release 007
                                                   >>   3  *
                                                   >>   4  *      This code REQUIRES 2.1.15 or higher/ NET3.038
                                                   >>   5  *
                                                   >>   6  *      This module:
                                                   >>   7  *              This module is free software; you can redistribute it and/or
                                                   >>   8  *              modify it under the terms of the GNU General Public License
                                                   >>   9  *              as published by the Free Software Foundation; either version
                                                   >>  10  *              2 of the License, or (at your option) any later version.
                                                   >>  11  *
                                                   >>  12  *      History
                                                   >>  13  *      NET/ROM 007     Tomi(OH2BNS)    Created this file.
                                                   >>  14  *                                      Small change in nr_loopback_queue().
  3  *                                                 15  *
  4  * Copyright Tomi Manninen OH2BNS (oh2bns@sral << 
  5  */                                                16  */
                                                   >>  17 
  6 #include <linux/types.h>                           18 #include <linux/types.h>
  7 #include <linux/slab.h>                        << 
  8 #include <linux/socket.h>                          19 #include <linux/socket.h>
  9 #include <linux/timer.h>                           20 #include <linux/timer.h>
 10 #include <net/ax25.h>                              21 #include <net/ax25.h>
 11 #include <linux/skbuff.h>                          22 #include <linux/skbuff.h>
 12 #include <net/netrom.h>                            23 #include <net/netrom.h>
 13 #include <linux/init.h>                            24 #include <linux/init.h>
 14                                                    25 
 15 static void nr_loopback_timer(struct timer_lis << 
 16                                                << 
 17 static struct sk_buff_head loopback_queue;         26 static struct sk_buff_head loopback_queue;
 18 static DEFINE_TIMER(loopback_timer, nr_loopbac !!  27 static struct timer_list loopback_timer;
                                                   >>  28 
                                                   >>  29 static void nr_set_loopback_timer(void);
 19                                                    30 
 20 void __init nr_loopback_init(void)             !!  31 void nr_loopback_init(void)
 21 {                                                  32 {
 22         skb_queue_head_init(&loopback_queue);      33         skb_queue_head_init(&loopback_queue);
                                                   >>  34 
                                                   >>  35         init_timer(&loopback_timer);
 23 }                                                  36 }
 24                                                    37 
 25 static inline int nr_loopback_running(void)    !!  38 static int nr_loopback_running(void)
 26 {                                                  39 {
 27         return timer_pending(&loopback_timer);     40         return timer_pending(&loopback_timer);
 28 }                                                  41 }
 29                                                    42 
 30 int nr_loopback_queue(struct sk_buff *skb)         43 int nr_loopback_queue(struct sk_buff *skb)
 31 {                                                  44 {
 32         struct sk_buff *skbn;                      45         struct sk_buff *skbn;
 33                                                    46 
 34         if ((skbn = alloc_skb(skb->len, GFP_AT     47         if ((skbn = alloc_skb(skb->len, GFP_ATOMIC)) != NULL) {
 35                 skb_copy_from_linear_data(skb, !!  48                 memcpy(skb_put(skbn, skb->len), skb->data, skb->len);
 36                 skb_reset_transport_header(skb !!  49                 skbn->h.raw = skbn->data;
 37                                                    50 
 38                 skb_queue_tail(&loopback_queue     51                 skb_queue_tail(&loopback_queue, skbn);
 39                                                    52 
 40                 if (!nr_loopback_running())        53                 if (!nr_loopback_running())
 41                         mod_timer(&loopback_ti !!  54                         nr_set_loopback_timer();
 42         }                                          55         }
 43                                                    56 
 44         kfree_skb(skb);                            57         kfree_skb(skb);
 45         return 1;                                  58         return 1;
 46 }                                                  59 }
 47                                                    60 
 48 static void nr_loopback_timer(struct timer_lis !!  61 static void nr_loopback_timer(unsigned long);
                                                   >>  62 
                                                   >>  63 static void nr_set_loopback_timer(void)
                                                   >>  64 {
                                                   >>  65         del_timer(&loopback_timer);
                                                   >>  66 
                                                   >>  67         loopback_timer.data     = 0;
                                                   >>  68         loopback_timer.function = &nr_loopback_timer;
                                                   >>  69         loopback_timer.expires  = jiffies + 10;
                                                   >>  70 
                                                   >>  71         add_timer(&loopback_timer);
                                                   >>  72 }
                                                   >>  73 
                                                   >>  74 static void nr_loopback_timer(unsigned long param)
 49 {                                                  75 {
 50         struct sk_buff *skb;                       76         struct sk_buff *skb;
 51         ax25_address *nr_dest;                     77         ax25_address *nr_dest;
 52         struct net_device *dev;                    78         struct net_device *dev;
 53                                                    79 
 54         if ((skb = skb_dequeue(&loopback_queue     80         if ((skb = skb_dequeue(&loopback_queue)) != NULL) {
 55                 nr_dest = (ax25_address *)(skb     81                 nr_dest = (ax25_address *)(skb->data + 7);
 56                                                    82 
 57                 dev = nr_dev_get(nr_dest);         83                 dev = nr_dev_get(nr_dest);
 58                                                    84 
 59                 if (dev == NULL || nr_rx_frame     85                 if (dev == NULL || nr_rx_frame(skb, dev) == 0)
 60                         kfree_skb(skb);            86                         kfree_skb(skb);
 61                                                    87 
 62                 dev_put(dev);                  !!  88                 if (dev != NULL)
                                                   >>  89                         dev_put(dev);
 63                                                    90 
 64                 if (!skb_queue_empty(&loopback     91                 if (!skb_queue_empty(&loopback_queue) && !nr_loopback_running())
 65                         mod_timer(&loopback_ti !!  92                         nr_set_loopback_timer();
 66         }                                          93         }
 67 }                                                  94 }
 68                                                    95 
 69 void nr_loopback_clear(void)                   !!  96 void __exit nr_loopback_clear(void)
 70 {                                                  97 {
 71         del_timer_sync(&loopback_timer);       !!  98         del_timer(&loopback_timer);
 72         skb_queue_purge(&loopback_queue);          99         skb_queue_purge(&loopback_queue);
 73 }                                                 100 }
 74                                                   101 

~ [ 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