lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Memory management for packet buffers


From: Mason
Subject: [lwip-users] Memory management for packet buffers
Date: Tue, 23 Aug 2011 12:05:08 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14

Hello,

I'm trying to port lwip 1.4.0 to STMicro's OS21/OS+ operating system.

I've coded the required sys_arch.c

I'm now working on the Ethernet interface code.

On my platform, reads (rx) and writes (tx) are asynchronous.

Here's how the driver works for reads:

I register a packet-handling function, and 120 1536-byte buffers
(large enough to store an entire frame). The driver "owns" these
buffers. When a frame is received, the interrupt handler copies
the frame to the first available buffer, then calls the packet-
handling function. When the app doesn't need the buffer anymore,
it returns control of the buffer back to the driver.

I'm not sure how to do this within the pbuf infrastructure?


Here's how the driver works for writes:

When a packet is ready to be sent, the app calls the send function
which returns immediately, because it only puts the packet on a send
queue. When the packet has actually been sent, the driver calls a
user-defined function, and only then is it safe to reuse the buffer.

I might be able to use references to mimic this behavior?


I'm not sure how/when to initialize memory pools. And how to deal
with the fact that the driver wants to "own" some memory, while
the lwip stack also wants to manage memory pools its way.

Could someone provide some guidance?

-- 
Regards.



reply via email to

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