https://www.cnblogs.com/s08243/p/6221472.html
notes
来自中兴
s1
包由端口进入交换芯片之后,首先进行包头字段匹配,为流分类做准备;然后经过一个安全引擎进行包过滤;符合安全的包进行L2交换或者L3路由,并经过流分类处理器对匹配的包做相关动作(比如丢弃、限速、修改VLAN等);对于可以转发的包根据802.1P或DSCP放到不同队列的buffer中,调度器根据优先级或者WRR等算法进行队列调度,在端口发出该包之前执行流分类修改动作,最终从相应端口发送出去。
什么是IEEE 802.1p
是IEEE 802.1Q(VLAN标签技术)标准的扩展协议,两者共同运作,使第二层网上交换器能够提供流量优先级和动态多播过滤服务。
IEEE 802.1Q标准定义了以太网MAC数据帧添加的标签。VLAN标签有两部分:VLAN ID(12位)和PCP(Priority Code Point)(3比特)。IEEE 802.1Q VLAN标准中没有定义和使用PCP,而802.1P中则定义了PCP。
PCP定义了从0至7的优先值,可以为第二层服务质量(QoS)或服务类(CoS)区分流量。此外,IEEE 802.1p标准也提供了多播流量过滤功能,以确保该流量不超出第二层交换网上范围。 [1]
优先
对于交换芯片来说,L2转发是一个最基本的功能。
L2功能主要包括ingress过滤、MAC学习和老化、根据MAC+VLAN转发、广播与洪泛、生成树控制等基本功能。
2.2.3 L2 的地址表
56504的L2地址表大小为16K,5630X的L2地址表大小为8K,地址表使用MAC+VID的hash值作为索引查表。实际上56504的L2地址表hash值为4K,每个hash值对应4条地址,这样最多可以保存4条hash冲突的地址。地址表中每个表项都保存了MAC_ADDR和VLAN_ID。MAC学习的时候使用原MAC+VID的hash查表,把表中的MAC+VID与包中的MAC+VID进行比较,如果完全相等,表示找到了。然后看端口(TGID_PORT)是否相等,如果不相等表示地址发生了迁移,对于动态学习的地址需要更新port;如果相等表示命中,更新hit标志。其他几个重要的功能介绍如下:
-
设置静态地址:STATIC_BIT=1
-
设置L3转发标志:L3=1
-
设置本地址的包都转发到CPU去:CPU=1
-
设置本地址匹配的包丢弃:SRC_DISCARD=1、DST_DISCARD=1
-
设置本地址匹配的包对某些端口阻塞:MAC_BLOCK_INDEX
-
设置本地址匹配的包镜像:MIRROR=1
-
设置组播索引:L2MC_PTR
-
地址有效标志:VALID=1