没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
基于 BCM53115 实现 ACL 功能
ACL,Access Control List,访问控制列表,是路由器和交换机接口的指令列表,用来
控制端口进出的数据包。这张表中包含了匹配关系、条件和查询语句,表只是一个框架结
构,其目的是为了对某种访问进行控制。
ACL 的本质其实是一种流分类技术,它是人为定义的一些规则,目的是通过网络设备
对数据流进行分类,以便执行用户规定的动作。
一、BCM53115 ACL 介绍
BCM53115 的 ACL 由 CFP(Compact Field Processor)模块实现。
BCM53115 的 CFP 共支持 256 条规则。这些规则依次保存在物理的 TCAM
Entry(Ternary Content-Aware Memory)中,索引号 0~255。
Slice n Key 可以理解为逻辑上的规则,共有 4 个 Slice:Slice 0~3。其中 Slice 0~2 可以
匹配 IPv4、IPv6 和 Non-IP 包。Slice 3 可以和 Slice 0 联合,形成联合 Slice,用于匹配 IPv6
包(联合 Slice 可匹配的字段更多了)。
芯片收到一个包后,会查找 TCAM 表,当发现 TCAM 表中某条 Entry 可以匹配该包时,
就会执行相应的操作:限速(Rate Meters)、统计( Counters)、动作( Action)。其中
动作包括丢弃、转发到其他端口、替换 DSCP 值等。
如果有多条规则匹配,则优先级最高的起作用。Slice 编号越大优先级越高(当有联合
Slice 时,联合 Slice 优先级最高)。同一 Slice 内,索引号越小,优先级越高。
CFP 规则的 Slice Key 共 232bit,分 4 种格式,分别对应独立 Slice 下的 IPv4 包、IPv6 包、
Non-IP 包以及联合 Slice 下的 IPv6 包。具体格式描述下述。
1 / 15
二、BCM53115 CFP 相关寄存器
1 、 CFP TCAM Data Register 0~7 (Page A0h: Address 10h–2Fh) 和 CFP TCAM Mask
Register 0~7 (Page A0h: Address 30h–4Fh)
TCAM 数据和掩码寄存器。对应于上述的 Slice Key。Slice Key 中不一定每一个字
段都要匹配,不需要匹配的字段,可将掩码寄存器的相应 bit 设置为 0。
下面的 4 个表格说明了 4 种 Slice 格式与 TCAM 数据和掩码寄存器的对应关系。
Table 1: Slice Format for IPv4 Packets
Field Width
(bits)
Slice Bit
Map
TCAM Data/Mask
Register Map
TCAM
Register
Bit Map
Description
Source_Port Map 8 231: 224 TCAM Data
Register 7, Page
A0h, Address 2Ch–
2Fh.
TCAM Mask
register 7, Page
A0h, Address 4Ch–
4Fh.
Bit[7:0] The ingress port select
to which the rule
applies. To enable a
key to a port or ports,
the corresponding port
mask bit should be set
to 0, regardless of the
setting state in the key
field.
S_Tag_Status 2 223: 222 TCAM Data
Register 6, Page
A0h, address 28h–
2Bh.
TCAM Mask
Register 6, Page
A0h, Address 48h–
4Bh
Bit[31:30] 00 = the packet was
originally received
without S Tag.
01 = the packet was
originally received
with SVID = 0.
10 = reserved.
11 = the packet was
originally received
with SVID = not 0.
C_Tag_Status 2 221: 220 Bit[29:28] 00 = the packet was
originally received
without C Tag.
01 = the packet was
originally received
with CVID = 0.
10 = reserved.
11 = the packet was
originally received
with CVID = not 0.
L2_Framing 2 219: 218 Bit[27:26] 00 = DIXv2
2 / 15
01 = SNAP Public
L3_Framing 2 217: 216 Bit[25:24] 00 = IPv4
IP_TOS 8 215: 208 Bit[23:16] Type of Service field
in IPv4 header
IP_Protocol 8 207: 200 Bit[15:8] Protocol field in IPv4
header
IP_Fragmentatio
n
1 199 Bit[7] 0 = not fragmented
1 = fragmented
Non_First_Frag
ment
1 198 Bit[6] Bit[6] 0 = not
fragmented or first
fragment
1 = not first
fragmented
IP_Authenticatio
n
1 197 Bit[5] 0 = not authenticated
1 = authenticated
TTL_Range 2 196:195 Bit[4:3] 00: TTL = 0
01: TTL = 1
10: TTL = others
11: TTL = 255
Reserved 2 194:193 Bit[2:1] Default to zero
UDF_Valid[8] 1 192 Bit[0] Indicates whether
UDF_n_A8 is valid
UDF_Valid[7:0] 8 191: 184 TCAM Data
Register 5, Page
A0h, Address 24h–
27h.
TCAM Mask
Register 5, Page
A0h, Address 44h–
47h.
Bit[31:24] Indicates if
UDF_n_A[7:0] is
valid
S-Tag 16 183: 168 Bit[23:8] The SVLAN tag is
carried in the packet
explicitly or is
generated implicitly
based on the ingress
port default setting.
C-Tag 8 167: 160 Bit[7:0] The CVLAN tag is
carried in the packet
explicitly or is
generated implicitly
based on the ingress
port default setting.
C-Tag 8
(LSB)
159: 152 TCAM Data
Register 4, Page
A0h, Address 20h–
23h.
TCAM Mask
Register 4, Page
A0h, Address 40h–
43h.
Bit[31:24]
UDF_n_A8 16 151: 136 Bit[23:8] Must be validated by
UDF_Valid[8]
UDF_n_A7 8 135: 128 Bit[7:0] Must be validated by
UDF_Valid[7]
UDF_n_A7 8
(LSB)
127: 120 TCAM Data
Register 3, Page
A0h, Address 1Ch–
Bit[31:24]
UDF_n_A6 16 119: 104 Bit[23:8] Must be validated by
3 / 15
剩余14页未读,继续阅读
资源评论
- zhuohuayin2014-10-27还可以,看看!
- mt_mcu2014-09-01感谢分享,很好的总结!
- asas_20012016-02-08感谢分享, 要是有实现具体代码就好了!
- 屌丝要逆袭2019-11-12资料挺好的~~
netksks
- 粉丝: 4
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功