关闭

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

标签: linux3G修改源码提升网速内核
576人阅读 评论(0) 收藏 举报
分类:

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

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

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:81819次
    • 积分:1461
    • 等级:
    • 排名:千里之外
    • 原创:67篇
    • 转载:4篇
    • 译文:0篇
    • 评论:5条
    文章分类
    最新评论