From: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public•gmane.org>
To: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public•gmane.org>
Cc: Netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public•gmane.org
Subject: poll broken (for can) (was: Re: Multiple programs trying to access the socket)
Date: Mon, 28 Mar 2011 18:13:36 +0200 [thread overview]
Message-ID: <4D90B3B0.2010401@pengutronix.de> (raw)
In-Reply-To: <4D90AF67.1080405-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 1179 bytes --]
On 03/28/2011 05:55 PM, Wolfgang Grandegger wrote:
>> BTW: I figured out why poll() wakes you up but the next write will fail
>> with -ENOBUFS again.
>
> Ah, I'm curious? I also did realize that poll does burn CPU cycles
> (instead of waiting).
The poll callback checks if the used memory is less than the half of per
socket snd buffer (IIRC ~60K). See:
datagram_poll (http://lxr.linux.no/linux+v2.6.38/net/core/datagram.c#L737)
sock_writeable (http://lxr.linux.no/linux+v2.6.38/include/net/sock.h#L1618)
Because the size of a can frame (+the skb overhead) is much less then
the ethernet frame (+overhead) the default value for the snd buffer is
too big for can.
We get the -ENOBUF from write() if the tx_queue_len (default 10) is
exceeded.
http://lxr.linux.no/linux+v2.6.38/drivers/net/can/dev.c#L435
http://lxr.linux.no/linux+v2.6.38/net/can/af_can.c#L268
cheers, Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
[-- Attachment #2: Type: text/plain, Size: 191 bytes --]
_______________________________________________
Socketcan-users mailing list
Socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public•gmane.org
https://lists.berlios.de/mailman/listinfo/socketcan-users
next parent reply other threads:[~2011-03-28 16:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1301321142.9519.10.camel@lukonin-pc>
[not found] ` <4D90A7E9.1080804@grandegger.com>
[not found] ` <4D90AA8A.9010804@pengutronix.de>
[not found] ` <4D90AF67.1080405@grandegger.com>
[not found] ` <4D90AF67.1080405-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2011-03-28 16:13 ` Marc Kleine-Budde [this message]
[not found] ` <4D90B3B0.2010401-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-03-28 17:53 ` poll broken (for can) Oliver Hartkopp
[not found] ` <4D90CB17.4030205-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
2011-03-28 19:32 ` Marc Kleine-Budde
[not found] ` <4D90E262.1090201-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-03-29 20:03 ` Oliver Hartkopp
2011-03-30 7:05 ` David Miller
2011-03-30 7:46 ` [Socketcan-users] " Kurt Van Dijck
[not found] ` <4D923B00.20500-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
2011-03-30 8:53 ` 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=4D90B3B0.2010401@pengutronix.de \
--to=mkl-bicnvbalz9megne8c9+irq@public$(echo .)gmane.org \
--cc=Netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
--cc=socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public$(echo .)gmane.org \
--cc=wg-5Yr1BZd7O62+XT7JhA+gdA@public$(echo .)gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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