zoukankan      html  css  js  c++  java
  • BCM_SDK命令

    启动bcm的sdk,会进入一个类似shell的交互界面,在其中如入命令,可以配置交换机芯片。
    本文主要记录一下命令:
       1.端口限速命令
       2.链路聚合命令
       3.i2c控制命令
    启动方法:
    /tmp/bcm # ./bcm.user.proxy
    “?”显示帮助信息。直接输入会显示出sdk对所有型号芯片支持的命令,以及当前所支持的命令。
    BCM.0> ?
    help: "??" or "help" for summary
    Commands common to all modes:
    ?              ??             ASSert         BackGround     BCM            
    BCMX           Board          break          CASE           CD             
    CONFig         CONSole        CoPy           DATE           DeBug          
    DeBugMod       DELAY          DEVice         DIR            DISPatch       
    Echo           EXIT           EXPR           FLASHINIT      FLASHSYNC      
    FOR            Help           HISTory        IF             JOBS           
    KILL           LOCal          LOG            LOOP           LS             
    MKDIR          MODE           MORe           MoVe           NOEcho         
    Pause          PRINTENV       PWD            QUIT           RCCache        
    RCLoad         REBOOT         REName         RESET          RM             
    RMDIR          SalProfile     SAVE           SET            SETENV         
    SHell          SLeep          TIME           Version        
    Commands for current mode:
    AGE            Attach         Auth           BIST           BPDU           
    BTiMeout       CABLEdiag      CACHE          CellHDR        CHecK          
    CLEAR          COLOR          COMBO          COS            CounTeR        
    CustomSTAT     DELete         DETach         DMA            DmaRomTest     
    DMIRror        DSCP           DTAG           Dump           EditReg        
    EGRess         EthernetAV     FieldProcessor Getreg         GPORT          
    H2HIGIG        H2HIGIG2       HASH           HeaderMode     INIT           
    Insert         INTR           IPFIX          IPG            KNETctrl       
    L2             L2MODE         LED            LINKscan       LISTmem        
    Listreg        LOOKup         MCAST          MemSCAN        MemWatch       
    MIRror         MODify         ModMap         Modreg         MTiMeout       
    MultiCast      OAM            PacketWatcher  PBMP           PHY            
    POP            PORT           PortRate       PortSampRate   PortStat       
    PROBE          PUSH           PUTREG         PVlan          RATE           
    RateBw         RegCMp         REMove         RXCfg          RXInit         
    RXMon          SCHan          SEArch         Setreg         SHOW           
    SOC            STACKMode      StackPortGet   StackPortSet   STG            
    STiMeout       STKMode        SwitchControl  SystemSnake    TestClear      
    TestList       TestMode       TestParameters TestRun        TestSelect     
    TRUNK          TX             TXCount        TXSTArt        TXSTOp         
    VLAN           WARMBOOT       Write          XAUI   

    ### 1.portrate设置端口限速
    BCM.0> portrate ?
    Usage (PortRate): Set/Display port rate metering characteristics.
    Parameters: <pbm> [ingress|egress|pause [arg1 arg2]]
                For Ingress or Egress: arg1 is rate, arg2 is max_burst
                For Pause: arg1 is pause_thresh, arg2 is resume_thresh
                rate is in kilobits (1000 bits) per second
                max_burst and xxx_thresh are in kilobits (1000 bits)
    # 设置端口1的入口速率最大为1000,burst是有关qos相关的参数。
    BCM.0> portrate ge0 ingress 1000  
    PortRate: Error: missing port burst size
    BCM.0> portrate ge0 ingress 1000 1000
    # 显示所设置的端口参数,可以看出与设置的有些不同,因该是进行了转化
    BCM.0> portrate
     ge0:   Ingress meter:     1024 kbps     1031 kbits max burst.

    ### 2.trunk 设置链路聚合
    BCM.0> trunk
    Usage (TRUNK): Usages:
              trunk init
                    - Initialize trunking function
              trunk deinit
                    - Deinitialize trunking function
              trunk add <Id=val> <Rtag=val> <Pbmp=val>
                    - Add ports to a trunk
              trunk remove <Id=val> <Pbmp=val>
                    - Remove ports from a trunk
              trunk show [<Id=val>]
                    - Display trunk information
              trunk egress [<Id=val>] <Pbmp=val>
                    - Set egress ports for trunk
              trunk mcast <Id=val> <Mac=val> <Vlan=val>
                    - Join multicast to a trunk
              trunk hash set <Pbmp=val> <HashValue=val>
                    - Set ingress port hash value to select egress port of a trunk
              trunk hash get <Pbmp=val>
                    - Get ingress port programmable hash value
              trunk psc <Id=val> <Rtag=val>
                    - Change Rtag (for testing ONLY)
    # rtag指定链路聚合的负载分担方式。当设置2台交换机都配置为srcmac,destmac的时候,
    # 再通过测试卡进行发包测试,发送和接收都不会丢包,
    # 但是2两台交换机中有一台配置为srcdestmac的时候就会丢一半的包,正在查原因。
    BCM.0> trunk add id=1 rtag=1 pbmp=ge0,ge1
    BCM.0> trunk add id=2 rtag=2 pbmp=ge2,ge3
    BCM.0> trunk add id=3 rtag=3 pbmp=ge4,ge5
    # 查看链路聚合的设置
    BCM.0> trunk show
    Device supports 8 trunk groups:
      8 front panel trunks (0..7), 8 ports/trunk
    trunk 1: (front panel, 2 ports)=ge0,ge1 dlf=any mc=any ipmc=any psc=srcmac (0x1)
    trunk 2: (front panel, 2 ports)=ge2,ge3 dlf=any mc=any ipmc=any psc=destmac (0x2)
    trunk 3: (front panel, 2 ports)=ge4,ge5 dlf=any mc=any ipmc=any psc=srcdestmac (0x3)
    ### 3.i2c命令
    BCM.0> i2c ?
    Usage (I2C): Usages:
            i2c probe [pio|intr] [speed] [quiet]
                - probe devices on I2C bus and build device tree.
                  If "intr" or "pio" is specified, change to that bus mode.
                  If a valid speed is specified, change the bus to that speed.
                  If "quiet" is specified, suppresses probe output.
            i2c scan [pio|intr] [saddr] [quiet]
                - Scan devices on I2C bus and display the device list.
            i2c log
                - show I2C bus transaction log.
            i2c backlog
                - show I2C bus transaction log (in reverse order).
            i2c clearlog
                - reset I2C bus transaction log.
            i2c reset
                - reset I2C bus controller core.
            i2c speeds
                - show supported I2C bus controller clock rates.
            i2c show
                - show devices found and their attributes.
            i2c read saddr comm len
                - generic interface to read devices, do probe first
            i2c readb saddr len
                - generic interface to read devices without register based access, do probe first
            i2c write saddr comm [data]
                - generic interface to write a byte to devices, do probe first
                - comm is data when writing directly otherwise command register
    # 操作i2c之前,都需要先输入i2c probe
    BCM.0> i2c probe
    Yet to Implement soc_i2c_write_word_data
    Yet to Implement soc_i2c_write_word_data
    I2C: detected 2 devices
    # 扫描i2c设备
    BCM.0> i2c scan
    I2C device found at slave address 0X20 (lpt0: PCF8574 MUX control)
    I2C device found at slave address 0X32 (Unknown)
    I2C device found at slave address 0X48 (temp0: LM75 Temperature Sensor)
    I2C device found at slave address 0X77 (PCA9548 MUX)
    # 0x32的设备地址是SD2405时钟芯片。读取时钟芯片秒寄存器的值
    BCM.0> i2c read 0x32 0x00 1
    00: 18
    # 读取秒寄存器和分寄存器的值
    BCM.0> i2c read 0x32 0x00 2
    00: 31 35

    查看sdk/src/appl/diag/目录中的文件就可以了解对应的命令的实现。
    例如i2c_cmds.c文件。
  • 相关阅读:
    6-[多线程]-互斥锁、GIL、死锁、递归锁、信号量
    5-[多线程]-线程理论
    4-1 多进程练习题
    压缩与解压缩
    检测SSL证书很好用的三个网站
    shell之sort和uniq 及wc 的使用
    shell之cut和tr 的命令的使用
    三剑客之awk数组实战
    三剑客之sed
    linux文件查找(find,locate)
  • 原文地址:https://www.cnblogs.com/helloworldtoyou/p/5177932.html
Copyright © 2011-2022 走看看