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
->recvq
,skb
);
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
);
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
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
)))
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
;
68 vcc
->send
= atm_send_aal0
;
73 int atm_init_aal34(struct atm_vcc
*vcc
)
75 vcc
->push
= atm_push_raw
;
76 vcc
->pop
= atm_pop_raw
;
78 vcc
->send
= vcc
->dev
->ops
->send
;
83 int atm_init_aal5(struct atm_vcc
*vcc
)
85 vcc
->push
= atm_push_raw
;
86 vcc
->pop
= atm_pop_raw
;
88 vcc
->send
= vcc
->dev
->ops
->send
;
93 EXPORT_SYMBOL(atm_init_aal5
);