Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE
I am implementing a simple Ethernet application. Currently, I am only working on ARP and ICMP portions (basically, ping). I am using the C2000Ware provided driver for the CM and hooking into the provided ethernet driver.
I added custom callbacks for RX (for packet parsing) and TX (for freeing of buffers). Both of these custom callbacks also call the driver standard callbacks (Ethernet_receivePacketCallback and Ethernet_releaseTxPacketBuffer).
The code will ARP and handle ping traffic without issue for some time. Eventually, I notice that I am missing some buffers that were allocated for TX. I check the traffic with Wireshark and see that all pings were responded to, and check verify that the data in the missing buffers matches the ID of the transmitted responses. It appears that the TX interrupt was not called to release the buffer resource. I have counters in the TX descriptor/buffer manager for allocation and release, which shows that the resources were never returned. These counters also match the counters in the driver layer.
This situation happens anywhere from 10 to 6000 pings. I am pinging the device from two separate terminal windows to stress the system. From Wireshark, it looks like the traffic gets transmitted out of order, as a new ping is received before the previous one is responded to. I notice this event with every missing interrupt. As I mentioned above, the response is 100% getting transmitted, but the release of the resource (from the TX interrupt) is missing.
My threading model is:
- RX ISR
- disable interrupts (INT_EMAC_RX0 and INT_EMAC_TX0)
- parse packet
- allocate TX descriptor and buffer from pool
- transmit response
- enable interrupts
- TX ISR
- disable interrupts
- free TX descriptor and buffer
- enable interrupts
I have messed with interrupt priorities thinking that the TX interrupt is getting mangled and cleared by the RX interrupt, but have yet to find the issue. Any community thoughts/experiences with the Ethernet driver? What am I missing in my flow? Thanks in advance.