AR# 72136

Zynq UltraScale+: PS GEM - reason for multiple duplicate packets in custom software driver

Description

PS GEM Ethernet packets can get duplicated multiple times when monitored on Wireshark or an equivalent utility when you are developing a custom driver.

The reason for the duplicate packets is explained in this Answer Record, and a work- around which can be used in your driver or application is provided.

Solution

Two buffer descriptors are required at both the RX and TX path of the PS GEM IP which is used in a Zynq UltraScale+ device.

The issue occurs if there are not multiple descriptors:


"On TX, GEM needs multiple descriptors with the last descriptor in the BD ring having the used bit set. It is needed to ensure the GEM does not wrap and attempt to transmit the same frames more than once.

On RX, there is no hard requirement to have multiple buffer descriptors, although it is a very sensible thing to minimize the chance of getting buffer resource errors (where the hardware has a frame to write to memory, but there is no free buffer(s) to write to).

Extreme overflow conditions in general are more likely when these buffer resource errors occur.

Work-around: Configure at least two buffer descriptors for both Tx/Rx data paths."


This requirement came about because the PS GEM DMA prefetches buffer descriptors to reduce latency.

For TX, the driver software should maintain at least one terminating buffer descriptor in order to avoid overwriting packets in the same memory locations. 

These should be placed in non-cacheable memory.


For an example, see the Xilinx LWIP code which can be used for reference:

https://github.com/Xilinx/embeddedsw/blob/xilinx-v2018.1/ThirdParty/sw_services/lwip141/src/contrib/ports/xilinx/netif/xemacpsif_dma.c#L561.

It is implemented and explained in the comment section of the driver code at line 575.

AR# 72136
Date 03/27/2019
Status Active
Type General Article
Devices
IP