This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: interrupt extension of Davicom DM9000 ethernet driver


On Wed, Feb 16, 2005 at 08:33:12PM +0100, Stefan Rosinger wrote:
> Hi!
> 
> Which resources I have to to look at. Memory should free automatically? or
> not?
> 
> Can you give me an example of an ethernet driver which release his resources
> in a good manner?
> So i can go through this.

There are basically two resouces you need to take care off:

1) mbufs/clusters. These are what the network stack uses.  

2) ethernet device buffers which the ethernet sends its packet from
and receives its packet into.

So the basic transmit path is that the network stack passes down an
mbuf/cluster. You then allocate an ethernet buffer and copy the data
into the ethernet buffer. When you have finished with the mbuf/cluster
you need to call eth_drv_tx_done() to tell the network stack you have
finished with the mbuf/cluster. Some time later the ethernet driver
will normally interrupt saying the packet has been sent. You might
then need to free the transmit buffer, or it may happen automagically.

The receive path is similar. The ethernet driver interrupts saying it
has received a packet into one of its receiver buffers. You then need
to allocate an mbuf/cluster which you do using eth_drv_recv(). It will
then call your HRDWR_recv() function to copy the data into the
mbuf/cluster. Once you have copied to data you need to deallocate the
hardware buffer back to the hardware so that it can receive another
packet into it.

Take a look at packages/io/eth/current/doc/driver_doc.  Also take a
look at the drivers in packages/dev/eth. The intel 82559 works well,
but there are simpler ones as well.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]