All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Austin Schuh <austin@peloton-tech.com>, linux-can@vger.kernel.org
Subject: Re: Stuck vcan
Date: Tue, 11 Mar 2014 08:05:08 +0100	[thread overview]
Message-ID: <531EB5A4.1090302@hartkopp.net> (raw)
In-Reply-To: <CANGgnMZLZ+Uhdjpw0QC1ER74FFyot6sjSpcL0Q+HK7ydQTynsg@mail.gmail.com>

Hi Austin,



On 11.03.2014 01:22, Austin Schuh wrote:

> $ Linux vpc3 3.10-3-rt-amd64 #1 SMP PREEMPT RT Debian 3.10.11-1

Oh, one of these -rt kernels again %-)

> Mar 10 16:49:12 vpc3 kernel: [356480.638351] Dead loop on virtual device
> vcan2, fix it urgently!

The vcan driver usually does not set the IFF_ECHO flag:
> 
> austin[4262] vpc3 ~
> $ ifconfig vcan2
> vcan2     Link encap:UNSPEC  HWaddr
> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
>           UP RUNNING NOARP  MTU:16  Metric:1
                            ^^
Which would be indicated here then.

Therefore the 'shortcut' in af_can.c is used to provide the echo:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/net/can/af_can.c#n283

which increases performance but may lead to funny effects as the sending
process leads to a reception event which is probably already handled by the
receiver when the write() of the sender returns.

Two things I would suggest:

1. Let the vcan really handle the frames by enabling IFF_ECHO
2. Add a queue (queue length != 0) to the vcan interface

For 1: Insert the vcan module with the parameter echo=1, e.g.

# rmmod vcan
# modprobe vcan echo=1
# ip link add type vcan
# ip link show vcan0
26: vcan0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default 
    link/can 

And see if this already fixes your problem ('ECHO' is enabled here).

For 2: Add a queue length to your vcan with

# ip link set vcan0 txqueuelen 10
# ip link show vcan0
26: vcan0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
    link/can 

This urges the network subsystem to used the normal packet flow, as a queue
length of zero is only feasible for software devices like loopback / vcan ...

Please give a feedback if it solves the problem in your -rt kernel.

Best regards,
Oliver


  reply	other threads:[~2014-03-11  7:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11  0:22 Stuck vcan Austin Schuh
2014-03-11  7:05 ` Oliver Hartkopp [this message]
2014-03-11 20:37   ` Austin Schuh
2014-03-11 20:56     ` Marc Kleine-Budde
2014-03-11 21:54       ` Austin Schuh
2014-03-11 21:29     ` Oliver Hartkopp
2014-03-11 21:55       ` Austin Schuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=531EB5A4.1090302@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=austin@peloton-tech.com \
    --cc=linux-can@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.