Yesterday evening, I got the AGROS TCP/IP stack plus LPC23xx Ethernet driver to the point of usually answering pings, after a fashion.
This evening (sneaking in a bit of work time after being out and about all day), I fixed an off-by-one bug in the Ethernet driver, eliminating some rather puzzling behavior on the transmit side.
See the result: once the debug printfs are commented out, ping response is 1.5 ms for 800-byte packets, and 0.29 ms for 80-byte packets. Not only does a ping flood not break anything, but I'm not seeing any dropped packets. (This has a hub in the picture; I don't know how much difference a switched network would make, and it's past Tinga's bedtime, so the lab is closed.)
Not too shabby for something that's written more for convenience than for efficiency, and that therefore ends up copying the packet contents around a few times. (Were I really going for performance, I'd be trying to keep things inside the DMA-able Ethernet buffer memory as much as possible, and get aggressive with scatter/gather buffer management. The current ping process involves two copy operations, one from the receive buffer to the response packet image in main memory, then another from the finished response packet to the transmit buffer.)
Still a fair bit of work to do, but my confidence is improving.
Morning update: same performance with the hub out of the picture (though I haven't tried enabling full duplex). It's a somewhat slower ping response than the lab PC, running Windows XP... but since that's running on a 2 GHz Athlon, and AGROS is running on a 0.072 GHz ARM7, I'm not too worried.
Quick test of full duplex: no change, not that I really expected any. I think the time is being spent moving the bytes around in memory.
Now I gotta do some unrelated mechanical engineering.
Comments