All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Xenomai and Libpcap
@ 2009-10-22 12:39 Benjamin Biegel
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Biegel @ 2009-10-22 12:39 UTC (permalink / raw)
  To: xenomai

Hej

I have a question regarding the use of Libpcap together with Xenomai. 
The Libpcap library provides the ability to capture Ethernet frames with 
my NIC in promiscuous mode + time stamp the received frames on Ethernet 
level (through the clock of the NIC).

My question is this: How do i set up an Xenomai real-time environment 
that makes the time-stamping very accurate. How do I have influence on 
when pcap is scheduled? How do I make sure pcap is not preempted by the OS?

Thanks for any guidance on this point :)

Benjamin


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

* Re: [Xenomai-help] Xenomai and Libpcap
@ 2009-10-22 14:38 Fillod Stephane
  2009-10-22 15:11 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 6+ messages in thread
From: Fillod Stephane @ 2009-10-22 14:38 UTC (permalink / raw)
  To: Benjamin Biegel, xenomai

Hej!

Benjamin Biegel wrote:
> I have a question regarding the use of Libpcap together with Xenomai. 
> The Libpcap library provides the ability to capture Ethernet frames
with 
> my NIC in promiscuous mode + time stamp the received frames on
Ethernet 
> level (through the clock of the NIC).
> 
> My question is this: How do i set up an Xenomai real-time environment 
> that makes the time-stamping very accurate. How do I have influence on

> when pcap is scheduled? How do I make sure pcap is not preempted by
the OS?

You have to know that the Linux network stack and libpcap on behalf of
your process won't be able to run under hard real-time even with
Xenomai.

What you're looking for is RTnet: http://www.rtnet.org
So far, performance for high speed networking is rather poor IMHO,
esp. regarding the API. Please follow this proposal[1] (sorry for 
formatting), and feel free to revive the thread and the discussion.

[1]
http://thread.gmane.org/gmane.linux.real-time.rtnet.devel/262/focus=263

Best Regards
-- 
Stephane


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

* Re: [Xenomai-help] Xenomai and Libpcap
  2009-10-22 14:38 Fillod Stephane
@ 2009-10-22 15:11 ` Gilles Chanteperdrix
  2009-10-22 16:21   ` Jan Kiszka
  0 siblings, 1 reply; 6+ messages in thread
From: Gilles Chanteperdrix @ 2009-10-22 15:11 UTC (permalink / raw)
  To: Fillod Stephane; +Cc: xenomai

Fillod Stephane wrote:
> Hej!
> 
> Benjamin Biegel wrote:
>> I have a question regarding the use of Libpcap together with Xenomai. 
>> The Libpcap library provides the ability to capture Ethernet frames
> with 
>> my NIC in promiscuous mode + time stamp the received frames on
> Ethernet 
>> level (through the clock of the NIC).
>>
>> My question is this: How do i set up an Xenomai real-time environment 
>> that makes the time-stamping very accurate. How do I have influence on
> 
>> when pcap is scheduled? How do I make sure pcap is not preempted by
> the OS?
> 
> You have to know that the Linux network stack and libpcap on behalf of
> your process won't be able to run under hard real-time even with
> Xenomai.
> 
> What you're looking for is RTnet: http://www.rtnet.org
> So far, performance for high speed networking is rather poor IMHO,
> esp. regarding the API. Please follow this proposal[1] (sorry for 
> formatting), and feel free to revive the thread and the discussion.
> 
> [1]
> http://thread.gmane.org/gmane.linux.real-time.rtnet.devel/262/focus=263

To be a bit more precise. Rtnet has a capture interface (rtcap), which
sends a copy of each packet received by the rtnet driver, to a Linux
driver, which you can capture with libpcap.

As far as I remember, however, the timestamping of each packet is done
in the Linux domain, so, if you want to get the real timestamp, you have
to modify rtnet to get the timestamp done in the Xenomai domain.

Unfortunately, that is not all, because if you get Xenomai's timestamp,
they drift when compared to Linux timestamps. But if you look only at
relative timestamps over short period of times, that is Ok.

-- 
                                          Gilles



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

* Re: [Xenomai-help] Xenomai and Libpcap
  2009-10-22 15:11 ` Gilles Chanteperdrix
@ 2009-10-22 16:21   ` Jan Kiszka
  2009-10-22 16:58     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2009-10-22 16:21 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Gilles Chanteperdrix wrote:
