The following are some of the different C2H stream packets.
Regular Packet
The regular C2H packet has both the data packet and Completion (CMPT) packet. They are a one-to-one match.
The regular C2H data packet can be multiple beats.
-
dma<n>_s_axis_c2h_ctrl_qid
= C2H descriptor queue ID. -
dma<n>_s_axis_c2h_ctrl_len
= length of the packet. -
dma<n>_s_axis_c2h_mty
= empty byte should be set in last beat. -
dma<n>_s_axis_c2h_ctrl_has_cmpt
=1'b1
. This data packet has a corresponding CMPT packet.
The regular C2H CMPT packet is one beat.
-
dma<n>_s_axis_c2h_cmpt_ctrl_qid
= Completion queue ID of the packet. This can be different from the C2H descriptor QID. -
dma<n>_s_axis_c2h_cmpt_ctrl_cmpt_type
=HAS_PLD
. This completion packet has a corresponding data packet. -
dma<n>_s_axis_c2h_cmpt_ctrl_wait_pld_pkt_id
= This completion packet has to wait for the data packet with this ID to be sent before the CMPT packet can be sent.
When the user application sends the data packet, it must count the packet ID for each packet. The first data packet has a packet ID of 1, and it increments for each data packets.
For the regular C2H packet, the data packet and the completion packet is a
one-to-one match. Therefore, the number of data packets with dma<n>_s_axis_c2h_ctrl_has_cmpt
as 1'b1
should be equal to the number of CMPT packet with dma<n>_s_axis_c2h_cmpt_ctrl_cmpt_type
as HAS_PLD
.
The QDMA has a shallow completion input FIFO of depth 2. For better performance, add FIFO for completion input as shown in the diagram below. Depth and width of the FIFO depends on the use case. Width is dependent on the largest CMPT size for the application, and depth is dependent on performance needs. For best performance for 64 Byte CMPT, a depth of 512 is recommended.
When the user application sends the data payload, it counts every
packet. The first packet starts with a pkt_pld_id
of 1. The second packet has a pkt_pld_id
of 2, and
so on. It is a 16-bits counter once the count reaches 16'hffff it wraps around to 0
and count forward.
The user application defines the CMPT type.
- If the
dma<n>_s_axis_c2h_cmpt_ctrl_cmpt_type
is HAS_PLD, the CMPT has a corresponding data payload. The user application must placepkt_pld_id
of that packet in thedma<n>_s_axis_c2h_cmpt_ctrl_wait_pld_pkt_id
field. The DMA only sends out this CMPT after it sends out the corresponding data payload packet. - If the
dma<n>_s_axis_c2h_cmpt_ctrl_cmpt_type
is NO_PLD_NO_WAIT, the CMPT does not have any data payload, and it does not need to wait for payload. Then the DMA sends out this CMPT. - If the
dma<n>_s_axis_c2h_cmpt_ctrl_cmpt_type
is NO_PLD_BUT_WAIT, the CMPT does not have a corresponding data payload packet. The CMPT must wait for a particular data payload packet before the CMPT is sent out. Therefore, the user application must place thepld_pkt_id
of that particular data payload into thedma<n>_s_axis_c2h_cmpt_ctrl_wait_pld_pkt_id
field. The DMA does not send out the CMPT until the data payload with thatpld_pkt_id
is sent out.
Immediate Data Packet
The user application can have a packet that only writes to the Completion Ring without having a corresponding data packet transfer to the host. This type of packet is called immediate data packet. For the immediate data packet, the QDMA does not send the data payload, but it writes to the CMPT Queue. The immediate packet does not consume a descriptor.
For the immediate data packet, the user application only sends the CMPT packet to the DMA, and it does not send the data packet.
The following is the setting of the immediate completion packet. There is no corresponding data packet.
In some applications, the immediate completion packet does not need
to wait for any data packet. But in some applications, it might still need to wait
for the data payload packet. When the completion type is NO_PLD_NO_WAIT
, the completion packet can be sent out without waiting
for any data packet. When the completion type is NO_PLD_BUT_WAIT
, the completion packet must specify the data packet ID
that it needs to wait for.
-
dma<n>_s_axis_c2h_cmpt_user_cmpt_type
=NO_PLD_NO_WAIT
orNO_PLD_BUT_WAIT
. -
dma<n>_s_axis_c2h_cmpt_ctrl_wait_pld_pkt_id
= Do not increment packet count.
Zero Length Packet
The length of the data packet can be zero. On the input, the user needs to send one beat of data. The zero length packet consumes the descriptor. The QDMA sends out 1DW payload data.
The following is the setting of the zero length packet:
- 1 beat of data
-
dma<n>_s_axis_c2h_ctrl_len
= 0 -
dma<n>_s_axis_c2h_mty
= 0
Disable Completion Packet
The user application can disable the completion for a specific packet. The QDMA provides direct memory access (DMA) to the payload, but does not write to the C2H Completion Ring. The user application only sends the data packet to the DMA, and does not send the CMPT packet.
The following is the setting of the disable completion packet:
-
dma<n>_s_axis_c2h_ctrl_has_cmpt
=1'b0