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.