Scatter-Gather DMA slows down after a few transfers
I have custom IP that generates 128-byte data packets in 32 32-bit words, and I use DMA in Scatter-Gather mode to transfer the data to memory. The problem I'm seeing is that the first ~32 128-byte packets are transferred as expected, but after that the transfer slows down considerably (10,000 clock cycles between transfers). What could be causing the problem? I've tried multiple values of the DMA max burst size but I'm seeing the same result. I'm running the processor in bare metal, and the code is very similar to the example xaxidma_example_sgcyclic_intr.c, with a few modifications for receiving the 32-bit words.
In a related topic, I would prefer to use the DMA Scatter-Gather in non-cyclic mode, since I want to do a certain number of transfers, access the data and transfer TCP/IP packets to an external client, and repeat. I used a slightly modified version of xaxidma_example_sg_intr.c and put RxSetup() inside a loop. This procedure did the transfer correctly, but the time between transfers was too large, and I believe it's because RxSetup() re-generates the Rx BD every time. Ideally I would like to split the function RxSetup into two functions, one that generates the BD ring, and another one with the DMA transfers, so that I can generate the BD ring only once and only run the DMA transfer inside the loop (similar to xaxidma_example_simple_intr.c). I tried creating a new function with XAxiDma_BdRingStart() but this didn't work. How should I approach this? Is there another recommended approach to perform the same task?