PCIe gen6 數(shù)據(jù)鏈路層總結(jié)
掃描二維碼
隨時(shí)隨地手機(jī)看文章

Data Link Layer 負(fù)責(zé)將TLP可靠地傳輸給鏈路的另外一個(gè)組件。
Data Link Layer 功能包含如下部分:
Data Exchange
Accept TLPs for transmission from the Transmit Transaction Layer and convey them to the Transmit Physical Layer
Accept TLPs received over the Link from the Physical Layer and convey them to the Receive Transaction Layer
Error Detection and Retry (Non-Flit Mode)
TLP Sequence Number and LCRC generation
Transmitted TLP storage for Data Link Layer Retry
Data integrity checking for TLPs and Data Link Layer Packets (DLLPs)
Positive and negative acknowledgement DLLPs
Error indications for error reporting and logging mechanisms
Link Acknowledgement Timeout replay mechanism
Initialization and power management:
跟蹤鏈路狀態(tài),并且將 active/reset/disconnected狀態(tài)傳遞給Transaction Layer
DLLPs 用于鏈路管理,包含TLP確認(rèn),功耗管理和流控交互。
DLLP是在鏈路的兩個(gè)組件之間進(jìn)行傳輸,而TLP的傳輸路徑有可能會(huì)經(jīng)過(guò)多個(gè)中間組件。
Non-Flit模式,DLLP使用16bit的CRC,TLP使用32bit的CRC進(jìn)行數(shù)據(jù)完整性檢查。收到的DLLP如果沒(méi)有通過(guò)CRC檢查,則直接丟棄。沒(méi)有通過(guò)完整性檢查(LCRC and sequence number)的TLP則會(huì)被對(duì)端重新發(fā)送。
Flit Mode模式, DLLP和TLP都會(huì)使用flit傳輸,flit使用LCRC,F(xiàn)EC和sequence number進(jìn)行數(shù)據(jù)完整性檢查。重傳操作發(fā)生在Flit層級(jí)。
Data Link Control and Management State Machine
Data Link Layer負(fù)責(zé)跟蹤鏈路狀態(tài),并且與Transaction and Physical Layers交互鏈路狀態(tài)。

