All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Janusz Uzycki <janusz.uzycki@elproma.com.pl>
Cc: linux-can@vger.kernel.org
Subject: Re: RFC: (optional) software filtering in candump
Date: Fri, 14 Jun 2013 20:05:52 +0200	[thread overview]
Message-ID: <51BB5B80.9060109@hartkopp.net> (raw)
In-Reply-To: <190D92B052C049F4B059DCFE8F841940@laptop2>

On 14.06.2013 10:29, Janusz Uzycki wrote:
> Hi.
>  
> I read the discussion. I agree the documentation should better explain
> multifilter filter policy. I think good workaround could be duplicated
> timestamp filtering - it seems simple to realize in userspace.

Did you see my patch to remove duplicates by matching the CAN-ID and the
timestamp for the raw socket?

> The problem
> could be a lot of frames in short time. Then additional field in can_frame
> struct with packet_id in queue would be useful.

No. For two reasons:

1. The struct can_frame contains the content of a CAN frame, which is
   - a CAN Identifier
   - a data length
   - CAN payload data

   all other stuff is not really CAN specific.

2. The struct can_frame is set in stone with Linux 2.6.25. Any change breaks
   the binary API

> The timestamp could be also
> added in the same way. How SIOCGSTAMP works now?

Use ioctl(s, SIOCGSTAMP, &tv) after read/recvmsg:

See e.g. for a read() syscall
https://gitorious.org/linux-can/can-utils/blobs/master/isotpdump.c#line214

See e.g. for a recvmsg() syscall
https://gitorious.org/linux-can/can-utils/blobs/master/candump.c#line663

> What is difference in
> SO_TIMESTAMP? 

It *is* SO_TIMESTAMP. The standard established programming interface in POSIX
systems. Therefore puting the timestamp into struct can_frame would have been
a mistake.


> Where in kernel (socket layer or low level CAN driver, eq. irq)
> the timestamp is generated?

See netif_receive_skb() (softirq context)
http://lxr.linux.no/#linux+v3.9.6/net/core/dev.c#L3547

Or netif_rx() (irq context)
http://lxr.linux.no/#linux+v3.9.6/net/core/dev.c#L3116

These call net_timestamp_check() at
http://lxr.linux.no/#linux+v3.9.6/net/core/dev.c#L1571

which sets the timestamp if enabled and needed.

So it's at irq level (e.g. for SJA1000 driver)

Additional a hardware timestamp can be retrieved from the hardware and passed
to the userspace. (HW timestamps)

Best regards,
Oliver


       reply	other threads:[~2013-06-14 18:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <190D92B052C049F4B059DCFE8F841940@laptop2>
2013-06-14 18:05 ` Oliver Hartkopp [this message]
2013-06-17 11:27   ` RFC: (optional) software filtering in candump Janusz Uzycki
2013-06-19 16:59     ` Oliver Hartkopp
2013-06-14  8:42 Janusz Uzycki
  -- strict thread matches above, loose matches on Subject: below --
2013-05-29 20:55 RxFilter issues vcan Sebastian Haas
2013-05-30  4:58 ` Oliver Hartkopp
2013-05-30  8:34   ` Sebastian Haas
2013-05-30  8:49     ` Oliver Hartkopp
2013-05-30  9:06       ` Sebastian Haas
2013-05-30 10:17         ` RFC: (optional) software filtering in candump Kurt Van Dijck
2013-05-30 12:07           ` Oliver Hartkopp
2013-05-30 12:35             ` Kurt Van Dijck
2013-05-30 15:37               ` Sebastian Haas
2013-05-30 15:55                 ` Oliver Hartkopp
2013-05-31 20:40                   ` Sebastian Haas
2013-06-01 14:15                 ` Oliver Hartkopp
2013-06-01 18:35                   ` Sebastian Haas
2013-06-02 11:23                   ` Kurt Van Dijck
2015-03-17 10:44                   ` Marc Kleine-Budde
2015-03-17 11:34                   ` Marc Kleine-Budde
2015-03-17 12:04                     ` Oliver Hartkopp
2015-03-17 13:02                       ` Oliver Hartkopp
2015-03-17 13:33                         ` Marc Kleine-Budde

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=51BB5B80.9060109@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=janusz.uzycki@elproma.com.pl \
    --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.