From 329377a604fa7ac7e89f7351356242b2c958734b Mon Sep 17 00:00:00 2001 From: Harini Katakam Date: Sat, 14 Mar 2015 12:26:56 +0530 Subject: [PATCH] emacps: Add support for jumbo frames in example Enable jumbo option and use updated API's for zynqmp. Increase array size to support jumbo frames - these can be decreased by user if not required. Signed-off-by: Harini Katakam --- .../drivers/emacps/examples/xemacps_example.h | 5 +++-- .../examples/xemacps_example_intr_dma.c | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/XilinxProcessorIPLib/drivers/emacps/examples/xemacps_example.h b/XilinxProcessorIPLib/drivers/emacps/examples/xemacps_example.h index afc6021f..7ce149f3 100644 --- a/XilinxProcessorIPLib/drivers/emacps/examples/xemacps_example.h +++ b/XilinxProcessorIPLib/drivers/emacps/examples/xemacps_example.h @@ -51,6 +51,7 @@ * 1.01a asa 02/27/12 Hash define added for EMACPS_SLCR_DIV_MASK. * 1.05a asa 09/22/13 The EthernetFrame is made cache line aligned (32 bytes). * Fix for CR #663885. +* 3.0 hk 02/20/15 Increase array sizes to add support for jumbo frames. * * *****************************************************************************/ @@ -94,10 +95,10 @@ */ #ifdef __ICCARM__ #pragma data_alignment = 64 -typedef char EthernetFrame[XEMACPS_MAX_VLAN_FRAME_SIZE]; +typedef char EthernetFrame[XEMACPS_MAX_VLAN_FRAME_SIZE_JUMBO]; #pragma data_alignment = 4 #else -typedef char EthernetFrame[XEMACPS_MAX_VLAN_FRAME_SIZE] +typedef char EthernetFrame[XEMACPS_MAX_VLAN_FRAME_SIZE_JUMBO] __attribute__ ((aligned(64))); #endif diff --git a/XilinxProcessorIPLib/drivers/emacps/examples/xemacps_example_intr_dma.c b/XilinxProcessorIPLib/drivers/emacps/examples/xemacps_example_intr_dma.c index 6bf8f60a..64efb0af 100644 --- a/XilinxProcessorIPLib/drivers/emacps/examples/xemacps_example_intr_dma.c +++ b/XilinxProcessorIPLib/drivers/emacps/examples/xemacps_example_intr_dma.c @@ -104,6 +104,7 @@ * 2.1 srt 07/11/14 Implemented 64-bit changes and modified as per * Zynq Ultrascale Mp GEM specification * 3.0 kpc 01/23/14 Removed PEEP board related code +* 3.0 hk 02/20/15 Added support for jumbo frames. * * * @@ -160,7 +161,7 @@ EthernetFrame RxFrame; /* Receive buffer */ * uncached by setting the attributes appropriately in the MMU table. */ #define RX_BD_LIST_START_ADDRESS 0x0FF00000 -#define TX_BD_LIST_START_ADDRESS 0x0FF10000 +#define TX_BD_LIST_START_ADDRESS 0x0FF70000 #define FIRST_FRAGMENT_SIZE 64 @@ -314,6 +315,10 @@ LONG EmacPsDmaIntrExample(XScuGic * IntcInstancePtr, GemVersion = ((Xil_In32(Config->BaseAddress + 0xFC)) >> 16) & 0xFFF; + /* Enable jumbo frames for zynqmp */ + if (GemVersion > 2) { + XEmacPs_SetOptions(EmacPsInstancePtr, XEMACPS_JUMBO_ENABLE_OPTION); + } if (GemVersion == 2) { @@ -551,6 +556,7 @@ LONG EmacPsDmaSingleFrameIntrExample(XEmacPs *EmacPsInstancePtr) LONG Status; u32 PayloadSize = 1000; u32 NumRxBuf = 0; + u32 RxFrLen; XEmacPs_Bd *Bd1Ptr; XEmacPs_Bd *BdRxPtr; @@ -561,6 +567,9 @@ LONG EmacPsDmaSingleFrameIntrExample(XEmacPs *EmacPsInstancePtr) FramesTx = 0; DeviceErrors = 0; + if (GemVersion > 2) { + PayloadSize = (7168-14); + } /* * Calculate the frame length (not including FCS) */ @@ -728,7 +737,13 @@ LONG EmacPsDmaSingleFrameIntrExample(XEmacPs *EmacPsInstancePtr) * receive lengthi against the transmitted length, then verify * the data. */ - if ((XEmacPs_BdGetLength(BdRxPtr)) != TxFrameLength) { + if (GemVersion > 2) { + /* API to get correct RX frame size - jumbo or otherwise */ + RxFrLen = XEmacPs_GetRxFrameSize(EmacPsInstancePtr, BdRxPtr); + } else { + RxFrLen = XEmacPs_BdGetLength(BdRxPtr); + } + if (RxFrLen != TxFrameLength) { EmacPsUtilErrorTrap("Length mismatch"); return XST_FAILURE; }