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

Re: [MiNT] Fix wrong size of outgoing packets in the FEC driver

Hello there,

Am Donnerstag, den 04.09.2014, 21:14 +0200 schrieb markus@mubf.de:

> I will probably post a patch against fec.c soon anyway, I have found a 
> few things that need fixing in the original code (memory is 
> overallocated, there is no need to have the receive function delegate 
> work to a timeout function, ...).

What do you mean by overallocation? It uses FireTOS DMA buffers
currently and I also implemented usage of SRAM (which should also work
with EmuTOS, because it does not rely on functions provided by the
FireTOS DMA cookie), but because usage of SRAM has some shortcomings (1.
a lot more reception/outgoing activity because there is less memory for
buffers - this results in low network speed, 2. because there is not
much memory in the SRAM, low level software will fight available SRAM
sooner or later...) it is not enabled by default.
But when writing this, I remember that I decided to not share the
reception/transmission buffers with the kernel, because that was to
risky for my coding skills. Also perfomance is dropped by that code,
because the driver copies received data into the kernel buffers. 

About the timeout function... so you want to do the reception right in
the interrupt handler? I was thinking that this is no good idea: 
- Maybe it takes to long and keeps other interrupts from being
- Receiving data directly (same code, just placed directly inside the
interrupt handler), resulted in system hang. There is also an comment in
the source: 

    // when processing the frame directly, I get Access Faults and other
    // strange stuff.  So this just triggers an timeout.
    // Maybe the reason for the fault is nested interrupts? Dunno.

I believe I also looked at other drivers in the freemint source and I
believe it's not so unusually to schedule interrupt processing. AFAIK
this scheme is called Top Halve and Bottom Halve, please correct me if
I'm wrong or tell me how to do it better, I just want to learn about
it :)