36 #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
38 #include <linux/module.h>
42 #include <linux/slab.h>
43 #include <linux/atm.h>
44 #include <linux/atmdev.h>
45 #include <linux/capability.h>
46 #include <linux/ppp_defs.h>
79 #define NONE_INFLIGHT -2
87 static const unsigned char pppllc[6] = { 0xFE, 0xFE, 0x03, 0xCF, 0xC0, 0x21 };
105 static void pppoatm_wakeup_sender(
unsigned long arg)
148 static void pppoatm_unassign_vcc(
struct atm_vcc *atmvcc)
151 pvcc = atmvcc_to_pvcc(atmvcc);
163 static void pppoatm_push(
struct atm_vcc *atmvcc,
struct sk_buff *skb)
168 pr_debug(
"removing ATMPPP VCC %p\n", pvcc);
169 pppoatm_unassign_vcc(atmvcc);
186 if (skb->
len >=
sizeof(pppllc) &&
194 sizeof(pppllc) - LLC_LEN)) {
199 pr_debug(
"Couldn't autodetect yet (skb: %02X %02X %02X %02X %02X %02X)\n",
223 if (atm_may_send(pvcc->
atmvcc, size) &&
253 if (atm_may_send(pvcc->
atmvcc, size) &&
268 #define DROP_PACKET 1
278 if (skb_headroom(skb) <
LLC_LEN) {
282 !pppoatm_may_send(pvcc, n->
truesize)) {
290 }
else if (!pppoatm_may_send(pvcc, skb->
truesize))
295 if (!pppoatm_may_send(pvcc, skb->
truesize))
299 pr_debug(
"Trying to send without setting encaps!\n");
306 pr_debug(
"atm_skb(%p)->vcc(%p)->dev(%p)\n",
316 skb->
data[-1] ==
'\0')
322 static int pppoatm_devppp_ioctl(
struct ppp_channel *chan,
unsigned int cmd,
327 return put_user(chan_to_pvcc(chan)->
flags, (
int __user *) arg)
330 return get_user(chan_to_pvcc(chan)->
flags, (
int __user *) arg)
337 .start_xmit = pppoatm_send,
338 .ioctl = pppoatm_devppp_ioctl,
341 static int pppoatm_assign_vcc(
struct atm_vcc *atmvcc,
void __user *arg)
366 pvcc->
chan.private = pvcc;
367 pvcc->
chan.ops = &pppoatm_ops;
378 atmvcc->
push = pppoatm_push;
379 atmvcc->
pop = pppoatm_pop;
392 static int pppoatm_ioctl(
struct socket *
sock,
unsigned int cmd,
395 struct atm_vcc *atmvcc = ATM_SD(sock);
409 return pppoatm_assign_vcc(atmvcc, argp);
413 chan), (
int __user *) argp) ? -
EFAULT : 0;
416 chan), (
int __user *) argp) ? -
EFAULT : 0;
421 static struct atm_ioctl pppoatm_ioctl_ops = {
423 .ioctl = pppoatm_ioctl,
426 static int __init pppoatm_init(
void)
432 static void __exit pppoatm_exit(
void)