netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fighting out-of-order reception with RPS?
@ 2015-07-08 17:49 Oliver Hartkopp
  2015-07-08 21:17 ` Tom Herbert
  2015-07-09  6:34 ` Holger Schurig
  0 siblings, 2 replies; 16+ messages in thread
From: Oliver Hartkopp @ 2015-07-08 17:49 UTC (permalink / raw)
  To: netdev, therbert.google.com
  Cc: linux-can@vger.kernel.org, sunil.kovvuri, jonathon.reinhart

I'm picking up the request 'Setting RPS affinities from network driver' from
Sunil Kovvuri http://marc.info/?t=142424023500001&r=1&w=2 as I assume to have
the same issue here.

When receiving CAN frames from a specific CAN network interface (e.g. can0)
the frames are sporadically out-of-order on SMP systems like my Core i7 laptop
with 4 CPUs. This out-of-order reception kills reliable communication e.g. for
CAN transport protocols.

First approach was to set the smp_affinity for the USB adapter on irq 28 with:

	echo 1 > /proc/irq/28/smp_affinity

This worked in my case but it looks wrong to pin the USB host adapter to a
single CPU and has to be done by hand depending on where the CAN interfaces
are attached to the system.

Next idea was to use RPS after reading Documentation/networking/scaling.txt

As the only relevant flow identifiction is the number of the incoming CAN
interface I added

	skb_set_hash(skb, dev->ifindex, PKT_HASH_TYPE_L2);

when creating CAN skbs with alloc_can_skb() in drivers/net/can/dev.c

After enabling RPS for my four CPUs with

	echo f > /sys/class/net/can0/queues/rx-0/rps_cpus

I had no more out-of-order frames in my system :-)

My two questions:

1. Is there any better solution to meet the described requirements?
2. If not: How can enable this RPS solution by default for CAN interfaces?

Best regards,
Oliver


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-07-14 19:05 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08 17:49 Fighting out-of-order reception with RPS? Oliver Hartkopp
2015-07-08 21:17 ` Tom Herbert
2015-07-09  5:55   ` Oliver Hartkopp
2015-07-10  2:48     ` Tom Herbert
2015-07-10 20:36       ` Oliver Hartkopp
2015-07-11  4:35         ` Eric Dumazet
2015-07-12 19:15           ` Oliver Hartkopp
2015-07-13  3:22             ` David Miller
2015-07-13  4:57             ` Eric Dumazet
2015-07-14 17:09               ` Oliver Hartkopp
2015-07-14 18:02                 ` Tom Herbert
2015-07-14 19:03                   ` David Miller
2015-07-14 19:05                     ` Oliver Hartkopp
2015-07-13 19:08             ` Tom Herbert
2015-07-09  6:34 ` Holger Schurig
2015-07-09  8:48   ` Oliver Hartkopp

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).