linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* getting the fill level of rx and tx fifos
@ 2011-11-29 11:25 Heinz-Jürgen Oertel
  2011-11-29 14:33 ` Wolfgang Grandegger
  0 siblings, 1 reply; 2+ messages in thread
From: Heinz-Jürgen Oertel @ 2011-11-29 11:25 UTC (permalink / raw)
  To: socketcan-users@lists.berlios.de; +Cc: linux-can@vger.kernel.org

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. 

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



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

* Re: getting the fill level of rx and tx fifos
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Grandegger @ 2011-11-29 14:33 UTC (permalink / raw)
  To: Heinz-Jürgen Oertel
  Cc: socketcan-users@lists.berlios.de, linux-can@vger.kernel.org

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.

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

end of thread, other threads:[~2011-11-29 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).