數(shù)據(jù)鏈路層使用Data Link Control and Management State Machine (DLCMSM)完成鏈路狀態(tài)管理工作。
DLCMSM包含如下4個(gè)狀態(tài):
? DL_Inactive - Physical Layer reporting Link is non-operational or nothing is connected to the Port
? DL_Feature (optional) - Physical Layer reporting Link is operational, perform the Data Link Feature Exchange
? DL_Init - Physical Layer reporting Link is operational, initialize Flow Control for the default Virtual Channel
? DL_Active - Normal operation mode
DLCMSM輸出兩個(gè)狀態(tài):
??DL_Down?- The Data Link Layer is not communicating with the component on the other side of the Link.
??DL_Up?- The Data Link Layer is communicating with the component on the other side of the Link.
Data Link Control and Management State規(guī)則
DL狀態(tài)不受FLR影響
DL_Inactive
在DL_Inactive狀態(tài),DLCMSM會(huì)輸出DL_Down狀態(tài)給向事務(wù)層和鏈路層的其他模塊。
鏈路層會(huì)丟棄來(lái)自事務(wù)層和物理層的TLP
不再產(chǎn)生和接收DLLP
如果物理層表示Physical LinkUp=1,且支持Data Link Feature Exchange并且Data Link Feature Exchange is Enabled bit為1,則從DL_Inactive進(jìn)入DL_Feature
如果物理層表示Physical LinkUp=1,不支持Data Link Feature Exchange或者Data Link Feature Exchange is Enabled bit為0,則從DL_Inactive進(jìn)入DL_Init
這會(huì)導(dǎo)致事務(wù)層丟棄任意未完成的傳輸,并且去終止傳輸TLP。對(duì)Downstream Port來(lái)說(shuō),這相當(dāng)于Hot-Remove。對(duì)Upstream Port來(lái)說(shuō),鏈路進(jìn)入down狀態(tài),相當(dāng)于hot reset。
DL_Inactive是PCIe 復(fù)位(僅包含PCI Express Hot, Warm, or Cold Reset )后的初始狀態(tài),
一旦進(jìn)入DL_inactive,則復(fù)位DL層狀態(tài)為初始值
在DL_Inactive狀態(tài):
DL_Feature:
成功完成 Data Link Feature Exchange,并且物理層繼續(xù)表示Physical LinkUp = 1b,或者
Data Link Feature Exchange 過(guò)程判斷遠(yuǎn)端的數(shù)據(jù)鏈路層不支持Data Link Feature Exchange protocol,并且物理層繼續(xù)表示Physical LinkUp = 1b
通過(guò)Data Link Feature DLLP執(zhí)行Data Link Feature Exchange協(xié)議,完成Scaled Flow Control等信息交換
匯報(bào)DL_Down 狀態(tài)
DL_Down的端口,其數(shù)據(jù)鏈路層允許丟棄任意收到的TLP,因?yàn)闆](méi)有ACK DLLP用于確認(rèn)TLP的接收。
在 DL_Feature狀態(tài):
滿足如下要求進(jìn)入DL_Init狀態(tài)
一旦物理層繼續(xù)表示Physical LinkUp = 0b,則終止Data Link Feature Exchange 過(guò)程,進(jìn)入DL_Inactive
DL_Init
成功完成流控初始化,并且物理層持續(xù)支持Physical LinkUp = 1b
為VC0完成流控初始化
在 FC_INIT1階段輸出DL_Down狀態(tài),在FC_INIT2狀態(tài)輸出DL_Up狀態(tài)
DL_Down狀態(tài)的鏈路層允許丟棄任意收到的TLP
滿足如下要求進(jìn)入DL_Active 狀態(tài)
一旦物理層指示Physical LinkUp = 0b,則終止VC0的流控初始化,且進(jìn)入DL_Inactive
DL_Active?
DL_Active 是鏈路正常工作狀態(tài)
鏈路層能夠正常接收來(lái)自物理層的TLP,能夠發(fā)送來(lái)自事務(wù)層的TLP
能夠產(chǎn)生和發(fā)送DLLP
給事務(wù)層和鏈路層其他模塊輸出DL_Up狀態(tài)
一旦物理層指示Physical LinkUp = 0b,則進(jìn)入DL_Inactive
2、Data Link?Feature Exchange

? 數(shù)據(jù)鏈路特性交換協(xié)議的操作就是通過(guò)DLLP將local port支持的特性傳遞給remote port,并且捕獲remote port傳遞過(guò)來(lái)的特性信息,并且記錄更新到Data Link Feature Status Register
? 支持16.0 GT/s以及更高速率的port必須支持 Data Link Feature交換協(xié)議。實(shí)現(xiàn)此協(xié)議的Downstream Ports必須實(shí)現(xiàn)了Data Link Feature Extended Capability,而實(shí)現(xiàn)此協(xié)議的 Upstream Ports是可選擇實(shí)現(xiàn)Data Link Feature Extended Capability。

? 此能力主要包含如下4部分:
Local Data Link Feature Supported field 為1表示支持Data Link Features,為0表示不支持
此字段位于Data Link Feature Capabilities Register寄存器

Remote Data Link Feature Supported field表示對(duì)端port是否支持the Data Link Features
此字段位于Data Link Feature Status Register
Remote Scaled Flow Control Supported為1表示remote支持縮放流量控制(Scaled Flow Control )


Remote Data Link Feature Supported Valid 字段為1表示當(dāng)前port在 DL_Feature階段至少收到一個(gè) Data Link Feature DLLP,表示 Remote Data Link Feature Supported字段包含有效數(shù)據(jù)
Data Link Feature Exchange is Enabled允許系統(tǒng)關(guān)閉Data Link Feature Exchange.這個(gè)功能可以用于對(duì)接無(wú)法正確處理Data Link Feature DLLP的傳統(tǒng)舊設(shè)備。


