All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Masayuki Ohtake <masa-korg@dsn.okisemi.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
	"Wang, Yong Y" <yong.y.wang@intel.com>,
	arjan@linux.intel.com, gregkh@suse.de, Qi <qi.wang@intel.com>,
	Andrew Chih Howe <andrew.chih.howe.khor@intel.com>,
	ML linux-kernel <linux-kernel@vger.kernel.org>,
	ML netdev <netdev@vger.kernel.org>,
	socketcan-core@lists.berlios.de,
	Samuel Ortiz <sameo@linux.intel.com>,
	Barry Song <21cnbao@gmail.com>,
	Christian Pellegrin <chripell@fsfe.org>,
	Wolfram Sang <w.sang@pengutronix.de>,
	"David S. Miller" <davem@davemloft.net>
Subject: out-of-order tx objects - was Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Date: Wed, 01 Sep 2010 19:04:04 +0200	[thread overview]
Message-ID: <4C7E8784.9060509@hartkopp.net> (raw)
In-Reply-To: <000501cb49a9$9cd4bf00$66f8800a@maildom.okisemi.com>

Hello Ohtake,

i'm only picking up the out-of-order issue here ...

On 01.09.2010 09:45, Masayuki Ohtake wrote:

>>>>> - I see that the driver uses many TX and RX objects. How do you avoid
>>>>>   out-of-order transmission and reception?
>>>> What do you mean out-of-order RX and TX?
>>>> Atom processor only supports in-order execution, and PCIe-based peripherals
>>> can solve it with consumer-producer model. Actually IC designer will take care
>>> of out-of-order PCIe CPLD transaction.
>>>
>>> I mean out-of-order transmission to or from the CAN bus. This is handled
>>> by the CAN controller hardware. It has nothing to to with the processor.
> Cannot avoid occurring rx or tx our-of-order.

The CAN frames that are sent by the local system have to touch the wire in the
same order as you put them into the socket as user.

An example:

You send CAN-frames with CAN Identifiers via can-raw sockets

0x123
0x456
0x010

and of course you expect these frames sent in exactly this order.
This is easy to archive as you get each of these CAN frames out of the
netdevices tx-queue in this order.

The problems comes up when you use multiple "tx objects" of your CAN
controller. Some CAN controllers have a "magic intelligence" that leads to
some re-ordering according to the CAN-Identifiers priority.

E.g.

0x123
0x456
0x010

leads to

0x123
0x010
0x456

because you pushed these CAN-frames into different tx objects and the CAN
controller sorts them on its own by priority. For CAN newbies: A lower CAN-ID
value has a higher priority in arbitration on the *physical* layer.

In the example above the CAN controller checks after sending the 0x123 CAN
frame if there's a priority order in the tx objects that are ready to send,
and selects 0x010 ...

This behaviour might be interesting in single-user/single-application
environments - but it is just wrong in multi-user systems where several
different applications use the (same) CAN bus. Standard networking behaviour.

Please ensure that the CAN frame order given by the tx-queue of the Linux
kernel netdevice infrastructure is send on the wire in the same order.

This usually leads to the use of ONLY ONE tx object of your CAN controller.
Probably you can use two tx objects to increase the throughput if this does
not have any impact to the frame order. See your controllers documentation for
details about this tx object behaviour.

I hope this makes the question of Wolfgang a bit clearer :-)

Regards,
Oliver

WARNING: multiple messages have this Message-ID (diff)
From: Oliver Hartkopp <socketcan-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
To: Masayuki Ohtake <masa-korg-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
Cc: Andrew Chih Howe
	<andrew.chih.howe.khor-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Qi <qi.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	ML netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	gregkh-l3A5Bk7waGM@public.gmane.org, "Wang,
	Yong Y" <yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	ML linux-kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org,
	Christian Pellegrin <chripell-VaTbYqLCNhc@public.gmane.org>,
	arjan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>,
	Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: out-of-order tx objects - was Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35
Date: Wed, 01 Sep 2010 19:04:04 +0200	[thread overview]
Message-ID: <4C7E8784.9060509@hartkopp.net> (raw)
In-Reply-To: <000501cb49a9$9cd4bf00$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>

Hello Ohtake,

i'm only picking up the out-of-order issue here ...

On 01.09.2010 09:45, Masayuki Ohtake wrote:

>>>>> - I see that the driver uses many TX and RX objects. How do you avoid
>>>>>   out-of-order transmission and reception?
>>>> What do you mean out-of-order RX and TX?
>>>> Atom processor only supports in-order execution, and PCIe-based peripherals
>>> can solve it with consumer-producer model. Actually IC designer will take care
>>> of out-of-order PCIe CPLD transaction.
>>>
>>> I mean out-of-order transmission to or from the CAN bus. This is handled
>>> by the CAN controller hardware. It has nothing to to with the processor.
> Cannot avoid occurring rx or tx our-of-order.

The CAN frames that are sent by the local system have to touch the wire in the
same order as you put them into the socket as user.

An example:

You send CAN-frames with CAN Identifiers via can-raw sockets

0x123
0x456
0x010

and of course you expect these frames sent in exactly this order.
This is easy to archive as you get each of these CAN frames out of the
netdevices tx-queue in this order.

The problems comes up when you use multiple "tx objects" of your CAN
controller. Some CAN controllers have a "magic intelligence" that leads to
some re-ordering according to the CAN-Identifiers priority.

