目录
PC 1
Helix4 Switch
5120 Switch
PC 2
BCM芯片Ingress 流程
BCM.0> v
Broadcom Command Monitor: Copyright (c) 1998-2010 Broadcom Corporation
Release: sdk-6.4.8 built 20160524 (Tue May 24 13:17:02 2016)
From broadcom@old-CentOS:/work/platform/broadcom/sdk-xgs-robo-6.4.8
Platform: IPROC_CMICD
OS: Unix (Posix)
Chips:
BCM56640_A0,
BCM56340_A0,
PHYs: BCM5218, BCM5220/21, BCM5226, BCM5228,
BCM5238, BCM5248, BCM5324/FE, BCM5348/FE,
BCM53242/FE, BCM53262/FE, BCM53101/FE, BCM53280/FE,
BCM53600/FE, BCM5400, BCM5401, BCM5402,
BCM5404, BCM5424/34, BCM5411, BCM5461,
BCM5464, BCM5466, BCM5478, BCM5488,
BCM54980, BCM54980, BCM54980, BCM54980,
BCM53314, BCM5482/801x, BCM54684, BCM54640,
BCM54682E, BCM54684E, BCM54685, BCM54616,
BCM54618E, BCM54618SE, BCM54210, BCM54220,
BCM54280, BCM54282, BCM54240, BCM54285,
BCM5428X, BCM54290, BCM54292, BCM54294,
BCM54295, BCM54296, BCM5421S, BCM54680,
BCM53324, BCM53125, BCM53128, BCM53010,
BCM53018, BCM5302X, BCM54880, BCM54881,
BCM54810, BCM54811, BCM89500, BCM54640E
BCM54880E, BCM54680E, BCM52681E, BCM8703,
BCM8704, BCM8705/24/25, BCM8706/8726, BCM8727,
BCM8728/8747, BCM8072, BCM8073, BCM8074,
BCM8040, BCM8481X, BCM84812, BCM84821,
BCM84822, BCM84823, BCM84833, BCM84834,
BCM84835, BCM84836, BCM84844, BCM84846,
BCM84848, BCM84858, BCM84856, BCM84860,
BCM84861, BCM84864, BCM84868, BCM8750,
BCM8752, BCM8754, BCM84740, BCM84164,
BCM84758, BCM84780, BCM84784, BCM84318,
BCM84328, copper sfp
BCM.0>
Xcap 0.4.2
在L2 Entry表中增加如下cpu mac 表项
BCM.0>L2 add mac=02:10:18:db:88:47 vlan=1 pbm=cpu0 Static=true ReplacePriority=false Replace=false L3=true
BCM.0> knet filter show
Filter ID 1: prio=127 dest=NetIF(1) desc=‘‘ striptag
BCM.0> knet filter destroy 1
BCM.0> knet filter create desttype=netif destid=1 prio=127 striptag=yes mirror=yes
Filter ID 1: prio=127 dest=NetIF(1) desc=‘‘ mirror=rxapi striptag
BCM.0>
Shell下配置虚拟接口vintf0的ip地址,即为交换机ip地址。
ifconfig vintf0 192.168.21.231
BCM.0> ps ge12
ps ge12
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge12 up 100M FD SW Yes Forward TX RX None FA SGMII 16356
BCM.0> ps ge8
ps ge8
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge8 up 1G FD SW Yes Forward TX RX None FA SGMII 16356
如上所示命令调用下面两个驱动接口获取端口状态
Void port_info_init(int unit, int port, bcm_port_info_t *info, uint32 actions)
int bcm_port_selective_get(int unit, bcm_port_t port, bcm_port_info_t *info)
Actions = BCM_PORT_ATTR_ALL_MASK
BCM.0> debug bcm api
debug bcm api
BCM.0> stg show 1
stg show 1
API: bcm_stg_vlan_list(0,1,...) -> 0 Ok
STG 1: contains 2 VLANs (1-2)
API: bcm_stg_vlan_list_destroy(0,...) -> 0 Ok
BCM.0> stg stp 1
stg stp 1
STG 1:
API: bcm_port_config_get(0,...) -> 0 Ok
API: bcm_stg_stp_get(0,1,1,...) -> 0 Ok
API: bcm_stg_stp_get(0,1,2,...) -> 0 Ok
...
API: bcm_stg_stp_get(0,1,55,...) -> 0 Ok
Forward: ge,xe,hg
如上所示,调用驱动接口获取端口stp 状态。
bcm_stg_stp_get(int unit, bcm_stg_t stg, bcm_port_t port, int *stp_state)
BCM.0> debug bcm api
debug bcm api
BCM.0> stg stp 1 ge15 block
stg stp 1 ge15 block
API: bcm_port_config_get(0,...) -> 0 Ok
API: bcm_stg_stp_set(0,1,16,...) -> 0 Ok
BCM.0> ps ge15
ps ge15
API: bcm_port_config_get(0,...) -> 0 Ok
API: bcm_port_selective_get(0,16,...) -> 0 Ok
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge15 up 1G FD SW Yes Block TX RX None FA SGMII 16356
BCM.0> clear c
clear c
BCM.0> show c
show c
R255.ge10 : 1 +1
R511.ge10 : 4 +4
RPKT.ge10 : 5 +5
RMCA.ge10 : 5 +5
RPOK.ge10 : 5 +5
RBYT.ge10 : 1,499 +1,499
RPORTD.ge15 : 25 +11
RDBGC0.ge15 : 25 +11
R127.ge15 : 7 +6
R255.ge15 : 7 +4
R511.ge15 : 1 +1
RPKT.ge15 : 25 +11
RMCA.ge15 : 7 +4
RBCA.ge15 : 18 +7
RPOK.ge15 : 25 +11
RBYT.ge15 : 2,631 +1,422
命令在调用驱动接口
bcm_stg_stp_set( int unit, bcm_stg_t stg, bcm_port_t port, int stp_state)
设置端口ge15 stp 状态为Block之后,查看端口状态,显示为block,打入广播报文,其他端口没有广播报文统计计数。
BCM.0> m L2_user_entry 3 1 MAC_ADDR=0x000000000003 VLAN_ID=1 MODULE_ID=0 MASK=0x00ffffffffffffff cpu=0 PORT_NUM=15
BCM.0> d l2_user_entry 3 1
d l2_user_entry 3 1
L2_USER_ENTRY.ipipe0[3]: <VLAN_ID=1,VFI=1,VALID=1,TGID=0xf,T=0,RPE=0,RESERVED_0=0,PRI=0,PORT_NUM=0xf,MODULE_ID=0,MASK=0x00ffffffffffffff,MAC_ADDR=0x000000000003,L2_PROTOCOL_PKT=0,KEY_TYPE=0,KEY=0x0001000000000003,EVEN_PARITY=0,DST_DISCARD=0,DO_NOT_LEARN_MACSA=0,CPU=0,CLASS_ID=0,BPDU=1>
修改L2_user_entry 表index 为3的表项,mac 为0x000000000003,从block 的ge12打入构造的目的mac为0x03的二层报文,其他端口有统计计数。
或者通过如下方式增加L2_user_entry表项
BCM.0> bpdu add index=-1 mac=0x000000000001
BCM.0> bpdu show
unit 0 has 512 BPDU entries
BPDU 0: 01:80:c2:00:00:00
BPDU 1: 01:80:c2:00:00:00
BPDU 2: 01:80:c2:00:00:00
BPDU 3: 01:80:c2:00:00:00
BPDU 4: 01:80:c2:00:00:00
BPDU 5: 01:80:c2:00:00:00
BPDU 6: 01:80:c2:00:00:10
BPDU 7: 00:00:00:00:00:01
BPDU 510: 01:80:c2:00:00:20
BPDU 511: 01:80:c2:00:00:00
BCM.0>
BCM.0> d chg L2_user_entry
L2_USER_ENTRY.ipipe0[0]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[1]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[2]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[3]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[4]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[5]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[6]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000010,KEY=0x00000180c2000010,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[7]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x000000000001,KEY=0x0000000000000001,BPDU=1>
L2_USER_ENTRY.ipipe0[510]: <VALID=1,MASK=0x0000fffffffffff0,MAC_ADDR=0x0180c2000020,KEY=0x00000180c2000020,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[511]: <VALID=1,MASK=0x0000fffffffffff0,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
BCM.0>
BCM.0> stg stp 1 ge12 block
stg stp 1 ge12 block
BCM.0> ps ge12
ps ge12
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge12 up 1G FD SW Yes Block TX RX None FA SGMII 16356
BCM.0> show c
show c
RUC.ge12 : 10 +10
R64.ge12 : 10 +10
RPKT.ge12 : 10 +10
RUCA.ge12 : 10 +10
RPRM.ge12 : 10 +10
RPOK.ge12 : 10 +10
RBYT.ge12 : 640 +640
T64.ge14 : 10 +10
TPOK.ge14 : 10 +10
TPKT.ge14 : 10 +10
TUCA.ge14 : 10 +10
TBYT.ge14 : 640 +640
MC_PERQ_PKT(0).ge14 : 10 +10
MC_PERQ_BYTE(0).ge14 : 640 +640
T64.ge48 : 10 +10
TPOK.ge48 : 10 +10
TPKT.ge48 : 10 +10
TUCA.ge48 : 10 +10
TBYT.ge48 : 640 +640
MC_PERQ_PKT(0).ge48 : 10 +10
MC_PERQ_BYTE(0).ge48 : 640 +640
BCM.0> stg stp 1 ge8 block
BCM.0> clear c
BCM.0> show c
RPORTD.ge8 : 10 +10
RDBGC0.ge8 : 10 +10
R64.ge8 : 10 +10
RPKT.ge8 : 10 +10
RBCA.ge8 : 10 +10
RPOK.ge8 : 10 +10
RBYT.ge8 : 640 +640
BCM.0> bpdu show
unit 0 has 512 BPDU entries
BPDU 0: 01:80:c2:00:00:00
BPDU 1: 01:80:c2:00:00:00
BPDU 2: 01:80:c2:00:00:00
BPDU 3: 01:80:c2:00:00:00
BPDU 4: 01:80:c2:00:00:00
BPDU 5: 01:80:c2:00:00:00
BPDU 6: 01:80:c2:00:00:10
BPDU 510: 01:80:c2:00:00:20
BPDU 511: 01:80:c2:00:00:00
BCM.0> bpdu add index=-1 mac=01:80:c2:05:00:01
BCM.0> bpdu show
unit 0 has 512 BPDU entries
BPDU 0: 01:80:c2:00:00:00
BPDU 1: 01:80:c2:00:00:00
BPDU 2: 01:80:c2:00:00:00
BPDU 3: 01:80:c2:00:00:00
BPDU 4: 01:80:c2:00:00:00
BPDU 5: 01:80:c2:00:00:00
BPDU 6: 01:80:c2:00:00:10
BPDU 7: 01:80:c2:05:00:01
BPDU 510: 01:80:c2:00:00:20
BPDU 511: 01:80:c2:00:00:00
BCM.0> d chg L2_user_entry
L2_USER_ENTRY.ipipe0[0]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[1]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[2]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[3]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[4]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[5]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[6]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2000010,KEY=0x00000180c2000010,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[7]: <VALID=1,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2050001,KEY=0x00000180c2050001,BPDU=1>
L2_USER_ENTRY.ipipe0[510]: <VALID=1,MASK=0x0000fffffffffff0,MAC_ADDR=0x0180c2000020,KEY=0x00000180c2000020,CPU=1,BPDU=1>
L2_USER_ENTRY.ipipe0[511]: <VALID=1,MASK=0x0000fffffffffff0,MAC_ADDR=0x0180c2000000,KEY=0x00000180c2000000,CPU=1,BPDU=1>
BCM.0> d L2_user_entry 7 1
L2_USER_ENTRY.ipipe0[7]: <VLAN_ID=0,VFI=0,VALID=1,TGID=0,T=0,RPE=0,RESERVED_0=0,PRI=0,PORT_NUM=0,MODULE_ID=0,MASK=0x0000ffffffffffff,MAC_ADDR=0x0180c2050001,L2_PROTOCOL_PKT=0,KEY_TYPE=0,KEY=0x00000180c2050001,EVEN_PARITY=0,DST_DISCARD=0,DO_NOT_LEARN_MACSA=0,CPU=0,CLASS_ID=0,BPDU=1>
BCM.0> mod L2_user_entry 7 1 cpu=1
BCM.0> clear c
BCM.0> show c
MC_PERQ_PKT(0).cpu0 : 10 +10
MC_PERQ_BYTE(0).cpu0 : 680 +680
R64.ge8 : 10 +10
RPKT.ge8 : 10 +10
RMCA.ge8 : 10 +10
RPOK.ge8 : 10 +10
RBYT.ge8 : 640 +640
BCM.0> stg stp 1 ge15 forward
stg stp 1 ge15 forward
API: bcm_port_config_get(0,...) -> 0 Ok
API: bcm_stg_stp_set(0,1,16,...) -> 0 Ok
BCM.0> clear c
clear c
BCM.0> show c
show c
T64.ge10 : 10 +10
T127.ge10 : 2 +2
TPOK.ge10 : 12 +12
TPKT.ge10 : 12 +12
TBCA.ge10 : 12 +12
TBYT.ge10 : 812 +812
MC_PERQ_PKT(0).ge10 : 12 +12
MC_PERQ_BYTE(0).ge10 : 812 +812
R64.ge15 : 10 +10
R127.ge15 : 2 +2
RPKT.ge15 : 12 +12
RBCA.ge15 : 12 +12
RPOK.ge15 : 12 +12
RBYT.ge15 : 812 +812
T64.ge48 : 10 +10
T127.ge48 : 2 +2
TPOK.ge48 : 12 +12
TPKT.ge48 : 12 +12
TBCA.ge48 : 12 +12
TBYT.ge48 : 812 +812
MC_PERQ_PKT(0).ge48 : 12 +12
MC_PERQ_BYTE(0).ge48 : 812 +812
BCM.0> ps ge15
ps ge15
API: bcm_port_config_get(0,...) -> 0 Ok
API: bcm_port_selective_get(0,16,...) -> 0 Ok
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge15 up 1G FD SW Yes Forward TX RX None FA SGMII 16356
BCM.0>
在将端口ge15 stp设置为forward 之后,查看端口状态显示为forward, 从ge15打入二层广播报文,其他端口有报文统计计数。
BCM.0> stg stp 1 ge10 disable
stg stp 1 ge10 disable
BCM.0> clear c
clear c
BCM.0> ps ge10
ps ge10
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge10 up 1G FD SW Yes Disable TX RX None FA SGMII 16356
BCM.0> show c
show c
RPORTD.ge10 : 10 +10
RDBGC0.ge10 : 10 +10
R64.ge10 : 10 +10
RPKT.ge10 : 10 +10
RBCA.ge10 : 10 +10
RPOK.ge10 : 10 +10
RBYT.ge10 : 640 +640
BCM.0>
BCM.0> stg stp 1 ge10 forward
stg stp 1 ge10 forward
BCM.0> clear c
clear c
BCM.0> show c
show c
R64.ge10 : 10 +10
RPKT.ge10 : 10 +10
RBCA.ge10 : 10 +10
RPOK.ge10 : 10 +10
RBYT.ge10 : 640 +640
R511.ge14 : 1 +1
RPKT.ge14 : 1 +1
RMCA.ge14 : 1 +1
RPOK.ge14 : 1 +1
RBYT.ge14 : 333 +333
T64.ge14 : 10 +10
TPOK.ge14 : 10 +10
TPKT.ge14 : 10 +10
TBCA.ge14 : 10 +10
TBYT.ge14 : 640 +640
MC_PERQ_PKT(0).ge14 : 10 +10
MC_PERQ_BYTE(0).ge14 : 640 +640
BCM.0>
BCM.0> stg stp 1 ge10 listen
stg stp 1 ge10 listen
BCM.0> ps ge10
ps ge10
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge10 up 1G FD SW Yes Block TX RX None FA SGMII 16356
BCM.0> clear c
clear c
BCM.0> show c
show c
RPORTD.ge10 : 11 +11
RDBGC0.ge10 : 11 +11
R64.ge10 : 10 +10
R255.ge10 : 1 +1
RPKT.ge10 : 11 +11
RBCA.ge10 : 11 +11
RPOK.ge10 : 11 +11
RBYT.ge10 : 887 +887
BCM.0>
BCM.0> stg stp 1 ge10 forward
stg stp 1 ge10 forward
BCM.0> ps ge10
ps ge10
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge10 up 1G FD SW Yes Forward TX RX None FA SGMII 16356
BCM.0> stg stp 1 ge10 learn
stg stp 1 ge10 learn
BCM.0> ps ge10
ps ge10
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge10 up 1G FD SW Yes LEarn TX RX None FA SGMII 16356
BCM.0> clear c
clear c
BCM.0> show c
show c
RPORTD.ge10 : 10 +10
RDBGC0.ge10 : 10 +10
R64.ge10 : 10 +10
RPKT.ge10 : 10 +10
RBCA.ge10 : 10 +10
RPOK.ge10 : 10 +10
RBYT.ge10 : 640 +640
R255.ge14 : 1 +1
RPKT.ge14 : 1 +1
RMCA.ge14 : 1 +1
RPOK.ge14 : 1 +1
RBYT.ge14 : 167 +167
BCM.0>
2.4.1 电口up/down事件
BCM.0> dispatch linkreg 0
dispatch linkreg 0
API: bcm_linkscan_register(0,...) -> 0 Ok
BCM.0> port ge8 en=false
port ge8 en=false
BCM.0> [bcmLINK.0] port 0.9 link down
BCM.0> ps ge8
ps ge8
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge8 !ena - SW Yes Forward TX RX None FA SGMII 16356
BCM.0> port ge8 en=true
port ge8 en=true
BCM.0> [bcmLINK.0] port 0.9 link up 1000Mb/s FD
命令调用驱动接口
int bcm_linkscan_register( int unit, bcm_linkscan_handler_t f)
注册linkscan 回调处理函数,在port ge8 enable 设置为false 时,打印link down消息,
在enable 设置为true之后,打印link up消息。
2.4.2 光口up/down事件
分别使用光转电,光模块,线缆验证。接光转电模块时,在插拔网线或光转电模块都会上报up/down事件;在接光模块时,插拔光纤或光模块都会上报up/down事件;在接线缆时,插拔线缆会上报up/down事件。
BCM.0> dispatch linkreg 0
dispatch linkreg 0
[bcmLINK.0] port 0.3 link up 1000Mb/s FD
[bcmLINK.0] port 0.3 link down
[bcmLINK.0] port 0.3 link up 1000Mb/s FD
[bcmLINK.0] port 0.3 link down
[bcmLINK.0] port 0.1 link up 1000Mb/s FD
[bcmLINK.0] port 0.1 link down
[bcmLINK.0] port 0.1 link up 1000Mb/s FD
[bcmLINK.0] port 0.7 link up 1000Mb/s FD
[bcmLINK.0] port 0.1 link down
[bcmLINK.0] port 0.7 link down
[bcmLINK.0] port 0.1 link up 1000Mb/s FD
[bcmLINK.0] port 0.7 link up 1000Mb/s FD
[bcmLINK.0] port 0.1 link down
[bcmLINK.0] port 0.7 link down
[bcmLINK.0] port 0.1 link up 1000Mb/s FD
[bcmLINK.0] port 0.7 link up 1000Mb/s FD
[bcmLINK.0] port 0.1 link down
[bcmLINK.0] port 0.7 link down
[bcmLINK.0] port 0.3 link up 1000Mb/s FD
[bcmLINK.0] port 0.6 link up 1000Mb/s FD
[bcmLINK.0] port 0.3 link down
[bcmLINK.0] port 0.6 link down
BCM.0> dispatch linkunreg 0
dispatch linkunreg 0
API: bcm_linkscan_unregister(0,...) -> 0 Ok
BCM.0> port ge8 en=false
port ge8 en=false
BCM.0> ps ge8
ps ge8
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge8 !ena - SW Yes Forward TX RX None FA SGMII 16356
BCM.0> port ge8 en=true
port ge8 en=true
BCM.0> ps ge8
ps ge8
ena/ speed/ link auto STP lrn inter max loop
port link duplex scan neg? state pause discrd ops face frame back
ge8 up 1G FD SW Yes Forward TX RX None FA SGMII 16356
BCM.0>
命令调用驱动接口
int bcm_linkscan_unregister(int unit, bcm_linkscan_handler_t f)
取消注册的回调处理函数,在将port ge8设置为enable = false 或true 之后,都不打印linkdown /linkup消息。
2.6 VCT
BCM.0> cable ge12
cable ge12
port ge12: cable (4 pairs, length +/- 10 meters)
pair A Open, length 1 meters
pair B Open, length 1 meters
pair C Open, length 1 meters
pair D Open, length 1 meters
2.7 Mirror
BCM.0> dmir 11 mode=ingress destport=13
dmir 11 mode=ingress destport=13
BCM.0> l2 watch start
l2 watch start
API: bcm_l2_addr_register(0,...) -> 0 Ok
BCM.0> API: bcm_stk_my_modid_get(0,...) -> 0 Ok
L2 ADD: mac=00:00:00:00:00:03 vlan=1 GPORT=0x9API: bcm_port_local_get(0,134217737,...) -> 0 Ok modid=0 port=9/ge8
命令调用驱动接口
int bcm_l2_addr_register( int unit, bcm_l2_addr_callback_t callback, void *userdata)
打入mac=00:00:00:00:00:03 的广播报文,可以看到,提示mac地址添加消息。
BCM.0> l2 watch stop
l2 watch stop
API: bcm_l2_addr_unregister(0,...) -> 0 Ok
BCM.0> debug bcm api -
debug bcm api -
BCM.0> l2 show
l2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xd modid=0 port=13/ge12 Hit
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=2 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:03 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:01 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:04 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
BCM.0>
命令调用驱动接口
int bcm_l2_addr_unregister( int unit, bcm_l2_addr_callback_t callback,
void *userdata)
打入mac=00:00:00:00:00:04 的广播报文,可以看到,没有打印mac地址添加消息,查看L2 地址表,04 mac地址已学习到。
BCM.0> debug bcm api
debug bcm api
BCM.0> l2 add port=ge8 MACaddress=0x000000000005 vlanid=1 STatic=true
l2 add port=ge8 MACaddress=0x000000000005 vlanid=1 STatic=true
API: bcm_stk_modmap_map(0,2,0,...) -> 0 Ok
API: bcm_l2_addr_add(0,...) -> 0 Ok
API: bcm_stk_my_modid_get(0,...) -> 0 Ok
ADD: mac=00:00:00:00:00:05 vlan=1 GPORT=0x9API: bcm_port_local_get(0,134217737,...) -> 0 Ok modid=0 port=9/ge8 Static ReplacePriority
BCM.0> debug bcm api -
debug bcm api -
BCM.0> l2 show
l2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xd modid=0 port=13/ge12 Hit
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=2 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:03 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:01 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:05 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Static ReplacePriority
mac=00:00:00:00:00:04 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
BCM.0>
在命令添加L2 地址时,调用驱动接口
int bcm_l2_addr_add( int unit, bcm_l2_addr_t *l2addr)
添加单播地址mac = 0x000000000005,查看L2 地址表,添加成功。
BCM.0> debug bcm api
debug bcm api
BCM.0> l2 del macaddress=0x000000000005 vlanid=1
l2 del macaddress=0x000000000005 vlanid=1
API: bcm_l2_addr_get(0,...) -> 0 Ok
API: bcm_l2_addr_delete(0,...) -> 0 Ok
BCM.0> debug bcm api -
debug bcm api -
BCM.0> l2 show
l2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xd modid=0 port=13/ge12 Hit
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=2 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:03 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:01 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:04 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
BCM.0>
在命令删除mac 为0x000000000005 vlanid=1 的表项时,调用驱动接口
int bcm_l2_addr_delete( int unit, bcm_mac_t mac, bcm_vlan_t vid)
查看L2 表,成功删除。
BCM.0> mcast add mac=0x01005e000009 vlanid=1 pbm=ge8-ge11
mcast add mac=0x01005e000009 vlanid=1 pbm=ge8-ge11
BCM.0> L2 show
L2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xd modid=0 port=13/ge12 Hit
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=2 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=01:00:5e:00:00:09 vlan=1 GPORT=0x0 modid=0 port=0/cpu0 Static CPU MCast=1
mac=00:00:00:00:00:03 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:01 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:04 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
BCM.0> d L2mc 1 1
d L2mc 1 1
L2MC.ipipe0[1]: <VALID=1,PORT_BITMAP_W1=0,PORT_BITMAP_W0=0x1e00,PORT_BITMAP=0x0000000000001e00,HIGIG_TRUNK_OVERRIDE_PROFILE_PTR=0,EVEN_PARITY=0>
BCM.0> pbmp 0x0000000000001e00
pbmp 0x0000000000001e00
0x0000000000000000000000000000000000000000000000000000000000001e00 ==> ge8-ge11
命令在调用驱动接口
int bcm_mcast_addr_add( int unit, bcm_mcast_addr_t *mcaddr)
添加组播mac=0x01005e000009 vlanid=1 pbm=ge8-ge11 的表项后,查看L2 entry表,MCast=1,即L2mc 表的index为1,dump L2mc,端口位图为0x1e00,对应ge8-ge11.
BCM.0> debug bcm api
debug bcm api
BCM.0> mcast delete mac=0x01005e000009 vlanid=1
mcast delete mac=0x01005e000009 vlanid=1
API: bcm_mcast_addr_remove(0,...) -> 0 Ok
BCM.0> debug bcm api -
debug bcm api -
BCM.0> d chg L2mc
d chg L2mc
BCM.0> L2 show
L2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xd modid=0 port=13/ge12 Hit
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=2 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:03 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:01 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:04 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
BCM.0>
命令调用驱动接口
int bcm_mcast_addr_remove( int unit, bcm_mac_t mac, bcm_vlan_t vid)
删除mac=0x01005e000009 vlanid=1 的组播地址之后,查看L2mc 及L2 entry
都没有此表项。
BCM.0> l2 show
l2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xd modid=0 port=13/ge12 Hit
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:03 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:01 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:05 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Static
mac=00:00:00:00:00:04 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
BCM.0> debug bcm api
debug bcm api
BCM.0> L2 clear port=ge8 Static=false
L2 clear port=ge8 Static=false
L2: Deleting non-static addresses by port, local module ID
API: bcm_l2_addr_delete_by_port(0,-1,9,...) -> 0 Ok
BCM.0> debug bcm api -
debug bcm api -
BCM.0> L2 show
L2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xd modid=0 port=13/ge12 Hit
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:05 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Static
BCM.0>
命令调用驱动接口
int
bcm_l2_addr_delete_by_port( int unit, bcm_module_t mod,
bcm_port_t port, uint32 flags)
基于端口删除所有动态地址之后,查看L2 entry表,静态地址保留,动态地址删除。
mac=d4:be:d9:e3:95:8d 为pc 的地址。
BCM.0> debug bcm api
debug bcm api
BCM.0> age
age
API: bcm_l2_age_timer_get(0,...) -> 0 Ok
Current age timer is 0.
BCM.0>
命令调用驱动接口
int bcm_l2_age_timer_get(int unit, int *age_seconds)
获取地址表老化时间,Setting to 0 disables hardware aging。
BCM.0> age 60
age 60
API: bcm_l2_age_timer_set(0,60) -> 0 Ok
Set age timer to 60.
BCM.0> age
age
API: bcm_l2_age_timer_get(0,...) -> 0 Ok
Current age timer is 60.
BCM.0>
BCM.0> debug bcm api -
debug bcm api -
BCM.0> L2 show
L2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xd modid=0 port=13/ge12 Hit
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:03 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:01 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:02 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:05 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Static
mac=00:00:00:00:00:04 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
BCM.0> date
date
1970/01/01 02:39:50 UTC
BCM.0> L2 show
L2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xd modid=0 port=13/ge12 Hit
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8 Hit
mac=00:00:00:00:00:03 vlan=1 GPORT=0x9 modid=0 port=9/ge8
mac=00:00:00:00:00:01 vlan=1 GPORT=0x9 modid=0 port=9/ge8
mac=00:00:00:00:00:02 vlan=1 GPORT=0x9 modid=0 port=9/ge8
mac=00:00:00:00:00:05 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Static
mac=00:00:00:00:00:04 vlan=1 GPORT=0x9 modid=0 port=9/ge8
BCM.0> L2 show
L2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xd modid=0 port=13/ge12
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8
mac=00:00:00:00:00:05 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Static
BCM.0> date
date
1970/01/01 02:41:10 UTC
BCM.0>
BCM.0> L2 show
L2 show
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0x9 modid=0 port=9/ge8
mac=00:00:00:00:00:05 vlan=1 GPORT=0x9 modid=0 port=9/ge8 Static
BCM.0>
命令调用驱动接口
int bcm_l2_age_timer_set( int unit, int age_seconds)
设置硬件老化时候为60s 之后,在第一个60s 到来时,如果地址没有再次命中,将hit 置0,第二个60s 到来时,将hit为0的表项删除。
BCM.0> vlan create 2 pbm=ge8-ge13 ubm=ge8-ge10
vlan create 2 pbm=ge8-ge13 ubm=ge8-ge10
API: bcm_vlan_create(0,2) -> 0 Ok
API: bcm_vlan_port_add(0,2,...) -> 0 Ok
BCM.0> db bcm api -
db bcm api -
BCM.0> vlan show 2
vlan show 2
vlan 2 ports ge8-ge13 (0x0000000000000000000000000000000000000000000000000000000000007e00), untagged ge8-ge10 (0x0000000000000000000000000000000000000000000000000000000000000e00) MCAST_FLOOD_UNKNOWN
BCM.0>
命令调用驱动接口
int bcm_vlan_create( int unit, bcm_vlan_t vid)
创建vlan 2 ,添加端口ge8--ge10以untag方式,ge11--ge13以tag方式加入vlan.
BCM.0> db bcm api
db bcm api
BCM.0> vlan destroy 2
vlan destroy 2
API: bcm_vlan_destroy(0,2) -> 0 Ok
BCM.0> db bcm api -
db bcm api -
BCM.0> vlan show
vlan show
vlan 1 ports cpu,ge,xe,hg (0x00000000000000000000000000000000000000000000000000ffffffffffffff), untagged ge,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffffe) MCAST_FLOOD_UNKNOWN
BCM.0>
命令调用驱动接口
int bcm_vlan_destroy( int unit, bcm_vlan_t vid)
删除vlan 2 之后,查看vlan entry,只有vlan 1 的表项。
BCM.0> vlan create 2
vlan create 2
API: bcm_vlan_create(0,2) -> 0 Ok
API: bcm_vlan_port_add(0,2,...) -> 0 Ok
BCM.0> vlan add 2 pbm=ge8-ge10 ubm=ge8-ge10
vlan add 2 pbm=ge8-ge10 ubm=ge8-ge10
API: bcm_vlan_port_add(0,2,...) -> 0 Ok
BCM.0> vlan show 2
vlan show 2
API: bcm_vlan_list(0,...) -> 0 Ok
API: bcm_vlan_mcast_flood_get(0,2,...) -> 0 Ok
vlan 2 ports ge8-ge10 (0x0000000000000000000000000000000000000000000000000000000000000e00), untagged ge8-ge10 (0x0000000000000000000000000000000000000000000000000000000000000e00) MCAST_FLOOD_UNKNOWN
API: bcm_vlan_list_destroy(0,...) -> 0 Ok
BCM.0>
命令调用驱动接口
int
bcm_vlan_port_add( int unit, bcm_vlan_t vid, bcm_pbmp_t pbmp,
bcm_pbmp_t ubmp)
添加untag bmp ge8-ge10到vlan 2中。
BCM.0> vlan add 2 pbm=ge11-ge13
vlan add 2 pbm=ge11-ge13
API: bcm_vlan_port_add(0,2,...) -> 0 Ok
BCM.0> vlan show 2
vlan show 2
API: bcm_vlan_list(0,...) -> 0 Ok
API: bcm_vlan_mcast_flood_get(0,2,...) -> 0 Ok
vlan 2 ports ge8-ge13 (0x0000000000000000000000000000000000000000000000000000000000007e00), untagged ge8-ge10 (0x0000000000000000000000000000000000000000000000000000000000000e00) MCAST_FLOOD_UNKNOWN
API: bcm_vlan_list_destroy(0,...) -> 0 Ok
BCM.0>
命令调用驱动接口
int
bcm_vlan_port_add( int unit, bcm_vlan_t vid, bcm_pbmp_t pbmp,
bcm_pbmp_t ubmp)
添加tag bmp ge11-ge13到vlan 2中。
BCM.0> vlan remove 2 pbm=ge11-ge13
vlan remove 2 pbm=ge11-ge13
API: bcm_vlan_port_remove(0,2,...) -> 0 Ok
BCM.0> vlan show 2
vlan show 2
API: bcm_vlan_list(0,...) -> 0 Ok
API: bcm_vlan_mcast_flood_get(0,2,...) -> 0 Ok
vlan 2 ports ge8-ge10 (0x0000000000000000000000000000000000000000000000000000000000000e00), untagged ge8-ge10 (0x0000000000000000000000000000000000000000000000000000000000000e00) MCAST_FLOOD_UNKNOWN
API: bcm_vlan_list_destroy(0,...) -> 0 Ok
BCM.0>
命令调用驱动接口
int
bcm_vlan_port_remove( int unit, bcm_vlan_t vid, bcm_pbmp_t pbmp)
从vlan 2 的pbm中删除ge11-ge13。
BCM.0> vlan default
vlan default
API: bcm_vlan_default_get(0,...) -> 0 Ok
Default VLAN ID is 1
BCM.0>
命令调用
int
bcm_port_untagged_vlan_get( int unit, bcm_port_t port, bcm_vlan_t *vid_ptr)
获取端口的default vlanid.
BCM.0> vlan default 2
vlan default 2
API: bcm_vlan_default_set(0,2) -> 0 Ok
Default VLAN ID set to 2
BCM.0> vlan default
vlan default
API: bcm_vlan_default_get(0,...) -> 0 Ok
Default VLAN ID is 2
BCM.0>
命令调用驱动接口
int
bcm_port_untagged_vlan_set(int unit, bcm_port_t port, bcm_vlan_t vid)
设置端口的default vlan id。
端口状态中,有ge9, ge10, ge11 三个端口为up, 创建vlan 2 ,将ge9, ge10以tagged加入valn中,构造20个带vlan tag为2的广播报文,从ge9打入,查看端口报文统计,只有ge10 出。
BCM.0> vlan create 2 pbm=ge9,ge10
vlan create 2 pbm=ge9,ge10
BCM.0> vlan show
vlan show
vlan 1 ports cpu,ge,xe,hg (0x00000000000000000000000000000000000000000000000000ffffffffffffff), untagged ge,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffffe) MCAST_FLOOD_UNKNOWN
vlan 2 ports ge9-ge10 (0x0000000000000000000000000000000000000000000000000000000000000c00), untagged none (0x0000000000000000000000000000000000000000000000000000000000000000) MCAST_FLOOD_UNKNOWN
BCM.0> clear c
clear c
BCM.0> show c
show c
所有端口以untag 方式加入vlan 1 ,从ge11口打入目的未知单播的二层报文,查看端口统计计数,报文在vlan 1内广播。
BCM.0> vlan show 1
vlan show 1
vlan 1 ports cpu,ge,xe,hg (0x00000000000000000000000000000000000000000000000000ffffffffffffff), untagged ge,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffffe) MCAST_FLOOD_UNKNOWN
BCM.0>
端口ge9, ge10, ge11 都以untag 加入vlan 1中,从ge9打入20个目的mac为00:50:c5:00:00:d7的untag报文,查看端口报文统计,只有ge10 收到。
BCM.0> l2 show
l2 show
mac=00:50:c5:00:00:d7 vlan=1 GPORT=0xb modid=0 port=11/ge10 Hit
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0xa modid=0 port=10/ge9 Hit
mac=3c:8c:40:0f:8d:1f vlan=1 GPORT=0xc modid=0 port=12/ge11 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0xc modid=0 port=12/ge11 Hit
mac=00:00:00:00:00:01 vlan=2 GPORT=0xa modid=0 port=10/ge9 Hit
BCM.0> vlan destroy 2
vlan destroy 2
BCM.0> vlan show
vlan show
vlan 1 ports cpu,ge,xe,hg (0x00000000000000000000000000000000000000000000000000ffffffffffffff), untagged ge,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffffe) MCAST_FLOOD_UNKNOWN
BCM.0> clear c
BCM.0> db bcm api
db bcm api
BCM.0> switchcontrol IgmpPktToCpu
switchcontrol IgmpPktToCpu
API: bcm_switch_control_get(0,92,...) -> 0 Ok
0x0
BCM.0>
命令调用驱动接口
int
bcm_switch_control_port_get( int unit, bcm_port_t port,
bcm_switch_control_t type, int *arg)
获取IGMP报文送cpu是否使能。
BCM.0> switchcontrol IgmpPktToCpu=1
switchcontrol IgmpPktToCpu=1
API: bcm_switch_control_set(0,92,1) -> 0 Ok
BCM.0> switchcontrol IgmpPktToCpu
switchcontrol IgmpPktToCpu
API: bcm_switch_control_get(0,92,...) -> 0 Ok
0x1
BCM.0>
命令调用驱动接口
int
bcm_switch_control_port_set( int unit, bcm_port_t port,
bcm_switch_control_t type, int arg)
设置IGMP报文送CPU使能。
BCM.0> db bcm api
db bcm api
BCM.0> vlan MulticastFlood 1
vlan MulticastFlood 1
API: bcm_vlan_mcast_flood_get(0,1,...) -> 0 Ok
vlan 1 Multicast Flood Mode is MCAST_FLOOD_UNKNOWN
BCM.0>
或者是如下命令
BCM.0> vlan 1
vlan 1
Current settings:
VRF=0
OuterTPID=0x8100
LearnDisable=0
UnknownIp6McastToCpu=0
UnknownIp4McastToCpu=0
Ip4Disable=0
Ip6Disable=0
Ip4McastDisable=0
Ip6McastDisable=0
Ip4McastL2Disable=0
Ip6McastL2Disable=0
L3VrfGlobalDisable=0
MplsDisable=0
CosqEnable=0
MiMTermDisable=0
Cosq=0
Ip6McastFloodMode=MCAST_FLOOD_UNKNOWN
Ip4McastFloodMode=MCAST_FLOOD_UNKNOWN
L2McastFloodMode=MCAST_FLOOD_UNKNOWN
IfClass=0
BCM.0>
命令调用驱动接口
int
bcm_vlan_mcast_flood_set( int unit, bcm_vlan_t vlan,
bcm_vlan_mcast_flood_t mode)
获取vlan 1 的multicast flood mode。
BCM.0> vlan MulticastFlood 1 2
vlan MulticastFlood 1 2
API: bcm_vlan_mcast_flood_set(0,1,2) -> 0 Ok
BCM.0> vlan MulticastFlood 1
vlan MulticastFlood 1
API: bcm_vlan_mcast_flood_get(0,1,...) -> 0 Ok
vlan 1 Multicast Flood Mode is MCAST_FLOOD_NONE
BCM.0>
/*
* Defines:
* _SHR_PORT_MCAST_FLOOD_*
* Purpose:
* Multicast packet flooding mode
*/
typedef enum _shr_port_mcast_flood_e {
_SHR_PORT_MCAST_FLOOD_ALL = 0,
_SHR_PORT_MCAST_FLOOD_UNKNOWN = 1,
_SHR_PORT_MCAST_FLOOD_NONE = 2,
_SHR_PORT_MCAST_FLOOD_COUNT /* last, please */
} _shr_port_mcast_flood_t;
命令调用驱动接口
int
bcm_vlan_mcast_flood_set( int unit, bcm_vlan_t vlan,
bcm_vlan_mcast_flood_t mode)
设置vlan 1 的pfm为2,即未知组播丢弃。
1. Vlan 1 的组播报文pfm设置为FLOOD UNKNOWN, 打入目的mac为01005e000010的组播mac,在vlan内所有端口转发。
BCM.0> vlan show 1
vlan show 1
vlan 1 ports cpu,ge,xe,hg (0x00000000000000000000000000000000000000000000000000ffffffffffffff), untagged ge,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffffe) MCAST_FLOOD_UNKNOWN
BCM.0> d chg l2mc
d chg l2mc
2. 配置未知组播丢弃之后,配置ge11为组播源,ge15加入组播组,从ge11打入13个目的mac为01:00:00:00:00:10 的报文,只有ge15收到组播报文。
BCM.0> vlan MulticastFlood 1 2
BCM.0> vlan multicastflood 1
vlan 1 Multicast Flood Mode is MCAST_FLOOD_NONE
BCM.0> mcast add mac=01:00:00:00:00:10 vlan=1 pbm=ge11 ubm=ge11
BCM.0> mcast join mac=01:00:00:00:00:10 vlan=1 pbm=ge15
port ge15 updated
BCM.0> l2 show
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0xc modid=0 port=12/ge11 Hit
mac=01:00:00:00:00:10 vlan=1 GPORT=0x0 modid=0 port=0/cpu0 Static CPU MCast=1
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> d chg l2mc 1 1
L2MC.ipipe0[1]: <VALID=1,PORT_BITMAP_W0=0x11000,PORT_BITMAP=0x0000000000011000,>
BCM.0> pbmp 0x0000000000011000
0x0000000000000000000000000000000000000000000000000000000000011000 ==> ge11,ge15
3. 端口ge15 离开组播组,从ge11发送组播流量,未知组播都被丢弃。
BCM.0> mcast leave mac=01:00:00:00:00:10 vlan=1 pbm=ge15
mcast leave mac=01:00:00:00:00:10 vlan=1 pbm=ge15
port ge15 updated
BCM.0> l2 show
l2 show
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0xc modid=0 port=12/ge11 Hit
mac=01:00:00:00:00:10 vlan=1 GPORT=0x0 modid=0 port=0/cpu0 Static Hit CPU MCast=1
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> d chg l2mc 1 1
d chg l2mc 1 1
L2MC.ipipe0[1]: <VALID=1,PORT_BITMAP_W0=0x1000,PORT_BITMAP=0x0000000000001000,>
BCM.0> pbmp 0x0000000000001000
pbmp 0x0000000000001000
0x0000000000000000000000000000000000000000000000000000000000001000 ==> ge11
BCM.0> clear c
BCM.0> vlan multicastflood 1
vlan multicastflood 1
vlan 1 Multicast Flood Mode is MCAST_FLOOD_NONE
BCM.0>
BCM.0> trunk init
trunk init
API: bcm_trunk_init(0) -> 0 Ok
BCM.0> trunk add id=1 rtag=1 pbmp=ge8-ge10
trunk add id=1 rtag=1 pbmp=ge8-ge10
API: bcm_stk_my_modid_get(0,...) -> 0 Ok
API: bcm_trunk_chip_info_get(0,...) -> 0 Ok
API: bcm_stk_modmap_map(0,2,0,...) -> 0 Ok
API: bcm_stk_modmap_map(0,2,0,...) -> 0 Ok
API: bcm_stk_modmap_map(0,2,0,...) -> 0 Ok
API: bcm_trunk_create(0,16,...) -> 0 Ok
API: bcm_trunk_set(0,1,...) -> 0 Ok
BCM.0> db bcm api -
db bcm api -
BCM.0> trunk show id=1
trunk show id=1
Device supports 1032 trunk groups:
1024 front panel trunks (0..1023), 256 ports/trunk
8 fabric trunks (1024..1031), 16 ports/trunk
trunk 1: (front panel, 3 ports)=ge8,ge9,ge10 dlf=any mc=any ipmc=any psc=srcmac (0x1)
命令调用驱动接口
int bcm_trunk_create( int unit, uint32 flags, bcm_trunk_t *tid)
创建trunk ID 1 ,并添加端口。
BCM.0> db bcm api
db bcm api
BCM.0> trunk remove id=1 pbmp=ge8-ge10
trunk remove id=1 pbmp=ge8-ge10
API: bcm_stk_my_modid_get(0,...) -> 0 Ok
API: bcm_trunk_get(0,1,...) -> 0 Ok
API: bcm_stk_my_modid_get(0,...) -> 0 Ok
API: bcm_trunk_destroy(0,1) -> 0 Ok
BCM.0> trunk show id=1
trunk show id=1
API: bcm_trunk_chip_info_get(0,...) -> 0 Ok
Device supports 1032 trunk groups:
1024 front panel trunks (0..1023), 256 ports/trunk
8 fabric trunks (1024..1031), 16 ports/trunk
API: bcm_trunk_get(0,1,...) -> -7 Entry not found
[no matching trunks defined]
BCM.0>
命令调用驱动接口
int bcm_trunk_destroy( int unit, bcm_trunk_t tid)
删除trunk ID 为1 的trunk 组。
BCM.0> trunk show id=1
trunk show id=1
API: bcm_trunk_chip_info_get(0,...) -> 0 Ok
Device supports 1032 trunk groups:
1024 front panel trunks (0..1023), 256 ports/trunk
8 fabric trunks (1024..1031), 16 ports/trunk
API: bcm_trunk_get(0,1,...) -> -7 Entry not found
[no matching trunks defined]
BCM.0>
命令调用驱动接口
int
bcm_trunk_get( int unit, bcm_trunk_t tid, bcm_trunk_info_t *t_data,
int member_max, bcm_trunk_member_t *member_array,
int *member_count)
获取trunk
组是否存在。
BCM.0> trunk show id=1
trunk show id=1
Device supports 1032 trunk groups:
1024 front panel trunks (0..1023), 256 ports/trunk
8 fabric trunks (1024..1031), 16 ports/trunk
trunk 1: (front panel, 3 ports)=ge8,ge9,ge10 dlf=any mc=any ipmc=any psc=srcmac (0x1)
BCM.0> db bcm api
db bcm api
BCM.0> trunk add id=1 rtag=1 pbmp=ge11-13
trunk add id=1 rtag=1 pbmp=ge11-13
API: bcm_stk_my_modid_get(0,...) -> 0 Ok
API: bcm_trunk_chip_info_get(0,...) -> 0 Ok
API: bcm_stk_modmap_map(0,2,0,...) -> 0 Ok
API: bcm_stk_modmap_map(0,2,0,...) -> 0 Ok
API: bcm_trunk_create(0,16,...) -> -8 Entry exists
API: bcm_trunk_set(0,1,...) -> 0 Ok
BCM.0> db bcm api -
db bcm api -
BCM.0> trunk show id=1
trunk show id=1
Device supports 1032 trunk groups:
1024 front panel trunks (0..1023), 256 ports/trunk
8 fabric trunks (1024..1031), 16 ports/trunk
trunk 1: (front panel, 2 ports)=ge11,ge12 dlf=any mc=any ipmc=any psc=srcmac (0x1)
BCM.0>
命令调用驱动接口
int
bcm_trunk_set( int unit, bcm_trunk_t tid, bcm_trunk_info_t *trunk_info,
int member_count, bcm_trunk_member_t *member_array)
添加port ge11-ge13到trunk id 1 中。
如5.4 中所示,
命令调用驱动接口
int
bcm_trunk_set( int unit, bcm_trunk_t tid, bcm_trunk_info_t *trunk_info,
int member_count, bcm_trunk_member_t *member_array)
在将新的端口ge11-ge13加入到trunk id 1 中之后,原有的ge8, ge9, ge10不存在于trunk 组中。
如下,创建Trunk 组,配置rtag 为1,基于源mac负载分担,将端口ge9, ge10加入trunk组。
BCM.0> trunk init
BCM.0> pbmp ge9,ge10
pbmp ge9,ge10
0x0000000000000000000000000000000000000000000000000000000000000c00 ==> ge9-ge10
BCM.0> trunk add id=1 rtag=1 pbmp=0x0c00
BCM.0> trunk show
Device supports 1032 trunk groups:
1024 front panel trunks (0..1023), 256 ports/trunk
8 fabric trunks (1024..1031), 16 ports/trunk
trunk 1: (front panel, 2 ports)=ge9,ge10 dlf=any mc=any ipmc=any psc=srcmac (0x1)
添加静态mac,目的端口为trunk组,构造目的mac为00:00:00:03:02:02,源mac递增的二层报文,分别打入10000个和以1000p/s速率打入ge12,查看ge9,ge10上报文统计计数,
报文个数和速率都已负载分担。
BCM.0> l2 add mac=00:00:00:03:02:02 Vlanid=1 Trunk=true TrunkGroupId=1
BCM.0> show c
show c
MC_PERQ_PKT(0).cpu0 : 1 +1
MC_PERQ_BYTE(0).cpu0 : 337 +337
RUC.ge9 : 5,000 +5,000
RDBGC0.ge9 : 5,000 +5,000
R64.ge9 : 5,000 +5,000
R511.ge9 : 1 +1
RPKT.ge9 : 5,001 +5,001
RUCA.ge9 : 5,000 +5,000
RMCA.ge9 : 1 +1
RPRM.ge9 : 5,000 +5,000
RPOK.ge9 : 5,001 +5,001
RBYT.ge9 : 320,333 +320,333
T64.ge9 : 5,000 +5,000
T127.ge9 : 2 +2
TPOK.ge9 : 5,002 +5,002
TPKT.ge9 : 5,002 +5,002
TUCA.ge9 : 5,000 +5,000
TBCA.ge9 : 2 +2
TBYT.ge9 : 320,172 +320,172
MC_PERQ_PKT(0).ge9 : 2 +2
MC_PERQ_BYTE(0).ge9 : 172 +172
UC_PERQ_PKT(0).ge9 : 5,000 +5,000
UC_PERQ_BYTE(0).ge9 : 320,000 +320,000
RUC.ge10 : 5,000 +5,000
RDBGC0.ge10 : 5,000 +5,000
R64.ge10 : 5,000 +5,000
R127.ge10 : 2 +2
RPKT.ge10 : 5,002 +5,002
RUCA.ge10 : 5,000 +5,000
RBCA.ge10 : 2 +2
RPRM.ge10 : 5,000 +5,000
RPOK.ge10 : 5,002 +5,002
RBYT.ge10 : 320,172 +320,172
T64.ge10 : 5,000 +5,000
TPOK.ge10 : 5,000 +5,000
TPKT.ge10 : 5,000 +5,000
TUCA.ge10 : 5,000 +5,000
TBYT.ge10 : 320,000 +320,000
UC_PERQ_PKT(0).ge10 : 5,000 +5,000
UC_PERQ_BYTE(0).ge10 : 320,000 +320,000
RUC.ge12 : 10,000 +10,000
R64.ge12 : 10,000 +10,000
R127.ge12 : 2 +2
RPKT.ge12 : 10,002 +10,002
RUCA.ge12 : 10,000 +10,000
RBCA.ge12 : 2 +2
RPRM.ge12 : 10,000 +10,000
RPOK.ge12 : 10,002 +10,002
RBYT.ge12 : 640,172 +640,172
T127.ge12 : 2 +2
TPOK.ge12 : 2 +2
TPKT.ge12 : 2 +2
TBCA.ge12 : 2 +2
TBYT.ge12 : 172 +172
MC_PERQ_PKT(0).ge12 : 2 +2
MC_PERQ_BYTE(0).ge12 : 172 +172
T127.ge48 : 4 +4
TPOK.ge48 : 4 +4
TPKT.ge48 : 4 +4
TBCA.ge48 : 4 +4
TBYT.ge48 : 344 +344
MC_PERQ_PKT(0).ge48 : 4 +4
MC_PERQ_BYTE(0).ge48 : 344 +344
BCM.0> clear c
clear c
BCM.0> show c
show c
RUC.ge9 : 1,716 +1,716 501/s
RDBGC0.ge9 : 1,716 +1,716 501/s
R64.ge9 : 1,716 +1,716 501/s
RPKT.ge9 : 1,716 +1,716 501/s
RUCA.ge9 : 1,716 +1,716 501/s
RPRM.ge9 : 1,716 +1,716 501/s
RPOK.ge9 : 1,716 +1,716 501/s
RBYT.ge9 : 109,824 +109,824 32,072/s
T64.ge9 : 1,716 +1,716 501/s
T255.ge9 : 1 +1 1/s
TPOK.ge9 : 1,717 +1,717 502/s
TPKT.ge9 : 1,717 +1,717 502/s
TUCA.ge9 : 1,716 +1,716 501/s
TMCA.ge9 : 1 +1 1/s
TBYT.ge9 : 109,985 +109,985 32,220/s
MC_PERQ_PKT(0).ge9 : 1 +1 1/s
MC_PERQ_BYTE(0).ge9 : 161 +161 148/s
UC_PERQ_PKT(0).ge9 : 1,732 +1,732 495/s
UC_PERQ_BYTE(0).ge9 : 110,848 +110,848 31,661/s
RUC.ge10 : 1,716 +1,716 501/s
RDBGC0.ge10 : 1,716 +1,716 501/s
RDBGC1.ge10 : 1 +1 1/s
R64.ge10 : 1,716 +1,716 501/s
R255.ge10 : 1 +1 1/s
RPKT.ge10 : 1,717 +1,717 502/s
RUCA.ge10 : 1,716 +1,716 501/s
RMCA.ge10 : 1 +1 1/s
RPRM.ge10 : 1,716 +1,716 501/s
RPOK.ge10 : 1,717 +1,717 502/s
RBYT.ge10 : 109,985 +109,985 32,220/s
T64.ge10 : 1,715 +1,715 501/s
TPOK.ge10 : 1,715 +1,715 501/s
TPKT.ge10 : 1,715 +1,715 501/s
TUCA.ge10 : 1,715 +1,715 501/s
TBYT.ge10 : 109,760 +109,760 32,072/s
UC_PERQ_PKT(0).ge10 : 1,731 +1,731 494/s
UC_PERQ_BYTE(0).ge10 : 110,784 +110,784 31,602/s
RUC.ge12 : 3,424 +3,424 1,002/s
RDBGC1.ge12 : 1 +1 1/s
R64.ge12 : 3,423 +3,423 1,002/s
R255.ge12 : 1 +1 1/s
RPKT.ge12 : 3,424 +3,424 1,003/s
RUCA.ge12 : 3,423 +3,423 1,002/s
RMCA.ge12 : 1 +1 1/s
RPRM.ge12 : 3,423 +3,423 1,002/s
RPOK.ge12 : 3,424 +3,424 1,003/s
RBYT.ge12 : 219,169 +219,169 64,291/s
T255.ge12 : 1 +1 1/s
TPOK.ge12 : 1 +1 1/s
TPKT.ge12 : 1 +1 1/s
TMCA.ge12 : 1 +1 1/s
TBYT.ge12 : 161 +161 148/s
MC_PERQ_PKT(0).ge12 : 1 +1 1/s
MC_PERQ_BYTE(0).ge12 : 161 +161 148/s
在端口ge11 上使能安全检查,LearnEnable 设置为false之后,查看port ge11,Lrn 标识为cpu。从ge11 打入构造的源mac 为非L2 Entry表中的广播二层报文,查看端口报文统计,其他端口没有收到,打入源mac为d4:be:d9:e3:95:8d 广播报文,其他端口都可以收到。
BCM.0> auth init
auth init
BCM.0> auth mac init
auth mac init
All ports set to MAC address 00:19:ad:75:01:11
BCM.0> port ge11
port ge11
PORT: Status (* indicates PHY link up)
*ge11 LS(SW) Auto(1GFD,pause) Ability (fd = 10MB,100MB,1000MB hd = intf = sgmii medium = copper pause = pause_tx,pause_rx,pause_asymm lb = none,MAC,PHY flags = autoneg )Local (fd = 10MB,100MB,1000MB hd = intf = medium = pause = pause_tx,pause_rx lb = flags = )Remote (fd = 10MB,100MB,1000MB hd = 10MB,100MB,1000MB intf = medium = pause = pause_rx lb = flags = )STP(Forward) Lrn(ARL,FWD) UtPri(0) Pfm(FloodNone) IF(SGMII) PH(Auto) Max_frame(16356) MDIX(Auto, Normal) Medium(Copper) VLANFILTER(2)
BCM.0> l2 show
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0xc modid=0 port=12/ge11 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> db bcm api
db bcm api
BCM.0> BCM.0> auth enable pbm=ge11 LE=false IL=false
auth enable pbm=ge11 LE=false IL=false
API: bcm_port_config_get(0,...) -> 0 Ok
API: bcm_auth_mode_set(0,12,4) -> 0 Ok
port ge11 authorization enabled.
BCM.0> port ge11
PORT: Status (* indicates PHY link up)
*ge11 LS(SW) Auto(1GFD,pause) Ability (fd = 10MB,100MB,1000MB hd = intf = sgmii medium = copper pause = pause_tx,pause_rx,pause_asymm lb = none,MAC,PHY flags = autoneg )Local (fd = 10MB,100MB,1000MB hd = intf = medium = pause = pause_tx,pause_rx lb = flags = )Remote (fd = 10MB,100MB,1000MB hd = 10MB,100MB,1000MB intf = medium = pause = pause_rx lb = flags = )STP(Forward) Lrn(CPU) UtPri(0) Pfm(FloodNone) IF(SGMII) PH(Auto) Max_frame(16356) MDIX(Auto, Normal) Medium(Copper) VLANFILTER(2)
BCM.0> clear c
命令调用驱动接口
int bcm_auth_mode_set( int unit, int port, uint32 mode)
BCM.0> debug bcm api
debug bcm api
BCM.0> auth unblock pbm=ge11
auth unblock pbm=ge11
API: bcm_port_config_get(0,...) -> 0 Ok
API: bcm_auth_mode_set(0,12,1) -> 0 Ok
port ge11 unblock - all traffic allowed now.
从ge11 口打入源mac在与不在L2 Entry表中二层广播的报文,其他端口都能收到。
BCM.0> l3 init
l3 init
API: bcm_l3_init(0) -> 0 Ok
BCM.0> l3 intf add mac=00:19:ad:75:01:11 vlan=1 intf=1
l3 intf add mac=00:19:ad:75:01:11 vlan=1 intf=1
API: bcm_l3_intf_create(0,...) -> 0 Ok
BCM.0>
BCM.0> l3 intf show intf=1
l3 intf show intf=1
Free L3INTF entries: 8190
Unit Intf VRF Group VLAN Source Mac MTU TTL Tunnel InnerVlan NATRealm
------------------------------------------------------------------
0 1 0 0 1 00:19:ad:75:01:11 16383 0 0 0 0
命令调用驱动接口
int bcm_l3_intf_create( int unit, bcm_l3_intf_t *intf)
创建Intf 1,交换机mac 为00:19:ad:75:01:11, vlan 1。
查看my_station_tcam 表,已成功创建。
BCM.0> d chg my_station_tcam
d chg my_station_tcam
MY_STATION_TCAM.ipipe0[511]: <VLAN_ID_MASK=0xfff,VLAN_ID=1,VALID=1,MASK=0x00000fffffffffffffff,MAC_ADDR_MASK=0xffffffffffff,MAC_ADDR=0x0019ad750111,KEY=0x000000010019ad750111,IPV6_TERMINATION_ALLOWED=1,IPV4_TERMINATION_ALLOWED=1,DATA=0x38,ARP_RARP_TERMINATION_ALLOWED=1>
BCM.0> debug bcm api
debug bcm api
BCM.0> l3 l3table add ip=192.168.6.10 intf=1 mac=00:19:ad:75:01:12 port=ge8
l3 l3table add ip=192.168.6.10 intf=1 mac=00:19:ad:75:01:12 port=ge8
API: bcm_l3_host_add(0,...) -> 0 Ok
BCM.0> l3 l3table show
l3 l3table show
Unit 0, free L3 table entries: 24575
Entry VRF IP address Mac Address INTF MOD PORT CLASS HIT
1 0 192.168.6.10 00:19:ad:75:01:12 1 0 9 0 n
命令调用驱动接口
int bcm_l3_host_add( int unit, bcm_l3_host_t *info)
创建主机路由表项192.168.6.10 对应mac 00:19:ad:75:01:12,端口为9.
BCM.0> debug bcm api
debug bcm api
BCM.0> l3 l3table destroy vrf=0 ip=192.168.6.10
l3 l3table destroy vrf=0 ip=192.168.6.10
API: bcm_l3_host_delete(0,...) -> 0 Ok
BCM.0>
BCM.0> l3 l3table show
l3 l3table show
Unit 0, free L3 table entries: 24576
Entry VRF IP address Mac Address INTF MOD PORT CLASS HIT
BCM.0>
命令调用驱动接口
int bcm_l3_host_delete( int unit, bcm_l3_host_t *ip_addr)
删除主机路由ip = 192.168.6.10.
BCM.0> l3 defip add vrf=0 ip=192.168.5.0 MaSk=255.255.255.0 Mac=0x000000030201 INtf=2 port=ge12
API: bcm_l3_route_add(0,...) -> 0 Ok
BCM.0>
BCM.0> l3 defip show
l3 defip show
Unit 0, Total Number of DEFIP entries: 8192
# VRF Net addr Next Hop Mac INTF MODID PORT PRIO CLASS HIT VLAN
2048 0 192.168.5.0/24 00:00:00:03:02:01 2 0 13 0 0 n
BCM.0>
命令调用驱动接口
int bcm_l3_route_add( int unit, bcm_l3_route_t *info)
添加网段路由192.168.5.0/24 ,dmac 0x000000030201, egress intf 2, 出端口ge12.
BCM.0> debug bcm api
BCM.0> l3 defip destroy vrf=0 ip=192.168.5.0 mask=255.255.255.0
API: bcm_l3_route_delete(0,...) -> 0 Ok
BCM.0> debug bcm api -
debug bcm api -
BCM.0> l3 defip show
l3 defip show
Unit 0, Total Number of DEFIP entries: 8192
# VRF Net addr Next Hop Mac INTF MODID PORT PRIO CLASS HIT VLAN
BCM.0>
命令调用驱动接口
int bcm_l3_route_delete( int unit, bcm_l3_route_t *info)
删除dip 为192.168.5.0/24 的网段路由。
8.6.1 添加intf 2,交换机mac 02:01
BCM.0> L3 intf add mac=00:00:00:00:02:01 vlan=2 intf=2
BCM.0> L3 intf show intf=2
Free L3INTF entries: 8190
Unit Intf VRF Group VLAN Source Mac MTU TTL Tunnel InnerVlan NATRealm
------------------------------------------------------------------
0 2 0 0 2 00:00:00:00:02:01 16383 0 0 0 0
查看my_station_tcam,成功添加。
BCM.0> d chg my_station_tcam
d chg my_station_tcam
MY_STATION_TCAM.ipipe0[511]: <VLAN_ID_MASK=0xfff,VLAN_ID=2,VALID=1,MASK=0x00000fffffffffffffff,MAC_ADDR_MASK=0xffffffffffff,MAC_ADDR=0x000000000201,KEY=0x00000002000000000201,IPV6_TERMINATION_ALLOWED=1,IPV4_TERMINATION_ALLOWED=1,DATA=0x38,ARP_RARP_TERMINATION_ALLOWED=1>
8.6.2 添加主机路由
BCM.0> L3 l3table add ip=192.168.2.1 intf=2 mac=00:00:00:00:02:02 port=ge8
BCM.0> L3 l3table show
l3 l3table show
Unit 0, free L3 table entries: 24575
Entry VRF IP address Mac Address INTF MOD PORT CLASS HIT
1 0 192.168.2.1 00:00:00:00:02:02 2 0 9 0 n
8.6.3 查看L3_ENTRY表,获取Next_hop_index.
BCM.0> d chg L3_ENTRY_1
L3_ENTRY_1.ism0[5972]: <WIDE_ENTRY_BITS=0x0000000000100006054010080003,VALID=1,NEXT_HOP_INDEX=2,KEY=0x01815004020000,IP_ADDR=0xc0a80201,IPV4UC:NEXT_HOP_INDEX=2,IPV4UC:KEY=0x01815004020000,IPV4UC:IP_ADDR=0xc0a80201,IPV4UC:HASH_LSB=0x201,IPV4UC:DATA=0x0000020000,HASH_LSB=0x201,EVEN_PARITY=1,DATA=0x0000020000,>
8.6.4 根据NH index索引INITIAL_ING_L3_NEXT_HOP,获取MODULE_ID和出端口
BCM.0> d chg INITIAL_ING_L3_NEXT_HOP 2 1
INITIAL_ING_L3_NEXT_HOP.ipipe0[2]: <TGID=9,PORT_NUM=9,>
8.6.5 根据NH index索引ING_L3_NEXT_HOP
BCM.0> d chg ING_L3_NEXT_HOP 2 1
ING_L3_NEXT_HOP.ipipe0[2]: <VLAN_ID=2,TGID=9,PORT_NUM=9,L3_OIF=2,DVP_RES_INFO=2,DVP_ATTRIBUTE_1_INDEX=2,>
8.6.6 根据NH index索引EGR_L3_NEXT_HOP
BCM.0> d chg EGR_L3_NEXT_HOP 2 1
EGR_L3_NEXT_HOP.epipe0[2]: <SD_TAG_VID=2,OVID=2,MAC_ADDRESS=0x000000000202,L3MC:INTF_NUM=2,L3MC:EH_TAG_TYPE=2,L3MC:EH_QUEUE_TAG=0x40,L3:OVID=2,L3:MAC_ADDRESS=0x000000000202,L3:IVID=0x202,L3:INTF_NUM=2,IVID=0x202,INTF_NUM=2,DVP=0x202,>
获取到下一跳的目的mac地址。
8.6.7 根据EGR_L3_NEXT_HOP 中的INTF_NUM索引到EGR_L3_INTF
BCM.0> d chg EGR_L3_INTF 2 1
EGR_L3_INTF.epipe0[2]: <VID=2,OVID=2,MAC_ADDRESS=0x000000000201,>
获取到交换机的mac地址,作为源mac,以及egress vid。
8.6.8 添加网段路由
BCM.0> L3 defip add ip=192.168.3.0 mask=255.255.255.0 mac=00:00:02:00:00:03 intf=2 port=ge8
BCM.0> d chg L3_defip
L3_DEFIP.ipipe0[2048]: <VRF_ID_MASK0=0x7ff,VALID0=1,NEXT_HOP_INDEX0=2,MODE_MASK0=3,MASK0=0x1ffffffffc03,KEY0=0x000302a00c00,IP_ADDR_MASK0=0xffffff00,IP_ADDR0=0xc0a80300,EVEN_PARITY=1,ECMP_PTR0=2,>
通过命令添加网段路由的处理过程和添加主机路由的是相同的,不同的是路由表下发到硬件的defip中。
默认情况下,所有端口都以untag方式加入vlan 1,将ge11从vlan 1 中删除,以untag方式加入到vlan 2,并设置port ge11 的port_vid 为2,使从ge11打入不带tag的报文时,打上vlan tag 2.
BCM.0> vlan show 1
vlan show 1
vlan 1 ports cpu,ge,xe,hg (0x00000000000000000000000000000000000000000000000000ffffffffffffff), untagged ge,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffffe) MCAST_FL OOD_UNKNOWN
BCM.0> vlan remove 1 pbm=ge11
vlan remove 1 pbm=ge11
BCM.0> vlan create 2 pbm=ge11 ubm=ge11
vlan create 2 pbm=ge11 ubm=ge11
BCM.0> vlan show 2
vlan show 2
vlan 2 ports ge11 (0x0000000000000000000000000000000000000000000000000000000000001000), untagge d ge11 (0x0000000000000000000000000000000000000000000000000000000000001000) MCAST_FLOOD_UNKNOWN
BCM.0> vlan show 1
vlan show 1
vlan 1 ports cpu,ge0-ge10,ge12-ge48,xe,hg (0x00000000000000000000000000000000000000000000000000 ffffffffffefff), untagged ge0-ge10,ge12-ge48,xe,hg (0x000000000000000000000000000000000000000000 00000000ffffffffffeffe) MCAST_FLOOD_UNKNOWN
BCM.0> age 60
age 60
Set age timer to 60.
BCM.0> L2 show
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0xc modid=0 port=12/ge11 Hit
mac=3c:8c:40:0f:8d:1f vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> L2 clear port=ge11
L2: Deleting static and non-static addresses by port, local module ID
BCM.0> L2 show
mac=3c:8c:40:0f:8d:1f vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> d chg port 12 1
PORT.ipipe0[12]: <VT_PORT_TYPE_SELECT_2=1,VT_PORT_TYPE_SELECT=1,VT_KEY_TYPE_2=5,VT_KEY_TYPE=4,VL AN_PROTOCOL_DATA_INDEX=0xc,VFP_ENABLE=1,V6L3_ENABLE=1,V6IPMC_ENABLE=1,V4L3_ENABLE=1,V4IPMC_ENABL E=1,TRUST_INCOMING_VID=1,TRUST_DSCP_PTR=0xc,SUBNET_BASED_VID_ENABLE=1,PRI_MAPPING=0xfac688,PORT_ VID=1,OVID=1,OUTER_TPID_ENABLE=1,OAM_ENABLE=1,MIM_TERM_ENABLE=1,MIM_MC_TERM_ENABLE=1,MAC_BASED_V ID_ENABLE=1,IPRI_MAPPING=0xfac688,IPMC_DO_VLAN=1,ICFI_1_MAPPING=1,FP_PORT_FIELD_SEL_INDEX=0xc,FI LTER_ENABLE=1,CML_FLAGS_NEW=8,CML_FLAGS_MOVE=8,CFI_1_MAPPING=1,>
BCM.0> mod port 12 1 PORT_VID=2
BCM.0> L2 show
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0xc modid=0 port=12/ge11
mac=d4:be:d9:e3:95:8d vlan=2 GPORT=0xc modid=0 port=12/ge11 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> L2 clear port=ge11
L2: Deleting static and non-static addresses by port, local module ID
BCM.0> L2 show
mac=d4:be:d9:e3:95:8d vlan=2 GPORT=0xc modid=0 port=12/ge11 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
mac=00:00:00:00:00:33 vlan=2 GPORT=0xc modid=0 port=12/ge11 Hit
分别添加L3 intf 1,2 配置交换机mac为00:00:00:03:02:01.
BCM.0> L3 init
BCM.0> L3 intf add vlan=2 mac=00:00:00:03:02:01 intf=2 vrf=0 mtu=1500
BCM.0> L3 intf add vlan=1 mac=00:00:00:03:02:01 intf=1 vrf=0 mtu=1500
BCM.0> L3 intf show
Free L3INTF entries: 8189
Unit Intf VRF Group VLAN Source Mac MTU TTL Tunnel InnerVlan NATRealm
------------------------------------------------------------------
0 1 0 0 1 00:00:00:03:02:01 1500 0 0 0 0
0 2 0 0 2 00:00:00:03:02:01 1500 0 0 0 0
添加主机路由1.1.1.1 和2.1.1.1 分别和intf 1, 2 对应,出端口分别为ge15,ge11.
从ge11口打入构造的目的mac为交换机mac 000000030201,源mac为d4:be:d9:e3:95:8d,
目的ip 为1.1.1.1,源ip为2.1.1.1的ipv4报文,查看端口报文统计,可以看到ge15端口有报文计数,查看L3table,Hit位都置位了。
BCM.0> L2 show
mac=00:00:00:03:02:01 vlan=1 GPORT=0x0 modid=0 port=0/cpu0 Static CPU
mac=00:00:00:03:02:01 vlan=2 GPORT=0x0 modid=0 port=0/cpu0 Static CPU
mac=d4:be:d9:e3:95:8d vlan=2 GPORT=0xc modid=0 port=12/ge11 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> L3 l3table add vrf=0 ip=2.1.1.1 mac=d4:be:d9:e3:95:8d intf=2 port=ge11
BCM.0> L3 l3table add vrf=0 ip=1.1.1.1 mac=3c:8c:40:0f:8d:40 intf=1 port=ge15
BCM.0> L3 l3table show
Unit 0, free L3 table entries: 24574
Entry VRF IP address Mac Address INTF MOD PORT CLASS HIT
1 0 1.1.1.1 3c:8c:40:0f:8d:40 1 0 16 0 n
2 0 2.1.1.1 d4:be:d9:e3:95:8d 2 0 12 0 n
BCM.0> d chg my_station_tcam
d chg my_station_tcam
MY_STATION_TCAM.ipipe0[510]: <VLAN_ID_MASK=0xfff,VLAN_ID=1,VALID=1,MASK=0x00000fffffffffffffff,M AC_ADDR_MASK=0xffffffffffff,MAC_ADDR=0x000000030201,KEY=0x00000001000000030201,IPV6_TERMINATION_ ALLOWED=1,IPV4_TERMINATION_ALLOWED=1,DATA=0x38,ARP_RARP_TERMINATION_ALLOWED=1>
MY_STATION_TCAM.ipipe0[511]: <VLAN_ID_MASK=0xfff,VLAN_ID=2,VALID=1,MASK=0x00000fffffffffffffff,M AC_ADDR_MASK=0xffffffffffff,MAC_ADDR=0x000000030201,KEY=0x00000002000000030201,IPV6_TERMINATION_ ALLOWED=1,IPV4_TERMINATION_ALLOWED=1,DATA=0x38,ARP_RARP_TERMINATION_ALLOWED=1>
BCM.0> clear c
BCM.0> show c
RIPC4.ge11 : 3 +3
RUC.ge11 : 3 +3
RDBGC0.ge11 : 4 +4
R64.ge11 : 7 +7
RPKT.ge11 : 7 +7
RUCA.ge11 : 3 +3
RBCA.ge11 : 4 +4
RPRM.ge11 : 3 +3
RPOK.ge11 : 7 +7
RBYT.ge11 : 448 +448
TDBGC4.ge15 : 3 +3
T64.ge15 : 3 +3
TPOK.ge15 : 3 +3
TPKT.ge15 : 3 +3
TUCA.ge15 : 3 +3
TBYT.ge15 : 192 +192
UC_PERQ_PKT(0).ge15 : 3 +3
UC_PERQ_BYTE(0).ge15 : 192 +192
BCM.0> L2 show
mac=00:00:00:03:02:01 vlan=1 GPORT=0x0 modid=0 port=0/cpu0 Static CPU
mac=00:00:00:03:02:01 vlan=2 GPORT=0x0 modid=0 port=0/cpu0 Static Hit CPU
mac=d4:be:d9:e3:95:8d vlan=2 GPORT=0xc modid=0 port=12/ge11 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> L3 l3table show
Unit 0, free L3 table entries: 24574
Entry VRF IP address Mac Address INTF MOD PORT CLASS HIT
1 0 1.1.1.1 3c:8c:40:0f:8d:40 1 0 16 0 y
2 0 2.1.1.1 d4:be:d9:e3:95:8d 2 0 12 0 y
将ge11以不带vlan tag的方式加入到vlan 2 中,并设置ge11的port_vid为2。
BCM.0> vlan remove 1 pbm=ge11
vlan remove 1 pbm=ge11
BCM.0> vlan create 2 pbm=ge11 ubm=ge11
vlan create 2 pbm=ge11 ubm=ge11
BCM.0> vlan show
vlan show
vlan 1 ports cpu,ge0-ge10,ge12-ge48,xe,hg (0x00000000000000000000000000000000000000000000000000ffffffffffefff), untagged ge0-ge10,ge12-ge48,xe,hg (0x00000000000000000000000000000000000000000000000000ffffffffffeffe) MCAST_FLOOD_UNKNOWN
vlan 2 ports ge11 (0x0000000000000000000000000000000000000000000000000000000000001000), untagged ge11 (0x0000000000000000000000000000000000000000000000000000000000001000) MCAST_FLOOD_UNKNOWN
^[[A BCM.0> l2 show
mac=d4:be:d9:e3:95:8d vlan=1 GPORT=0xc modid=0 port=12/ge11 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> L2 clear port=ge11
L2: Deleting static and non-static addresses by port, local module ID
BCM.0> l2 show
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> d chg port 12 1
PORT.ipipe0[12]: <VT_PORT_TYPE_SELECT_2=1,VT_PORT_TYPE_SELECT=1,VT_KEY_TYPE_2=5,VT_KEY_TYPE=4,VLAN_PROTOCOL_DATA_INDEX=0xc,VFP_ENABLE=1,V6L3_ENABLE=1,V6IPMC_ENABLE=1,V4L3_ENABLE=1,V4IPMC_ENABLE=1,TRUST_INCOMING_VID=1,TRUST_DSCP_PTR=0xc,SUBNET_BASED_VID_ENABLE=1,PRI_MAPPING=0xfac688,PORT_VID=1,OVID=1,OUTER_TPID_ENABLE=1,OAM_ENABLE=1,MIM_TERM_ENABLE=1,MIM_MC_TERM_ENABLE=1,MAC_BASED_VID_ENABLE=1,IPRI_MAPPING=0xfac688,IPMC_DO_VLAN=1,ICFI_1_MAPPING=1,FP_PORT_FIELD_SEL_INDEX=0xc,FILTER_ENABLE=1,CML_FLAGS_NEW=8,CML_FLAGS_MOVE=8,CFI_1_MAPPING=1,>
BCM.0> mod port 12 1 port_vid=2
mod port 12 1 port_vid=2
BCM.0> l2 clear port=ge11
l2 clear port=ge11
L2: Deleting static and non-static addresses by port, local module ID
BCM.0> l2 show
l2 show
mac=d4:be:d9:e3:95:8d vlan=2 GPORT=0xc modid=0 port=12/ge11 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
创建L3 intf 1和2,配置交换机mac为00:00:00:03:02:01,分别对应vlan 1,2
BCM.0> L3 init
BCM.0> L3 intf add vlan=2 mac=00:00:00:03:02:01 intf=2 vrf=0 mtu=1500
L3 intf add vlan=2 mac=00:00:00:03:02:01 intf=2 vrf=0 mtu=1500
BCM.0> L3 intf add vlan=1 mac=00:00:00:03:02:01 intf=1 vrf=0 mtu=1500
L3 intf add vlan=1 mac=00:00:00:03:02:01 intf=1 vrf=0 mtu=1500
BCM.0> L3 intf show
Free L3INTF entries: 8189
Unit Intf VRF Group VLAN Source Mac MTU TTL Tunnel InnerVlan NATRealm
------------------------------------------------------------------
0 1 0 0 1 00:00:00:03:02:01 1500 0 0 0 0
0 2 0 0 2 00:00:00:03:02:01 1500 0 0 0 0
创建主机路由2.1.1.1,对应intf 2, port ge11;
创建网段路由1.1.1.0/24 ,对应inf 1 , port ge15;
构造目的mac为00:00:00:03:02:01,源mac为d4:be:d9:e3:95:8d 的不带vlan tag的ipv4报文,
源ip为2.1.1.1,目的ip为1.1.1.1,从ge11口打入,查看报文统计计数,ge15口有计数,查看L3 defip,Hit位已置位。
BCM.0> l2 show
l2 show
mac=d4:be:d9:e3:95:8d vlan=2 GPORT=0xc modid=0 port=12/ge11 Hit
mac=3c:8c:40:0f:8d:40 vlan=1 GPORT=0x10 modid=0 port=16/ge15 Hit
BCM.0> L3 l3table add vrf=0 ip=2.1.1.1 mac=d4:be:d9:e3:95:8d intf=2 port=ge11
L3 l3table add vrf=0 ip=2.1.1.1 mac=d4:be:d9:e3:95:8d intf=2 port=ge11
BCM.0> L3 defip add vrf=0 ip=1.1.1.0 mask=255.255.255.0 mac=3c:8c:40:0f:8d:40 intf=1 port=ge15
BCM.0> L3 L3table show
Unit 0, free L3 table entries: 24575
Entry VRF IP address Mac Address INTF MOD PORT CLASS HIT
1 0 2.1.1.1 d4:be:d9:e3:95:8d 2 0 12 0 n
BCM.0> L3 defip show
Unit 0, Total Number of DEFIP entries: 8192
# VRF Net addr Next Hop Mac INTF MODID PORT PRIO CLASS HIT VLAN
2048 0 1.1.1.0/24 3c:8c:40:0f:8d:40 1 0 16 0 0 n
BCM.0> clear c
clear c
BCM.0> show c
show c
RIPC4.ge11 : 5 +5
RUC.ge11 : 5 +5
R64.ge11 : 5 +5
RPKT.ge11 : 5 +5
RUCA.ge11 : 5 +5
RPRM.ge11 : 5 +5
RPOK.ge11 : 5 +5
RBYT.ge11 : 320 +320
TDBGC4.ge15 : 5 +5
T64.ge15 : 5 +5
TPOK.ge15 : 5 +5
TPKT.ge15 : 5 +5
TUCA.ge15 : 5 +5
TBYT.ge15 : 320 +320
UC_PERQ_PKT(0).ge15 : 5 +5
UC_PERQ_BYTE(0).ge15 : 320 +320
BCM.0> L3 defip show
Unit 0, Total Number of DEFIP entries: 8192
# VRF Net addr Next Hop Mac INTF MODID PORT PRIO CLASS HIT VLAN
2048 0 1.1.1.0/24 3c:8c:40:0f:8d:40 1 0 16 0 0 y
BCM.0> L3 L3table show
Unit 0, free L3 table entries: 24575
Entry VRF IP address Mac Address INTF MOD PORT CLASS HIT
1 0 2.1.1.1 d4:be:d9:e3:95:8d 2 0 12 0 y
BCM.0>
BCM.0> vlan create 2
BCM.0> vlan add 2 pbm=ge10 ubm=ge10
BCM.0> mod port 11 1 port_vid=2
BCM.0> l3 intf add int=2 vlan=2 mac=00:00:00:00:00:f2
BCM.0> l3 egress add intf=2 mac=d4:be:d9:e3:95:8d port=ge10
BCM.0> l3 defip add ip=2.2.2.0 mask=255.255.255.0 intf=$egr_object_id
优先级映射实现从QoS优先级到内部优先级或从内部优先级到QoS优先级的映射,并利用DiffServ域来管理和记录QoS优先级和服务等级之间的映射关系。
对于进入设备的报文,将报文携带的优先级或者端口优先级映射为内部优先级,然后根据内部优先级与队列之间的映射关系确定报文进入的队列,从而针对队列进行流量整形、拥塞避免、队列调度等处理,并可以根据配置修改报文发送出去时所携带的优先级,以便其他设备根据报文的优先级提供相应的QoS服务。
对报文进行优先级标记,可以打在二层报文上,也可以在三层(ip)报文头上。
1. 二层802.1P 优先级映射
如下,查看port ge8的COS配置,PRIO 0 映射到COS QUEUE 0, PRIO 3 映射到COS QUEUE 1 , PRIO 5映射到COS QUEUE 2.
BCM.0> cos port show pbm=ge8
Port ge8 COS configuration:
------------------------------
Config (max queues): 4
Schedule mode: weighted round-robin
Weighting (in packets):
COSQ 0 = 1 packets
COSQ 1 = 1 packets
COSQ 2 = 1 packets
COSQ 3 = 1 packets
Priority to queue mappings:
PRIO 0 ==> COSQ 0
PRIO 1 ==> COSQ 0
PRIO 2 ==> COSQ 1
PRIO 3 ==> COSQ 1
PRIO 4 ==> COSQ 2
PRIO 5 ==> COSQ 2
PRIO 6 ==> COSQ 3
PRIO 7 ==> COSQ 3
PRIO 8 ==> COSQ 3
PRIO 9 ==> COSQ 3
PRIO 10 ==> COSQ 3
PRIO 11 ==> COSQ 3
PRIO 12 ==> COSQ 3
PRIO 13 ==> COSQ 3
PRIO 14 ==> COSQ 3
PRIO 15 ==> COSQ 3
配置队列调度模式为为Deficit Round Robin,四个队列权重分别为1,3,5,7.
BCM.0> cos drr W0=1 W1=3 W2=5 W3=7
BCM.0> cos show
COS configuration:
Config (max queues): 4
Schedule mode: deficit round-robin
Weighting (in Kbytes):
COSQ 0 = 1 Kbytes
COSQ 1 = 3 Kbytes
COSQ 2 = 5 Kbytes
COSQ 3 = 7 Kbytes
Priority to queue mappings:
PRIO 0 ==> COSQ 0
PRIO 1 ==> COSQ 0
PRIO 2 ==> COSQ 1
PRIO 3 ==> COSQ 1
PRIO 4 ==> COSQ 2
PRIO 5 ==> COSQ 2
PRIO 6 ==> COSQ 3
PRIO 7 ==> COSQ 3
PRIO 8 ==> COSQ 3
PRIO 9 ==> COSQ 3
PRIO 10 ==> COSQ 3
PRIO 11 ==> COSQ 3
PRIO 12 ==> COSQ 3
PRIO 13 ==> COSQ 3
PRIO 14 ==> COSQ 3
PRIO 15 ==> COSQ 3
配置从ge8 端口入的报文的Prio 0 CFI 0 映射到内部IntPrio 3,设置Queue 1 的带宽范围,ge8以带vlan tag方式加入到vlan 1,打入不带vlan tag上送CPU的ARP报文,rxAPI打印出来的报文IntPrio为3,COS QUEUE 为1.
BCM.0> memwatch ING_PRI_CNG_MAP write
BCM.0> color map port=2 pktPrio=0 cfi=0 intprio=1 color=green
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 16, Entry - <PRI=1,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 17, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 18, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 19, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 20, Entry - <PRI=0,EVEN_PARITY=0,CNG=1>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 21, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 22, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 23, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 24, Entry - <PRI=1,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 25, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 26, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 27, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 28, Entry - <PRI=1,EVEN_PARITY=0,CNG=1>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 29, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 30, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 31, Entry - <PRI=0,EVEN_PARITY=0,CNG=0>
其中,ING_PRI_CNG_MAP的index值由Port 中的TRUST_DOT1P_PTR *16 索引。
BCM.0> d chg port 2 1
PORT.ipipe0[2]: <VT_PORT_TYPE_SELECT_2=1,VT_PORT_TYPE_SELECT=1,VT_KEY_TYPE_2=5,VT_KEY_TYPE=4,VLAN_PROTOCOL_DATA_INDEX=2,VFP_ENABLE=1,V6L3_ENABLE=1,V6IPMC_ENABLE=1,V4L3_ENABLE=1,V4IPMC_ENABLE=1,TRUST_INCOMING_VID=1,TRUST_DSCP_PTR=2,TRUST_DOT1P_PTR=1,SUBNET_BASED_VID_ENABLE=1,PROTOCOL_PKT_INDEX=2,PRI_MAPPING=0xfac688,PORT_VID=1,OVID=1,OUTER_TPID_ENABLE=1,OAM_ENABLE=1,MIM_TERM_ENABLE=1,MIM_MC_TERM_ENABLE=1,MAC_BASED_VID_ENABLE=1,IPRI_MAPPING=0xfac688,IPMC_DO_VLAN=1,ICFI_1_MAPPING=1,FP_PORT_FIELD_SEL_INDEX=2,FILTER_ENABLE=1,CML_FLAGS_NEW=8,CML_FLAGS_MOVE=8,CFI_1_MAPPING=1,>
BCM.0> memwatch ING_PRI_CNG_MAP read
BCM.0> color map port=ge8 PktPrio=-1
Color map settings for port ge8
Packet Prio=0, CFI=0, Internal Prio=3, Color=Green
Packet Prio=0, CFI=1, Internal Prio=0, Color=Red
Packet Prio=1, CFI=0, Internal Prio=1, Color=Green
Packet Prio=1, CFI=1, Internal Prio=1, Color=Red
Packet Prio=2, CFI=0, Internal Prio=2, Color=Green
Packet Prio=2, CFI=1, Internal Prio=2, Color=Red
Packet Prio=3, CFI=0, Internal Prio=5, Color=Green
Packet Prio=3, CFI=1, Internal Prio=3, Color=Red
Packet Prio=4, CFI=0, Internal Prio=4, Color=Green
Packet Prio=4, CFI=1, Internal Prio=4, Color=Red
Packet Prio=5, CFI=0, Internal Prio=5, Color=Green
Packet Prio=5, CFI=1, Internal Prio=5, Color=Red
Packet Prio=6, CFI=0, Internal Prio=6, Color=Green
Packet Prio=6, CFI=1, Internal Prio=6, Color=Red
Packet Prio=7, CFI=0, Internal Prio=7, Color=Green
Packet Prio=7, CFI=1, Internal Prio=7, Color=Red
BCM.0> d ING_PRI_CNG_MAP 16 1
Unit = 0, mem = ING_PRI_CNG_MAP (3202), copyno = 4 index = 16, Entry - <PRI=1,EVEN_PARITY=0,CNG=0>
ING_PRI_CNG_MAP.ipipe0[16]: <PRI=1,EVEN_PARITY=0,CNG=0>
BCM.0>
BCM.0> memwatch ING_PRI_CNG_MAP off
BCM.0>
BCM.0> vlan add 1 pbm=ge8
BCM.0> vlan show
vlan 1 ports ge,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffffe), untagged ge0-ge7,ge9-ge 48,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffdfe) MCAST_FLOOD_UNKNOWN
BCM.0>
BCM.0> cos bandwidth pbm=ge8 Queue=1 KbpsMIn=20 KbpsMAx=1000
BCM.0> cos bandwidth_show
cos bandwidth_show
COSQ bandwith configuration:
-----+---+----------+----------+-------
ge8 | 0 | 0 | 0 | 0
ge8 | 1 | 24 | 1000 | 0
ge8 | 2 | 0 | 0 | 0
ge8 | 3 | 0 | 0 | 0
-----+---+----------+----------+-------
BCM.0> pw start
BCM.0> pw report +raw
[bcmPW.0]
[bcmPW.0]Packet[11]: data[0000]: {ffffffffffff} {d4bed9e3958d} 0806 0001
[bcmPW.0]Packet[11]: data[0010]: 0800 0604 0001 d4be d9e3 958d c0a8 154d
[bcmPW.0]Packet[11]: data[0020]: 0000 0000 0000 c0a8 154d 0000 0000 0000
[bcmPW.0]Packet[11]: data[0030]: 0000 0000 0000 0000 0000 0000 8d22 f91b
[bcmPW.0]Packet[11]: data[0040]: 0000 0000
[bcmPW.0]Packet[11]: length 68 (68). rx-port 9. cos 1. prio_int 3. vlan 1. reason 0x2000. Untagged.
[bcmPW.0]Packet[11]: dest-port 1. dest-mod 0. src-port 9. src-mod 0. opcode 2. matched 0. classification-tag 0.
[bcmPW.0]Packet[11]: reasons: Protocol
BCM.0> pw quiet
配置报文优先级0映射为Int Prio 5,对应的队列为2。
BCM.0> color unmap Port=ge8 IntPrio=3 Color=green PktPrio=0 CFI=0
BCM.0> color map port=ge8 IntPrio=5 Color=green PktPrio=0 CFI=0
color map port=ge8 IntPrio=5 Color=green PktPrio=0 CFI=0
BCM.0> pw report +raw
[bcmPW.0]Packet[12]: data[0000]: {ffffffffffff} {d4bed9e3958d} 0806 0001
[bcmPW.0]Packet[12]: data[0010]: 0800 0604 0001 d4be d9e3 958d c0a8 154d
[bcmPW.0]Packet[12]: data[0020]: 0000 0000 0000 c0a8 15d3 0000 0000 0000
[bcmPW.0]Packet[12]: data[0030]: 0000 0000 0000 0000 0000 0000 41d7 d706
[bcmPW.0]Packet[12]: data[0040]: 0000 0000
[bcmPW.0]Packet[12]: length 68 (68). rx-port 9. cos 2. prio_int 5. vlan 1. reason 0x2000. Untagged.
[bcmPW.0]Packet[12]: dest-port 1. dest-mod 0. src-port 9. src-mod 0. opcode 2. matched 0. classification-tag 0.
[bcmPW.0]Packet[12]: reasons: Protocol
通过FP 规则,匹配报文,修改IntPrio。
BCM.0> fp init
BCM.0> fp qset add IpProtocol
BCM_FIELD_QSET_ADD(IpProtocol) okay
BCM.0> fp group create 0 0
BCM.0> fp entry create 0 1
BCM.0> fp qual 1 IpProtocol 0x1 0xf
BCM.0> fp action add 1 PrioIntNew 4
BCM.0> fp entry install 1
BCM.0> pw report +raw
BCM.0> [bcmPW.0]
[bcmPW.0]Packet[252]: data[0000]: {0019ad197521} {000000000002} 0800 4500
[bcmPW.0]Packet[252]: data[0010]: 0014 0001 0000 4001 ce77 c0a8 154d c0a8
[bcmPW.0]Packet[252]: data[0020]: 15d3 0000 0000 0000 0000 0000 0000 0000
[bcmPW.0]Packet[252]: data[0030]: 0000 0000 0000 0000 676f a7d2 4574 6865
[bcmPW.0]Packet[252]: length 64 (64). rx-port 1. cos 2. prio_int 4. vlan 1. reason 0x80000000. Outer tagged.
[bcmPW.0]Packet[252]: dest-port 0. dest-mod 0. src-port 1. src-mod 0. opcode 1. matched 0. classification-tag 0.
[bcmPW.0]Packet[252]: reasons: Nhop
三层DSCP 报文优先级映射
配置源DSCP为0的三层报文映射为5,IntPrio 为3。
BCM.0> dscp ge8 mode=2 0 5 3 0
BCM.0> dscp ge8
0:ge8 dscp map:
0->5 prio=3 cng=0
1->0 prio=0 cng=0
2->0 prio=0 cng=0
3->0 prio=0 cng=0
4->0 prio=0 cng=0
5->0 prio=0 cng=0
6->0 prio=0 cng=0
7->0 prio=0 cng=0
8->0 prio=0 cng=0
9->0 prio=0 cng=0
10->0 prio=0 cng=0
11->0 prio=0 cng=0
12->0 prio=0 cng=0
13->0 prio=0 cng=0
14->0 prio=0 cng=0
15->0 prio=0 cng=0
16->0 prio=0 cng=0
17->0 prio=0 cng=0
18->0 prio=0 cng=0
19->0 prio=0 cng=0
20->0 prio=0 cng=0
21->0 prio=0 cng=0
22->0 prio=0 cng=0
23->0 prio=0 cng=0
24->0 prio=0 cng=0
25->0 prio=0 cng=0
26->0 prio=0 cng=0
27->0 prio=0 cng=0
28->0 prio=0 cng=0
29->0 prio=0 cng=0
30->0 prio=0 cng=0
31->0 prio=0 cng=0
32->0 prio=0 cng=0
33->0 prio=0 cng=0
34->0 prio=0 cng=0
35->0 prio=0 cng=0
36->0 prio=0 cng=0
37->0 prio=0 cng=0
38->0 prio=0 cng=0
39->0 prio=0 cng=0
40->0 prio=0 cng=0
41->0 prio=0 cng=0
42->0 prio=0 cng=0
43->0 prio=0 cng=0
44->0 prio=0 cng=0
45->0 prio=0 cng=0
46->0 prio=0 cng=0
47->0 prio=0 cng=0
48->0 prio=0 cng=0
49->0 prio=0 cng=0
50->0 prio=0 cng=0
51->0 prio=0 cng=0
52->0 prio=0 cng=0
53->0 prio=0 cng=0
54->0 prio=0 cng=0
55->0 prio=0 cng=0
56->0 prio=0 cng=0
57->0 prio=0 cng=0
58->0 prio=0 cng=0
59->0 prio=0 cng=0
60->0 prio=0 cng=0
61->0 prio=0 cng=0
62->0 prio=0 cng=0
63->0 prio=0 cng=0
BCM.0> pw report +raw
BCM.0> [bcmPW.0]
[bcmPW.0]Packet[25]: data[0000]: {0019ad197521} {000000000033} 0800 4500
[bcmPW.0]Packet[25]: data[0010]: 0014 0001 0000 4001 ce77 c0a8 154d c0a8
[bcmPW.0]Packet[25]: data[0020]: 15d3 0000 0000 0000 0000 0000 0000 0000
[bcmPW.0]Packet[25]: data[0030]: 0000 0000 0000 0000 0000 0000 76a3 5424
[bcmPW.0]Packet[25]: data[0040]: 6173 6520
[bcmPW.0]Packet[25]: length 68 (68). rx-port 9. cos 1. prio_int 3. vlan 1. reason 0x80000000. Untagged.
[bcmPW.0]Packet[25]: dest-port 0. dest-mod 0. src-port 9. src-mod 0. opcode 1. matched 0. classification-tag 0.
[bcmPW.0]Packet[25]: reasons: Nhop
[bcmPW.0]
以大于200p/s发送二层广播报文时出现发送流控问题,此时cpu口在vlan 1内,将cpu口从vlan中移除,不会发送流控,对于需要上送cpu的报文可以通过添加L2 Entry表项或设置寄存器或ACL规则上送,此外需要配置cpu上送报文限速。
BCM.0> vlan show 1
vlan show 1
vlan 1 ports cpu,ge,xe,hg (0x00000000000000000000000000000000000000000000000000ffffffffffffff), untagged ge,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffffe) MCAST_FLOOD_UNKNOWN
BCM.0> vlan remove 1 pbm=cpu0
vlan remove 1 pbm=cpu0
BCM.0> vlan show 1
vlan show 1
vlan 1 ports ge,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffffe), untagged ge,xe,hg (0x00000000000000000000000000000000000000000000000000fffffffffffffe) MCAST_FLOOD_UNKNOWN
BCM.0>
BCM.0> rate pbm=cpu0 bc=true limit=400
通过添加L2 Entry,目的mac为cpu mac的ICMP报文实现上送
BCM.0>L2 add mac=02:10:18:db:88:47 vlan=1 pbm=cpu0 Static=true ReplacePriority=false Replace=false L3=true
2. 寄存器配置ARP报文上送
BCM.0> sc ArpReplyToCpu=1
BCM.0> sc ArpRequestToCpu=1
3. 通过FP规则配置EtherType 为0x0806的ARP报文上送cpu
配置如下:
BCM.0> fp init
BCM.0> fp qset add EtherType
BCM_FIELD_QSET_ADD(EtherType) okay
BCM.0> fp group create 0 0
BCM.0> fp entry create 0 1
BCM.0> fp qual 1 EtherType 0x0806 0xfff
BCM.0> fp action add 1 CopyToCPU 0 0
BCM.0> fp entry install 1
BCM.0> fp show
fp show
FP: unit 0:PIPELINE STAGE INGRESS
FP: :tcam_sz=4096(0x1000), tcam_slices=16, tcam_ext_numb=-1,
PIPELINE STAGE EGRESS
FP: :tcam_sz=1024(0x400), tcam_slices=4, tcam_ext_numb=-1,
PIPELINE STAGE LOOKUP
FP: :tcam_sz=2048(0x800), tcam_slices=4, tcam_ext_numb=-1,
GID 0: gid=0x0, instance=0 mode=Single, stage=Ingress lookup=Enabled, ActionResId={-1}, pbmp={0x00000000000000000000000000000000000000000000000000ffffffffffffff}
qset={EtherType, Stage},
selcodes[0]=
{
FPF1=4
Intraslice=Primary slice.
{
Stage->EtherType},
slice_pri= 0 {slice_number=0, Entry count=256(0x100),pbmp={0x00000000000000000000000000000000000000000000000000ffffffffffffff}},
group_status={prio_min=0, prio_max=2147483647, entries_total=4096, entries_free=4095,
counters_total=4096, counters_free=4096, meters_total=4096, meters_free=4096}
EID 0x00000001: gid=0x0,
slice=0, slice_idx=0, part =0 prio=0, flags=0x10602, Installed, Enabled
tcam: color_indep=1,
Stage
EtherType
Offset0: 201 Width0: 16
DATA=0x00000806
MASK=0x00000fff
action={act=CopyToCpu, param0=0(0), param1=0(0), param2=0(0), param3=0(0)}
policer=
statistics=NULL
BCM.0>
BCM.0> pw start report +dec
BCM.0> pw report +raw
BCM.0> pw quiet
_bcm_modules_init <--_bcm_esw_init <--bcm_esw_init <--bcm_init <-- sh_init <--
cmdlist_init <-- diag_init <-- sh_rcload_file <--diag_shell
函数sh_init 中,对从rc.soc中读取到的,或通过命令下发的init soc, init bcm , init mmu, init all 进行处理,下发init bcm时,调用bcm_init 函数。
在_bcm_modules_init中,完成各个模块的初始化。
首先,初始化tx, rx ,然后注册驱动功能处理函数指针,实现根据芯片类型dispatch到对应的处理。
如下为_bcm_modules_init 中处理流程:
而由bcm_init 调用到bcm_esw_init 是通过dispatch 实现的。
Src/bcm/Control.c 中的bcm_init 调用函数指针_dispatch_init[BCM_DTYPE(unit)](unit); 分发到具体的芯片处理初始化函数。
在src/bcm/Control.c中,定义宏BCM_DLIST_ENTRY 参数为_dtype 时,声明的外部函数为
Int bcm_##_dtype##_init(int);
#define BCM_DLIST_ENTRY(_dtype)\
extern int bcm_##_dtype##_init(int);
#include <bcm_int/bcm_dlist.h>
#define BCM_DLIST_ENTRY(_dtype)\
bcm_##_dtype##_init,
static int (*_dispatch_init[])(int) = {
#include <bcm_int/bcm_dlist.h>
};
在bcm_dlist.h 中,定义
#ifdef BCM_ESW_SUPPORT
BCM_DLIST_ENTRY(esw)
#endif
这样,支持esw类型的芯片(Helix4)调用_dispatch_init 时,就分发到bcm_esw_init 函数处理。
和芯片初始化相关的函数定义在Src/bcm/Control.c中,和功能相关的函数定义在src/bcm/Dispatch.c中。
上面为一次分发调用过程,此外还有多次分发调用过程。
例如src/bcm/Dispatch.c 中的bcm_l3_init,首先分发到src/bcm/esw/L3.c 中的bcm_esw_l3_init,在其中再调用
mbcm_driver[unit]->mbcm_l3_tables_init(unit),
mbcm_l3_tables_init 是一个函数指针,在src/bcm/esw/Mbcm.c 的mbcm_init 中,通过
mbcm_driver[unit] = &mbcm_firebolt_driver;
将函数指针数组mbcm_firebolt_driver 赋值给mbcm_driver,这样,调用mbcm_l3_tables_init就会调用到函数指针数组中对应的bcm_xgs3_l3_tables_init 。
原文:https://www.cnblogs.com/wallywl/p/15310461.html