數(shù)據(jù)鏈路特性交換協(xié)議需要遵守的規(guī)則:
一旦進(jìn)入DL_Feature,允許將Remote Data Link Feature Supported and Remote Data Link Feature Supported Valid fields 清零
在 DL_Feature 狀態(tài)
如果 Remote Data Link Feature Supported Valid 為0,則從接收到的Data Link Feature DLLP中提取Feature Supported field,并且將Data Link Feature status寄存器Remote Data Link Feature Supported Valid bit置1.
DLLP中的The transmitted Feature Supported字段必須使用Data Link Feature Capabilities寄存器的the Local Data Link Feature Supported field.
DLLP中The transmitted Feature Ack bit 必須使用Data Link Feature status寄存器the Remote Data Link Feature Supported Valid bit.
事務(wù)層必須停止傳輸TLPs
數(shù)據(jù)鏈路層發(fā)送 the Data Link Feature DLLP
處理接收到的Data Link Feature DLLPs:
滿足如下情況則退出DL_Feature
已經(jīng)收到了InitFC1 DLLP,或者
至少收到一個(gè)Feature Ack bit置1的 Data Link Feature DLLP
Data Link Feature 處于activated狀態(tài)的條件
在Local Data Link Feature Supported and Remote Data Link Feature Supported fields中對(duì)應(yīng)的Feature Supported bit 為1且Remote Data Link Feature Supported Valid 為1
3.Flow Control Initialization Protocol
在PCIe建立過(guò)程中,還有一個(gè)重要的一步,那就是流控初始化。默認(rèn)虛擬通道,即VC0必須首先由硬件完成初始化,隨后才能進(jìn)行其他VC的初始化(如果存在多個(gè)VC)。
PCIe Gen6 支持Flit 模式,在Flit模式下共享流控(Shared Flow Control)是生效的,而在非flit模式下,Shared Flow Control必須關(guān)閉。需要注意的是,在FLit模式下,共享(shared)信用量和專用(Dedicated)信用量是可以同時(shí)存在的。在Non-Flit模式,僅僅使用專用(Dedicated)信用量。
流控初始化的兩個(gè)狀態(tài):
? FC_INIT1 :對(duì)接的設(shè)備通過(guò)發(fā)送FC_INIT1 DLLP,完成信用量信息的交換。
? FC_INIT2 :通過(guò)發(fā)送InitFC2 DLLPs完成信用量信息的再次確認(rèn)。

3.1 FC_INIT1 狀態(tài)
在FC_INIT1 狀態(tài)下,對(duì)接的設(shè)備通過(guò)發(fā)送FC_INIT1 DLLP,完成信用量信息的交換。
在FC_INIT1 狀態(tài)下,會(huì)進(jìn)行如下操作
事務(wù)層阻塞當(dāng)前VC的TLP
Non-Flit模式下,按順序傳輸3種類型的InitFC1 DLLPs
? ? InitFC1-P [Dedicated] (first)
? ? InitFC1-NP [Dedicated] (second)
? ? InitFC1-Cpl [Dedicated] (third)
Flit模式下,按順序傳輸6種類型的InitFC1 DLLPs
? InitFC1-P [Dedicated] (first)
? InitFC1-NP [Dedicated] (second)
? InitFC1-Cpl [Dedicated] (third)
? InitFC1-P [Shared] (fourth)
? InitFC1-NP [Shared] (fifth)
? InitFC1-Cpl [Shared] (sixth)
設(shè)置 DataFC, DataScale, HdrFC, and HdrScale 如表Table 3-2 和 Table 3-3
此處不推薦大家耗費(fèi)很多時(shí)間在share credit 上面,因?yàn)楫?dāng)前主流PCIe IP vendor對(duì)share credit的支持不夠完善,目前幾乎沒(méi)有已商用的支持share credit的產(chǎn)品。



