Commit ae8ac8d4 authored by Simon Goldschmidt's avatar Simon Goldschmidt Committed by Joe Hershberger

net: designware: fix tx packet length

The designware driver has a bug in setting the tx length into the dma
descriptor: it always or's the length into the descriptor without
zeroing out the length mask before.

This results in occasional packets being transmitted with a length
greater than they should be (trailer). Due to the nature of Ethernet
allowing such a trailer, most packets seem to be parsed fine by remote
hosts, which is probably why this hasn't been noticed.

Fix this by correctly clearing the size mask before setting the new

Tested on socfpga gen5.
Signed-off-by: default avatarSimon Goldschmidt <>
Acked-by: Joe Hershberger's avatarJoe Hershberger <>
Reviewed-by: Philipp Tomsich's avatarPhilipp Tomsich <>
parent b3eabd82
......@@ -389,13 +389,15 @@ static int _dw_eth_send(struct dw_eth_dev *priv, void *packet, int length)
desc_p->txrx_status |= DESC_TXSTS_TXFIRST | DESC_TXSTS_TXLAST;
desc_p->dmamac_cntl |= (length << DESC_TXCTRL_SIZE1SHFT) &
desc_p->dmamac_cntl = (desc_p->dmamac_cntl & ~DESC_TXCTRL_SIZE1MASK) |
((length << DESC_TXCTRL_SIZE1SHFT) &
desc_p->txrx_status &= ~(DESC_TXSTS_MSK);
desc_p->txrx_status |= DESC_TXSTS_OWNBYDMA;
desc_p->dmamac_cntl |= ((length << DESC_TXCTRL_SIZE1SHFT) &
desc_p->dmamac_cntl = (desc_p->dmamac_cntl & ~DESC_TXCTRL_SIZE1MASK) |
((length << DESC_TXCTRL_SIZE1SHFT) &
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment