linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: tom_usenet@optusnet.com.au
Cc: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [PATCH] can: fix loss of frames due to wrong assumption in raw_rcv
Date: Tue, 23 Jun 2015 10:01:39 +0200	[thread overview]
Message-ID: <55891263.3050704@hartkopp.net> (raw)
In-Reply-To: <5588E6FB.5040903@optusnet.com.au>

Hi Tom,

On 23.06.2015 06:56, Tom Evans wrote:
> On 22/06/15 20:24, Oliver Hartkopp wrote:
>> But the point becomes an issue when there's no userspace application that
>> requires timestamps.
>>
>> I did my testing wile having at least one "candump" instances running, which
>> enables timestamping. So when there's no one requesting timestamps the check
>> in can_rcv does not perform properly.
>>
>> Therefor my patch grabs your idea to set the timestamps for CAN skbs
>> unconditionally. But there were some more places in the code where we need to
>> take care about that.
>
> The original patch contains:
>
> +    /* eliminate multiple filter matches for the same skb */
> +    if (this_cpu_ptr(ro->uniq)->skb == oskb &&
> +        ktime_equal(this_cpu_ptr(ro->uniq)->tstamp, oskb->tstamp)) {
> +        return;
> +    } else {
> +        this_cpu_ptr(ro->uniq)->skb = oskb;
> +        this_cpu_ptr(ro->uniq)->tstamp = oskb->tstamp;
> +    }
> +
>
> Mightn't it be more robust if the above check didn't filter out a packet if
> either of the timestamps weren't set (were zero)? Assuming the structures are
> zeroed before this gets set.

Yes. But the source just moved on with the introduction of joined filters.
And when you don't have a unique skb detection the joint filter mechanic fails 
totally.

An alternative to force the timestamp to be set would be to add another 
'counter' to struct can_skb_priv which is just increased by the driver with 
every received CAN frame.

But I wonder if its worth the effort in opposite to just enable timestamping 
in every skb. What do you think?

Regards,
Oliver

  parent reply	other threads:[~2015-06-23  8:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-20 17:21 [PATCH] can: fix loss of frames due to wrong assumption in raw_rcv Manfred Schlaegl
2015-06-20 22:42 ` Oliver Hartkopp
2015-06-22  9:48   ` Manfred Schlaegl
2015-06-22 10:24     ` Oliver Hartkopp
     [not found]       ` <5588E6FB.5040903@optusnet.com.au>
2015-06-23  8:01         ` Oliver Hartkopp [this message]
2015-06-24  2:13           ` Tom Evans
2015-06-24 19:56             ` Oliver Hartkopp
2015-06-25  8:32               ` [BULK]Re: " Stephane Grosjean
2015-06-25  9:36                 ` Oliver Hartkopp
2015-06-29 16:13                   ` Oliver Hartkopp
2015-07-04 16:54                     ` Oliver Hartkopp
2015-07-05  1:18                       ` Tom Evans
2015-07-05 18:21                         ` Oliver Hartkopp
2015-07-06  5:44                           ` Oliver Hartkopp
2015-07-06  6:50                             ` Tom Evans
2015-07-06 17:09                               ` Oliver Hartkopp
2015-07-06  7:58                       ` [BULK]Re: " Stephane Grosjean
2015-07-06 17:14                         ` Oliver Hartkopp
  -- strict thread matches above, loose matches on Subject: below --
2015-06-20 16:24 manfred.schlaegl

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=55891263.3050704@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=tom_usenet@optusnet.com.au \
    /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).