1. PIP/IPD
概述:
PIP/IPD将数目包以适合上层软件的格式写入buffer。buffer的大小可以编程控制,可以将数据包分配到多buffer里,一支持更大的输入数据包。
PIP/IPD也为每个包创建分配一个工作队列入口,包括一个指向buffered packet指针,硬件分析结果,数据包查错结果。这个unit有L2-L4中检查方式,包括TCP/UDP校验和检验。它能在分析输入包之间跳过用户定义的输入。他能执行packet-instruction headers,这样能使包的走向和解码信息更易控制,还有自动可配置的数组和mask packet tag generation.
1.1 INPUT PORTS
● PIP/IPD Ports 0–15 = Packet Interface 0 Ports 0–15
● PIP/IPD Ports 16–31 = Packet Interface 1 Ports 0–15
● PIP/IPD Ports 32–35 = PCI Interface Ports 0–3
每个接口端口都是PIP/IPD硬件独立处理的。处理PCI端口和数据包接口端口大同小异(PCI端口处理没有CRC check,and packet-instruction headers are created differently)
Packet interface 可能只能用16个可用端口中的几个。比如在RGMII模式中,一个packet interface只能用最多4个端口。For example,if both packet interfaces are in RGMII mode, only PIP/IPD ports 0–3 and 16–19 areused, and PIP/IPD ports 4–15 and 20–31 do not exist.
1.2 输入数据包格式以及IP预处理
PIP/IPD支持三种不同的数据包输入分析模式
● uninterpreted
● skip-to-L2
● skip-to-IP
当一个数据包没有instruction header时,PIP/IPD只根据数据包信息和配置创建packet scheduling and packet-decode information。PKT_INST_HDR作为可选的packet instruction header允许一个外部设备直接控制packet scheduling and decoding on a packet-by-packet basisi.
在skip区(和pad区),应用程序可以附加一些信息在原有的正常包上。Skip-to L2模式分析多种ethernet-lick L2 header formats,能判断IP是否在包中。Skip-to-IP mode 让PIP/IPD直接分析包含IP的包。
对于uninterpreted packets,很多PIP/IPD 分析是不可用的。(校验和仍然要产生,也要检验数据包长度,CRC也要检查和丢弃)
除了PCI ports时PKT_INST_HDR存在的时候,SKIP I 是一定会存在的。因为当数据包从PCI ports出来时,skip I 是不能在PKT_INST_HDR之前的。The number of Skip I bytes是在数据包到达时为每个端口单独设置的。可以从0到他的最大值。
The Skip II field can only be present when a PKT_INST_HDR is present. The Skip II field can be any byte amount from 0 (where it is not present) up to its maximum.
The total SKIP is the total number of bytes in the Skip I, PKT_INST_HDR, and SkipII fields
The optional pad field is only relevant to the PIP/IPD hardware when the packet is IP.例如:如果定义最小的包是64byte,而一个只有40byte的包将被padded out 到64byte。如果一个输入数据包在IP包结尾前有pad,PIP/IPD会和处理其他数据一样处理这个pad,最终它将和其他数据一起传到核心程序。
最后的CRC/FCS是防止传输出错的保障措施。
1.3 Packet instruction header(包头)
包头包含了控制packet scheduling and decode.the full PKT_INST_HDR是8byte.其中PKT_INST_HDR[SL]记录了包头大小和SKIP II的bytes。
The packet instruction header 格式和PCI instruction header格式差不多。还和the format of the packet scheduling information in WORD1 of the resultant work-queue entry差不多。
对于包头里的可选项到底选择还是不选择,是根据不同的端口(ports0-31)独立配置的。在PIP_PRT_CFG(0-31)[INST_HDR]里配置。
所有PCI instructions 包含一个PCI_INST_HDR, but the resultant packets that enter via the PCI interface ports (ports 32-35) only include a PKT_INST_HDR in the following cases:
● the PCI instruction selects raw scheduling or decoding
(i.e. PCI_INST_HDR[R] is set, or the packet is RAWFULL or RAWSCH), or
● all packets arriving via the PCI port are forced to include PKT_INST_HDRs (i.e.
NPI_PORT(32..35)_INSTR_HDR[USE_IHDR] is set).
当一个包有包头时,它很可能有one of two special forms:
● RAWFULL (PKT_INST_HDR[R] is set and PKT_INST_HDR[PM] is uninterpreted)
PKT_INST_HDR直接控制packet scheduling information,PIP/IPD解RAWFULL包时不产生解码信息(此时解码信息来自a configuration register (PIP_RAW_WORD))。
● RAWSCH (PKT_INST_HDR[R] is set and PKT_INST_HDR[PM] is skip-to-L2 or skip-to-IP)
PKT_INST_HDR直接控制packet scheduling information,PIP/IPD解RAWSCH包时产生解码信息
RAWFULL和RAWSCH包要有一个8byte的PKT_INST_HDR,其他的PKT_INST_HDR可能有2个或者4个字节,具体要看有没有用PKT_INST_HDR[RS]。
PKT_INST_HDR[R]
如果PKT_INST_HDR[R]i==1&&PKT_INST_HDR[RS]==0,(表明是RAWFULL包),那么,PIP/IPD用PKT_INST_HDR[QOS,GRP,TT,TAG]表示scheduling information(WORD1),
PID_RAW_WORD[WORD]为work-queue中的decode information(WORD 2)。
如果PKT_INST-HDR[R]=1&&PKT_INST_HDR[PM]!=0,(表明是个RAWSCH包),那么,PIP/IPD用PKT_INST_HDR[QOS,GRP,TT,TAG]表示scheduling information(WORD1),并为了work-queue里的解码信息(WORD2)分析数据包。
如果PKT_INST-HDR[R]=1,则PKT_INST_HDR就为8bytes
PKT_INST_HDR[PM] :分析数据包的方式
0 = uninterpreted
1 = skip-to-L2 mode
2 = skip-to-IP mode
3 = reserved
PKT_INST_HDR[SL]:PKT_INST_HDR和skip II 区的byte数
Skip II 可能没有byte,但是PKT_INST_HDR必须存在并且有最小限制,具体限制如下:
● When PKT_INST_HDR[R] = 1, the PKT_INST_HDR is eight bytes, so PKT_INST_HDR[SL] should be eight or more.
● When PKT_INST_HDR[R] = 0, the PKT_INST_HDR may be as small as two bytes, so PKT_INST_HDR[SL] should be two or more. If PKT_INST_HDR[RS] is needed, PKT_INST_HDR[SL] should be four or more bytes rather than two.