From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/6] net: fsl-fman: move status read into loop
Date: Thu, 14 Nov 2019 14:00:18 +0100 [thread overview]
Message-ID: <20191114130021.1029-4-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20191114130021.1029-1-s.hauer@pengutronix.de>
Instead of reading the status once before the loop and then again right
before the next iteration, just read the status in the loop.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/fsl-fman.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/fsl-fman.c b/drivers/net/fsl-fman.c
index b5d617212e..5dc7ed5090 100644
--- a/drivers/net/fsl-fman.c
+++ b/drivers/net/fsl-fman.c
@@ -900,9 +900,12 @@ static int fm_eth_recv(struct eth_device *edev)
pram = fm_eth->rx_pram;
rxbd = fm_eth->cur_rxbd;
- status = muram_readw(&rxbd->status);
- while (!(status & RxBD_EMPTY)) {
+ while (1) {
+ status = muram_readw(&rxbd->status);
+ if (status & RxBD_EMPTY)
+ break;
+
if (!(status & RxBD_ERROR)) {
buf_hi = muram_readw(&rxbd->buf_ptr_hi);
buf_lo = in_be32(&rxbd->buf_ptr_lo);
@@ -932,8 +935,6 @@ static int fm_eth_recv(struct eth_device *edev)
rxbd_base = fm_eth->rx_bd_ring;
if (rxbd >= (rxbd_base + RX_BD_RING_SIZE))
rxbd = rxbd_base;
- /* read next status */
- status = muram_readw(&rxbd->status);
/* update RxQD */
offset_out = muram_readw(&pram->rxqd.offset_out);
--
2.24.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-11-14 13:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 13:00 [PATCH 0/6] fsl-fman patches Sascha Hauer
2019-11-14 13:00 ` [PATCH 1/6] net: fsl-fman: reset device before leaving Sascha Hauer
2019-11-14 13:23 ` Ahmad Fatoum
2019-11-14 14:36 ` Sascha Hauer
2019-11-14 13:00 ` [PATCH 2/6] net: fsl-fman: Store index for txbd Sascha Hauer
2019-11-14 13:00 ` Sascha Hauer [this message]
2019-11-14 13:00 ` [PATCH 4/6] net: fsl-fman: Store index for rxbd Sascha Hauer
2019-11-14 13:00 ` [PATCH 5/6] net: fsl-fman: simplify setting next offset Sascha Hauer
2019-11-14 13:00 ` [PATCH 6/6] net: fsl-fman: do not leave not transmitted DMA buffers mapped Sascha Hauer
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=20191114130021.1029-4-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--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