diff mbox series

[v2,net] ice: Write all GNSS buffers instead of first one

Message ID 20230216100512.224241-1-karol.kolacinski@intel.com
State Changes Requested
Headers show
Series [v2,net] ice: Write all GNSS buffers instead of first one | expand

Commit Message

Karol Kolacinski Feb. 16, 2023, 10:05 a.m. UTC
When user writes multiple messages in a short period of time, the driver
writes only the first one and buffers others in a linked list.

Fix this behavior to write all pending buffers instead of only the first
one.

To reproduce this issue, open the GNSS device with cat, send a few
messages to the device, e.g. multiple commands using echo. The issue
manifests itself as response to only first message. Then, after issuing
a single or multiple commands, user can see that response from the
device was not for recent ones but for the next single buffered one from
the first batch.

Fixes: d6b98c8d242a ("ice: add write functionality for GNSS TTY")
Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
---
V1 -> V2: Added reproduction steps in the commit message.

 drivers/net/ethernet/intel/ice/ice_gnss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tony Nguyen Feb. 16, 2023, 5:12 p.m. UTC | #1
On 2/16/2023 2:05 AM, Karol Kolacinski wrote:
> When user writes multiple messages in a short period of time, the driver
> writes only the first one and buffers others in a linked list.
> 
> Fix this behavior to write all pending buffers instead of only the first
> one.
> 
> To reproduce this issue, open the GNSS device with cat, send a few
> messages to the device, e.g. multiple commands using echo. The issue
> manifests itself as response to only first message. Then, after issuing
> a single or multiple commands, user can see that response from the
> device was not for recent ones but for the next single buffered one from
> the first batch.
> 
> Fixes: d6b98c8d242a ("ice: add write functionality for GNSS TTY")
> Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
> ---
> V1 -> V2: Added reproduction steps in the commit message.
> 
>   drivers/net/ethernet/intel/ice/ice_gnss.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_gnss.c b/drivers/net/ethernet/intel/ice/ice_gnss.c
> index 8dec748bb53a..1fa7bf31816f 100644
> --- a/drivers/net/ethernet/intel/ice/ice_gnss.c
> +++ b/drivers/net/ethernet/intel/ice/ice_gnss.c
> @@ -91,7 +91,7 @@ static void ice_gnss_write_pending(struct kthread_work *work)
>   	if (!test_bit(ICE_FLAG_GNSS, pf->flags))
>   		return;
>   
> -	if (!list_empty(&gnss->queue)) {
> +	while (!list_empty(&gnss->queue)) {
>   		struct gnss_write_buf *write_buf = NULL;
>   		unsigned int bytes;
>   

Are you using the net-queue tree? Did you rebase/update your tree? This 
doesn't apply.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_gnss.c b/drivers/net/ethernet/intel/ice/ice_gnss.c
index 8dec748bb53a..1fa7bf31816f 100644
--- a/drivers/net/ethernet/intel/ice/ice_gnss.c
+++ b/drivers/net/ethernet/intel/ice/ice_gnss.c
@@ -91,7 +91,7 @@  static void ice_gnss_write_pending(struct kthread_work *work)
 	if (!test_bit(ICE_FLAG_GNSS, pf->flags))
 		return;
 
-	if (!list_empty(&gnss->queue)) {
+	while (!list_empty(&gnss->queue)) {
 		struct gnss_write_buf *write_buf = NULL;
 		unsigned int bytes;