aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/usbip/vhci_rx.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c
index ac15cea7539..bf699147094 100644
--- a/drivers/staging/usbip/vhci_rx.c
+++ b/drivers/staging/usbip/vhci_rx.c
@@ -193,6 +193,19 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,
193 return; 193 return;
194} 194}
195 195
196static int vhci_priv_tx_empty(struct vhci_device *vdev)
197{
198 int empty = 0;
199
200 spin_lock(&vdev->priv_lock);
201
202 empty = list_empty(&vdev->priv_rx);
203
204 spin_unlock(&vdev->priv_lock);
205
206 return empty;
207}
208
196/* recv a pdu */ 209/* recv a pdu */
197static void vhci_rx_pdu(struct usbip_device *ud) 210static void vhci_rx_pdu(struct usbip_device *ud)
198{ 211{
@@ -210,8 +223,14 @@ static void vhci_rx_pdu(struct usbip_device *ud)
210 if (ret < 0) { 223 if (ret < 0) {
211 if (ret == -ECONNRESET) 224 if (ret == -ECONNRESET)
212 usbip_uinfo("connection reset by peer\n"); 225 usbip_uinfo("connection reset by peer\n");
213 else if (ret != -ERESTARTSYS) 226 else if (ret == -EAGAIN) {
227 /* ignore if connection was idle */
228 if (vhci_priv_tx_empty(vdev))
229 return;
230 usbip_uinfo("connection timed out with pending urbs\n");
231 } else if (ret != -ERESTARTSYS)
214 usbip_uinfo("xmit failed %d\n", ret); 232 usbip_uinfo("xmit failed %d\n", ret);
233
215 usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); 234 usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
216 return; 235 return;
217 } 236 }