16 #include <linux/sched.h>
17 #include <linux/slab.h>
23 .start_xmit = ppp_irnet_send,
24 .ioctl = ppp_irnet_ioctl
46 const char __user *
buf,
54 DENTER(CTRL_TRACE,
"(ap=0x%p, count=%Zd)\n", ap, count);
68 command[
count] =
'\0';
69 DEBUG(CTRL_INFO,
"Command line received is ``%s'' (%Zd).\n",
87 length = next -
start;
93 DEBUG(CTRL_INFO,
"Found command ``%s'' (%d).\n", start, length);
102 if((length > 5) && (
strcmp(start + 5,
"any")))
105 while(
isspace(start[length - 1]))
113 ap->
rname[length - 5] =
'\0';
117 DEBUG(CTRL_INFO,
"Got rname = ``%s''\n", ap->
rname);
125 if((!
strncmp(start,
"addr", 4)) ||
126 (!
strncmp(start,
"daddr", 5)) ||
132 if((length > 5) && (
strcmp(start + 5,
"any")))
134 char * begp = start + 5;
151 DEBUG(CTRL_INFO,
"Got rsaddr = %08x\n", ap->
rsaddr);
157 DEBUG(CTRL_INFO,
"Got rdaddr = %08x\n", ap->
rdaddr);
174 #ifdef INITIAL_DISCOVERY
197 DEBUG(CTRL_INFO,
"Got the log (0x%p), size is %d\n",
222 DENTER(CTRL_TRACE,
"(ap=0x%p, event=0x%p)\n",
228 DEBUG(CTRL_INFO,
"Already done\n");
234 irnet_get_discovery_log(ap);
240 sprintf(event,
"Found %08x (%s) behind %08x {hints %02X-%02X}\n",
246 DEBUG(CTRL_INFO,
"Writing discovery %d : %s\n",
259 DEBUG(CTRL_INFO,
"Cleaning up log (0x%p)\n",
288 DENTER(CTRL_TRACE,
"(ap=0x%p, count=%Zd)\n", ap, count);
293 #ifdef INITIAL_DISCOVERY
295 if(irnet_read_discovery_log(ap, event))
304 DEXIT(CTRL_TRACE,
"\n");
334 DEXIT(CTRL_TRACE,
" - ret %Zd\n", ret);
342 sprintf(event,
"Discovered %08x (%s) behind %08x {hints %02X-%02X}\n",
350 sprintf(event,
"Expired %08x (%s) behind %08x {hints %02X-%02X}\n",
358 sprintf(event,
"Connected to %08x (%s) on ppp%d\n",
364 sprintf(event,
"Connection from %08x (%s) on ppp%d\n",
370 sprintf(event,
"Request from %08x (%s) behind %08x\n",
376 sprintf(event,
"No-answer from %08x (%s) on ppp%d\n",
382 sprintf(event,
"Blocked link with %08x (%s) on ppp%d\n",
388 sprintf(event,
"Disconnection from %08x (%s) on ppp%d\n",
394 sprintf(event,
"Disconnected to %08x (%s)\n",
404 DEBUG(CTRL_INFO,
"Event is :%s", event);
413 DEXIT(CTRL_TRACE,
"\n");
422 static inline unsigned int
429 DENTER(CTRL_TRACE,
"(ap=0x%p)\n", ap);
436 #ifdef INITIAL_DISCOVERY
441 irnet_get_discovery_log(ap);
448 DEXIT(CTRL_TRACE,
" - mask=0x%X\n", mask);
473 DENTER(FS_TRACE,
"(file=0x%p)\n", file);
475 #ifdef SECURE_DEVIRNET
490 ap->
chan.private = ap;
491 ap->
chan.ops = &irnet_ppp_ops;
497 ap->
xaccm[3] = 0x60000000
U;
504 DERROR(FS_ERROR,
"Can't setup IrDA link...\n");
518 DEXIT(FS_TRACE,
" - ap=0x%p\n", ap);
535 DENTER(FS_TRACE,
"(file=0x%p, ap=0x%p)\n",
537 DABORT(ap ==
NULL, 0, FS_ERROR,
"ap is NULL !!!\n");
548 DERROR(FS_ERROR,
"Channel still registered - deregistering !\n");
555 DEXIT(FS_TRACE,
"\n");
565 dev_irnet_write(
struct file * file,
566 const char __user *buf,
572 DPASS(FS_TRACE,
"(file=0x%p, ap=0x%p, count=%Zd)\n",
580 return irnet_ctrl_write(ap, buf, count);
596 DPASS(FS_TRACE,
"(file=0x%p, ap=0x%p, count=%Zd)\n",
604 return irnet_ctrl_read(ap, file, buf, count);
612 dev_irnet_poll(
struct file * file,
618 DENTER(FS_TRACE,
"(file=0x%p, ap=0x%p)\n",
622 DABORT(ap ==
NULL, mask, FS_ERROR,
"ap is NULL !!!\n");
626 mask |= irnet_ctrl_poll(ap, file, wait);
628 DEXIT(FS_TRACE,
" - mask=0x%X\n", mask);
649 DENTER(FS_TRACE,
"(file=0x%p, ap=0x%p, cmd=0x%X)\n",
654 #ifdef SECURE_DEVIRNET
664 if(
get_user(val, (
int __user *)argp))
668 DEBUG(FS_INFO,
"Entering PPP discipline.\n");
679 DEBUG(FS_INFO,
"Trying to establish a connection.\n");
684 DERROR(FS_ERROR,
"Can't setup PPP channel...\n");
691 DEBUG(FS_INFO,
"Exiting PPP discipline.\n");
702 DERROR(FS_ERROR,
"Channel not registered !\n");
744 DEBUG(FS_INFO,
"Standard PPP ioctl.\n");
751 err = ppp_irnet_ioctl(&ap->
chan, cmd, arg);
760 DEBUG(FS_INFO,
"Get termios.\n");
776 DEBUG(FS_INFO,
"Set termios.\n");
797 DEBUG(FS_INFO,
"TTY compatibility.\n");
802 DEBUG(FS_INFO,
"TCGETA\n");
806 DEBUG(FS_INFO,
"TCFLSH\n");
820 DEBUG(FS_INFO,
"FIONREAD\n");
822 if(
put_user(val, (
int __user *)argp))
828 DERROR(FS_ERROR,
"Unsupported ioctl (0x%X)\n", cmd);
832 DEXIT(FS_TRACE,
" - err = 0x%X\n", err);
853 unsigned char *
data;
858 DENTER(PPP_TRACE,
"(ap=0x%p, skb=0x%p)\n",
863 proto = (data[0] << 8) + data[1];
868 islcp = (proto ==
PPP_LCP) && (1 <= data[2]) && (data[2] <= 7);
883 DEBUG(PPP_INFO,
"Reallocating skb\n");
892 DABORT(new_skb ==
NULL,
NULL, PPP_ERROR,
"Could not realloc skb\n");
906 DEXIT(PPP_TRACE,
"\n");
926 DENTER(PPP_TRACE,
"(channel=0x%p, ap/self=0x%p)\n",
930 DASSERT(
self !=
NULL, 0, PPP_ERROR,
"Self is NULL !!!\n");
935 #ifdef CONNECT_IN_SEND
943 DEBUG(PPP_INFO,
"IrTTP not ready ! (%ld-%ld)\n",
944 self->ttp_open, self->ttp_connect);
965 #ifdef BLOCK_WHEN_CONNECT
981 DRETURN(0, PPP_INFO,
"IrTTP queue full (%d skbs)...\n",
982 skb_queue_len(&self->tsap->tx_queue));
985 skb = irnet_prepare_skb(
self, skb);
986 DABORT(skb ==
NULL, 1, PPP_ERROR,
"Prepare skb for Tx failed.\n");
1007 DERROR(PPP_ERROR,
"IrTTP doesn't like this packet !!! (0x%X)\n", ret);
1011 DEXIT(PPP_TRACE,
"\n");
1029 void __user *argp = (
void __user *)
arg;
1031 DENTER(PPP_TRACE,
"(channel=0x%p, ap=0x%p, cmd=0x%X)\n",
1043 if(
put_user(val, (
int __user *) argp))
1048 if(
get_user(val, (
int __user *) argp))
1084 accm[2] &= ~0x40000000
U;
1085 accm[3] |= 0x60000000
U;
1097 if(
get_user(val, (
int __user *) argp))
1106 DEBUG(PPP_INFO,
"Unsupported ioctl (0x%X)\n", cmd);
1110 DEXIT(PPP_TRACE,
" - err = 0x%X\n", err);
1125 ppp_irnet_init(
void)
1129 DENTER(MODULE_TRACE,
"()\n");
1134 DEXIT(MODULE_TRACE,
"\n");
1142 static inline void __exit
1143 ppp_irnet_cleanup(
void)
1145 DENTER(MODULE_TRACE,
"()\n");
1150 DEXIT(MODULE_TRACE,
"\n");
1165 err = ppp_irnet_init();
1177 ppp_irnet_cleanup();