diff options
author | Tilman Schmidt <tilman@imap.cc> | 2010-09-30 09:35:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-01 03:33:37 -0400 |
commit | bb7196d2bf30e4cb06fe5fed046c9084465e854c (patch) | |
tree | 797d7112db64e5e041ab606fc3006589c476a49f /drivers | |
parent | c9c0c3043452d30ab87135ba3753ce7855a3a8e7 (diff) |
isdn/gigaset: improve bas_gigaset USB error reporting
Rephrase some USB error messages to make them clearer and more consistent.
Downgrade some warning messages that may occur during normal operation to
debug messages.
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/gigaset/bas-gigaset.c | 112 |
1 files changed, 61 insertions, 51 deletions
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 71e3fdee4410..178942a2ee61 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -172,7 +172,7 @@ static char *get_usb_rcmsg(int rc) | |||
172 | case -EAGAIN: | 172 | case -EAGAIN: |
173 | return "start frame too early or too much scheduled"; | 173 | return "start frame too early or too much scheduled"; |
174 | case -EFBIG: | 174 | case -EFBIG: |
175 | return "too many isochronous frames requested"; | 175 | return "too many isoc frames requested"; |
176 | case -EPIPE: | 176 | case -EPIPE: |
177 | return "endpoint stalled"; | 177 | return "endpoint stalled"; |
178 | case -EMSGSIZE: | 178 | case -EMSGSIZE: |
@@ -203,13 +203,13 @@ static char *get_usb_statmsg(int status) | |||
203 | case -ENOENT: | 203 | case -ENOENT: |
204 | return "unlinked (sync)"; | 204 | return "unlinked (sync)"; |
205 | case -EINPROGRESS: | 205 | case -EINPROGRESS: |
206 | return "pending"; | 206 | return "URB still pending"; |
207 | case -EPROTO: | 207 | case -EPROTO: |
208 | return "bit stuffing error, timeout, or unknown USB error"; | 208 | return "bitstuff error, timeout, or unknown USB error"; |
209 | case -EILSEQ: | 209 | case -EILSEQ: |
210 | return "CRC mismatch, timeout, or unknown USB error"; | 210 | return "CRC mismatch, timeout, or unknown USB error"; |
211 | case -ETIME: | 211 | case -ETIME: |
212 | return "timed out"; | 212 | return "USB response timeout"; |
213 | case -EPIPE: | 213 | case -EPIPE: |
214 | return "endpoint stalled"; | 214 | return "endpoint stalled"; |
215 | case -ECOMM: | 215 | case -ECOMM: |
@@ -217,15 +217,15 @@ static char *get_usb_statmsg(int status) | |||
217 | case -ENOSR: | 217 | case -ENOSR: |
218 | return "OUT buffer underrun"; | 218 | return "OUT buffer underrun"; |
219 | case -EOVERFLOW: | 219 | case -EOVERFLOW: |
220 | return "too much data"; | 220 | return "endpoint babble"; |
221 | case -EREMOTEIO: | 221 | case -EREMOTEIO: |
222 | return "short packet detected"; | 222 | return "short packet"; |
223 | case -ENODEV: | 223 | case -ENODEV: |
224 | return "device removed"; | 224 | return "device removed"; |
225 | case -EXDEV: | 225 | case -EXDEV: |
226 | return "partial isochronous transfer"; | 226 | return "partial isoc transfer"; |
227 | case -EINVAL: | 227 | case -EINVAL: |
228 | return "invalid argument"; | 228 | return "ISO madness"; |
229 | case -ECONNRESET: | 229 | case -ECONNRESET: |
230 | return "unlinked (async)"; | 230 | return "unlinked (async)"; |
231 | case -ESHUTDOWN: | 231 | case -ESHUTDOWN: |
@@ -872,6 +872,7 @@ static void read_iso_callback(struct urb *urb) | |||
872 | tasklet_hi_schedule(&ubc->rcvd_tasklet); | 872 | tasklet_hi_schedule(&ubc->rcvd_tasklet); |
873 | } else { | 873 | } else { |
874 | /* tasklet still busy, drop data and resubmit URB */ | 874 | /* tasklet still busy, drop data and resubmit URB */ |
875 | gig_dbg(DEBUG_ISO, "%s: overrun", __func__); | ||
875 | ubc->loststatus = status; | 876 | ubc->loststatus = status; |
876 | for (i = 0; i < BAS_NUMFRAMES; i++) { | 877 | for (i = 0; i < BAS_NUMFRAMES; i++) { |
877 | ubc->isoinlost += urb->iso_frame_desc[i].actual_length; | 878 | ubc->isoinlost += urb->iso_frame_desc[i].actual_length; |
@@ -887,13 +888,11 @@ static void read_iso_callback(struct urb *urb) | |||
887 | urb->dev = bcs->cs->hw.bas->udev; | 888 | urb->dev = bcs->cs->hw.bas->udev; |
888 | urb->transfer_flags = URB_ISO_ASAP; | 889 | urb->transfer_flags = URB_ISO_ASAP; |
889 | urb->number_of_packets = BAS_NUMFRAMES; | 890 | urb->number_of_packets = BAS_NUMFRAMES; |
890 | gig_dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", | ||
891 | __func__); | ||
892 | rc = usb_submit_urb(urb, GFP_ATOMIC); | 891 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
893 | if (unlikely(rc != 0 && rc != -ENODEV)) { | 892 | if (unlikely(rc != 0 && rc != -ENODEV)) { |
894 | dev_err(bcs->cs->dev, | 893 | dev_err(bcs->cs->dev, |
895 | "could not resubmit isochronous read " | 894 | "could not resubmit isoc read URB: %s\n", |
896 | "URB: %s\n", get_usb_rcmsg(rc)); | 895 | get_usb_rcmsg(rc)); |
897 | dump_urb(DEBUG_ISO, "isoc read", urb); | 896 | dump_urb(DEBUG_ISO, "isoc read", urb); |
898 | error_hangup(bcs); | 897 | error_hangup(bcs); |
899 | } | 898 | } |
@@ -1135,7 +1134,7 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) | |||
1135 | gig_dbg(DEBUG_ISO, "%s: disconnected", __func__); | 1134 | gig_dbg(DEBUG_ISO, "%s: disconnected", __func__); |
1136 | else | 1135 | else |
1137 | dev_err(ucx->bcs->cs->dev, | 1136 | dev_err(ucx->bcs->cs->dev, |
1138 | "could not submit isochronous write URB: %s\n", | 1137 | "could not submit isoc write URB: %s\n", |
1139 | get_usb_rcmsg(rc)); | 1138 | get_usb_rcmsg(rc)); |
1140 | return rc; | 1139 | return rc; |
1141 | } | 1140 | } |
@@ -1180,7 +1179,7 @@ static void write_iso_tasklet(unsigned long data) | |||
1180 | ubc->isooutovfl = NULL; | 1179 | ubc->isooutovfl = NULL; |
1181 | spin_unlock_irqrestore(&ubc->isooutlock, flags); | 1180 | spin_unlock_irqrestore(&ubc->isooutlock, flags); |
1182 | if (ovfl) { | 1181 | if (ovfl) { |
1183 | dev_err(cs->dev, "isochronous write buffer underrun\n"); | 1182 | dev_err(cs->dev, "isoc write underrun\n"); |
1184 | error_hangup(bcs); | 1183 | error_hangup(bcs); |
1185 | break; | 1184 | break; |
1186 | } | 1185 | } |
@@ -1205,7 +1204,7 @@ static void write_iso_tasklet(unsigned long data) | |||
1205 | if (next) { | 1204 | if (next) { |
1206 | /* couldn't put it back */ | 1205 | /* couldn't put it back */ |
1207 | dev_err(cs->dev, | 1206 | dev_err(cs->dev, |
1208 | "losing isochronous write URB\n"); | 1207 | "losing isoc write URB\n"); |
1209 | error_hangup(bcs); | 1208 | error_hangup(bcs); |
1210 | } | 1209 | } |
1211 | } | 1210 | } |
@@ -1232,10 +1231,10 @@ static void write_iso_tasklet(unsigned long data) | |||
1232 | if (ifd->status || | 1231 | if (ifd->status || |
1233 | ifd->actual_length != ifd->length) { | 1232 | ifd->actual_length != ifd->length) { |
1234 | dev_warn(cs->dev, | 1233 | dev_warn(cs->dev, |
1235 | "isochronous write: frame %d: %s, " | 1234 | "isoc write: frame %d[%d/%d]: %s\n", |
1236 | "only %d of %d bytes sent\n", | 1235 | i, ifd->actual_length, |
1237 | i, get_usb_statmsg(ifd->status), | 1236 | ifd->length, |
1238 | ifd->actual_length, ifd->length); | 1237 | get_usb_statmsg(ifd->status)); |
1239 | offset = (ifd->offset + | 1238 | offset = (ifd->offset + |
1240 | ifd->actual_length) | 1239 | ifd->actual_length) |
1241 | % BAS_OUTBUFSIZE; | 1240 | % BAS_OUTBUFSIZE; |
@@ -1244,11 +1243,11 @@ static void write_iso_tasklet(unsigned long data) | |||
1244 | } | 1243 | } |
1245 | break; | 1244 | break; |
1246 | case -EPIPE: /* stall - probably underrun */ | 1245 | case -EPIPE: /* stall - probably underrun */ |
1247 | dev_err(cs->dev, "isochronous write stalled\n"); | 1246 | dev_err(cs->dev, "isoc write: stalled\n"); |
1248 | error_hangup(bcs); | 1247 | error_hangup(bcs); |
1249 | break; | 1248 | break; |
1250 | default: /* severe trouble */ | 1249 | default: /* other errors */ |
1251 | dev_warn(cs->dev, "isochronous write: %s\n", | 1250 | dev_warn(cs->dev, "isoc write: %s\n", |
1252 | get_usb_statmsg(status)); | 1251 | get_usb_statmsg(status)); |
1253 | } | 1252 | } |
1254 | 1253 | ||
@@ -1304,6 +1303,7 @@ static void read_iso_tasklet(unsigned long data) | |||
1304 | struct cardstate *cs = bcs->cs; | 1303 | struct cardstate *cs = bcs->cs; |
1305 | struct urb *urb; | 1304 | struct urb *urb; |
1306 | int status; | 1305 | int status; |
1306 | struct usb_iso_packet_descriptor *ifd; | ||
1307 | char *rcvbuf; | 1307 | char *rcvbuf; |
1308 | unsigned long flags; | 1308 | unsigned long flags; |
1309 | int totleft, numbytes, offset, frame, rc; | 1309 | int totleft, numbytes, offset, frame, rc; |
@@ -1321,8 +1321,7 @@ static void read_iso_tasklet(unsigned long data) | |||
1321 | ubc->isoindone = NULL; | 1321 | ubc->isoindone = NULL; |
1322 | if (unlikely(ubc->loststatus != -EINPROGRESS)) { | 1322 | if (unlikely(ubc->loststatus != -EINPROGRESS)) { |
1323 | dev_warn(cs->dev, | 1323 | dev_warn(cs->dev, |
1324 | "isochronous read overrun, " | 1324 | "isoc read overrun, URB dropped (status: %s, %d bytes)\n", |
1325 | "dropped URB with status: %s, %d bytes lost\n", | ||
1326 | get_usb_statmsg(ubc->loststatus), | 1325 | get_usb_statmsg(ubc->loststatus), |
1327 | ubc->isoinlost); | 1326 | ubc->isoinlost); |
1328 | ubc->loststatus = -EINPROGRESS; | 1327 | ubc->loststatus = -EINPROGRESS; |
@@ -1352,11 +1351,11 @@ static void read_iso_tasklet(unsigned long data) | |||
1352 | __func__, get_usb_statmsg(status)); | 1351 | __func__, get_usb_statmsg(status)); |
1353 | continue; /* -> skip */ | 1352 | continue; /* -> skip */ |
1354 | case -EPIPE: | 1353 | case -EPIPE: |
1355 | dev_err(cs->dev, "isochronous read stalled\n"); | 1354 | dev_err(cs->dev, "isoc read: stalled\n"); |
1356 | error_hangup(bcs); | 1355 | error_hangup(bcs); |
1357 | continue; /* -> skip */ | 1356 | continue; /* -> skip */ |
1358 | default: /* severe trouble */ | 1357 | default: /* other error */ |
1359 | dev_warn(cs->dev, "isochronous read: %s\n", | 1358 | dev_warn(cs->dev, "isoc read: %s\n", |
1360 | get_usb_statmsg(status)); | 1359 | get_usb_statmsg(status)); |
1361 | goto error; | 1360 | goto error; |
1362 | } | 1361 | } |
@@ -1364,40 +1363,52 @@ static void read_iso_tasklet(unsigned long data) | |||
1364 | rcvbuf = urb->transfer_buffer; | 1363 | rcvbuf = urb->transfer_buffer; |
1365 | totleft = urb->actual_length; | 1364 | totleft = urb->actual_length; |
1366 | for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { | 1365 | for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { |
1367 | numbytes = urb->iso_frame_desc[frame].actual_length; | 1366 | ifd = &urb->iso_frame_desc[frame]; |
1368 | if (unlikely(urb->iso_frame_desc[frame].status)) | 1367 | numbytes = ifd->actual_length; |
1368 | switch (ifd->status) { | ||
1369 | case 0: /* success */ | ||
1370 | break; | ||
1371 | case -EPROTO: /* protocol error or unplug */ | ||
1372 | case -EILSEQ: | ||
1373 | case -ETIME: | ||
1374 | /* probably just disconnected, ignore */ | ||
1375 | gig_dbg(DEBUG_ISO, | ||
1376 | "isoc read: frame %d[%d]: %s\n", | ||
1377 | frame, numbytes, | ||
1378 | get_usb_statmsg(ifd->status)); | ||
1379 | break; | ||
1380 | default: /* other error */ | ||
1381 | /* report, assume transferred bytes are ok */ | ||
1369 | dev_warn(cs->dev, | 1382 | dev_warn(cs->dev, |
1370 | "isochronous read: frame %d[%d]: %s\n", | 1383 | "isoc read: frame %d[%d]: %s\n", |
1371 | frame, numbytes, | 1384 | frame, numbytes, |
1372 | get_usb_statmsg( | 1385 | get_usb_statmsg(ifd->status)); |
1373 | urb->iso_frame_desc[frame].status)); | 1386 | } |
1374 | if (unlikely(numbytes > BAS_MAXFRAME)) | 1387 | if (unlikely(numbytes > BAS_MAXFRAME)) |
1375 | dev_warn(cs->dev, | 1388 | dev_warn(cs->dev, |
1376 | "isochronous read: frame %d: " | 1389 | "isoc read: frame %d[%d]: %s\n", |
1377 | "numbytes (%d) > BAS_MAXFRAME\n", | 1390 | frame, numbytes, |
1378 | frame, numbytes); | 1391 | "exceeds max frame size"); |
1379 | if (unlikely(numbytes > totleft)) { | 1392 | if (unlikely(numbytes > totleft)) { |
1380 | dev_warn(cs->dev, | 1393 | dev_warn(cs->dev, |
1381 | "isochronous read: frame %d: " | 1394 | "isoc read: frame %d[%d]: %s\n", |
1382 | "numbytes (%d) > totleft (%d)\n", | 1395 | frame, numbytes, |
1383 | frame, numbytes, totleft); | 1396 | "exceeds total transfer length"); |
1384 | numbytes = totleft; | 1397 | numbytes = totleft; |
1385 | } | 1398 | } |
1386 | offset = urb->iso_frame_desc[frame].offset; | 1399 | offset = ifd->offset; |
1387 | if (unlikely(offset + numbytes > BAS_INBUFSIZE)) { | 1400 | if (unlikely(offset + numbytes > BAS_INBUFSIZE)) { |
1388 | dev_warn(cs->dev, | 1401 | dev_warn(cs->dev, |
1389 | "isochronous read: frame %d: " | 1402 | "isoc read: frame %d[%d]: %s\n", |
1390 | "offset (%d) + numbytes (%d) " | 1403 | frame, numbytes, |
1391 | "> BAS_INBUFSIZE\n", | 1404 | "exceeds end of buffer"); |
1392 | frame, offset, numbytes); | ||
1393 | numbytes = BAS_INBUFSIZE - offset; | 1405 | numbytes = BAS_INBUFSIZE - offset; |
1394 | } | 1406 | } |
1395 | gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs); | 1407 | gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs); |
1396 | totleft -= numbytes; | 1408 | totleft -= numbytes; |
1397 | } | 1409 | } |
1398 | if (unlikely(totleft > 0)) | 1410 | if (unlikely(totleft > 0)) |
1399 | dev_warn(cs->dev, | 1411 | dev_warn(cs->dev, "isoc read: %d data bytes missing\n", |
1400 | "isochronous read: %d data bytes missing\n", | ||
1401 | totleft); | 1412 | totleft); |
1402 | 1413 | ||
1403 | error: | 1414 | error: |
@@ -1413,9 +1424,9 @@ error: | |||
1413 | rc = usb_submit_urb(urb, GFP_ATOMIC); | 1424 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
1414 | if (unlikely(rc != 0 && rc != -ENODEV)) { | 1425 | if (unlikely(rc != 0 && rc != -ENODEV)) { |
1415 | dev_err(cs->dev, | 1426 | dev_err(cs->dev, |
1416 | "could not resubmit isochronous read URB: %s\n", | 1427 | "could not resubmit isoc read URB: %s\n", |
1417 | get_usb_rcmsg(rc)); | 1428 | get_usb_rcmsg(rc)); |
1418 | dump_urb(DEBUG_ISO, "resubmit iso read", urb); | 1429 | dump_urb(DEBUG_ISO, "resubmit isoc read", urb); |
1419 | error_hangup(bcs); | 1430 | error_hangup(bcs); |
1420 | } | 1431 | } |
1421 | } | 1432 | } |
@@ -1647,8 +1658,7 @@ static int gigaset_init_bchannel(struct bc_state *bcs) | |||
1647 | 1658 | ||
1648 | if (cs->hw.bas->basstate & BS_SUSPEND) { | 1659 | if (cs->hw.bas->basstate & BS_SUSPEND) { |
1649 | dev_notice(cs->dev, | 1660 | dev_notice(cs->dev, |
1650 | "not starting isochronous I/O, " | 1661 | "not starting isoc I/O, suspend in progress\n"); |
1651 | "suspend in progress\n"); | ||
1652 | spin_unlock_irqrestore(&cs->lock, flags); | 1662 | spin_unlock_irqrestore(&cs->lock, flags); |
1653 | return -EHOSTUNREACH; | 1663 | return -EHOSTUNREACH; |
1654 | } | 1664 | } |
@@ -1657,7 +1667,7 @@ static int gigaset_init_bchannel(struct bc_state *bcs) | |||
1657 | if (ret < 0) { | 1667 | if (ret < 0) { |
1658 | spin_unlock_irqrestore(&cs->lock, flags); | 1668 | spin_unlock_irqrestore(&cs->lock, flags); |
1659 | dev_err(cs->dev, | 1669 | dev_err(cs->dev, |
1660 | "could not start isochronous I/O for channel B%d: %s\n", | 1670 | "could not start isoc I/O for channel B%d: %s\n", |
1661 | bcs->channel + 1, | 1671 | bcs->channel + 1, |
1662 | ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); | 1672 | ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); |
1663 | if (ret != -ENODEV) | 1673 | if (ret != -ENODEV) |
@@ -2086,7 +2096,7 @@ static int gigaset_freebcshw(struct bc_state *bcs) | |||
2086 | 2096 | ||
2087 | /* kill URBs and tasklets before freeing - better safe than sorry */ | 2097 | /* kill URBs and tasklets before freeing - better safe than sorry */ |
2088 | ubc->running = 0; | 2098 | ubc->running = 0; |
2089 | gig_dbg(DEBUG_INIT, "%s: killing iso URBs", __func__); | 2099 | gig_dbg(DEBUG_INIT, "%s: killing isoc URBs", __func__); |
2090 | for (i = 0; i < BAS_OUTURBS; ++i) { | 2100 | for (i = 0; i < BAS_OUTURBS; ++i) { |
2091 | usb_kill_urb(ubc->isoouturbs[i].urb); | 2101 | usb_kill_urb(ubc->isoouturbs[i].urb); |
2092 | usb_free_urb(ubc->isoouturbs[i].urb); | 2102 | usb_free_urb(ubc->isoouturbs[i].urb); |