1 /* net/atm/raw.c - Raw AAL0 and AAL5 transports */
3 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
6 #include <linux/module.h>
7 #include <linux/sched.h>
8 #include <linux/atmdev.h>
9 #include <linux/kernel.h>
10 #include <linux/skbuff.h>
14 #include "protocols.h"
18 #define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
20 #define DPRINTK(format,args...)
25 * SKB == NULL indicates that the link is being closed
28 void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
31 skb_queue_tail(&vcc->sk->sk_receive_queue, skb);
32 vcc->sk->sk_data_ready(vcc->sk, skb->len);
37 static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb)
39 DPRINTK("APopR (%d) %d -= %d\n", vcc->vci, vcc->sk->sk_wmem_alloc,
41 atomic_sub(skb->truesize, &vcc->sk->sk_wmem_alloc);
42 dev_kfree_skb_any(skb);
43 vcc->sk->sk_write_space(vcc->sk);
47 static int atm_send_aal0(struct atm_vcc *vcc,struct sk_buff *skb)
50 * Note that if vpi/vci are _ANY or _UNSPEC the below will
53 if (!capable(CAP_NET_ADMIN) &&
54 (((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
55 ((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT)))
58 return -EADDRNOTAVAIL;
60 return vcc->dev->ops->send(vcc,skb);
64 int atm_init_aal0(struct atm_vcc *vcc)
66 vcc->push = atm_push_raw;
67 vcc->pop = atm_pop_raw;
69 vcc->send = atm_send_aal0;
74 int atm_init_aal34(struct atm_vcc *vcc)
76 vcc->push = atm_push_raw;
77 vcc->pop = atm_pop_raw;
79 vcc->send = vcc->dev->ops->send;
84 int atm_init_aal5(struct atm_vcc *vcc)
86 vcc->push = atm_push_raw;
87 vcc->pop = atm_pop_raw;
89 vcc->send = vcc->dev->ops->send;
94 EXPORT_SYMBOL(atm_init_aal5);