All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Baltieri <fabio.baltieri@gmail.com>
To: Wolfgang Grandegger <wg@grandegger.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	Martin Gysel <m.gysel@gmail.com>,
	linux-can@vger.kernel.org
Subject: Re: [RFC PATCH] can: add tx/rx led trigger support
Date: Thu, 12 Apr 2012 19:28:04 +0200	[thread overview]
Message-ID: <CABkP77dzvdTFFTxUwAAPtTHFt2SzOGWRxet=bhX+c4LKpS20Gw@mail.gmail.com> (raw)
In-Reply-To: <4F86FF20.60207@grandegger.com>

On Thu, Apr 12, 2012 at 6:13 PM, Wolfgang Grandegger <wg@grandegger.com> wrote:
>> I think the original approach from Fabio was to follow the LED implementation
>> from mac80211:
>>
>> "The implementation is similar to the MAC80211_LEDS one, and takes quite a lot
>> of inspiration and some code from it."
>>
>> And IMHO we should follow this implementation as it is proved to be used in
>> high traffic netdev environments. I wonder if some 'generic gpio LED'
>> implementation will perform sufficiently.
>
> Yes, I agree. But that implementation does not use timers but toggles
> the LED on/off for each new packet.
>
> http://lxr.linux.no/#linux+v3.3.1/net/mac80211/led.c#L15

That's correct, but I think it works for 80211 because there you
always have some traffic. In the canbus case if implemented as
"toggle" you'll end up with a led full-on when removing the cable with
50% probability - which I think is quite misleading.

> I would vote for that solution as well (because it's very lite and we
> already have counters for rx and tx packets).

There are other implementation (which I took as example) in critical
paths which blink leds on one-time events with timers:

ledtrig-ide-disk (with fixed 10ms timeout):
http://lxr.linux.no/#linux+v3.3.1/drivers/leds/ledtrig-ide-disk.c#L28

netfilter's xt_LED trigger:
http://lxr.linux.no/#linux+v3.3.1/net/netfilter/xt_LED.c#L69

I think that with the timer called with a reasonably high delay
(20-30ms) it should be quite lightweight. After all, most of the times
embedded system's leds are gpio-mapped and will be handled by a bunch
of function call and single memory write...

Regards.

-- 
Fabio Baltieri

  reply	other threads:[~2012-04-12 17:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10 21:39 [RFC PATCH] can: add tx/rx led trigger support Fabio Baltieri
2012-04-11  6:14 ` Oliver Hartkopp
2012-04-11 17:58   ` Fabio Baltieri
2012-04-11 18:29     ` Oliver Hartkopp
2012-04-11 18:58       ` Wolfgang Grandegger
2012-04-12  6:16         ` Oliver Hartkopp
2012-04-11 19:02     ` Oliver Hartkopp
2012-04-11 19:36       ` Fabio Baltieri
2012-04-12  6:05         ` Oliver Hartkopp
2012-04-12  6:32         ` Alexander Stein
2012-04-12 15:52           ` Oliver Hartkopp
2012-04-12 18:30             ` Fabio Baltieri
2012-04-13 19:00               ` Oliver Hartkopp
2012-04-12  7:37         ` Wolfgang Grandegger
2012-04-12 11:07           ` Martin Gysel
2012-04-12 16:02             ` Oliver Hartkopp
2012-04-12 16:13               ` Wolfgang Grandegger
2012-04-12 17:28                 ` Fabio Baltieri [this message]
2012-04-12 18:47                   ` Wolfgang Grandegger
2012-04-12 17:46           ` Fabio Baltieri
2012-04-12 18:53             ` Wolfgang Grandegger
2012-04-11  6:29 ` Alexander Stein
2012-04-11 18:03   ` Fabio Baltieri
2012-04-11 14:45 ` Wolfgang Grandegger
2012-04-11 16:24   ` Oliver Hartkopp
2012-04-11 19:11   ` Fabio Baltieri

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='CABkP77dzvdTFFTxUwAAPtTHFt2SzOGWRxet=bhX+c4LKpS20Gw@mail.gmail.com' \
    --to=fabio.baltieri@gmail.com \
    --cc=linux-can@vger.kernel.org \
    --cc=m.gysel@gmail.com \
    --cc=socketcan@hartkopp.net \
    --cc=wg@grandegger.com \
    /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.