In evaluating the RM57’s EMAC, I noticed that the transmit CPPI chain was stalling. I believe this is caused by the EOQ not being set until the frame has completed transmission, though the EMAC has already determined to stop (CPPI descriptor’s next == NULL). The driver we’ve developed seeks to minimize the need for the main core to manage the EMAC.
To resolve the race condition between the EMAC’s decision to continue and the EOQ flag state, I’ve tested the the following workaround:
- The tail of the transmit CPPI chain always points to a sacrificial descriptor
- Sacrificial descriptor
-
- Next Descriptor Pointer = NULL
- Buffer Pointer = (a non-NULL address)
- Buffer Length = 1
- Flags = SOP | EOP | OWNER
- Packet Length = 0
- Since the chain should always continue to the sacrificial descriptor, we can now test the final real descriptor for the OWNER flag to determine if it has been transmitted. If the OWNER flag is set (EMAC owned), we assume that we can safely append to the CPPI chain. If the OWNER flag is clear (core owned), we wait for the sacrificial descriptor to have it’s EOQ flag set, and then start a new CPPI chain.
As I had to use trial and error to identify a sacrificial descriptor that works, I wanted to request TI's opinion on this workaround. Specifically, my concern is that these settings may impact the RM57 internals in some way that we've not identified in testing just ethernet alone.