Skip to contentSkip to conversation

ice: Write all GNSS buffers instead of first one

PATCH In review Karol Kolacinski 3 participants 3 messages Feb 17, 2023 – Apr 4, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ice: Write all GNSS buffers instead of first one

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")

---
V2 -> V3: Switched to net-queue tree instead of next-queue. 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(-)
drivers/net/ethernet/intel/ice/ice_gnss.c +1 -1
index 43e199b5b513..02533014f24a 100644
@@ -82,7 +82,7 @@ static void ice_gnss_write_pending(struct kthread_work *work)
 						write_work);
 	struct ice_pf *pf = gnss->back;
 
-	if (!list_empty(&gnss->queue)) {
+	while (!list_empty(&gnss->queue)) {
 		struct gnss_write_buf *write_buf = NULL;
 		unsigned int bytes;
 
Signature · 6 lines
2.37.2

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#1 lore raw
Quoted 7 lines · Karol Kolacinski

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.

Quoted 6 lines

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.

Although the patch does fix the described issue in my testing, I believe the buffering must be eliminated.
See my patch "ice: make writes to /dev/gnssX synchronous",
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/

Michal

Quoted 25 lines
Fixes d6b98c8d242a ("ice: add write functionality for GNSS TTY")

---
V2 -> V3: Switched to net-queue tree instead of next-queue. 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(-)
drivers/net/ethernet/intel/ice/ice_gnss.c +1 -2
index 43e199b5b513..02533014f24a 100644
@@ -82,7 +82,7 @@ static void ice_gnss_write_pending(struct kthread_work *work)
                                                write_work);
        struct ice_pf *pf = gnss->back;
 
-       if (!list_empty(&gnss->queue)) {
+       while (!list_empty(&gnss->queue)) {
                struct gnss_write_buf *write_buf = NULL;
                unsigned int bytes;
 
--

2.37.2

Quoted 5 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#2 lore raw
Quoted 22 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Friday, March 24, 2023 9:48 AM
To: Kolacinski, Karol <[email protected]>
Cc: Nguyen, Anthony L <[email protected]>; [email protected]
Subject: Re: [Intel-wired-lan] [PATCH v3 net] ice: Write all GNSS buffers instead of first one

Quoted 7 lines · Karol Kolacinski

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.

Quoted 6 lines

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.

Quoted 14 lines

Although the patch does fix the described issue in my testing, I believe the buffering must be eliminated.
See my patch "ice: make writes to /dev/gnssX synchronous", https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/

Michal

Quoted 8 lines
Fixes d6b98c8d242a ("ice: add write functionality for GNSS TTY")

---
V2 -> V3: Switched to net-queue tree instead of next-queue. 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(-)

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan