All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: "Heinz-Jürgen Oertel" <oe@port.de>
Cc: "socketcan-users@lists.berlios.de"
	<socketcan-users@lists.berlios.de>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: getting the fill level of rx and tx fifos
Date: Tue, 29 Nov 2011 15:33:20 +0100	[thread overview]
Message-ID: <4ED4ED30.4010904@grandegger.com> (raw)
In-Reply-To: <B3B3BE5A55ED7743A83865E234A22B1D1B91F2C105@SBSPORT.portnet.local>

On 11/29/2011 12:25 PM, Heinz-Jürgen Oertel wrote:
> Hello,
> reading can.txt and list emails I could not  manage to get this information.
> Can please someone explain if and how it is possible to get this information.
> I need to know how many frames are still in the net layer and not yet handled by the application.
> And as well importand, how many not yet sent CAN Frames are in the socket layer or the driver. 

CAN messages are queued as skb's in the socket's receive and send
buffer. What counts is the *total* size of the skb, which requires more
space than a CAN frame, of course. For CAN I do not know of any
interface allowing to retreive the fill level. But other protocols seem
to have something like that, e.g. AF_PACKET provides ioctl request:

#define SIOCINQ  FIONREAD
#define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */

> Mit freundlichen Grüßen / With best regards
> 
> Heinz 
> 
> PS:
> I saw in candump.c getsockopt(fd, SO_SOCKET, SO_RCVBUF, &rcvbuf_size,....)
> Is used.
> But what does the result mean?
> I get large numbers here : 124928

It means that there is space for "124928 / sizeof(skb)" skb's ==
messages. I will try to find out the overhead later today.

Wolfgang.

      reply	other threads:[~2011-11-29 14:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29 11:25 getting the fill level of rx and tx fifos Heinz-Jürgen Oertel
2011-11-29 14:33 ` Wolfgang Grandegger [this message]

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=4ED4ED30.4010904@grandegger.com \
    --to=wg@grandegger.com \
    --cc=linux-can@vger.kernel.org \
    --cc=oe@port.de \
    --cc=socketcan-users@lists.berlios.de \
    /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.