当前位置: 首页 > news >正文

EG800G-CN不联网不定位

不联网不定位

出现问题后,adb shell登录到设备,lsusb查看EG800G模块存在,/dev/ttyUSB*设备文件也存在,用microcom发AT指令收不到应答。使用QAndroidLog工具在设备上抓模块日志,抓不到任何日志。

lsusb

# lsusb
Bus 003 Device 001: ID 1d6b:0003
Bus 002 Device 002: ID 2c7c:0904
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 004: ID 0781:5591
Bus 002 Device 001: ID 1d6b:0002

ttyUSB

# ls /dev/ttyUSB* -lh
crw-r----- 1 radio radio 188, 0 2025-05-14 17:57 /dev/ttyUSB0
crw-r----- 1 radio radio 188, 1 2010-01-01 08:00 /dev/ttyUSB1
crw-r----- 1 radio radio 188, 2 2010-01-01 08:00 /dev/ttyUSB2
crw-r----- 1 radio radio 188, 3 2010-01-01 08:00 /dev/ttyUSB3
crw-r----- 1 radio radio 188, 4 2010-01-01 08:00 /dev/ttyUSB4
crw-r----- 1 radio radio 188, 5 2010-01-01 08:00 /dev/ttyUSB5
# busybox microcom /dev/ttyUSB4
AT

uptime

 18:09:16 up 1 day, 59 min,  0 users,  load average: 15.27, 15.52, 16.00

QAndroidLog

VBUS

QUECTEL EG800G系列硬件设计手册
备注1、在拉低PWRKEY引脚之前,需保证VBAT电压稳定。建议VBAT上电稳定至少30ms后再拉低PWRKEY.
2、如果使用上电自动开机方案,使用AT命令关机后将无法再次自动开机,此时需强制断开VBAT申
源重新上电开机。因此推荐通过开关电路控制PWRKEY引脚的开关机方式。
3、在模块上电之前,需保证VBAT电压低于0.5V。如果使用MOSFET管控制VBAT电源,需设计
放电电路,保证模块关机断电后,VBAT端电压能较快释放。如外围预留看门狗电路,建议通过开
关电路去控制模块的VBAT电源。
4、针对以下两种开机场景需特别注意:* USB VBUS先接入电源(或者一直接入),VBAT后供电,再拉低PWRKEY开机的场景:需保证VBAT上电稳定后至少2s再执行拉低PWRKEY动作;* VBAT先供电(或者一直有电),USB_VBUS后接入电源,再拉低PWRKEY开机的场景:需保证USB VBUS接入后至少2s再执行拉低PWRKEY动作。

 AP log to debug UART

AT+QDBGCFG="tracecfg",0,1
AT+CFUN=1,1

usbmon

0516build275内核增加usbmon功能,发现出问题时,bulk in urb请求一直返回-71 EPROTO错误。

-71 EPROTO

# cat /d/usb/usbmon/2u
dac26900 2992224310 S Bi:2:002:8 -115 4096 <
db277d80 2992224338 C Bi:2:002:3 -71 0
db277d80 2992224339 S Bi:2:002:3 -115 4096 <
dac26a80 2992224357 C Bi:2:002:8 -71 0
dac26a80 2992224358 S Bi:2:002:8 -115 4096 <
db277cc0 2992224386 C Bi:2:002:3 -71 0
db277cc0 2992224387 S Bi:2:002:3 -115 4096 <
dac26b40 2992224397 C Bi:2:002:8 -71 0
dac26b40 2992224397 S Bi:2:002:8 -115 4096 <
db277f00 2992224426 C Bi:2:002:3 -71 0
db277f00 2992224427 S Bi:2:002:3 -115 4096 <

text

drivers/usb/mon/mon_text.c

mon_text_add

%dt %du %ds

699 int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus)
700 {
701     struct dentry *d;
702     enum { NAMESZ = 10 };
703     char name[NAMESZ];
704     int busnum = ubus? ubus->busnum: 0;
705     int rc;
706
707     if (mon_dir == NULL)
708         return 0;
709
710     if (ubus != NULL) {
711         rc = snprintf(name, NAMESZ, "%dt", busnum);
712         if (rc <= 0 || rc >= NAMESZ)
713             goto err_print_t;
714         d = debugfs_create_file(name, 0600, mon_dir, mbus,
715                                  &mon_fops_text_t);
716         if (d == NULL)
717             goto err_create_t;
718         mbus->dent_t = d;
719     }
720
721     rc = snprintf(name, NAMESZ, "%du", busnum);
722     if (rc <= 0 || rc >= NAMESZ)
723         goto err_print_u;
724     d = debugfs_create_file(name, 0600, mon_dir, mbus, &mon_fops_text_u);
725     if (d == NULL)
726         goto err_create_u;
727     mbus->dent_u = d;
728
729     rc = snprintf(name, NAMESZ, "%ds", busnum);
730     if (rc <= 0 || rc >= NAMESZ)
731         goto err_print_s;
732     d = debugfs_create_file(name, 0600, mon_dir, mbus, &mon_fops_stat);
733     if (d == NULL)
734         goto err_create_s;
735     mbus->dent_s = d;
736
737     return 1;
738
739 err_create_s:
740 err_print_s:
741     debugfs_remove(mbus->dent_u);
742     mbus->dent_u = NULL;
743 err_create_u:
744 err_print_u:
745     if (ubus != NULL) {
746         debugfs_remove(mbus->dent_t);
747         mbus->dent_t = NULL;
748     }
749 err_create_t:
750 err_print_t:
751     return 0;
752 }
257 static void mon_text_submit(void *data, struct urb *urb)
258 {
259     struct mon_reader_text *rp = data;
260     mon_text_event(rp, urb, 'S', -EINPROGRESS);
261 }
262
263 static void mon_text_complete(void *data, struct urb *urb, int status)
264 {
265     struct mon_reader_text *rp = data;
266     mon_text_event(rp, urb, 'C', status);
267 }

mon_text_open

349     rp->r.rnf_submit = mon_text_submit;
350     rp->r.rnf_error = mon_text_error;
351     rp->r.rnf_complete = mon_text_complete;

bin

drivers/usb/mon/mon_bin.c

mon_bin_init

1361 int __init mon_bin_init(void)
1362 {
1363     int rc;
1364
1365     mon_bin_class = class_create(THIS_MODULE, "usbmon");
1366     if (IS_ERR(mon_bin_class)) {
1367         rc = PTR_ERR(mon_bin_class);
1368         goto err_class;
1369     }
1370
1371     rc = alloc_chrdev_region(&mon_bin_dev0, 0, MON_BIN_MAX_MINOR, "usbmon");
1372     if (rc < 0)
1373         goto err_dev;
1374
1375     cdev_init(&mon_bin_cdev, &mon_fops_binary);
1376     mon_bin_cdev.owner = THIS_MODULE;
1377
1378     rc = cdev_add(&mon_bin_cdev, mon_bin_dev0, MON_BIN_MAX_MINOR);
1379     if (rc < 0)
1380         goto err_add;
1381
1382     return 0;
1383
1384 err_add:
1385     unregister_chrdev_region(mon_bin_dev0, MON_BIN_MAX_MINOR);
1386 err_dev:
1387     class_destroy(mon_bin_class);
1388 err_class:
1389     return rc;
1390 }

QAndroidLog

0611

du -sh

8.1G    /data/quectel_debug_log

QGPS

# pm list packages|grep com.mediatek.ygps
package:com.mediatek.ygps
am start com.mediatek.ygps/.YgpsActivity
am start com.ublox.ucenter/.uCenter+QGPS: 1OK
# lsof|grep ttyUSB
rild 478 radio 11u CHR 188,0 0t0 8758 /dev/ttyUSB0
rild 478 radio 19u CHR 188,5 0t0 8793 /dev/ttyUSB5# microcom /dev/ttyUsB4
Quectel
EG800G
Revision:EG800GCNGBR02A03M08
OK+QGPS: 1
OK865005074740047
OK

 log

abnormal

ac8257_demo_1g_32:/data/xbin # ./QAndroidLog
[000.000] Version: QLog_Linux_Android_V1.5.30
[000.001] will use filter file: default filter
[000.001] [init_qlog_path] [1860] entry
[000.003] Written 4 bytes
[000.003] [2010] restart entry
[000.109] Find [0] idVendor=2c7c, idProduct=0904, bNumInterfaces=8, ttyDM=/dev/ttyUSB1, ttyGENERAL=/dev/ttyUSB3, ttyTHIRD=, busnum=002, dev=002, usbdevic
e_pah=/sys/bus/usb/devices/2-1
[000.112] open /dev/ttyUSB1 ttyfd = 3
[000.112] open /dev/ttyUSB3 ttyfd = 4
[000.113] Press CTRL+C to stop catch log.
[000.113] catch log via tty port
[000.113] [qlog_handle] entry!
[000.113] unisoc_send_cmd cmd='0'
[000.114] > AT+ARMLOG=1
[003.120] > AT+ARMLOG=1
[006.135] > AT+ARMLOG=1
[009.156] > AT+ARMLOG=1
[012.172] > AT+ARMLOG=1
[015.192] > AT+ARMLOG=1
[018.214] > AT+ARMLOG=1
[021.231] > AT+ARMLOG=1
[024.246] > AT+ARMLOG=1
[027.260] > AT+ARMLOG=1
[030.143] poll() = 0, errno: 2 (No such file or directory)
[030.143] QLog abnormal exit...
[030.143] pthread_join(filter)

 normal

# ./QAndroidLog
[000.000] Version: QLog_Linux_Android_V1.5.30
[000.000] will use filter file: default filter
[000.000] [init_qlog_path] [1860] entry
[000.001] Written 4 bytes
[000.001] [2010] restart entry
[000.104] Find [0] idVendor=2c7c, idProduct=0904, bNumInterfaces=8, ttyDM=/dev/ttyUSB1, ttyGENERAL=/dev/ttyUSB3, ttyTHIRD=, busnum=002, dev=002, usbdevice_pah=/sys/bus/usb/devices/2-1
[000.106] open /dev/ttyUSB1 ttyfd = 3
[000.107] open /dev/ttyUSB3 ttyfd = 4
[000.107] Press CTRL+C to stop catch log.
[000.107] catch log via tty port
[000.108] [qlog_handle] entry!
[000.109] unisoc_send_cmd cmd='0'
[000.109] > AT+ARMLOG=1
[000.122] kfifo_alloc [0] = 5
[000.122] [qlog_logfile_create][858] qlog_files/2025_06_12_15_38_47_802_0000.logel logfd=5
[000.123] HandleDiagPkt unknow type subtype
[000.123] hexdump size=22
[000.123] 0000:[000.123]  7e[000.123]  ff[000.123]  ff[000.123]  00[000.123]  00[000.123]  14[000.123]  00[000.123]  d1[000.123]  80[000.123]  0f[000.123]  02[000.123]  00[000.123]  00[000.123]  00[000.123]  00[000.123]  00[000.123]  00[000.123]  0f[000.123]  02[000.123]  00[000.123]  00[000.123]  7e[000.123]
[000.123] HandleDiagPkt unknow type subtype
[000.123] hexdump size=22
[000.123] 0000:[000.123]  7e[000.123]  ff[000.123]  ff[000.123]  00[000.123]  00[000.123]  14[000.123]  00[000.123]  d1[000.123]  80[000.123]  0f[000.123]  02[000.123]  00[000.123]  00[000.123]  00[000.123]  00[000.123]  00[000.123]  00[000.123]  0f[000.123]  02[000.123]  00[000.123]  00[000.123]  7e[000.123]
[000.128] HandleDiagPkt unknow type subtype
[000.128] hexdump size=22
[000.128] 0000:[000.128]  7e[000.128]  ff[000.128]  ff[000.128]  00[000.128]  00[000.128]  14[000.128]  00[000.128]  d1[000.128]  80[000.128]  2b[000.128]  20[000.128]  87[000.128]  6c[000.128]  dc[000.128]  00[000.128]  00[000.128]  00[000.128]  3c[000.128]  02[000.128]  00[000.128]  00[000.128]  7e[000.128]
[000.165] fix pkt_len= 32 -> 42
[000.166] fix pkt_len= 92 -> 76
[003.112] > AT+ARMLOG=1
[003.124] HandleDiagPkt unknow type subtype
[003.124] hexdump size=22
[003.124] 0000:[003.124]  7e[003.124]  ff[003.124]  ff[003.124]  00[003.124]  00[003.124]  14[003.124]  00[003.124]  d1[003.124]  80[003.124]  6e[003.124]  3c[003.124]  cb[003.124]  64[003.124]  97[003.124]  01[003.124]  00[003.124]  00[003.124]  b1[003.124]  18[003.124]  47[003.124]  00[003.124]  7e[003.124]
[003.124] < OK
[005.115] recv time:[5114]
[005.115] recv DM:[0M][2K][0B]
[005.115] recv BIN:[0M][0K][0B]
[010.130] recv time:[10130]
[010.130] recv DM:[0M][5K][0B]
[010.130] recv BIN:[0M][0K][0B]
[015.132] recv time:[15132]
[015.132] recv DM:[0M][7K][0B]
[015.132] recv BIN:[0M][0K][0B]

USB Serial Option 

Quectel_Linux_USB_Serial_Option_Driver_20220622 v4.9.111

-71 EPROTO

网文

USB xHCI err -71 略解 - xxxdk's blog

文中有如下描述:

在手册 6.4.5 TRB Completion Code 中详细说明了每个错误码的意思。我们看到 value 4 ,USB Transaction Error的描述:“Asserted in the case where the host did not receive a vaild response from the device (Timeout, CRC, Bad PID, unexpected NYET, etc).“ 大意是 “主机未从设备收到有效响应例如超时,CRC错误,错误的PID,意外的NYET等。” 结合上述步骤,我们大概可以确定,两个err -71问题都是设备问题,如果要明确,那就需要抓协议包了。

hub_port_init

drivers/usb/core/hub.c

4898                 r = usb_control_msg(udev, usb_rcvaddr0pipe(),
4899                     USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
4900                     USB_DT_DEVICE << 8, 0,
4901                     buf, GET_DESCRIPTOR_BUFSIZE,
4902                     initial_descriptor_timeout);
4903                 switch (buf->bMaxPacketSize0) {
4904                 case 8: case 16: case 32: case 64: case 255:
4905                     if (buf->bDescriptorType ==
4906                             USB_DT_DEVICE) {
4907                         r = 0;
4908                         break;
4909                     }
4910                     /* FALL THROUGH */
4911                 default:
4912 #ifdef CONFIG_ATC_AOSP_ENHANCEMENT
4913 #ifdef USB_TEST_MODE_CONFIG
4914                     printk("Device No Response\n");
4915                     kobject_uevent_env(&udev->dev.kobj, KOBJ_CHANGE, device_no_resp_msg);
4916 #endif
4917 #endif
4918                     if (r == 0)
4919                         r = -EPROTO;
4920                     break;
4921                 }