為了保證InitFC1 DLLP能夠得到足夠的傳輸頻率,此時(shí)數(shù)據(jù)鏈路層會(huì)阻塞其他類型的傳輸,例如阻塞Ordered Sets), Ack and Nak DLLPs (when applicable), 以及其他VC的TLP
如果收到 InitFC1 and InitFC2 DLLPs會(huì)進(jìn)行如下處理:
從InitFC1 and InitFC2 DLLPs中提取HdrFC and DataFC values 并且記錄下來(lái)
如果接收者支持Scaled Flow Control,則還需要把DLLPs中申明對(duì)端支持的HdrScale and DataScale記錄下來(lái)
一旦完成 P, NP, and Cpl對(duì)應(yīng)數(shù)據(jù)記錄,則將FI1標(biāo)志置1
在 Non-Flit模式下,當(dāng)收到3種專用信用量的FC unit 數(shù)據(jù)后,則將則將 FI1標(biāo)志置1
在 Flit模式下,當(dāng)收到6種信用量的FC unit 數(shù)據(jù)后,則將則將 FI1標(biāo)志置1
一旦完成FI1標(biāo)志置1,則表明已經(jīng)記錄對(duì)端設(shè)備的 P, NP, Cpl對(duì)應(yīng)的FC unit 數(shù)值,此時(shí)從FC_INIT1退出,進(jìn)入FC_INIT2
3.2 FC_INIT2
在FC_INIT2 狀態(tài)下,通過(guò)發(fā)送InitFC2 DLLPs完成信用量信息的再次確認(rèn)。
在FC_INIT2 狀態(tài)下,會(huì)進(jìn)行如下操作
事務(wù)層阻塞當(dāng)前VC的TLP
Non-Flit模式下,按順序傳輸3種類型的InitFC2 DLLPs
? ? InitFC1-P [Dedicated] (first)
? ? InitFC1-NP [Dedicated] (second)
? ? InitFC1-Cpl [Dedicated] (third)
Flit模式下,按順序傳輸6種類型的InitFC2 DLLPs
? InitFC1-P [Dedicated] (first)
? InitFC1-NP [Dedicated] (second)
? InitFC1-Cpl [Dedicated] (third)
? InitFC1-P [Shared] (fourth)
? InitFC1-NP [Shared] (fifth)
? InitFC1-Cpl [Shared] (sixth)
設(shè)置 DataFC, DataScale, HdrFC, and HdrScale 如表Table 3-2 和 Table 3-3
此處不推薦大家耗費(fèi)很多時(shí)間在share credit 上面,因?yàn)楫?dāng)前主流PCIe IP vendor對(duì)share credit的支持不夠完善,目前幾乎沒(méi)有已商用的支持share credit的產(chǎn)品。
為了保證InitFC1 DLLP能夠得到足夠的傳輸頻率,此時(shí)數(shù)據(jù)鏈路層會(huì)阻塞其他類型的傳輸,例如阻塞Ordered Sets), Ack and Nak DLLPs (when applicable), 以及其他VC的TLP
如果收到 InitFC1 and InitFC2 DLLPs會(huì)進(jìn)行如下處理:
忽略DLLPS中的HdrFC, HdrScale, DataFC, and DataScale 數(shù)值
收到任何InitFC2 DLLP,則將FI2標(biāo)志置1
一旦收到當(dāng)前VC所屬的任何TLP,任何UpdateFC DLLP或者任何Optimized_Update_FC(Flit模式),則將FI2標(biāo)志置1
滿足如下條件則表示流程初始化流程完成并且退出InitFC2:
FI2標(biāo)志已置1
Scaled Flow Control已生效,發(fā)送側(cè)發(fā)送的當(dāng)前VC的 UpdateFC DLLPs中的HdrScale and DataScale 為01b, 10b, or 11b。note:此時(shí)不允許發(fā)送00的Scale數(shù)值。
Scaled Flow Control不支持或者不生效,發(fā)送側(cè)發(fā)送的當(dāng)前VC的 UpdateFC DLLPs中的HdrScale and DataScale 為00b。note:此時(shí)不允許發(fā)送01b, 10b, or 11b的Scale數(shù)值。

3.3 Scaled Flow Control
Scaled Flow Control機(jī)制目的就是現(xiàn)有FC DLLP字段位寬分布不修改的情況下,增加credit數(shù)量上限的方法,即用比例縮放的方式描述credit。當(dāng)Scale Factor為10b時(shí),此時(shí)表示放大4倍,這樣情況下,有限的FC DLLP filed字段能夠表示的credit上限就增加了。