> Fillod Stephane wrote:
>> Hej!
>>
>> Benjamin Biegel wrote:
>>> I have a question regarding the use of Libpcap together with Xenomai. 
>>> The Libpcap library provides the ability to capture Ethernet frames
>> with 
>>> my NIC in promiscuous mode + time stamp the received frames on
>> Ethernet 
>>> level (through the clock of the NIC).
>>>
>>> My question is this: How do i set up an Xenomai real-time environment 
>>> that makes the time-stamping very accurate. How do I have influence on
>>> when pcap is scheduled? How do I make sure pcap is not preempted by
>> the OS?
>>
>> You have to know that the Linux network stack and libpcap on behalf of
>> your process won't be able to run under hard real-time even with
>> Xenomai.
>>
>> What you're looking for is RTnet: http://www.rtnet.org
>> So far, performance for high speed networking is rather poor IMHO,
>> esp. regarding the API. Please follow this proposal[1] (sorry for 
>> formatting), and feel free to revive the thread and the discussion.
>>
>> [1]
>> http://thread.gmane.org/gmane.linux.real-time.rtnet.devel/262/focus=263
> 
> To be a bit more precise. Rtnet has a capture interface (rtcap), which
> sends a copy of each packet received by the rtnet driver, to a Linux
> driver, which you can capture with libpcap.

Precisely. You can watch the traffic in real-time with wireshark etc.,
simply write it to file with tcpdump -w, or do whatever you want.

> 
> As far as I remember, however, the timestamping of each packet is done
> in the Linux domain, so, if you want to get the real timestamp, you have
> to modify rtnet to get the timestamp done in the Xenomai domain.

No, time stamping is actually done in the RTnet driver (it is a
by-product of RTmac/TDMA).

> 
> Unfortunately, that is not all, because if you get Xenomai's timestamp,
> they drift when compared to Linux timestamps. But if you look only at
> relative timestamps over short period of times, that is Ok.
> 

Yes, timestamps will drift compared to a precise reference clock or even
the Linux host clock. But I'm optimistic we can fix this in the neat future.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-help] Xenomai and Libpcap
  2009-10-22 16:21   ` Jan Kiszka
@ 2009-10-22 16:58     ` Gilles Chanteperdrix
  2009-10-22 22:06       ` Benjamin Biegel
  0 siblings, 1 reply; 6+ messages in thread
From: Gilles Chanteperdrix @ 2009-10-22 16:58 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> As far as I remember, however, the timestamping of each packet is done
>> in the Linux domain, so, if you want to get the real timestamp, you have
>> to modify rtnet to get the timestamp done in the Xenomai domain.
> 
> No, time stamping is actually done in the RTnet driver (it is a
> by-product of RTmac/TDMA).

Ok, right, bad memory.

> 
>> Unfortunately, that is not all, because if you get Xenomai's timestamp,
>> they drift when compared to Linux timestamps. But if you look only at
>> relative timestamps over short period of times, that is Ok.
>>
> 
> Yes, timestamps will drift compared to a precise reference clock or even
> the Linux host clock. But I'm optimistic we can fix this in the neat future.

Ok. Now I remember why I touched this: in secondary domain, while
copying the packet for the rtcap driver, I read Xenomai's real-time
clock and Linux' real-time clock, and subtracted to Linux' timestamp the
difference between Xenomai's timestamp and the packet timestamp. This
compensates for the drift.

However, I far as I understood, Benjamin wants to get timestamps using
the NIC's clock. So, the solution would be a bit different.

-- 
                                          Gilles



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

* Re: [Xenomai-help] Xenomai and Libpcap
  2009-10-22 16:58     ` Gilles Chanteperdrix
@ 2009-10-22 22:06       ` Benjamin Biegel
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Biegel @ 2009-10-22 22:06 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Jan Kiszka, xenomai

[-- Attachment #1: Type: text/html, Size: 2655 bytes --]

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

end of thread, other threads:[~2009-10-22 22:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-22 12:39 [Xenomai-help] Xenomai and Libpcap Benjamin Biegel
  -- strict thread matches above, loose matches on Subject: below --
2009-10-22 14:38 Fillod Stephane
2009-10-22 15:11 ` Gilles Chanteperdrix
2009-10-22 16:21   ` Jan Kiszka
2009-10-22 16:58     ` Gilles Chanteperdrix
2009-10-22 22:06       ` Benjamin Biegel

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.