On Jun 2, 8:36 pm, ajcpp...@gmail.com wrote:
> Hi
>
> I'm trying to obtain timestamp information for packets arriving at a
> socket. I understand that this information will not be very accurate
> due to issue such as interrupt latency, software clocks and the
> packets not being timestamped by the NIC.
>
> My code is sitting on a select(), when data arrives at the socket it
> is read, processed then added to a database before returning to the
> select call. If any packets arrive after the socket's read but before
> returning to the select then they will not be serviced immediately. I
> would like to be able to measure this latency by reading the timestamp
> of the oldest packet sitting in the socket buffer before reading from
> the socket.
>
> I have attempted to write code which sets the SO_TIMESTAMP option and
> then calls recvmsg, but despite the return time from the recvmsg call
> indicating there were messages the cmsg_level, cmsg_type and cmsg_len
> are all zero. I'm attempting to do this on a SOCK_STREAM descriptor
> and I've read that the SO_TIMESTAMP option is only supported for DGRAM
> sockets, is this true?
>
> Can anyone give me a clue how to achieve this goal, pls. Is it
> possible using ioctl and SIOCGSTAMP or calls to libpcap?
>
> Any help much appreciated
>
> AJ
Alternatively, Is it possible to access a sk_buff from userspace? What
system calls
must I make in order to achieve this?
I would specifically like to obtain timestamp information for the
packets arriving at a socket and examine the current sk_buff len (i.e.
skb_queue_len).
I'm using a TCP socket so cannot use SO_TIMESTAMP option. I'm aware of
the SIOCGSTAMP option on ioctl() but I'm really after the timestamp of
the packet at the head of the queue not the tail (i.e. most recently
received).
please help,
AJ
|