diff mbox series

[U-Boot,v1] net: mvneta - Fixed recv() when multiple packets have arrived.

Message ID 1511896363-5738-1-git-send-email-jason.brown@apcon.com
State Accepted
Commit 32ac8b0bba72684281a079a8e23832efabd97e09
Delegated to: Joe Hershberger
Headers show
Series [U-Boot,v1] net: mvneta - Fixed recv() when multiple packets have arrived. | expand

Commit Message

Jason Brown Nov. 28, 2017, 7:12 p.m. UTC
This patch fixes a problem in the mvneta driver where if more than
one packet arrives between calls to mvneta_recv(), the additional
descriptors will be marked as free even though only one descriptor
has been read and processed from the receive queue.  This causes
the additional packet(s) to be delayed until the next packet arrives.
From this point on all packets will be delayed because the receive
queue will contain unprocessed packets but the hardware shows no
busy descriptors.

Signed-off-by: Jason Brown <jason.brown@apcon.com>
---

 drivers/net/mvneta.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Stefan Roese Nov. 29, 2017, 10:30 a.m. UTC | #1
On 28.11.2017 20:12, Jason Brown wrote:
> This patch fixes a problem in the mvneta driver where if more than
> one packet arrives between calls to mvneta_recv(), the additional
> descriptors will be marked as free even though only one descriptor
> has been read and processed from the receive queue.  This causes
> the additional packet(s) to be delayed until the next packet arrives.
>  From this point on all packets will be delayed because the receive
> queue will contain unprocessed packets but the hardware shows no
> busy descriptors.
> 
> Signed-off-by: Jason Brown <jason.brown@apcon.com>
> ---
> 
>   drivers/net/mvneta.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
> index f1be952..83e3153 100644
> --- a/drivers/net/mvneta.c
> +++ b/drivers/net/mvneta.c
> @@ -1654,7 +1654,11 @@ static int mvneta_recv(struct udevice *dev, int flags, uchar **packetp)
>   		 */
>   		*packetp = data;
>   
> -		mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_done);
> +		/*
> +		 * Only mark one descriptor as free
> +		 * since only one was processed
> +		 */
> +		mvneta_rxq_desc_num_update(pp, rxq, 1, 1);
>   	}
>   
>   	return rx_bytes;
> 

Thanks for catching and fixing this issue.

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
Joe Hershberger Dec. 5, 2017, 8:09 p.m. UTC | #2
On Tue, Nov 28, 2017 at 1:12 PM, Jason Brown <jason.brown@apcon.com> wrote:
> This patch fixes a problem in the mvneta driver where if more than
> one packet arrives between calls to mvneta_recv(), the additional
> descriptors will be marked as free even though only one descriptor
> has been read and processed from the receive queue.  This causes
> the additional packet(s) to be delayed until the next packet arrives.
> From this point on all packets will be delayed because the receive
> queue will contain unprocessed packets but the hardware shows no
> busy descriptors.
>
> Signed-off-by: Jason Brown <jason.brown@apcon.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger Jan. 22, 2018, 4:49 p.m. UTC | #3
Hi Jason,

https://patchwork.ozlabs.org/patch/842258/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index f1be952..83e3153 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -1654,7 +1654,11 @@  static int mvneta_recv(struct udevice *dev, int flags, uchar **packetp)
 		 */
 		*packetp = data;
 
-		mvneta_rxq_desc_num_update(pp, rxq, rx_done, rx_done);
+		/*
+		 * Only mark one descriptor as free
+		 * since only one was processed
+		 */
+		mvneta_rxq_desc_num_update(pp, rxq, 1, 1);
 	}
 
 	return rx_bytes;