Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / net / atm / raw.c
blob738b2a7beaeabeb598d6eab973bd1dce9f1e2267
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>
11 #include <linux/mm.h>
13 #include "common.h"
14 #include "protocols.h"
17 #if 0
18 #define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
19 #else
20 #define DPRINTK(format,args...)
21 #endif
25 * SKB == NULL indicates that the link is being closed
28 void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
30 if (skb) {
31 skb_queue_tail(&vcc->recvq,skb);
32 wake_up(&vcc->sleep);
37 static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb)
39 DPRINTK("APopR (%d) %d -= %d\n",vcc->vci,vcc->tx_inuse,skb->truesize);
40 atomic_sub(skb->truesize+ATM_PDU_OVHD,&vcc->tx_inuse);
41 dev_kfree_skb_any(skb);
42 wake_up(&vcc->sleep);
46 static int atm_send_aal0(struct atm_vcc *vcc,struct sk_buff *skb)
49 * Note that if vpi/vci are _ANY or _UNSPEC the below will
50 * still work
52 if (!capable(CAP_NET_ADMIN) &&
53 (((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
54 ((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT)))
56 kfree_skb(skb);
57 return -EADDRNOTAVAIL;
59 return vcc->dev->ops->send(vcc,skb);
63 int atm_init_aal0(struct atm_vcc *vcc)
65 vcc->push = atm_push_raw;
66 vcc->pop = atm_pop_raw;
67 vcc->push_oam = NULL;
68 vcc->send = atm_send_aal0;
69 return 0;
73 int atm_init_aal34(struct atm_vcc *vcc)
75 vcc->push = atm_push_raw;
76 vcc->pop = atm_pop_raw;
77 vcc->push_oam = NULL;
78 vcc->send = vcc->dev->ops->send;
79 return 0;
83 int atm_init_aal5(struct atm_vcc *vcc)
85 vcc->push = atm_push_raw;
86 vcc->pop = atm_pop_raw;
87 vcc->push_oam = NULL;
88 vcc->send = vcc->dev->ops->send;
89 return 0;
93 EXPORT_SYMBOL(atm_init_aal5);