LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices



Reply
 
Search this Thread
Old 03-06-2008, 03:34 PM   #1
-supergeek-
LQ Newbie
 
Registered: Mar 2008
Posts: 2

Rep: Reputation: 0
linux and slip networking


Hello kernel geeks,

I have a small 'project' with avr microcontoller and linux host pc. I connect them with a null-modem serial cable. In the avr side I have leds indicating when a char arrives to the uart.

Everything goes fine when I just cat something to the serial port. But I want to use a network interface for communication. I try to use slip driver:

- insmod slip.ko
- slattach -s 9600 -p slip /dev/ttyS0 &
- ifconfig sl0 192.168.0.1 pointopoint 192.168.0.2 up

Things seem to ok, the sl0 interface shows up when I load the module and there is no warnings or anything. But when I ping to the target nothing happens.

Here is the part of the kernel module that prints that (function sl_tx_timeout with debug printk's attached):

#######
printk(KERN_ALERT "timeout, chars in buf %d\n",
sl->tty->driver->chars_in_buffer(sl->tty));
printk(KERN_WARNING "%s: transmit timed out, %s?\n", dev->name,
(sl->tty->driver->chars_in_buffer(sl->tty) || sl->xleft) ?
"bad line quality" : "driver error");
#######

And here's another part (sl_encaps that is called by sl_start_hard_xmit):

#######
printk(KERN_ALERT "after sl encaps!\n");
actual = sl->tty->driver->write(sl->tty, sl->xbuff, count);
printk(KERN_ALERT "after tty send %d!\n", actual);
#######

Here's the dmesg log:

#######
[ 6326.377957] before sl encaps!
[ 6326.377960] after sl encaps!
[ 6326.377963] after tty send 88!
[ 6336.360453] NETDEV WATCHDOG: sl0: transmit timed out
[ 6341.351712] NETDEV WATCHDOG: sl0: transmit timed out
[ 6346.342972] NETDEV WATCHDOG: sl0: transmit timed out
[ 6346.342983] timeout, chars in buf 440
[ 6346.342987] sl0: transmit timed out, bad line quality?
[ 6346.342999] before sl encaps!
[ 6346.343003] after sl encaps!
[ 6346.343007] after tty send 88!
[ 6356.325486] NETDEV WATCHDOG: sl0: transmit timed out
[ 6361.316745] NETDEV WATCHDOG: sl0: transmit timed out
[ 6366.308003] NETDEV WATCHDOG: sl0: transmit timed out
[ 6366.308012] timeout, chars in buf 528
[ 6366.308016] sl0: transmit timed out, bad line quality?
#######

I hope that clarifies what my problem is. I understand that the slip driver gives the data properly to the uart driver. I don't know what the write function exactly is but I think that it is uart_write in serial_core.c ? Write seems to go fine because it returns the amount of data that it is supposed to write. But then the data is lost.

'ifconfig sl0' gives zero tx and rx bytes

'cat /proc/tty/driver/serial' gives

serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:0 rx:0 RTS|DTR|DSR|CD
1: uart:unknown port:000002F8 irq:3
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3

So the question is, where is my data? Has anyone made slip to work with recent kernels? (Btw, is tested it also with some slip terminal in windows and it worked fine, there is just something with SLIP line discipline and the tty driver)
 
Old 06-05-2008, 05:00 AM   #2
trailman
LQ Newbie
 
Registered: Jun 2008
Posts: 4

Rep: Reputation: 0
I had the same problem on an XScale CPU board and found that the problem was comming from hardware flow control at the tty level.

The slip driver do a write call to the tty device to send the data, and this call is OK. But as the tty is not allowed to send the data, nothing is sent, all data remains in the tty TX fifo, and no transmit interrupt occurs. After timeout expiration (20s), the timeout handler of the slip driver is called to report the timeout error.

When slattach is running, the crtscts mode (hardware flow control) is enabled on the tty, even when using the -L option of slattach; this can be seen by an stty -a command.
However on my board, the CTS signal is always seen inactive by the tty driver, and can not be accessed by hardware.

So I patched slattach.c (from net-tools source RPM) to not enable crtscts mode :
- tty->c_cflag = (CRTSCTS | HUPCL | CREAD); /* UART flags */
+ tty->c_cflag = (/*CRTSCTS | */HUPCL | CREAD); /* UART flags */
and rebuilt it.
Now It works.
 
Old 06-09-2008, 12:29 PM   #3
-supergeek-
LQ Newbie
 
Registered: Mar 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by trailman View Post
I had the same problem on an XScale CPU board and found that the problem was comming from hardware flow control at the tty level.

The slip driver do a write call to the tty device to send the data, and this call is OK. But as the tty is not allowed to send the data, nothing is sent, all data remains in the tty TX fifo, and no transmit interrupt occurs. After timeout expiration (20s), the timeout handler of the slip driver is called to report the timeout error.

When slattach is running, the crtscts mode (hardware flow control) is enabled on the tty, even when using the -L option of slattach; this can be seen by an stty -a command.
However on my board, the CTS signal is always seen inactive by the tty driver, and can not be accessed by hardware.

So I patched slattach.c (from net-tools source RPM) to not enable crtscts mode :
- tty->c_cflag = (CRTSCTS | HUPCL | CREAD); /* UART flags */
+ tty->c_cflag = (/*CRTSCTS | */HUPCL | CREAD); /* UART flags */
and rebuilt it.
Now It works.
Hello,

Actually, you don't have to patch it. There is -m option in slattach that disables cts/rts signalling In the help it is quite misleading explained (Do not initialize 8 bit raw mode).

Last edited by -supergeek-; 06-09-2008 at 12:31 PM.
 
Old 03-31-2014, 05:34 AM   #4
user0814
LQ Newbie
 
Registered: Mar 2014
Posts: 3

Rep: Reputation: Disabled
Hi guys,

can you take a look at my problem here (http://www.linuxquestions.org/questi...e-4175500009) Thx.

Best Regards
 
Old 03-31-2014, 09:16 PM   #5
jefro
Guru
 
Registered: Mar 2008
Posts: 12,078

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
That didn't work as expected.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Vista slip to boost Linux says Red Hat LXer Syndicated Linux News 0 03-29-2006 05:54 PM
XP to Linux SLIP connection Johnnyae17 Linux - Networking 0 12-23-2004 08:25 PM
SLIP Networking crep Linux - Networking 1 09-07-2004 09:42 PM
Linux Slip and Cisco 2524 router paradoxlight Linux - Networking 5 12-01-2002 12:47 PM
SLIP login j0ker Linux - General 1 03-23-2002 10:26 PM


All times are GMT -5. The time now is 04:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration