All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: Hui Wang <jason77.wang@gmail.com>
Cc: mkl@pengutronix.de, shawn.guo@linaro.org, linux-can@vger.kernel.org
Subject: Re: [RFC PATCH] can: dev: update rx state in the can_get_echo_skb()
Date: Thu, 28 Jun 2012 12:59:35 +0200	[thread overview]
Message-ID: <4FEC3917.5020905@grandegger.com> (raw)
In-Reply-To: <1340876540-27840-1-git-send-email-jason77.wang@gmail.com>

On 06/28/2012 11:42 AM, Hui Wang wrote:
> After a loopback packet is routed to rx interface, we forget to update
> rx state both in the can_get_echo_skb() and in the controller specific
> drivers, as a result, after we sent a loopback packet and executed
> ifconfig, following state is outputed:
> can0      Link encap:UNSPEC  HWaddr 00-00-00-00-<snip>
>           UP RUNNING NOARP  MTU:16  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:10
>           RX bytes:0 (0.0 B)  TX bytes:4 (4.0 B)
> 
> We add rx state update in the can_get_echo_skb() to solve this
> problem.

Well...

> Cc: linux-can@vger.kernel.org
> Cc: Marc Kleine-Budde <mkl@pengutronix.de>
> Cc: Wolfgang Grandegger <wg@grandegger.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Signed-off-by: Hui Wang <jason77.wang@gmail.com>
> ---
> I don't know if it is designed like that on purpose, please instruct
> me if i am wrong.
> 
> I use following commands to let flexcan to work in the loopback mode:
> %>ip link set can0 type can bitrate 125000
> %>ip link set can0 type can loopback on
> %>ip link set can0 up
> And send a packet:
> %>cantest can0 123#AABBCCDD
> When i check net device state, i found tx doesn't equal rx:
> %>ifconfig
> can0      Link encap:UNSPEC  HWaddr 00-00-00-00-<snip>
>           UP RUNNING NOARP  MTU:16  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:1 errors:0 dropped:0 overruns:0 carrier:0

This means that one message has successfully been sent to the *real* CAN
bus.

>           collisions:0 txqueuelen:10
>           RX bytes:0 (0.0 B)  TX bytes:4 (4.0 B)
> 
>>From my understanding, i suppose it should be:
> can0      Link encap:UNSPEC  HWaddr 00-00-00-00-<snip>
>           UP RUNNING NOARP  MTU:16  Metric:1
>           RX packets:1 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:10 
>           RX bytes:4 (4.0 B)  TX bytes:4 (4.0 B)

Why, you have not received any message from the CAN bus. If you want to
count looped back messages, it should be:

          RX packets:1 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0

Wolfgang.

  reply	other threads:[~2012-06-28 10:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28  9:42 [RFC PATCH] can: dev: update rx state in the can_get_echo_skb() Hui Wang
2012-06-28 10:59 ` Wolfgang Grandegger [this message]
2012-07-02  3:36   ` Hui Wang
2012-06-28 10:59 ` Kurt Van Dijck
2012-07-02  3:42   ` Hui Wang

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=4FEC3917.5020905@grandegger.com \
    --to=wg@grandegger.com \
    --cc=jason77.wang@gmail.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=shawn.guo@linaro.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.