Commit 150431a2 authored by Young Xiao's avatar Young Xiao Committed by Stefan Bader

sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN

BugLink: https://bugs.launchpad.net/bugs/1818813

[ Upstream commit a11f6ca9 ]

__vdc_tx_trigger should only loop on EAGAIN a finite
number of times.

See commit adddc32d ("sunvnet: Do not spin in an
infinite loop when vio_ldc_send() returns EAGAIN") for detail.
Signed-off-by: default avatarYoung Xiao <YangX92@hotmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 015953d1
...@@ -40,6 +40,8 @@ MODULE_VERSION(DRV_MODULE_VERSION); ...@@ -40,6 +40,8 @@ MODULE_VERSION(DRV_MODULE_VERSION);
#define WAITING_FOR_GEN_CMD 0x04 #define WAITING_FOR_GEN_CMD 0x04
#define WAITING_FOR_ANY -1 #define WAITING_FOR_ANY -1
#define VDC_MAX_RETRIES 10
static struct workqueue_struct *sunvdc_wq; static struct workqueue_struct *sunvdc_wq;
struct vdc_req_entry { struct vdc_req_entry {
...@@ -419,6 +421,7 @@ static int __vdc_tx_trigger(struct vdc_port *port) ...@@ -419,6 +421,7 @@ static int __vdc_tx_trigger(struct vdc_port *port)
.end_idx = dr->prod, .end_idx = dr->prod,
}; };
int err, delay; int err, delay;
int retries = 0;
hdr.seq = dr->snd_nxt; hdr.seq = dr->snd_nxt;
delay = 1; delay = 1;
...@@ -431,6 +434,8 @@ static int __vdc_tx_trigger(struct vdc_port *port) ...@@ -431,6 +434,8 @@ static int __vdc_tx_trigger(struct vdc_port *port)
udelay(delay); udelay(delay);
if ((delay <<= 1) > 128) if ((delay <<= 1) > 128)
delay = 128; delay = 128;
if (retries++ > VDC_MAX_RETRIES)
break;
} while (err == -EAGAIN); } while (err == -EAGAIN);
if (err == -ENOTCONN) if (err == -ENOTCONN)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment