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

TOMOYO Linux Cross Reference
Linux/net/netrom/nr_loopback.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/netrom/nr_loopback.c (Version linux-6.11.5) and /net/netrom/nr_loopback.c (Version linux-4.15.18)


  1 // SPDX-License-Identifier: GPL-2.0-or-later   << 
  2 /*                                                  1 /*
                                                   >>   2  * This program is free software; you can redistribute it and/or modify
                                                   >>   3  * it under the terms of the GNU General Public License as published by
                                                   >>   4  * the Free Software Foundation; either version 2 of the License, or
                                                   >>   5  * (at your option) any later version.
  3  *                                                  6  *
  4  * Copyright Tomi Manninen OH2BNS (oh2bns@sral      7  * Copyright Tomi Manninen OH2BNS (oh2bns@sral.fi)
  5  */                                                 8  */
  6 #include <linux/types.h>                            9 #include <linux/types.h>
  7 #include <linux/slab.h>                            10 #include <linux/slab.h>
  8 #include <linux/socket.h>                          11 #include <linux/socket.h>
  9 #include <linux/timer.h>                           12 #include <linux/timer.h>
 10 #include <net/ax25.h>                              13 #include <net/ax25.h>
 11 #include <linux/skbuff.h>                          14 #include <linux/skbuff.h>
 12 #include <net/netrom.h>                            15 #include <net/netrom.h>
 13 #include <linux/init.h>                            16 #include <linux/init.h>
 14                                                    17 
 15 static void nr_loopback_timer(struct timer_lis     18 static void nr_loopback_timer(struct timer_list *);
 16                                                    19 
 17 static struct sk_buff_head loopback_queue;         20 static struct sk_buff_head loopback_queue;
 18 static DEFINE_TIMER(loopback_timer, nr_loopbac     21 static DEFINE_TIMER(loopback_timer, nr_loopback_timer);
 19                                                    22 
 20 void __init nr_loopback_init(void)                 23 void __init nr_loopback_init(void)
 21 {                                                  24 {
 22         skb_queue_head_init(&loopback_queue);      25         skb_queue_head_init(&loopback_queue);
 23 }                                                  26 }
 24                                                    27 
 25 static inline int nr_loopback_running(void)        28 static inline int nr_loopback_running(void)
 26 {                                                  29 {
 27         return timer_pending(&loopback_timer);     30         return timer_pending(&loopback_timer);
 28 }                                                  31 }
 29                                                    32 
 30 int nr_loopback_queue(struct sk_buff *skb)         33 int nr_loopback_queue(struct sk_buff *skb)
 31 {                                                  34 {
 32         struct sk_buff *skbn;                      35         struct sk_buff *skbn;
 33                                                    36 
 34         if ((skbn = alloc_skb(skb->len, GFP_AT     37         if ((skbn = alloc_skb(skb->len, GFP_ATOMIC)) != NULL) {
 35                 skb_copy_from_linear_data(skb,     38                 skb_copy_from_linear_data(skb, skb_put(skbn, skb->len), skb->len);
 36                 skb_reset_transport_header(skb     39                 skb_reset_transport_header(skbn);
 37                                                    40 
 38                 skb_queue_tail(&loopback_queue     41                 skb_queue_tail(&loopback_queue, skbn);
 39                                                    42 
 40                 if (!nr_loopback_running())        43                 if (!nr_loopback_running())
 41                         mod_timer(&loopback_ti     44                         mod_timer(&loopback_timer, jiffies + 10);
 42         }                                          45         }
 43                                                    46 
 44         kfree_skb(skb);                            47         kfree_skb(skb);
 45         return 1;                                  48         return 1;
 46 }                                                  49 }
 47                                                    50 
 48 static void nr_loopback_timer(struct timer_lis     51 static void nr_loopback_timer(struct timer_list *unused)
 49 {                                                  52 {
 50         struct sk_buff *skb;                       53         struct sk_buff *skb;
 51         ax25_address *nr_dest;                     54         ax25_address *nr_dest;
 52         struct net_device *dev;                    55         struct net_device *dev;
 53                                                    56 
 54         if ((skb = skb_dequeue(&loopback_queue     57         if ((skb = skb_dequeue(&loopback_queue)) != NULL) {
 55                 nr_dest = (ax25_address *)(skb     58                 nr_dest = (ax25_address *)(skb->data + 7);
 56                                                    59 
 57                 dev = nr_dev_get(nr_dest);         60                 dev = nr_dev_get(nr_dest);
 58                                                    61 
 59                 if (dev == NULL || nr_rx_frame     62                 if (dev == NULL || nr_rx_frame(skb, dev) == 0)
 60                         kfree_skb(skb);            63                         kfree_skb(skb);
 61                                                    64 
 62                 dev_put(dev);                  !!  65                 if (dev != NULL)
                                                   >>  66                         dev_put(dev);
 63                                                    67 
 64                 if (!skb_queue_empty(&loopback     68                 if (!skb_queue_empty(&loopback_queue) && !nr_loopback_running())
 65                         mod_timer(&loopback_ti     69                         mod_timer(&loopback_timer, jiffies + 10);
 66         }                                          70         }
 67 }                                                  71 }
 68                                                    72 
 69 void nr_loopback_clear(void)                   !!  73 void __exit nr_loopback_clear(void)
 70 {                                                  74 {
 71         del_timer_sync(&loopback_timer);           75         del_timer_sync(&loopback_timer);
 72         skb_queue_purge(&loopback_queue);          76         skb_queue_purge(&loopback_queue);
 73 }                                                  77 }
 74                                                    78 

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