linux 修改 usb-serial.c 提升3G上网速度

原创 2015年07月08日 14:03:34

Linux原有的USB驱动是针对低速USB设计的,,它的缓存开的太小。因此,3G上网卡的网速并没有达到evdo的正常速度。
在没有修改内核源码之前:

root@DayDream:/home# ping 114.114.114.114
PING 114.114.114.114 (114.114.114.114): 56 data bytes
64 bytes from 114.114.114.114: seq=0 ttl=67 time=102.400 ms
64 bytes from 114.114.114.114: seq=1 ttl=79 time=111.619 ms
64 bytes from 114.114.114.114: seq=2 ttl=84 time=118.659 ms
64 bytes from 114.114.114.114: seq=3 ttl=96 time=91.660 ms
64 bytes from 114.114.114.114: seq=4 ttl=94 time=122.760 ms
64 bytes from 114.114.114.114: seq=5 ttl=96 time=85.420 ms
64 bytes from 114.114.114.114: seq=6 ttl=82 time=199.560 ms
64 bytes from 114.114.114.114: seq=7 ttl=70 time=130.720 ms
64 bytes from 114.114.114.114: seq=8 ttl=78 time=154.260 ms
64 bytes from 114.114.114.114: seq=9 ttl=77 time=131.600 ms
64 bytes from 114.114.114.114: seq=10 ttl=69 time=206.619 ms
64 bytes from 114.114.114.114: seq=11 ttl=74 time=129.580 ms
64 bytes from 114.114.114.114: seq=12 ttl=72 time=223.679 ms
64 bytes from 114.114.114.114: seq=13 ttl=97 time=129.579 ms
64 bytes from 114.114.114.114: seq=14 ttl=84 time=178.639 ms
64 bytes from 114.114.114.114: seq=15 ttl=76 time=121.619 ms
^C
--- 114.114.114.114 ping statistics ---
16 packets transmitted, 16 packets received, 0% packet loss
round-trip min/avg/max = 85.420/139.898/223.679 ms

修改内核源码,建议修改前先复制一份备份。

vi build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_rt305x/linux-3.18.11/drivers/usb/serial/usb-serial.c 
//搜索 buffer_size =
//在赋值后面添加if(buffer_size < (10 * 1024)) buffer_size = (10 * 1024);
//总共有四处
buffer_size = max_t(int, serial->type->bulk_in_size,usb_endpoint_maxp(endpoint));
                /******************* Faker ******************************/
                if(buffer_size < (10 * 1024))
                        buffer_size = (10 * 1024);
                /************************************************/

编译烧写固件测试:

root@DayDream:/# ping 114.114.114.114
PING 114.114.114.114 (114.114.114.114): 56 data bytes
64 bytes from 114.114.114.114: seq=0 ttl=67 time=99.800 ms
64 bytes from 114.114.114.114: seq=1 ttl=79 time=93.160 ms
64 bytes from 114.114.114.114: seq=2 ttl=72 time=71.620 ms
64 bytes from 114.114.114.114: seq=3 ttl=69 time=84.160 ms
64 bytes from 114.114.114.114: seq=4 ttl=75 time=100.020 ms
64 bytes from 114.114.114.114: seq=5 ttl=95 time=94.100 ms
64 bytes from 114.114.114.114: seq=6 ttl=92 time=102.800 ms
64 bytes from 114.114.114.114: seq=7 ttl=66 time=90.800 ms
64 bytes from 114.114.114.114: seq=8 ttl=76 time=100.840 ms
64 bytes from 114.114.114.114: seq=9 ttl=85 time=97.240 ms
64 bytes from 114.114.114.114: seq=10 ttl=84 time=110.420 ms
64 bytes from 114.114.114.114: seq=11 ttl=74 time=101.160 ms
64 bytes from 114.114.114.114: seq=12 ttl=83 time=104.120 ms
64 bytes from 114.114.114.114: seq=13 ttl=97 time=104.240 ms
64 bytes from 114.114.114.114: seq=14 ttl=80 time=95.220 ms
64 bytes from 114.114.114.114: seq=15 ttl=94 time=108.680 ms
64 bytes from 114.114.114.114: seq=16 ttl=95 time=76.980 ms
64 bytes from 114.114.114.114: seq=17 ttl=72 time=102.960 ms
64 bytes from 114.114.114.114: seq=18 ttl=67 time=103.020 ms
64 bytes from 114.114.114.114: seq=19 ttl=95 time=102.679 ms
64 bytes from 114.114.114.114: seq=20 ttl=76 time=100.340 ms
64 bytes from 114.114.114.114: seq=21 ttl=94 time=99.040 ms
64 bytes from 114.114.114.114: seq=22 ttl=91 time=99.620 ms
64 bytes from 114.114.114.114: seq=23 ttl=72 time=102.620 ms
64 bytes from 114.114.114.114: seq=24 ttl=68 time=91.200 ms
^C
--- 114.114.114.114 ping statistics ---
25 packets transmitted, 25 packets received, 0% packet loss
round-trip min/avg/max = 71.620/97.473/110.420 ms

可以通过下载文件来测试网速

Linux中移植3G上网卡

本文所用到的源码下载地址如下: libusb-1.0.9.tar.bz2         下载地址点击这里! usb-modeswitch-2.0.1.tar.bz2   下载地址点击这...

USB 3G卡热插拔那些事3------usb serial驱动

上一节我们已经把3G识别出来并且可以工作了,具体3G卡拨号这一块我们稍后会讲到,这里先提下,首先就是pppd拨号程序,可以网上下载最新版源码自己编译安装,我是利用evdo拨号,当然还有其他方式。这里是...

Linux -> usb-serial -> option.c 设备编译

Linux -> usb-serial -> option.c 设备编译 在使用LC6311或者SIM4100类似的通讯modem的时候,我们经常...

嵌入式Linux下3G USB Modem的使用

一.ARM-Linux ARM-Linux-2.6.17 3G USB Modem:huaweiE220(WCDMA),huaweiEC156(EVDO) arm-linux至少需要支持usb ...

linux 使用ntfs-3g 挂载USB存储设备教程

转自:http://gzmaster.blog.51cto.com/299556/61160/ 1. 什么是NTFS-3G     NTFS-3G是一个开源软件,支持在Linux, FreeB...

嵌入式Linux下3G USB Modem的使用

busybox中需打开:wc,pidof; busybox中shell下打开getopts 百度搜索“Serial connection established. using chan...

Mini210 USB3G网卡拨号上网

一、拨号上网总体流程 mini210的linux文件系统中有“友善之臂”----"3G拨号上网"的选项,但是它的代码没有开源,用户不方便在自己的程序里面主动拨号。 其实使用USB3G网卡的步骤就三步:...

H3C 3g usb 无线路由配置方法

  • 2013年08月05日 02:14
  • 1.4MB
  • 下载

USB 3G拨号上网及短信功能的API说明

  • 2012年11月17日 15:16
  • 1.19MB
  • 下载

ARM+linux系统移植3G拨号上网收发短信(三)

一、用text查看模式 下面的“发”是指我敲的命令,“收”是指回车后显示的信息包括其他接收的信息。 ~ >: microcom -s 115200 /dev/ttyUSB1 发:at 收:OK...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:linux 修改 usb-serial.c 提升3G上网速度
举报原因:
原因补充:

(最多只允许输入30个字)