This section describes the steps for debugging the TX port.
TX path failures are easier to diagnose than RX failures because the flow is simpler,
but these failures still require systematic analysis to isolate whether the problem
is in packet submission, DMA transfer, ALE forwarding, or MAC transmission.
Understanding the complete packet flow from application to wire helps quickly
identify the failure point.
- Step 1: The expected TX packet flow.
When your application
transmits a packet, the application follows the following sequence:
- The application submits the packet → The EnetDma_submitTxPktQ() function
returns success.
- DMA transfers the packet from the CPU to the CPSW → The
hostStats.txGoodFrames increments.
- The ALE examines the destination MAC and determines the output port →
The ALE completes the look up.
- The MAC port transmits the packet to wire → The macStats.txGoodFrames
increments.
- Packets are dropped or never reach the wire if any of these steps
fail.
- Step 2:
- Setting a breakpoint at the EnetDma_submitTxPktQ() function in your
transmit function.
- Examine the packet queue being submitted before the call executes.
- Inspect the txSubmitQ structure.
- Check the status code after EnetDma_submitTxPktQ() returns.
- If the status is ENET_SOK and the submission succeeded, and the
packet is handed to DMA.
- If the status is ENET_EINVALIDPARAMS and the packet structure is
malformed, check if the bufPtr is valid, the segmentFilledLen is
reasonable, and verify the packet queue was initialized
correctly.
- If the status is ENET_ENOMEM, the DMA descriptor ring is full,
and the transmitted packets are not being retrieved and freed,
set the breakpoint in the EnetDma_retrieveTxPktQ() function to
verify this is called regularly.
- Step 3: TX descriptors must be retrieved after transmission completes to
free the descriptors for reuse.
- Set a breakpoint at the EnetDma_retrieveTxPktQ() function, typically
called from a periodic timer or completion callback.
Note: If this function is never called or
called too infrequently:
- The TX
descriptor ring fills up overtime and the
EnetDma_submitTxPktQ() function starts returning
ENET_ENOMEM.
- The
transmission stops silently, even though link is up. The
descriptor ring is finite (configured in SYSCFG). If packets
are submitted faster than completed descriptors are
retrieved, the ring exhausts. Verify retrieval happens after
each transmit or on a periodic timer fast enough to keep up
with the transmit rate.
- Step 4: Statistics counters show exactly where packets are dropped in the
TX path.
- Read the host port and MAC port statistics before and after
transmission. The pattern of counter changes identifies the failure
point in the following scenarios:
- Scenario 1: hostStats.txGoodFrames does NOT increment
→
- The
packet never reached DMA (submission failed).
- Check the
EnetDma_submitTxPktQ() function return code.
- Verify
the TX channel opened successfully (hTxCh is
valid).
- Check the
DMA descriptor ring is not exhausted (retrieve completed
packets).
- Scenario 2: hostStats.txGoodFrames increments and
macStats.txGoodFrames does NOT.
- DMA
accepted the packet but MAC did not transmit.
- The ALE
is dropping a packet or forwarding to a wrong port.
- Check the
hostStats.portMaskDrop counter.
- If
portMaskDrop increments, destination MAC entry has the
wrong port mask.
- Dump the
ALE table and verify the destination MAC address entry
exists with the correct output port.
- Scenario 3: Both hostStats and macStats txGoodFrames
increment, but link partner identifies nothing.
- The
packets transmitted but did not reach link partner.
- Check the
MAC port link status (must be UP).
- Verify
the cable is connected and the link partner is
listening.
- Use the
Wireshark® on link partner to confirm frames
are not arriving at all.
- Scenario 4: Link partner receives packets but identifies
CRC errors.
- The
packets transmitted but are corrupt.
- Check the
packet buffer contents before submission.
- Verify
segmentFilledLen matches the actual frame data
length.
- Enable
the CPSW automatic CRC append if the application does
not calculate a CRC.