mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ian Abbott <abbotti@mev.co.uk>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] net: designware: fix TX descriptor length corruption
Date: Fri, 1 Feb 2019 07:58:07 +0100	[thread overview]
Message-ID: <20190201065807.j4oroxhoelncp4q5@pengutronix.de> (raw)
In-Reply-To: <20190131171905.20634-1-abbotti@mev.co.uk>

On Thu, Jan 31, 2019 at 05:19:05PM +0000, Ian Abbott wrote:
> dwc_ether_send() sets the SIZE1 field of the TX descriptor incorrectly.
> It sets the SIZE1 field to a bit-wise OR of the old value and the new
> value.  If the old value differs from the new value, the transmitted
> Ethernet frame will be longer than it should be and is likely to have an
> incorrect frame check sequence.  As more and more Ethernet frames of
> different lengths are sent, more and more of the TX descriptors are
> affected (up to a maximum number of CONFIG_TX_DESCR_NUM, defined as 16
> in "designware.h").  Fix it by setting the SIZE1 field of the TX
> descriptor to just the new value.
> 
> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> ---
>  drivers/net/designware.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
> index ad70967e8..3c9bca981 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -291,12 +291,14 @@ static int dwc_ether_send(struct eth_device *dev, void *packet, int length)
>  
>  	if (priv->enh_desc) {
>  		desc_p->txrx_status |= DESC_ENH_TXSTS_TXFIRST | DESC_ENH_TXSTS_TXLAST;
> +		desc_p->dmamac_cntl &= ~(DESC_ENH_TXCTRL_SIZE1MASK);
>  		desc_p->dmamac_cntl |= (length << DESC_ENH_TXCTRL_SIZE1SHFT) &
>  				       DESC_ENH_TXCTRL_SIZE1MASK;
>  
>  		desc_p->txrx_status &= ~(DESC_ENH_TXSTS_MSK);
>  		desc_p->txrx_status |= DESC_ENH_TXSTS_OWNBYDMA;
>  	} else {
> +		desc_p->dmamac_cntl &= ~(DESC_TXCTRL_SIZE1MASK);
>  		desc_p->dmamac_cntl |= ((length << DESC_TXCTRL_SIZE1SHFT) &
>  				       DESC_TXCTRL_SIZE1MASK) | DESC_TXCTRL_TXLAST |
>  				       DESC_TXCTRL_TXFIRST;
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2019-02-01  6:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 17:19 Ian Abbott
2019-02-01  6:58 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190201065807.j4oroxhoelncp4q5@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=abbotti@mev.co.uk \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox