Skip to content

Commit 1279a3f

Browse files
authored
Fix Network-interface of the Xilinx UltraScale port (#588)
The underlying issue was when the port would be used with Jumbo frames. During receives of Jumbo packets the data length was always set incorrectly, which then would cause buffer allocation issues and subsequently corrupted data would be sent to the IP-task. After some inspection in the Xilinx UltraScale port, I found out that when the data length would be set, the wrong mask from the Xilinx Ethernet MAC driver would be used. By using the right mask (XEMACPS_RXBUF_LEN_JUMBO_MASK) when Jumbo Frame support is enabled the issue was resolved
1 parent 7d8299d commit 1279a3f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

source/portable/NetworkInterface/xilinx_ultrascale/x_emacpsif_dma.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@
7979
#if ( ipconfigNETWORK_MTU > 1526 )
8080
#warning the use of Jumbo Frames has not been tested sufficiently yet.
8181
#define USE_JUMBO_FRAMES 1
82-
#endif
82+
#endif /* ( ipconfigNETWORK_MTU > 1526 ) */
8383

8484
#if ( USE_JUMBO_FRAMES == 1 )
8585
#define dmaRX_TX_BUFFER_SIZE 10240
8686
#else
8787
#define dmaRX_TX_BUFFER_SIZE 1536
88-
#endif
88+
#endif /* ( USE_JUMBO_FRAMES == 1 ) */
8989

9090
#if ( ipconfigULTRASCALE == 1 )
9191
extern XScuGic xInterruptController;
@@ -430,8 +430,19 @@ int emacps_check_rx( xemacpsif_s * xemacpsif )
430430

431431
/*
432432
* Adjust the buffer size to the actual number of bytes received.
433+
* If port is built with Jumbo Frame support, then the XEMACPS_RXBUF_LEN_JUMBO_MASK
434+
* should be used to obtain the size of the buffer. Otherwise the mask
435+
* XEMACPS_RXBUF_LEN_MASK can be used.
433436
*/
434-
rx_bytes = xemacpsif->rxSegments[ head ].flags & XEMACPS_RXBUF_LEN_MASK;
437+
#if ( USE_JUMBO_FRAMES == 1 )
438+
{
439+
rx_bytes = xemacpsif->rxSegments[ head ].flags & XEMACPS_RXBUF_LEN_JUMBO_MASK;
440+
}
441+
#else
442+
{
443+
rx_bytes = xemacpsif->rxSegments[ head ].flags & XEMACPS_RXBUF_LEN_MASK;
444+
}
445+
#endif /* ( USE_JUMBO_FRAMES == 1 ) */
435446

436447
pxBuffer->xDataLength = rx_bytes;
437448

0 commit comments

Comments
 (0)