aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorMax Vozeler <max@vozeler.com>2011-01-12 15:02:03 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-01-20 16:01:49 -0800
commit7e249c8b0737429bbf534515f81aded93504f449 (patch)
tree67b5b98c5eec090a18a2cc81e83f7119b06ae69b /drivers/staging
parent6d212153a838354078cc7d96f9bb23b7d1fd3d1b (diff)
staging: usbip: vhci: friendly log messages for connection errors
Also changes the event on connection close to be VDEV_EVENT_DOWN - no functional change. Signed-off-by: Max Vozeler <max@vozeler.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/usbip/vhci_rx.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c
index bdbedd25690..ac15cea7539 100644
--- a/drivers/staging/usbip/vhci_rx.c
+++ b/drivers/staging/usbip/vhci_rx.c
@@ -205,11 +205,23 @@ static void vhci_rx_pdu(struct usbip_device *ud)
memset(&pdu, 0, sizeof(pdu));
-
/* 1. receive a pdu header */
ret = usbip_xmit(0, ud->tcp_socket, (char *) &pdu, sizeof(pdu), 0);
+ if (ret < 0) {
+ if (ret == -ECONNRESET)
+ usbip_uinfo("connection reset by peer\n");
+ else if (ret != -ERESTARTSYS)
+ usbip_uinfo("xmit failed %d\n", ret);
+ usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
+ return;
+ }
+ if (ret == 0) {
+ usbip_uinfo("connection closed");
+ usbip_event_add(ud, VDEV_EVENT_DOWN);
+ return;
+ }
if (ret != sizeof(pdu)) {
- usbip_uerr("receiving pdu failed! size is %d, should be %d\n",
+ usbip_uerr("received pdu size is %d, should be %d\n",
ret, (unsigned int)sizeof(pdu));
usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
return;