This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Accessing 2nd / 3rd Ethernet interface directly
- From: Tarmo Kuuse <tarmo dot kuuse at mail dot ee>
- To: ecos-discuss at sources dot redhat dot com
- Date: Mon, 10 Aug 2009 14:41:24 +0300
- Subject: [ECOS] Re: Accessing 2nd / 3rd Ethernet interface directly
- References: <376561.82808.qm@web87016.mail.ird.yahoo.com>
Hi Jim,
Jim Bradleigh wrote:
My target hardware is an i386 PC with 3 Ethernet controllers (all RTL8139 cards) and my application needs to direct access to the 2nd and 3rd Ethernet ports to read/write raw Ethernet frames. The primary port is used for TCP/IP control which works without problems.
I`m fairly new to eCos so not fully up to speed on the entire set-up of it but i`ve been reading the archived mailing list and can`t find any previous examples of how to directly access the Ethernet controllers.
Can anyone point in the right direction (or various directions) on where to start looking or tell me what is the correct way to do this? I can`t find an API or information that shows me how to locate the 2nd and 3rd cards and read/write raw data to them.
I believe when using BSD sockets for communication, the actual interface
is chosen based on which address you use for source/destination. Once
you have configured the addresses for all your interfaces, it is no
longer important to specify the physical interface.
Raw Ethernet is a real joy in eCos. I'd avoid it if possible.
I have a faint understanding that the old OpenBSD TCP/IP stack includes
the Berkeley Packet Filter (BPF) interface which gives at least read
access to raw Ethernet.
The new FreeBSD TCP/IP stack does not provide any interface or API to
read or write raw Ethernet packets. Even BPF support has been removed (I
asked about that on the list, but nobody is eager to explain).
If you can use BSD sockets, I'd recommend that. A nice online tutorial
is here: http://beej.us/guide/bgnet/
Otherwise, you probably need to add your own raw interface to the stack
or Ethernet drivers. This assumes some knowledge about the internals of
the TCP/IP stack. I'd suggest reading the first 5 chapters of Wright and
Stevens, "TCP/IP Illustrated, Volume 2".
--
Kind regards,
Tarmo Kuuse
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss