Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    【FAQ】全志R329以太网常用调试说明

    其它全志芯片讨论区
    r329 r818 faq 网络 技术支持
    1
    1
    307
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • q1215200171
      budbool LV 8 last edited by

      需求背景

      硬件:R329+ RTL8211F
      软件:Tina3.0及以上

      需求说明

      对于单phy的平台以太网技术已经很成熟,这里提供一些以太网常用的调试方法。帮助客户快速定位常见问题。

      常用命令

      ifconfig eth0 up        打开eth0 网卡
      ifconfig eth0 down      关闭eth0 网卡
      ifconfig eth0 promisc   设置网卡eth0为混杂模式
      ifconfig eth0 -promisc  取消网卡eth0的混杂模式
      ifconfig eth0 192.168.1.100   设置ip地址
      ifconfig eth0 hw ether 4A:13:E4:F9:79:74   设置mac地址
      ifconfig eth0 192.168.1.100  设置静态ip地址
      udhcpc -i eth0         动态获取ip地址
      

      代码路径

      内核代码

      gmac代码:
      drivers/net/ethernet/allwinner/
      sunxi-gmac.c  sunxi_gmac_ops.c
      phy代码:(一般用内核generic的代码)
      linux-4.9/drivers/net/phy
      phy.c phy_device.c mdio_bus.c ...
      

      配置代码

      linux-4.9的适配
      board.dts
       730                 gmac0: eth@05020000 {
       731                         phy-rst = <&r_pio PH 19 1 1 1 0>;
       732                         use_ephy25m = <1>;
       733                         phy-mode = "rgmii";
       734                         tx-delay = <7>;
       735                         rx-delay = <0>;
       736                         status   = "okay";
       737                 };
      

      调试工具

      1.ethtool

      ethtool -s eth0 speed 1000 duplex full autoneg on  //设置1000M全双工自适应
      

      2.brctl

      root@TinaLinux:/# brctl --help
      BusyBox v1.27.2 () multi-call binary.
      
      Usage: brctl COMMAND [BRIDGE [INTERFACE]]
      
      Manage ethernet bridges
      
      Commands:
              show                    Show a list of bridges
              addbr BRIDGE            Create BRIDGE
              delbr BRIDGE            Delete BRIDGE
              addif BRIDGE IFACE      Add IFACE to BRIDGE
              delif BRIDGE IFACE      Delete IFACE from BRIDGE
              setageing BRIDGE TIME           Set ageing time
              setfd BRIDGE TIME               Set bridge forward delay
              sethello BRIDGE TIME            Set hello time
              setmaxage BRIDGE TIME           Set max message age
              setpathcost BRIDGE COST         Set path cost
              setportprio BRIDGE PRIO         Set port priority
              setbridgeprio BRIDGE PRIO       Set bridge priority
              stp BRIDGE [1/yes/on|0/no/off]  STP on/off
      root@TinaLinux:/# brctl addif br-lan eth0
      [ 4312.718522] br-lan: port 1(eth0) entered blocking state
      [ 4312.724433] br-lan: port 1(eth0) entered disabled state
      [ 4312.730790] device eth0 entered promiscuous mode
      
      root@TinaLinux:/# brctl delif br-lan eth0
      [ 4270.518067] device eth0 left promiscuous mode
      [ 4270.523335] br-lan: port 1(eth0) entered disabled state
      

      eth0加入和移除网桥时都会有混杂模式的打印
      br-lan网桥的配置

      > Networking support > Networking options
      		<*> 802.1d Ethernet Bridging    //CONFIG_BRIDGE=y
      
      1 Reply Last reply Reply Quote Share 0
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • 1 / 1
      • First post
        Last post

      Copyright © 2022 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策