musb_host

drivers/misc/mediatek/usb20/musb_host.c 

musb_h_ep0_irq

1824     } else if (csr & MUSB_CSR0_H_ERROR) {
1825 #ifdef CONFIG_ATC_AOSP_ENHANCEMENT
1826         printk_ratelimited(KERN_ERR "[MUSB] no response, csr0 %04x\n", csr);
1827 #else
1828         DBG(0, "no response, csr0 %04x\n", csr);
1829 #endif
1830         status = -EPROTO;
1831
1832     } else if (csr & MUSB_CSR0_H_NAKTIMEOUT) {

musb_host_rx

2393 #if defined(CONFIG_ATC_AOSP_ENHANCEMENT) && defined(CONFIG_ATC_USB_HSRX_DISC)
2394         if (musb_disable_disconnect_flag) {
2395             musb_ep_select(mbase, epnum);
2396             if (hw_ep->rx_retry < MUSB_MAX_ERR_RETRIES) {
2397                 hw_ep->rx_retry ++;
2398                 rx_csr &= ~MUSB_RXCSR_H_ERROR;
2399                 musb_writew(hw_ep->regs, MUSB_RXCSR, rx_csr);
2400
2401                 musb_h_flush_rxfifo(hw_ep, 0);
2402
2403                 rx_csr |= MUSB_RXCSR_H_REQPKT;  /* ask packet from the device */
2404                 musb_writew(hw_ep->regs, MUSB_RXCSR, rx_csr);
2405                 rx_csr = musb_readw(hw_ep->regs, MUSB_RXCSR);
2406                 return;
2407             } else {
2408                 printk_ratelimited(KERN_ERR "RX CSR error Retry:%d,return -EPROTO \n", hw_ep->rx_retry);
2409                 hw_ep->rx_retry = 0;
2410                 status = -EPROTO;
2411             }
2412         } else {
2413                 status = -EPROTO;
2414                 musb_writeb(epio, MUSB_RXINTERVAL, 0);
2415                 printk_ratelimited(KERN_ERR "RX error CSR:0x%04x\n", rx_csr);
2416         }
2417 #else2425     } else if (rx_csr & MUSB_RXCSR_DATAERROR) {
2426
2427         if (qh->type != USB_ENDPOINT_XFER_ISOC) {
2428             DBG(0, "RX end %d NAK timeout,rxtoggle=0x%x\n", epnum,
2429                 musb_readl(mbase, MUSB_RXTOG));
2430
2431             /* NOTE: NAKing is *NOT* an error, so we want to
2432              * continue.  Except ... if there's a request for
2433              * another QH, use that instead of starving it.
2434              *
2435              * Devices like Ethernet and serial adapters keep
2436              * reads posted at all times, which will starve
2437              * other devices without this logic.
2438              */
2439
2440             if (usb_pipebulk(urb->pipe)
2441                 && qh->mux == 1
2442 #ifdef CONFIG_ATC_AOSP_ENHANCEMENT
2443                 && !list_is_singular(&musb->in_bulk) && (b_is_in_suspend == 0)) {
2444 #else
2445                 && !list_is_singular(&musb->in_bulk)) {
2446 #endif
2447                 musb_bulk_nak_timeout(musb, hw_ep, 1);
2448                 return;
2449             }
2450
2451             musb_ep_select(mbase, epnum);
2452             rx_csr |= MUSB_RXCSR_H_WZC_BITS;
2453             rx_csr &= ~MUSB_RXCSR_DATAERROR;
2454             musb_writew(epio, MUSB_RXCSR, rx_csr);
2455 #ifdef CONFIG_ATC_AOSP_ENHANCEMENT
2456             if(b_is_in_suspend) {
2457                 status = -EPROTO;
2458                 DBG(0,"b_is_in_suspend force NAK to EPROTO errro\n");
2459             } else {
2460                 goto finish;
2461             }
2462 #else2470     } else if (rx_csr & MUSB_RXCSR_INCOMPRX) {
2471         DBG(3, "end %d high bandwidth incomplete ISO packet RX\n"
2472             , epnum);
2473         status = -EPROTO;
2474     }2599     } else if (urb->status == -EINPROGRESS) {
2600         /* if no errors, be sure a packet is ready for unloading */
2601         if (unlikely(!(rx_csr & MUSB_RXCSR_RXPKTRDY))) {
2602             status = -EPROTO;
2603             pr_err("Rx interrupt with no errors or packet!\n");
2604
2605             /* FIXME this is another "SHOULD NEVER HAPPEN" */
2606
2607 /* SCRUB (RX) */
2608             /* do the proper sequence to abort the transfer */
2609             musb_ep_select(mbase, epnum);
2610             val &= ~MUSB_RXCSR_H_REQPKT;
2611             musb_writew(epio, MUSB_RXCSR, val);
2612             goto finish;
2613         }

 DBG

drivers/misc/mediatek/usb20/musb_debug.h

 78 #define DBG(level, fmt, args...) xprintk(level, fmt, ## args)
 _dbg_level
 66 extern unsigned int musb_debug;67 extern unsigned int musb_debug_limit;68 extern unsigned int musb_uart_debug;6970 static inline int _dbg_level(unsigned int level)71 {72     return level <= musb_debug;73 }
 xprintk
 54 #define xprintk(level,  format, args...) do { \55     if (_dbg_level(level)) { \56         if (musb_uart_debug) {\57             pr_notice("[MUSB]%s %d: " format, \58                 __func__, __LINE__, ## args); \59         } \60         else{\61             pr_debug("[MUSB]%s %d: " format, \62                 __func__, __LINE__, ## args); \63         } \64     } } while (0)
musb_debug

drivers/misc/mediatek/usb20/musb_core.c

 203 unsigned int musb_debug;204 unsigned int musb_debug_limit = 1;205 unsigned int musb_uart_debug = 1;245 module_param_named(debug, musb_debug, uint, 0644);246 MODULE_PARM_DESC(debug, "Debug message level. Default = 0");247 module_param_named(debug_limit, musb_debug_limit, uint, 0644);248 module_param_named(dbg_uart, musb_uart_debug, uint, 0644);
module parameter
/sys/module/musb_hdrc/parametersdebug 0debug_limit 1dbg_uart 1

xhci

drivers/usb/host/xhci.c

xhci_setup_device

3929     case COMP_TX_ERR:
3930         dev_warn(&udev->dev, "Device not responding to setup %s.\n", act);
3931         ret = -EPROTO;
3932         break;

drivers/usb/host/xhci-ring.c

process_isoc_td

2112     case COMP_DEV_ERR:
2113     case COMP_STALL:
2114         frame->status = -EPROTO;
2115         skip_td = true;
2116         break;
2117     case COMP_TX_ERR:
2118         frame->status = -EPROTO;
2119         if (event_trb != td->last_trb)
2120             return 0;
2121         skip_td = true;
2122         break;

 handle_tx_event (*)

2415     case COMP_SPLIT_ERR:
2416     case COMP_TX_ERR:
2417         xhci_dbg(xhci, "Transfer error on endpoint\n");
2418         status = -EPROTO;
2419         break;
2455     case COMP_DEV_ERR:
2456         xhci_warn(xhci, "WARN: detect an incompatible device");
2457         status = -EPROTO;
2458         break;

# ls /sys/bus/usb/devices/ -l
total 0
lrwxrwxrwx 1 root root 0 2025-06-25 10:22 1-0:1.0 -> ../../../devices/platform/mt_usb/musb-hdrc/usb1/1-0:1.0
lrwxrwxrwx 1 root root 0 2025-06-25 10:22 2-0:1.0 -> ../../../devices/platform/11280000.usb/usb2/2-0:1.0
lrwxrwxrwx 1 root root 0 2025-06-25 10:22 3-0:1.0 -> ../../../devices/platform/11280000.usb/usb3/3-0:1.0
lrwxrwxrwx 1 root root 0 2025-06-25 10:22 usb1 -> ../../../devices/platform/mt_usb/musb-hdrc/usb1
lrwxrwxrwx 1 root root 0 2025-06-25 10:22 usb2 -> ../../../devices/platform/11280000.usb/usb2
lrwxrwxrwx 1 root root 0 2025-06-25 10:22 usb3 -> ../../../devices/platform/11280000.usb/usb3

xhci-mtk

# ls /sys/devices/platform/11280000.usb/driver -l
lrwxrwxrwx 1 root root 0 2025-06-25 10:24 /sys/devices/platform/11280000.usb/driver -> ../../../bus/platform/drivers/xhci-mtk

device-tree

# ls /proc/device-tree/usb@11280000/
clock-names clocks compatible gpio_vbus interrupts linux,phandle name phandle reg reg-names

 xhci.h

1731 #define xhci_dbg(xhci, fmt, args...) \
1732     dev_dbg(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1733 #define xhci_err(xhci, fmt, args...) \
1734     dev_err(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1735 #define xhci_warn(xhci, fmt, args...) \
1736     dev_warn(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1737 #define xhci_warn_ratelimited(xhci, fmt, args...) \
1738     dev_warn_ratelimited(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1739 #define xhci_info(xhci, fmt, args...) \
1740     dev_info(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
 xhci_transfer_event
1053 struct xhci_transfer_event {
1054     /* 64-bit buffer address, or immediate data */
1055     __le64  buffer;
1056     __le32  transfer_len;
1057     /* This field is interpreted differently based on the type of TRB */
1058     __le32  flags;
1059 };

dynamic_debug

cat /d/dynamic_debug/control |grep xhciecho "func handle_tx_event +p" > /d/dynamic_debug/control
echo "func handle_tx_event -p" > /d/dynamic_debug/control
echo "func handle_tx_event =p" > /d/dynamic_debug/controlecho "module xhci_hcd +p" > /d/dynamic_debug/controlecho "file usb_wwan.c +p" > /d/dynamic_debug/control
echo "func usb_wwan_indat_callback +p" > /d/dynamic_debug/control
echo "func usb_wwan_write +p" > /d/dynamic_debug/control

xhci_irq

xhci-ring.c

xhci_irqxhci_handle_eventhandle_cmd_completionhandle_port_statushandle_tx_eventskip_isoc_tdprocess_ctrl_tdfinish_tdprocess_isoc_tdprocess_bulk_intr_tdhandle_device_notificationhandle_vendor_event

usb_serial_driver option

drivers/usb/serial/option.c

1974 static struct usb_serial_driver option_1port_device = {
1975     .driver = {
1976         .owner =    THIS_MODULE,
1977         .name =     "option1",
1978     },
1979     .description       = "GSM modem (1-port)",
1980     .id_table          = option_ids,
1981     .num_ports         = 1,
1982     .probe             = option_probe,
1983     .open              = usb_wwan_open,
1984     .close             = usb_wwan_close,
1985     .dtr_rts       = usb_wwan_dtr_rts,
1986     .write             = usb_wwan_write,
1987     .write_room        = usb_wwan_write_room,
1988     .chars_in_buffer   = usb_wwan_chars_in_buffer,
1989     .tiocmget          = usb_wwan_tiocmget,
1990     .tiocmset          = usb_wwan_tiocmset,
1991     .ioctl             = usb_wwan_ioctl,
1992     .attach            = option_attach,
1993     .release           = option_release,
1994     .port_probe        = usb_wwan_port_probe,
1995     .port_remove       = usb_wwan_port_remove,
1996     .read_int_callback = option_instat_callback,
1997 #ifdef CONFIG_PM
1998     .suspend           = usb_wwan_suspend,
1999     .resume            = usb_wwan_resume,
2000 #if 1 //Added by Quectel
2001     .reset_resume = usb_wwan_resume,
2002 #endif
2003 #endif
2004 };

usb_wwan

drivers/usb/serial/usb_wwan.c

usb_wwan_send_setup
usb_wwan_dtr_rts
usb_wwan_tiocmget
usb_wwan_tiocmset
get_serial_info
set_serial_info
usb_wwan_ioctl
usb_wwan_write
usb_wwan_indat_callback
usb_wwan_outdat_callback
usb_wwan_write_room
usb_wwan_chars_in_buffer
usb_wwan_open
unbusy_queued_urb
usb_wwan_close
usb_wwan_setup_urb
usb_wwan_port_probe
usb_wwan_port_remove
stop_urbs
usb_wwan_suspend
usb_wwan_submit_delayed_urbs
usb_wwan_resume
524 int usb_wwan_port_probe(struct usb_serial_port *port)
525 {
526     struct usb_wwan_port_private *portdata;
527     struct urb *urb;
528     u8 *buffer;
529     int i;
530
531     if (!port->bulk_in_size || !port->bulk_out_size)
532         return -ENODEV;
533
534     portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
535     if (!portdata)
536         return -ENOMEM;
537
538     init_usb_anchor(&portdata->delayed);
539
540     for (i = 0; i < N_IN_URB; i++) {
541         buffer = (u8 *)__get_free_page(GFP_KERNEL);
542         if (!buffer)
543             goto bail_out_error;
544         portdata->in_buffer[i] = buffer;
545
546         urb = usb_wwan_setup_urb(port, port->bulk_in_endpointAddress,
547                         USB_DIR_IN, port,
548                         buffer, IN_BUFLEN,
549                         usb_wwan_indat_callback);
550         portdata->in_urbs[i] = urb;
551     }
552
553     for (i = 0; i < N_OUT_URB; i++) {
554         buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL);
555         if (!buffer)
556             goto bail_out_error2;
557         portdata->out_buffer[i] = buffer;
558
559         urb = usb_wwan_setup_urb(port, port->bulk_out_endpointAddress,
560                         USB_DIR_OUT, port,
561                         buffer, OUT_BUFLEN,
562                         usb_wwan_outdat_callback);
563         portdata->out_urbs[i] = urb;
564     }
565
566     usb_set_serial_port_data(port, portdata);
567
568     return 0;
569
570 bail_out_error2:
571     for (i = 0; i < N_OUT_URB; i++) {
572         usb_free_urb(portdata->out_urbs[i]);
573         kfree(portdata->out_buffer[i]);
574     }
575 bail_out_error:
576     for (i = 0; i < N_IN_URB; i++) {
577         usb_free_urb(portdata->in_urbs[i]);
578         free_page((unsigned long)portdata->in_buffer[i]);
579     }
580     kfree(portdata);
581
582     return -ENOMEM;
583 }
584 EXPORT_SYMBOL_GPL(usb_wwan_port_probe);

 BUFLEN

 29 #define N_IN_URB 430 #define N_OUT_URB 431 #define IN_BUFLEN 409632 #define OUT_BUFLEN 4096

usb_wwan_indat_callback

292 static void usb_wwan_indat_callback(struct urb *urb)
293 {
294     int err;
295     int endpoint;
296     struct usb_serial_port *port;
297     struct device *dev;
298     unsigned char *data = urb->transfer_buffer;
299     int status = urb->status;
300
301     endpoint = usb_pipeendpoint(urb->pipe);
302     port = urb->context;
303     dev = &port->dev;
304
305     if (status) {
306         dev_dbg(dev, "%s: nonzero status: %d on endpoint %02x.\n",
307             __func__, status, endpoint);
308     } else {
309         if (urb->actual_length) {
310             tty_insert_flip_string(&port->port, data,
311                     urb->actual_length);
312             tty_flip_buffer_push(&port->port);
313         } else
314             dev_dbg(dev, "%s: empty read urb received\n", __func__);
315     }
316     /* Resubmit urb so we continue receiving */
317     err = usb_submit_urb(urb, GFP_ATOMIC);
318     if (err) {
319         if (err != -EPERM && err != -ENODEV) {
320             dev_err(dev, "%s: resubmit read urb failed. (%d)\n",
321                 __func__, err);
322             /* busy also in error unless we are killed */
323             usb_mark_last_busy(port->serial->dev);
324         }
325     } else {
326         usb_mark_last_busy(port->serial->dev);
327     }
328 }

USB Protocol Analyzer

LeCroy

TELEDYNE LECROY Advisor T3

Traffic Summary Report

dataEnd Date & TimeElapsed TimePacketsTransactionsTransfers
06_30_14_21_2006-30 14:21:2113:101023.50MB5360293426660632399
06_30_15_00_0607-01 13:53:4022:53:332.0GB107203897533200771186
07_01_16_34_0907-01 16:34:1002:02420.98MB183929581741648215

Search

Go to Packet/Transaction/TransferCtrl+G
Go to USB 2.0PID
ANY Error/WarningCtrl+Shift+2
Specific Errors/Warnings
Data Length
Addr & Endp
Transfer Type
Find ...Ctrl+F
Find NextF3

Isoch?

协议分析软件,把没有NAK ACK STALL的传输,显示成isoch。

bus utilization

 /d/usb/devices

# cat /d/usb/devicesT:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 4.09
S:  Manufacturer=Linux 4.9.117+ musb-hcd
S:  Product=MUSB HDRC host driver
S:  SerialNumber=musb-hdrc
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256msT:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 4.09
S:  Manufacturer=Linux 4.9.117+ xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=11280000.usb
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256msT:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=2c7c ProdID=0904 Rev= 3.18
S:  Manufacturer=Android
S:  Product=Android
C:* #Ifs= 8 Cfg#= 1 Atr=e0 MxPwr=400mA
A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00
I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0msT:  Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=10000 MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 3.10 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
P:  Vendor=1d6b ProdID=0003 Rev= 4.09
S:  Manufacturer=Linux 4.9.117+ xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=11280000.usb
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

 device number

24_0624:01-01 08:00:03.710 I/[    0.981642](0)[212:kworker/0:2]usb 2-1(  212): new high-speed USB device number 2 using xhci-mtk
24_0624:01-01 08:07:47.732 I/[  465.004020](2)[3508:kworker/2:3]usb 2-1( 3508): USB disconnect, device number 2
24_0624:01-01 08:07:49.560 I/[  466.831631](0)[4000:kworker/0:0]usb 2-1( 4000): new high-speed USB device number 3 using xhci-mtk
24_0630:01-07 00:33:33.755 I/[491611.026551](2)[18486:kworker/2:3]usb 2-1(18486): USB disconnect, device number 3
24_0630:01-07 01:00:53.056 I/[493250.327517](0)[25804:kworker/0:2]usb 2-1(25804): new high-speed USB device number 4 using xhci-mtk
24_0630:01-07 01:01:18.442 I/[493275.713316](1)[22008:kworker/1:0]usb 2-1(22008): USB disconnect, device number 4
24_0630:01-07 01:29:54.475 I/[494991.747136](2)[4189:kworker/2:1]usb 2-1( 4189): new high-speed USB device number 5 using xhci-mtk
24_0630:01-07 01:32:04.824 I/[495122.095299](1)[22008:kworker/1:0]usb 2-1(22008): USB disconnect, device number 5
24_0630:01-07 01:37:53.105 I/[495470.377075](2)[4189:kworker/2:1]usb 2-1( 4189): new high-speed USB device number 6 using xhci-mtk
24_0630:01-07 01:37:56.512 I/[495473.783283](1)[22008:kworker/1:0]usb 2-1(22008): USB disconnect, device number 6
24_0630:01-07 01:38:01.056 I/[495478.327378](1)[22008:kworker/1:0]usb 2-1(22008): new high-speed USB device number 7 using xhci-mtk
24_0630:01-07 02:17:02.559 I/[497819.830536](2)[14321:kworker/2:3]usb 2-1(14321): USB disconnect, device number 7
24_0630:01-07 02:19:17.705 I/[497954.976622](2)[14321:kworker/2:3]usb 2-1(14321): new high-speed USB device number 8 using xhci-mtk

 USB Device Tree Viewer

=========================== USB Port4 ===========================Connection Status        : 0x01 (Device is connected)
Port Chain               : 1-4
Properties               : 0x01IsUserConnectable       : yesPortIsDebugCapable      : noPortHasMultiCompanions  : noPortConnectorIsTypeC    : no
ConnectionIndex          : 4
CompanionIndex           : 0CompanionHubSymLnk      : USB#ROOT_HUB30#4&3a727aa6&0&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8}CompanionPortNumber     : 14======================== USB Device ========================+++++++++++++++++ Device Information ++++++++++++++++++
Device Description       : QUSB Composite Device
Device Path              : \\.\usb#vid_2c7c&pid_0904#5&299674b&0&4#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
Device ID                : USB\VID_2C7C&PID_0904\5&299674B&0&4
Hardware IDs             : USB\VID_2C7C&PID_0904&REV_0318 USB\VID_2C7C&PID_0904
Driver KeyName           : {36fc9e60-c465-11cf-8056-444553540000}\0020 (GUID_DEVCLASS_USB)
Driver                   : C:\WINDOWS\System32\drivers\usbccgp.sys (Version: 10.0.26100.3912  Date: 2025-05-21)
Driver Inf               : C:\WINDOWS\inf\oem60.inf
Legacy BusType           : PNPBus
Class                    : USB
Class GUID               : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)
Interface GUID           : {a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Service                  : usbccgp
Enumerator               : USB
Location Info            : Port_#0004.Hub_#0002
Location IDs             : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(4), ACPI(_SB_)#ACPI(PC00)#ACPI(XHCI)#ACPI(RHUB)#ACPI(HS04)
Container ID             : {674c5216-5007-11f0-9464-c8cb9e2f2e56}
Manufacturer Info        : (Standard system devices)
Capabilities             : 0x84 (Removable, SurpriseRemovalOK)
Status                   : 0x0180600A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code             : 0
Upper Filters            : ew_usbenumfilter
Address                  : 4
Power State              : D0 (supported: D0, D1, D2, D3, wake from D0, wake from D1, wake from D2)Child Device 1          : 基于远程 NDIS 的 Internet 共享设备Device ID              : USB\VID_2C7C&PID_0904&MI_00\6&34686A7D&7&0000Class                  : NetChild Device 2          : Quectel USB AT PortDevice ID              : USB\VID_2C7C&SUBCLASS_00&PROT_00\6&34686A7D&7&0002Class                  : PortsCOM-Port               : COM24 (\Device\usbcommIOT_serial1)Child Device 3          : Quectel USB DIAG PortDevice ID              : USB\VID_2C7C&SUBCLASS_00&PROT_00\6&34686A7D&7&0003Class                  : PortsCOM-Port               : COM23 (\Device\usbcommIOT_serial2)Child Device 4          : Quectel USB Debug Host PortDevice ID              : USB\VID_2C7C&SUBCLASS_00&PROT_00\6&34686A7D&7&0004Class                  : PortsCOM-Port               : COM22 (\Device\usbcommIOT_serial3)Child Device 5          : Quectel USB CP Log PortDevice ID              : USB\VID_2C7C&SUBCLASS_00&PROT_00\6&34686A7D&7&0005Class                  : PortsCOM-Port               : COM21 (\Device\usbcommIOT_serial4)Child Device 6          : Quectel USB ModemDevice ID              : USB\VID_2C7C&SUBCLASS_00&PROT_00\6&34686A7D&7&0007Class                  : ModemCOM-Port               : COM18 (\Device\sprd_usbcomm_modem1)Child Device 7          : Quectel USB NMEA PortDevice ID              : USB\VID_2C7C&SUBCLASS_00&PROT_00\6&34686A7D&7&0008Class                  : PortsCOM-Port               : COM25 (\Device\usbcommIOT_serial5)---------------- Connection Information ---------------
Connection Index         : 0x04 (4)
Connection Status        : 0x01 (DeviceConnected)
Current Config Value     : 0x01
Device Address           : 0x2B (43)
Is Hub                   : 0x00 (no)
Number Of Open Pipes     : 0x0F (15)
Device Bus Speed         : 0x02 (High-Speed)
Pipe0ScheduleOffset      : 0x00 (0)
Pipe1ScheduleOffset      : 0x00 (0)
Pipe2ScheduleOffset      : 0x00 (0)
Pipe3ScheduleOffset      : 0x00 (0)
Pipe4ScheduleOffset      : 0x00 (0)
Pipe5ScheduleOffset      : 0x00 (0)
Pipe6ScheduleOffset      : 0x00 (0)
Pipe7ScheduleOffset      : 0x00 (0)
Pipe8ScheduleOffset      : 0x00 (0)
Pipe9ScheduleOffset      : 0x00 (0)
Pipe10ScheduleOffset     : 0x00 (0)
Pipe11ScheduleOffset     : 0x00 (0)
Pipe12ScheduleOffset     : 0x00 (0)
Pipe13ScheduleOffset     : 0x00 (0)
Pipe14ScheduleOffset     : 0x00 (0)--------------- Connection Information V2 -------------
Connection Index         : 0x04 (4)
Length                   : 0x10 (16 bytes)
SupportedUsbProtocols    : 0x03Usb110                  : 1 (yes)Usb200                  : 1 (yes)Usb300                  : 0 (no)ReservedMBZ             : 0x00
Flags                    : 0x00DevIsOpAtSsOrHigher     : 0 (Is not operating at SuperSpeed or higher)DevIsSsCapOrHigher      : 0 (Is not SuperSpeed capable or higher)DevIsOpAtSsPlusOrHigher : 0 (Is not operating at SuperSpeedPlus or higher)DevIsSsPlusCapOrHigher  : 0 (Is not SuperSpeedPlus capable or higher)ReservedMBZ             : 0x00------------------ Device Descriptor ------------------
bLength                  : 0x12 (18 bytes)
bDescriptorType          : 0x01 (Device Descriptor)
bcdUSB                   : 0x200 (USB Version 2.00)
bDeviceClass             : 0x00 (defined by the interface descriptors)
bDeviceSubClass          : 0x00
bDeviceProtocol          : 0x00
bMaxPacketSize0          : 0x40 (64 bytes)
idVendor                 : 0x2C7C
idProduct                : 0x0904
bcdDevice                : 0x0318
iManufacturer            : 0x01 (String Descriptor 1)Language 0x0409         : "Android"
iProduct                 : 0x02 (String Descriptor 2)Language 0x0409         : "Android"
iSerialNumber            : 0x03 (String Descriptor 3)
bNumConfigurations       : 0x01------------------ String Descriptors ----------------------- String Descriptor 0 ------
bLength                  : 0x04 (4 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language ID[0]           : 0x0409 (English - United States)------ String Descriptor 1 ------
bLength                  : 0x10 (16 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "Android"------ String Descriptor 2 ------
bLength                  : 0x10 (16 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "Android"------ String Descriptor 4 ------
bLength                  : 0x3A (58 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "RNDIS Communications Control"------ String Descriptor 5 ------
bLength                  : 0x28 (40 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "RNDIS Ethernet Data"------ String Descriptor 6 ------
bLength                  : 0x0C (12 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "RNDIS"------ String Descriptor 7 ------
bLength                  : 0x2C (44 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "Mobile Generic Serial"---------------- Configuration Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x02 (Configuration Descriptor)
wTotalLength             : 0x00D5 (213 bytes)
bNumInterfaces           : 0x08
bConfigurationValue      : 0x01
iConfiguration           : 0x00 (No String Descriptor)
bmAttributes             : 0xE0D7: Reserved, set 1     : 0x01D6: Self Powered        : 0x01 (yes)D5: Remote Wakeup       : 0x01 (yes)D4..0: Reserved, set 0  : 0x00
MaxPower                 : 0xC8 (400 mA)------------------- IAD Descriptor --------------------
bLength                  : 0x08 (8 bytes)
bDescriptorType          : 0x0B
bFirstInterface          : 0x00
bInterfaceCount          : 0x02
bFunctionClass           : 0xE0 (Wireless Controller)
bFunctionSubClass        : 0x01
bFunctionProtocol        : 0x03
iFunction                : 0x06 (String Descriptor 6)Language 0x0409         : "RNDIS"---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00
bAlternateSetting        : 0x00
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0xE0 (Wireless Controller)
bInterfaceSubClass       : 0x01
bInterfaceProtocol       : 0x03 (Remote NDIS)
iInterface               : 0x04 (String Descriptor 4)Language 0x0409         : "RNDIS Communications Control"----------------- Unknown Descriptor ------------------
bLength                  : 0x05 (5 bytes)
bDescriptorType          : 0x24
Data (HexDump)           : 05 24 00 10 01 ----------------- Unknown Descriptor ------------------
bLength                  : 0x05 (5 bytes)
bDescriptorType          : 0x24
Data (HexDump)           : 05 24 01 00 01 ----------------- Unknown Descriptor ------------------
bLength                  : 0x04 (4 bytes)
bDescriptorType          : 0x24
Data (HexDump)           : 04 24 02 00 ----------------- Unknown Descriptor ------------------
bLength                  : 0x05 (5 bytes)
bDescriptorType          : 0x24
Data (HexDump)           : 05 24 06 00 01 ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x82 (Direction=IN EndpointID=2)
bmAttributes             : 0x03 (TransferType=Interrupt)
wMaxPacketSize           : 0x0008Bits 15..13             : 0x00 (reserved, must be zero)Bits 12..11             : 0x00 (0 additional transactions per microframe -> allows 1..1024 bytes per packet)Bits 10..0              : 0x08 (8 bytes per packet)
bInterval                : 0x10 (16 ms)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x01
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0x0A (CDC-Data)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x05 (String Descriptor 5)Language 0x0409         : "RNDIS Ethernet Data"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x81 (Direction=IN EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x01 (Direction=OUT EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x02
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x83 (Direction=IN EndpointID=3)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x02 (Direction=OUT EndpointID=2)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x03
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x84 (Direction=IN EndpointID=4)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x03 (Direction=OUT EndpointID=3)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x04
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x85 (Direction=IN EndpointID=5)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x04 (Direction=OUT EndpointID=4)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x05
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x86 (Direction=IN EndpointID=6)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x05 (Direction=OUT EndpointID=5)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x07
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x87 (Direction=IN EndpointID=7)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x06 (Direction=OUT EndpointID=6)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x08
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x88 (Direction=IN EndpointID=8)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x07 (Direction=OUT EndpointID=7)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Configuration Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x02 (Configuration Descriptor)
wTotalLength             : 0x00D5 (213 bytes)
bNumInterfaces           : 0x08
bConfigurationValue      : 0x01
iConfiguration           : 0x00 (No String Descriptor)
bmAttributes             : 0xE0D7: Reserved, set 1     : 0x01D6: Self Powered        : 0x01 (yes)D5: Remote Wakeup       : 0x01 (yes)D4..0: Reserved, set 0  : 0x00
MaxPower                 : 0xC8 (400 mA)------------------- IAD Descriptor --------------------
bLength                  : 0x08 (8 bytes)
bDescriptorType          : 0x0B
bFirstInterface          : 0x00
bInterfaceCount          : 0x02
bFunctionClass           : 0xE0 (Wireless Controller)
bFunctionSubClass        : 0x01
bFunctionProtocol        : 0x03
iFunction                : 0x06 (String Descriptor 6)Language 0x0409         : "RNDIS"---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00
bAlternateSetting        : 0x00
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0xE0 (Wireless Controller)
bInterfaceSubClass       : 0x01
bInterfaceProtocol       : 0x03 (Remote NDIS)
iInterface               : 0x04 (String Descriptor 4)Language 0x0409         : "RNDIS Communications Control"----------------- Unknown Descriptor ------------------
bLength                  : 0x05 (5 bytes)
bDescriptorType          : 0x24
Data (HexDump)           : 05 24 00 10 01 ----------------- Unknown Descriptor ------------------
bLength                  : 0x05 (5 bytes)
bDescriptorType          : 0x24
Data (HexDump)           : 05 24 01 00 01 ----------------- Unknown Descriptor ------------------
bLength                  : 0x04 (4 bytes)
bDescriptorType          : 0x24
Data (HexDump)           : 04 24 02 00 ----------------- Unknown Descriptor ------------------
bLength                  : 0x05 (5 bytes)
bDescriptorType          : 0x24
Data (HexDump)           : 05 24 06 00 01 ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x82 (Direction=IN EndpointID=2)
bmAttributes             : 0x03 (TransferType=Interrupt)
wMaxPacketSize           : 0x0008Bits 15..13             : 0x00 (reserved, must be zero)Bits 12..11             : 0x00 (0 additional transactions per microframe -> allows 1..1024 bytes per packet)Bits 10..0              : 0x08 (8 bytes per packet)
bInterval                : 0x10 (16 ms)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x01
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0x0A (CDC-Data)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x05 (String Descriptor 5)Language 0x0409         : "RNDIS Ethernet Data"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x81 (Direction=IN EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x01 (Direction=OUT EndpointID=1)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x02
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x83 (Direction=IN EndpointID=3)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x02 (Direction=OUT EndpointID=2)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x03
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x84 (Direction=IN EndpointID=4)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x03 (Direction=OUT EndpointID=3)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x04
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x85 (Direction=IN EndpointID=5)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x04 (Direction=OUT EndpointID=4)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x05
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x86 (Direction=IN EndpointID=6)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x05 (Direction=OUT EndpointID=5)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x07
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x87 (Direction=IN EndpointID=7)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x06 (Direction=OUT EndpointID=6)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x08
bAlternateSetting        : 0x00
bNumEndpoints            : 0x02 (2 Endpoints)
bInterfaceClass          : 0xFF (Vendor Specific)
bInterfaceSubClass       : 0x00
bInterfaceProtocol       : 0x00
iInterface               : 0x07 (String Descriptor 7)Language 0x0409         : "Mobile Generic Serial"----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x88 (Direction=IN EndpointID=8)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never NAKs)----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x07 (Direction=OUT EndpointID=7)
bmAttributes             : 0x02 (TransferType=Bulk)
wMaxPacketSize           : 0x0200 (max 512 bytes)
bInterval                : 0x00 (never 

-71 EPROTO日志

usb_wwan

出现问题时,xhci中断每秒2万次,打开usb_wwan的动态调试可以看到日志。

echo "func usb_wwan_indat_callback +p" > /d/dynamic_debug/controloption1 ttyUSB0: usb_wwan_indat_callback: nonzero status: -71 on endpoint 03.
option1 ttyUSB5: usb_wwan_indat_callback: nonzero status: -71 on endpoint 08.

usbnet

rx_complete

接收错误超过20/30,暂停125毫秒。

rx_submitusb_fill_bulk_urbrx_complete-EPROTO stats.rx_errors++

  69 // reawaken network queue this soon after stopping; else watchdog barks70 #define TX_TIMEOUT_JIFFIES  (5*HZ)7172 /* throttle rx/tx briefly after some faults, so hub_wq might disconnect()73  * us (it polls at HZ/4 usually) before we report too many false errors.74  */75 #define THROTTLE_JIFFIES    (HZ/8)7677 // between wakeups78 #define UNLINK_TIMEOUT_MS   3580 static void rx_complete (struct urb *urb)581 {582     struct sk_buff      *skb = (struct sk_buff *) urb->context;583     struct skb_data     *entry = (struct skb_data *) skb->cb;584     struct usbnet       *dev = entry->dev;585     int         urb_status = urb->status;586     enum skb_state      state;587588     skb_put (skb, urb->actual_length);589     state = rx_done;590     entry->urb = NULL;591592     switch (urb_status) {593     /* success */594     case 0:595         break;596597     /* stalls need manual reset. this is rare ... except that598      * when going through USB 2.0 TTs, unplug appears this way.599      * we avoid the highspeed version of the ETIMEDOUT/EILSEQ600      * storm, recovering as needed.601      */602     case -EPIPE:603         dev->net->stats.rx_errors++;604         usbnet_defer_kevent (dev, EVENT_RX_HALT);605         // FALLTHROUGH606607     /* software-driven interface shutdown */608     case -ECONNRESET:       /* async unlink */609     case -ESHUTDOWN:        /* hardware gone */610         netif_dbg(dev, ifdown, dev->net,611               "rx shutdown, code %d\n", urb_status);612         goto block;613614     /* we get controller i/o faults during hub_wq disconnect() delays.615      * throttle down resubmits, to avoid log floods; just temporarily,616      * so we still recover when the fault isn't a hub_wq delay.617      */618     case -EPROTO:619     case -ETIME:620     case -EILSEQ:621         dev->net->stats.rx_errors++;622         if (!timer_pending (&dev->delay)) {623             mod_timer (&dev->delay, jiffies + THROTTLE_JIFFIES);624             netif_dbg(dev, link, dev->net,625                   "rx throttle %d\n", urb_status);626         }627 block:628         state = rx_cleanup;629         entry->urb = urb;630         urb = NULL;631         break;632633     /* data overrun ... flush fifo? */634     case -EOVERFLOW:635         dev->net->stats.rx_over_errors++;636         // FALLTHROUGH637638     default:639         state = rx_cleanup;640         dev->net->stats.rx_errors++;641         netif_dbg(dev, rx_err, dev->net, "rx status %d\n", urb_status);642         break;643     }644645     /* stop rx if packet error rate is high */646     if (++dev->pkt_cnt > 30) {647         dev->pkt_cnt = 0;648         dev->pkt_err = 0;649     } else {650         if (state == rx_cleanup)651             dev->pkt_err++;652         if (dev->pkt_err > 20)653             set_bit(EVENT_RX_KILL, &dev->flags);654     }655656     state = defer_bh(dev, skb, &dev->rxq, state);657658     if (urb) {659         if (netif_running (dev->net) &&660             !test_bit (EVENT_RX_HALT, &dev->flags) &&661             state != unlink_start) {662             rx_submit (dev, urb, GFP_ATOMIC);663             usb_mark_last_busy(dev->udev);664             return;665         }666         usb_free_urb (urb);667     }668     netif_dbg(dev, rx_err, dev->net, "no read resubmitted\n");669 }
rx shutdown, code %d
rx status %d
no read resubmitted

tx_complete

发送错误,暂停125毫秒。

usbnet_start_xmittx_complete-EPROTO netif_stop_queue
1212 static void tx_complete (struct urb *urb)
1213 {
1214     struct sk_buff      *skb = (struct sk_buff *) urb->context;
1215     struct skb_data     *entry = (struct skb_data *) skb->cb;
1216     struct usbnet       *dev = entry->dev;
1217
1218     if (urb->status == 0) {
1219         dev->net->stats.tx_packets += entry->packets;
1220         dev->net->stats.tx_bytes += entry->length;
1221     } else {
1222         dev->net->stats.tx_errors++;
1223
1224         switch (urb->status) {
1225         case -EPIPE:
1226             usbnet_defer_kevent (dev, EVENT_TX_HALT);
1227             break;
1228
1229         /* software-driven interface shutdown */
1230         case -ECONNRESET:       // async unlink
1231         case -ESHUTDOWN:        // hardware gone
1232             break;
1233
1234         /* like rx, tx gets controller i/o faults during hub_wq
1235          * delays and so it uses the same throttling mechanism.
1236          */
1237         case -EPROTO:
1238         case -ETIME:
1239         case -EILSEQ:
1240             usb_mark_last_busy(dev->udev);
1241             if (!timer_pending (&dev->delay)) {
1242                 mod_timer (&dev->delay,
1243                     jiffies + THROTTLE_JIFFIES);
1244                 netif_dbg(dev, link, dev->net,
1245                       "tx throttle %d\n", urb->status);
1246             }
1247             netif_stop_queue (dev->net);
1248             break;
1249         default:
1250             netif_dbg(dev, tx_err, dev->net,
1251                   "tx err %d\n", entry->urb->status);
1252             break;
1253         }
1254     }
1255
1256     usb_autopm_put_interface_async(dev->intf);
1257     (void) defer_bh(dev, skb, &dev->txq, tx_done);
1258 }

tx throttle %d
tx err %d

usbnet_bh

1476 // tasklet (work deferred from completions, in_irq) or timer
1477
1478 static void usbnet_bh (unsigned long param)
1479 {
1480     struct usbnet       *dev = (struct usbnet *) param;
1481     struct sk_buff      *skb;
1482     struct skb_data     *entry;
1483
1484     while ((skb = skb_dequeue (&dev->done))) {
1485         entry = (struct skb_data *) skb->cb;
1486         switch (entry->state) {
1487         case rx_done:
1488             entry->state = rx_cleanup;
1489             rx_process (dev, skb);
1490             continue;
1491         case tx_done:
1492             kfree(entry->urb->sg);
1493         case rx_cleanup:
1494             usb_free_urb (entry->urb);
1495             dev_kfree_skb (skb);
1496             continue;
1497         default:
1498             netdev_dbg(dev->net, "bogus skb state %d\n", entry->state);
1499         }
1500     }
1501
1502     /* restart RX again after disabling due to high error rate */
1503     clear_bit(EVENT_RX_KILL, &dev->flags);
1504
1505     /* waiting for all pending urbs to complete?
1506      * only then can we forgo submitting anew
1507      */
1508     if (waitqueue_active(&dev->wait)) {
1509         if (dev->txq.qlen + dev->rxq.qlen + dev->done.qlen == 0)
1510             wake_up_all(&dev->wait);
1511
1512     // or are we maybe short a few urbs?
1513     } else if (netif_running (dev->net) &&
1514            netif_device_present (dev->net) &&
1515            netif_carrier_ok(dev->net) &&
1516            !timer_pending(&dev->delay) &&
1517            !test_bit(EVENT_RX_PAUSED, &dev->flags) &&
1518            !test_bit(EVENT_RX_HALT, &dev->flags)) {
1519         int temp = dev->rxq.qlen;
1520
1521         if (temp < RX_QLEN(dev)) {
1522             if (rx_alloc_submit(dev, GFP_ATOMIC) == -ENOLINK)
1523                 return;
1524             if (temp != dev->rxq.qlen)
1525                 netif_dbg(dev, link, dev->net,
1526                       "rxqlen %d --> %d\n",
1527                       temp, dev->rxq.qlen);
1528             if (dev->rxq.qlen < RX_QLEN(dev))
1529                 tasklet_schedule (&dev->bh);
1530         }
1531         if (dev->txq.qlen < TX_QLEN (dev))
1532             netif_wake_queue (dev->net);
1533     }
1534 }

http://www.dtcms.com/a/392805.html

相关文章:

  • sqzb_alldsd——板子
  • Windows 快速检测 Docker / WSL2 安装环境脚本(附 GUI 版本)
  • Redis最佳实践——电商应用的性能监控与告警体系设计详解
  • 【C++】C++11(二)
  • 如何解决 pip install 安装报错 ModuleNotFoundError: No module named ‘selenium’ 问题
  • 实测美团LongCat-Flash:当大模型装上“速度引擎”,能否改写智能体战局?
  • unicode ascii utf-8的区别
  • Rust_2025:阶段1:day6.1 collect补充 ,迭代器补充 ,闭包,Hashmap搜索指定值的个数,合并迭代器
  • ESP32- 项目应用2 音乐播放器之音响驱动 #2
  • Datawhale25年9月组队学习:llm-preview+Task2:大模型使用
  • Agent记忆:Memvid、Memary、MemoryOS
  • 《主流PLC品牌型号大全解析》,电气设计时PLC应该怎么选
  • 从92到102,一建实务突破之路:坚持与自我超越
  • 探索C语言中字符串长度的计算方法
  • 使用node框架 Express开发仓库管理系统练习项目
  • 网络系统管理
  • 【Vue3 ✨】Vue3 入门之旅 · 第四篇:组件的创建与传递数据
  • PHP魔法函数和超全局数组介绍——第一阶段
  • 深入剖析“惊群效应”:从Java的notifyAll到epoll的解决方案
  • 鸿蒙应用统一埋点体系设计
  • Rust_2025:阶段1:day6.2 Box ,Cow ,Rc ,Refcell ,Arc,线程(join(),lock(),子线程与主线程通信
  • GD32VW553-IOT V2【微秒延迟时间实现方法】
  • html5是移动设备玖写口吧目盖由
  • 华为全联接大会 2025:跃升行业智能化
  • 采用Mayavi对BEV相机外参进行可视化
  • 算法高频题-动态规划
  • 第七篇:强类型枚举:enum class - 彻底解决传统枚举的缺陷
  • 汽车中的轻量化 AI 算法:驶向智能出行新未来
  • 《根治开放世界坐骑卡顿:从时钟同步到负载均衡的架构级解决方案》
  • 在线预览Office文件全攻略