----- Original Message -----
Sent: Wednesday, October 17, 2007 11:43
Subject: [lwip-users] Driver interface
In order to
write an interface for my ethernet driver,
I used the ethernetif.c and
etharp.c, given in the lwip package.
1. because my driver api
function for Send, writes the data immediately to the register, I had to send
the Packet in one buffer, and not each pbuf in the chain separately.
Therefore, I created in low_level_output a new pbuf which collects the pbufs
in the chain into single pbuf chain, and then send to the driver the new pbuf,
and release him by pbuf_free.
Can it cause any problem?
Can it encounter a separate call for pbuf_free()?
No, I don't think
2. After managing to
create the driver interface, and to port the lwip into my system by writing
sys_arch of my own. It can now communicate with other computers,
after running for few seconds, it get stuck in an endless
loop, usually in the mbox_fetch of the tcpip_thread, even though the driver
keeps on getting packets.
I made a lot
of tests, and in each test it got stuck in a different phase of the
Most of time, it's a port problem.
What lwIP release do you use?
I believe it
enters some sort of race condition.
My main worry is about the
interrupt of the driver which handles the receive.
calls the callback function - 'ethernetif' and pass the data to him. When the
Packet enters the function, it gets processed as an IP Packet or an ARP
Packet. In both cases, the function uses semaphores (memp sem and
pbuf_pool_free sem), which can easily create a block to the program (because
those sems are occupied by the application or the tcpip thread) .
a way of handling the input packet without using any semaphores? What is the
common implementation for the input callback of the
Take a look to http://lists.nongnu.org/archive/html/lwip-users/2007-09/msg00097.html,
there is some informations from Jonathan about a Zero Copy Ethernet interface. Perhaps it can give you some ideas?
Can you see any other
solution for my problem?