netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: Patrick McHardy <kaber@trash.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
Subject: Re: [PATCH 3/8] can: CAN Network device driver and SYSFS interface
Date: Tue, 24 Feb 2009 17:29:59 +0100	[thread overview]
Message-ID: <49A42087.8050503@grandegger.com> (raw)
In-Reply-To: <49A3C023.90001@trash.net>

Patrick McHardy wrote:
> Wolfgang Grandegger wrote:
>>>> 1. Set and get CAN device properties like bit-rate and controller mode.
>>>> 2. Show CAN bus state (active, error-passive or bus-off).
>>>> 3. Get device constants like clock frequency and bit-timing parameters.
>>>> 4. Dump CAN device statistics.
>>>> 5. Trigger device restart if CAN bus-off state has been detected.
>>>>
>>>> Not sure yet, if the interface if good for all purposes. Especially
>>>> point 5. might be better handled by an IOCTL.
>>> The first points sound pretty regular. The last one - just triggering
>>> it is no problem of course, but since I don't know how the detection
>>> works, I can't really tell whether its suitable.
>>
>> CAN errors and state changes might be delivered as CAN error messages to
>> the receiving socket/application, like normal messages. When the
>> application realizes the state change to CAN bus-off, it may want to
>> trigger a bus-off recovery (controller restart). The CAN controller HW
>> enters bus-off, when too much errors occurred on the bus. No more
>> messages can then be sent of received and therefore the driver calls
>> netif_carrier_off(). Is there already an interface for the user to
>> restart? An appropriate IOCTL request would be a simply option, but they
>> are generally deprecated, AFAIK. Using netlink would be more cumbersome,
>> as with SYSFS.
> 
> You could consider triggering the restart automatically, similar
> to the netdev watchdog. In fact, you could simply use that one.

Automatic restart is already support by this patch series but we do not
use the watchdog, because it would trigger on normal transmit timeouts
as well. But maybe we can suppress them by fiddling with the watchdog's
timeout value.

> If you really want to trigger this from userspace, setting the
> device DOWN and UP again seems like the most appropriate way to
> me (even though not very nice to use from an application POV).

That's an option, but it might be a bit heavy, though.

>>>> And we need a user space
>>>> tool, e.g. canconfig, to handle the user requests and communicate with
>>>> the kernel side.
>>> Thats pretty standard :)
>>
>> For the iproute2 utility "ip", mainliy a netlink_can.c would be
>> required. But a dedicated tool for CAN seems more appropriate to me.
> 
> I don't know the CAN specifics. One goal of the rtnl_link API
> was to reduce to amount of userspace tools for link configuration
> though, so please only create a new tool if there's really a good
> reason. From my POV it would be preferrable to have link configuration
> in iproute for direct use by users and possibly also support in
> libnl for use by other applications.

OK, it also depends on what we would like the tool finally to perform,
apart from setting and getting device properties. On idea is to move the
rather heavy calculation of bit-timing parameters out of the kernel to
the user-space configuration tool.

Wolfgang.



      reply	other threads:[~2009-02-24 16:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19 19:01 [PATCH 0/8] can: CAN network device driver interface and drivers Wolfgang Grandegger
2009-02-19 19:01 ` [PATCH 1/8] can: Documentation for the CAN device driver interface Wolfgang Grandegger
2009-02-19 19:01   ` [PATCH 2/8] can: Update MAINTAINERS and CREDITS file Wolfgang Grandegger
2009-02-19 19:01     ` [PATCH 3/8] can: CAN Network device driver and SYSFS interface Wolfgang Grandegger
2009-02-19 19:01       ` [PATCH 4/8] can: Driver for the SJA1000 CAN controller Wolfgang Grandegger
2009-02-19 19:01         ` [PATCH 5/8] can: SJA1000 generic platform bus driver Wolfgang Grandegger
2009-02-19 19:01           ` [PATCH 6/8] can: SJA1000 driver for EMS PCI cards Wolfgang Grandegger
2009-02-19 19:01             ` [PATCH 7/8] can: SJA1000 driver for Kvaser " Wolfgang Grandegger
2009-02-19 19:01               ` [PATCH 8/8] can: Driver for the Freescale MSCAN controller Wolfgang Grandegger
2009-02-20  0:14         ` [PATCH 4/8] can: Driver for the SJA1000 CAN controller Jonathan Corbet
2009-02-20  8:46           ` David Miller
2009-02-20  9:35           ` Wolfgang Grandegger
2009-05-01 18:21           ` Wolfgang Grandegger
2009-02-19 23:49       ` [PATCH 3/8] can: CAN Network device driver and SYSFS interface Jonathan Corbet
2009-02-20  8:39         ` Wolfgang Grandegger
2009-02-20  9:44       ` Patrick McHardy
2009-02-21 15:09         ` Wolfgang Grandegger
2009-02-23  9:55           ` Patrick McHardy
2009-02-23 14:57             ` Wolfgang Grandegger
2009-02-24  9:38               ` Patrick McHardy
2009-02-24 16:29                 ` Wolfgang Grandegger [this message]

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=49A42087.8050503@grandegger.com \
    --to=wg@grandegger.com \
    --cc=kaber@trash.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oliver.hartkopp@volkswagen.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).