diff options
author | Prabhakar Kushwaha <prabhakar@freescale.com> | 2015-11-04 12:26:02 +0530 |
---|---|---|
committer | York Sun <yorksun@freescale.com> | 2015-11-30 08:53:03 -0800 |
commit | 14480454c76d0f0bc4c5828cc1f054ba6278530e (patch) | |
tree | 8b8e6a563d08e254d7a4593e1e426a80d0d17956 /drivers/net/ldpaa_eth/ldpaa_eth.c | |
parent | 5038d3e5f23ad979c05fa339284576ccb7e90c07 (diff) | |
download | u-boot-imx-14480454c76d0f0bc4c5828cc1f054ba6278530e.zip u-boot-imx-14480454c76d0f0bc4c5828cc1f054ba6278530e.tar.gz u-boot-imx-14480454c76d0f0bc4c5828cc1f054ba6278530e.tar.bz2 |
driver: net: ldpaa: Fix Rx buffer alignment
MC 0.7.1.2 enforces limitation i.e.: "Packets may be corrupted
in several combinations of buffer size and frame offsets.
Workaround: Use buffers that are of size that is a multiple of 256, and
frame offset that is a multiple of 256"
Updating the DPNI Eth driver to comply with the restriction.
Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
Diffstat (limited to 'drivers/net/ldpaa_eth/ldpaa_eth.c')
-rw-r--r-- | drivers/net/ldpaa_eth/ldpaa_eth.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c index 5ddc9fe..69530b1 100644 --- a/drivers/net/ldpaa_eth/ldpaa_eth.c +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c @@ -500,7 +500,7 @@ static int ldpaa_bp_add_7(uint16_t bpid) struct qbman_release_desc rd; for (i = 0; i < 7; i++) { - addr = memalign(L1_CACHE_BYTES, LDPAA_ETH_RX_BUFFER_SIZE); + addr = memalign(LDPAA_ETH_BUF_ALIGN, LDPAA_ETH_RX_BUFFER_SIZE); if (!addr) { printf("addr allocation failed\n"); goto err_alloc; @@ -685,10 +685,13 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv) /* Configure our buffers' layout */ dflt_dpni->buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT | DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | - DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE; + DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE | + DPNI_BUF_LAYOUT_OPT_DATA_ALIGN; dflt_dpni->buf_layout.pass_parser_result = true; dflt_dpni->buf_layout.pass_frame_status = true; dflt_dpni->buf_layout.private_data_size = LDPAA_ETH_SWA_SIZE; + /* HW erratum mandates data alignment in multiples of 256 */ + dflt_dpni->buf_layout.data_align = LDPAA_ETH_BUF_ALIGN; /* ...rx, ... */ err = dpni_set_rx_buffer_layout(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle, @@ -699,7 +702,9 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv) } /* ... tx, ... */ - dflt_dpni->buf_layout.options &= ~DPNI_BUF_LAYOUT_OPT_PARSER_RESULT; + /* remove Rx-only options */ + dflt_dpni->buf_layout.options &= ~(DPNI_BUF_LAYOUT_OPT_DATA_ALIGN | + DPNI_BUF_LAYOUT_OPT_PARSER_RESULT); err = dpni_set_tx_buffer_layout(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle, &dflt_dpni->buf_layout); |