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>

authored by Max Vozeler and committed by Greg Kroah-Hartman 7e249c8b 6d212153

+14 -2
+14 -2
drivers/staging/usbip/vhci_rx.c
··· 205 205 206 206 memset(&pdu, 0, sizeof(pdu)); 207 207 208 - 209 208 /* 1. receive a pdu header */ 210 209 ret = usbip_xmit(0, ud->tcp_socket, (char *) &pdu, sizeof(pdu), 0); 210 + if (ret < 0) { 211 + if (ret == -ECONNRESET) 212 + usbip_uinfo("connection reset by peer\n"); 213 + else if (ret != -ERESTARTSYS) 214 + usbip_uinfo("xmit failed %d\n", ret); 215 + usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); 216 + return; 217 + } 218 + if (ret == 0) { 219 + usbip_uinfo("connection closed"); 220 + usbip_event_add(ud, VDEV_EVENT_DOWN); 221 + return; 222 + } 211 223 if (ret != sizeof(pdu)) { 212 - usbip_uerr("receiving pdu failed! size is %d, should be %d\n", 224 + usbip_uerr("received pdu size is %d, should be %d\n", 213 225 ret, (unsigned int)sizeof(pdu)); 214 226 usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); 215 227 return;