[Top][All Lists]

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

[lwip-users] Ethernet driver for OS

From: Timmy Brolin
Subject: [lwip-users] Ethernet driver for OS
Date: Mon, 30 Aug 2010 21:52:49 +0200
User-agent: Thunderbird (Windows/20100228)

Hello all,

I am wondering if anyone could give me a pointer or two on the most
appropriate way to implement a Ethernet driver.
I have ported LwIP to two different platforms already, but this time we
will be using it in a multithreaded environment.
>From what I can tell, this affects how the Ethernet driver should be
I have looked in the contrib directory, but most or all Ethernet drivers
seems to be rather outdated.

First of all, the MAC we are going to use it pretty standard. It uses
DMA transfers and linked buffer descriptors just like most other modern
MACs. I will implement a zero-copy driver for both Rx and Tx.

For Tx it is pretty straightforward, I'll just write a
low_level_output() function which will be called from the lwip thread.
But how do I clean up the buffer descriptors when the transmission is
complete? Am I really supposed to create a new thread just to clean up
the Tx buffer descriptors, or is there a better way?

For Rx, I guess it could be possible to do all Rx processing in the ISR,
but it is quite a lot of processing for an ISR. And I am not too happy
about putting pbuf_alloc() (for filling the Rx ring) and pbuf_free()
(for dumping damaged frames) calls in an ISR. What if the pbuf pool is
locked when the ISR runs?

Is there a better way? Is it possible to have the Rx ISR signal the lwip
thread, and have the lwip thread process the Rx descriptors?
I would prefer not having to create a Rx thread just for processing the
Rx descriptors, since that would cause an extra task reschedule at the
reception of every frame.

Timmy Brolin

reply via email to

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