E.g.

0x123
0x456
0x010

leads to

0x123
0x010
0x456

because you pushed these CAN-frames into different tx objects and the CAN
controller sorts them on its own by priority. For CAN newbies: A lower CAN-ID
value has a higher priority in arbitration on the *physical* layer.

In the example above the CAN controller checks after sending the 0x123 CAN
frame if there's a priority order in the tx objects that are ready to send,
and selects 0x010 ...

This behaviour might be interesting in single-user/single-application
environments - but it is just wrong in multi-user systems where several
different applications use the (same) CAN bus. Standard networking behaviour.

Please ensure that the CAN frame order given by the tx-queue of the Linux
kernel netdevice infrastructure is send on the wire in the same order.

This usually leads to the use of ONLY ONE tx object of your CAN controller.
Probably you can use two tx objects to increase the throughput if this does
not have any impact to the frame order. See your controllers documentation for
details about this tx object behaviour.

I hope this makes the question of Wolfgang a bit clearer :-)

Regards,
Oliver

  reply	other threads:[~2010-09-01 17:04 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11  0:25 [MeeGo-Dev][PATCH] Topcliff: Update PCH_CAN driver to 2.6.35 Masayuki Ohtak
     [not found] ` <4C61EDE5.4030505-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-08-11 10:37   ` Daniel Baluta
2010-08-12  1:42     ` Wang, Qi
2010-08-12  2:04       ` Greg KH
2010-08-12  2:13         ` Wang, Qi
     [not found]         ` <20100812020414.GD14121-l3A5Bk7waGM@public.gmane.org>
2010-08-12  6:25           ` Oliver Hartkopp
2010-08-12  6:29             ` Wang, Qi
2010-08-12  2:39       ` Masayuki Ohtake
     [not found]       ` <D5AB6E638E5A3E4B8F4406B113A5A19A28EA26EB-QQHDSDV1ERZpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-08-12  5:17         ` Daniel Baluta
2010-08-12  9:03         ` Wolfgang Grandegger
2010-08-13  0:23           ` Wang, Qi
     [not found]             ` <D5AB6E638E5A3E4B8F4406B113A5A19A28EA2AB1-QQHDSDV1ERZpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-08-13  6:11               ` Daniel Baluta
2010-08-13 10:58               ` Wolfgang Grandegger
2010-08-20  6:01                 ` Masayuki Ohtake
     [not found]                   ` <000f01cb402d$34b675b0$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-08-20  7:59                     ` Wolfgang Grandegger
2010-08-20  8:37                       ` Masayuki Ohtake
2010-08-11 12:31   ` Wolfgang Grandegger
     [not found]     ` <D5AB6E638E5A3E4B8F4406B113A5A19A28EA26CC@shsmsx501.ccr.corp.intel.com>
     [not found]       ` <4C63B6C9.5050804@grandegger.com>
     [not found]         ` <D5AB6E638E5A3E4B8F4406B113A5A19A28EA29DF@shsmsx501.ccr.corp.intel.com>
2010-09-01  7:45           ` Masayuki Ohtake
2010-09-01 17:04             ` Oliver Hartkopp [this message]
2010-09-01 17:04               ` out-of-order tx objects - was " Oliver Hartkopp
2010-09-01 18:51             ` Wolfgang Grandegger
2010-09-01 18:51               ` Wolfgang Grandegger
2010-09-02  3:19               ` Masayuki Ohtake
2010-09-02  3:19                 ` Masayuki Ohtake
2010-09-02  6:32                 ` Wolfgang Grandegger
2010-09-02  6:32                   ` Wolfgang Grandegger
2010-08-11 13:04   ` Marc Kleine-Budde
2010-09-13 12:07     ` Masayuki Ohtake
     [not found]       ` <005f01cb533e$5c21d530$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-09-13 12:29         ` Marc Kleine-Budde
2010-09-14  0:46           ` Masayuki Ohtake
2010-09-14  7:08             ` Marc Kleine-Budde
     [not found]             ` <003a01cb53a6$4ca724d0$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-09-15  7:42               ` Wolfgang Grandegger
     [not found]                 ` <4C9078D3.50300-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2010-09-15  9:42                   ` Oliver Hartkopp
2010-09-15 10:55                     ` Wolfgang Grandegger
2010-09-15 12:04                       ` Marc Kleine-Budde
2010-09-15 12:11                         ` Wolfgang Grandegger
2010-09-13 15:22         ` Greg KH
2010-09-14  8:48           ` Masayuki Ohtake
     [not found]             ` <00ca01cb53e9$a50c1930$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-09-14 13:10               ` Greg KH
2010-09-15  1:21                 ` Masayuki Ohtake

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=4C7E8784.9060509@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=21cnbao@gmail.com \
    --cc=andrew.chih.howe.khor@intel.com \
    --cc=arjan@linux.intel.com \
    --cc=chripell@fsfe.org \
    --cc=davem@davemloft.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masa-korg@dsn.okisemi.com \
    --cc=netdev@vger.kernel.org \
    --cc=qi.wang@intel.com \
    --cc=sameo@linux.intel.com \
    --cc=socketcan-core@lists.berlios.de \
    --cc=w.sang@pengutronix.de \
    --cc=wg@grandegger.com \
    --cc=yong.y.wang@intel.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.