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

TOMOYO Linux Cross Reference
Linux/net/rose/rose_out.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/rose/rose_out.c (Version linux-6.11-rc3) and /net/rose/rose_out.c (Version linux-4.11.12)


  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 (C) Jonathan Naylor G4KLX (g4klx@      7  * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
  5  */                                                 8  */
  6 #include <linux/errno.h>                            9 #include <linux/errno.h>
  7 #include <linux/types.h>                           10 #include <linux/types.h>
  8 #include <linux/socket.h>                          11 #include <linux/socket.h>
  9 #include <linux/in.h>                              12 #include <linux/in.h>
 10 #include <linux/kernel.h>                          13 #include <linux/kernel.h>
 11 #include <linux/timer.h>                           14 #include <linux/timer.h>
 12 #include <linux/string.h>                          15 #include <linux/string.h>
 13 #include <linux/sockios.h>                         16 #include <linux/sockios.h>
 14 #include <linux/net.h>                             17 #include <linux/net.h>
 15 #include <linux/gfp.h>                             18 #include <linux/gfp.h>
 16 #include <net/ax25.h>                              19 #include <net/ax25.h>
 17 #include <linux/inet.h>                            20 #include <linux/inet.h>
 18 #include <linux/netdevice.h>                       21 #include <linux/netdevice.h>
 19 #include <linux/skbuff.h>                          22 #include <linux/skbuff.h>
 20 #include <net/sock.h>                              23 #include <net/sock.h>
 21 #include <linux/fcntl.h>                           24 #include <linux/fcntl.h>
 22 #include <linux/mm.h>                              25 #include <linux/mm.h>
 23 #include <linux/interrupt.h>                       26 #include <linux/interrupt.h>
 24 #include <net/rose.h>                              27 #include <net/rose.h>
 25                                                    28 
 26 /*                                                 29 /*
 27  *      This procedure is passed a buffer desc     30  *      This procedure is passed a buffer descriptor for an iframe. It builds
 28  *      the rest of the control part of the fr     31  *      the rest of the control part of the frame and then writes it out.
 29  */                                                32  */
 30 static void rose_send_iframe(struct sock *sk,      33 static void rose_send_iframe(struct sock *sk, struct sk_buff *skb)
 31 {                                                  34 {
 32         struct rose_sock *rose = rose_sk(sk);      35         struct rose_sock *rose = rose_sk(sk);
 33                                                    36 
 34         if (skb == NULL)                           37         if (skb == NULL)
 35                 return;                            38                 return;
 36                                                    39 
 37         skb->data[2] |= (rose->vr << 5) & 0xE0     40         skb->data[2] |= (rose->vr << 5) & 0xE0;
 38         skb->data[2] |= (rose->vs << 1) & 0x0E     41         skb->data[2] |= (rose->vs << 1) & 0x0E;
 39                                                    42 
 40         rose_start_idletimer(sk);                  43         rose_start_idletimer(sk);
 41                                                    44 
 42         rose_transmit_link(skb, rose->neighbou     45         rose_transmit_link(skb, rose->neighbour);
 43 }                                                  46 }
 44                                                    47 
 45 void rose_kick(struct sock *sk)                    48 void rose_kick(struct sock *sk)
 46 {                                                  49 {
 47         struct rose_sock *rose = rose_sk(sk);      50         struct rose_sock *rose = rose_sk(sk);
 48         struct sk_buff *skb, *skbn;                51         struct sk_buff *skb, *skbn;
 49         unsigned short start, end;                 52         unsigned short start, end;
 50                                                    53 
 51         if (rose->state != ROSE_STATE_3)           54         if (rose->state != ROSE_STATE_3)
 52                 return;                            55                 return;
 53                                                    56 
 54         if (rose->condition & ROSE_COND_PEER_R     57         if (rose->condition & ROSE_COND_PEER_RX_BUSY)
 55                 return;                            58                 return;
 56                                                    59 
 57         if (!skb_peek(&sk->sk_write_queue))        60         if (!skb_peek(&sk->sk_write_queue))
 58                 return;                            61                 return;
 59                                                    62 
 60         start = (skb_peek(&rose->ack_queue) ==     63         start = (skb_peek(&rose->ack_queue) == NULL) ? rose->va : rose->vs;
 61         end   = (rose->va + sysctl_rose_window     64         end   = (rose->va + sysctl_rose_window_size) % ROSE_MODULUS;
 62                                                    65 
 63         if (start == end)                          66         if (start == end)
 64                 return;                            67                 return;
 65                                                    68 
 66         rose->vs = start;                          69         rose->vs = start;
 67                                                    70 
 68         /*                                         71         /*
 69          * Transmit data until either we're ou     72          * Transmit data until either we're out of data to send or
 70          * the window is full.                     73          * the window is full.
 71          */                                        74          */
 72                                                    75 
 73         skb  = skb_dequeue(&sk->sk_write_queue     76         skb  = skb_dequeue(&sk->sk_write_queue);
 74                                                    77 
 75         do {                                       78         do {
 76                 if ((skbn = skb_clone(skb, GFP     79                 if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {
 77                         skb_queue_head(&sk->sk     80                         skb_queue_head(&sk->sk_write_queue, skb);
 78                         break;                     81                         break;
 79                 }                                  82                 }
 80                                                    83 
 81                 skb_set_owner_w(skbn, sk);         84                 skb_set_owner_w(skbn, sk);
 82                                                    85 
 83                 /*                                 86                 /*
 84                  * Transmit the frame copy.        87                  * Transmit the frame copy.
 85                  */                                88                  */
 86                 rose_send_iframe(sk, skbn);        89                 rose_send_iframe(sk, skbn);
 87                                                    90 
 88                 rose->vs = (rose->vs + 1) % RO     91                 rose->vs = (rose->vs + 1) % ROSE_MODULUS;
 89                                                    92 
 90                 /*                                 93                 /*
 91                  * Requeue the original data f     94                  * Requeue the original data frame.
 92                  */                                95                  */
 93                 skb_queue_tail(&rose->ack_queu     96                 skb_queue_tail(&rose->ack_queue, skb);
 94                                                    97 
 95         } while (rose->vs != end &&                98         } while (rose->vs != end &&
 96                  (skb = skb_dequeue(&sk->sk_wr     99                  (skb = skb_dequeue(&sk->sk_write_queue)) != NULL);
 97                                                   100 
 98         rose->vl         = rose->vr;              101         rose->vl         = rose->vr;
 99         rose->condition &= ~ROSE_COND_ACK_PEND    102         rose->condition &= ~ROSE_COND_ACK_PENDING;
100                                                   103 
101         rose_stop_timer(sk);                      104         rose_stop_timer(sk);
102 }                                                 105 }
103                                                   106 
104 /*                                                107 /*
105  * The following routines are taken from page     108  * The following routines are taken from page 170 of the 7th ARRL Computer
106  * Networking Conference paper, as is the whol    109  * Networking Conference paper, as is the whole state machine.
107  */                                               110  */
108                                                   111 
109 void rose_enquiry_response(struct sock *sk)       112 void rose_enquiry_response(struct sock *sk)
110 {                                                 113 {
111         struct rose_sock *rose = rose_sk(sk);     114         struct rose_sock *rose = rose_sk(sk);
112                                                   115 
113         if (rose->condition & ROSE_COND_OWN_RX    116         if (rose->condition & ROSE_COND_OWN_RX_BUSY)
114                 rose_write_internal(sk, ROSE_R    117                 rose_write_internal(sk, ROSE_RNR);
115         else                                      118         else
116                 rose_write_internal(sk, ROSE_R    119                 rose_write_internal(sk, ROSE_RR);
117                                                   120 
118         rose->vl         = rose->vr;              121         rose->vl         = rose->vr;
119         rose->condition &= ~ROSE_COND_ACK_PEND    122         rose->condition &= ~ROSE_COND_ACK_PENDING;
120                                                   123 
121         rose_stop_timer(sk);                      124         rose_stop_timer(sk);
122 }                                                 125 }
123                                                   126 

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