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

TOMOYO Linux Cross Reference
Linux/net/atm/raw.c

Version: ~ [ linux-5.8-rc4 ] ~ [ linux-5.7.7 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.50 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.131 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.187 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.229 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.229 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /* net/atm/raw.c - Raw AAL0 and AAL5 transports */
  3 
  4 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
  5 
  6 #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
  7 
  8 #include <linux/module.h>
  9 #include <linux/atmdev.h>
 10 #include <linux/capability.h>
 11 #include <linux/kernel.h>
 12 #include <linux/skbuff.h>
 13 #include <linux/mm.h>
 14 #include <linux/slab.h>
 15 
 16 #include "common.h"
 17 #include "protocols.h"
 18 
 19 /*
 20  * SKB == NULL indicates that the link is being closed
 21  */
 22 
 23 static void atm_push_raw(struct atm_vcc *vcc, struct sk_buff *skb)
 24 {
 25         if (skb) {
 26                 struct sock *sk = sk_atm(vcc);
 27 
 28                 skb_queue_tail(&sk->sk_receive_queue, skb);
 29                 sk->sk_data_ready(sk);
 30         }
 31 }
 32 
 33 static void atm_pop_raw(struct atm_vcc *vcc, struct sk_buff *skb)
 34 {
 35         struct sock *sk = sk_atm(vcc);
 36 
 37         pr_debug("(%d) %d -= %d\n",
 38                  vcc->vci, sk_wmem_alloc_get(sk), ATM_SKB(skb)->acct_truesize);
 39         WARN_ON(refcount_sub_and_test(ATM_SKB(skb)->acct_truesize, &sk->sk_wmem_alloc));
 40         dev_kfree_skb_any(skb);
 41         sk->sk_write_space(sk);
 42 }
 43 
 44 static int atm_send_aal0(struct atm_vcc *vcc, struct sk_buff *skb)
 45 {
 46         /*
 47          * Note that if vpi/vci are _ANY or _UNSPEC the below will
 48          * still work
 49          */
 50         if (!capable(CAP_NET_ADMIN) &&
 51             (((u32 *)skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
 52             ((vcc->vpi << ATM_HDR_VPI_SHIFT) |
 53              (vcc->vci << ATM_HDR_VCI_SHIFT))) {
 54                 kfree_skb(skb);
 55                 return -EADDRNOTAVAIL;
 56         }
 57         return vcc->dev->ops->send(vcc, skb);
 58 }
 59 
 60 int atm_init_aal0(struct atm_vcc *vcc)
 61 {
 62         vcc->push = atm_push_raw;
 63         vcc->pop = atm_pop_raw;
 64         vcc->push_oam = NULL;
 65         vcc->send = atm_send_aal0;
 66         return 0;
 67 }
 68 
 69 int atm_init_aal34(struct atm_vcc *vcc)
 70 {
 71         vcc->push = atm_push_raw;
 72         vcc->pop = atm_pop_raw;
 73         vcc->push_oam = NULL;
 74         vcc->send = vcc->dev->ops->send;
 75         return 0;
 76 }
 77 
 78 int atm_init_aal5(struct atm_vcc *vcc)
 79 {
 80         vcc->push = atm_push_raw;
 81         vcc->pop = atm_pop_raw;
 82         vcc->push_oam = NULL;
 83         vcc->send = vcc->dev->ops->send;
 84         return 0;
 85 }
 86 EXPORT_SYMBOL(atm_init_aal5);
 87 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp