From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Steffen Trumtrar <s.trumtrar@pengutronix.de>,
barebox@lists.infradead.org
Subject: Re: [PATCH v3 1/2] net: macb: fix dma_alloc for rx_buffer
Date: Wed, 29 Nov 2023 12:59:22 +0100 [thread overview]
Message-ID: <4b06c0fd-856e-4769-b04d-2273d1d37815@pengutronix.de> (raw)
In-Reply-To: <20231129-v2023-08-0-topic-macb-v3-1-65ad6db834dc@pengutronix.de>
On 29.11.23 12:33, Steffen Trumtrar wrote:
> @@ -181,14 +189,15 @@ static int gem_recv(struct eth_device *edev)
> barrier();
> status = macb->rx_ring[macb->rx_tail].ctrl;
> length = MACB_BFEXT(RX_FRMLEN, status);
> - buffer = macb->rx_buffer + macb->rx_buffer_size * macb->rx_tail;
> - dma_sync_single_for_cpu(macb->dev, (unsigned long)buffer, length,
> - DMA_FROM_DEVICE);
> - net_receive(edev, buffer, length);
> - dma_sync_single_for_device(macb->dev, (unsigned long)buffer, length,
> - DMA_FROM_DEVICE);
> macb->rx_ring[macb->rx_tail].addr &= ~MACB_BIT(RX_USED);
> barrier();
Is moving above two lines around intentional?
> + dma_sync_single_for_cpu(macb->dev,
> + macb->rx_buffer_phys + macb->rx_buffer_size * macb->rx_tail,
> + length, DMA_FROM_DEVICE);
> + net_receive(edev, macb->rx_buffer + macb->rx_buffer_size * macb->rx_tail, length);
> + dma_sync_single_for_device(macb->dev,
> + macb->rx_buffer_phys + macb->rx_buffer_size * macb->rx_tail,
> + length, DMA_FROM_DEVICE);
>
> macb->rx_tail++;
> if (macb->rx_tail >= macb->rx_ring_size)
> @@ -202,7 +211,6 @@ static int macb_recv(struct eth_device *edev)
> {
> struct macb_device *macb = edev->priv;
> unsigned int rx_tail = macb->rx_tail;
> - void *buffer;
> int length;
> int wrapped = 0;
> u32 status;
> @@ -221,7 +229,6 @@ static int macb_recv(struct eth_device *edev)
> }
>
> if (status & MACB_BIT(RX_EOF)) {
> - buffer = macb->rx_buffer + macb->rx_buffer_size * macb->rx_tail;
Nitpick: reworking this line would lead to less verbose changes below.
Cheers,
Ahmad
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2023-11-29 12:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 11:33 [PATCH v3 0/2] net: macb: fix dma usage Steffen Trumtrar
2023-11-29 11:33 ` [PATCH v3 1/2] net: macb: fix dma_alloc for rx_buffer Steffen Trumtrar
2023-11-29 11:59 ` Ahmad Fatoum [this message]
2023-11-29 11:33 ` [PATCH v3 2/2] net: macb: convert to volatile accesses Steffen Trumtrar
2023-11-29 12:03 ` Ahmad Fatoum
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=4b06c0fd-856e-4769-b04d-2273d1d37815@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.trumtrar@pengutronix.de \
/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