[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Custom memory management

From: Mason
Subject: [lwip-users] Custom memory management
Date: Thu, 06 Oct 2011 15:14:20 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20110902 Firefox/6.0.2 SeaMonkey/2.3.3


I've been trying to port lwip 1.4.0 to OS21/OS+ for several
weeks. I am very stuck on the aspect of buffer management,
because what lwip expects seems incompatible with the way
things work on this platform.

Here's a short description:

At init, I specify how many RX buffers and TX buffers I want
the OS to manage. The OS allocates these buffers along with
associated "descriptors". Thus, the OS manages an RX pool
and a (separate) TX pool.

When a packet is received, an IRQ handler grabs a buffer from
the RX pool, copies the packet to this buffer, then calls a
user-defined function. When the packet is no longer needed,
software is supposed to return it to the RX pool by calling
a particular function.

When software wants to send a packet, it requests a buffer from
the TX pool, copies its data to the buffer, then requests an
asynchronous TX. This function returns immediately, but the
packet is only sent "sometime later". When it has effectively
been sent, an IRQ handler calls a second user-defined function,
which is responsible for returning the packet to the TX pool.

Can someone explain how to make lwip happy with this buffer
management model, without using memcpy, i.e. having lwip
deal directly with the buffers from TX pool and RX pool?

I've come up with a slightly hackish solution to deal with
receiving, but I don't see how to make sending work?

(Aside from copying the pbuf to a TX pool buffer in
low_level_ouput, which I'm desperately trying to avoid.)

I would really appreciate a gentle nudge in the right direction.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]