Data Link Layer 负责将 TLP 可靠地传输给链路的另外一个组件。
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:
- 跟踪链路状态,并且将 active/reset/disconnected 状态传递给 Transaction Layer
- DLLPs 用于链路管理,包含 TLP 确认,功耗管理和流控交互。
DLLP 是在链路的两个组件之间进行传输,而 TLP 的传输路径有可能会经过多个中间组件。
Non-Flit 模式,DLLP 使用 16bit 的 CRC,TLP 使用 32bit 的 CRC 进行数据完整性检查。收到的 DLLP 如果没有通过 CRC 检查,则直接丢弃。没有通过完整性检查(LCRC and sequence number)的 TLP 则会被对端重新发送。
Flit Mode 模式, DLLP 和 TLP 都会使用 flit 传输,flit 使用 LCRC,FEC 和 sequence number 进行数据完整性检查。重传操作发生在 Flit 层级。
1. Data Link Control and Management State Machine
Data Link Layer 负责跟踪链路状态,并且与 Transaction and Physical Layers 交互链路状态。
数据链路层使用 Data Link Control and Management State Machine (DLCMSM)完成链路状态管理工作。
DLCMSM 包含如下 4 个状态:
- 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 输出两个状态:
- 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.
1. Data Link Control and Management State 规则
- DL 状态不受 FLR 影响
DL_Inactive
- 在 DL_Inactive 状态,DLCMSM 会输出 DL_Down 状态给向事务层和链路层的其他模块。
- 链路层会丢弃来自事务层和物理层的 TLP
- 不再产生和接收 DLLP
- 如果物理层表示 Physical LinkUp=1,且支持 Data Link Feature Exchange 并且 Data Link Feature Exchange is Enabled bit 为 1,则从 DL_Inactive 进入 DL_Feature
- 如果物理层表示 Physical LinkUp=1,不支持 Data Link Feature Exchange 或者 Data Link Feature Exchange is Enabled bit 为 0,则从 DL_Inactive 进入 DL_Init
- 这会导致事务层丢弃任意未完成的传输,并且去终止传输 TLP。对 Downstream Port 来说,这相当于 Hot-Remove。对 Upstream Port 来说,链路进入 down 状态,相当于 hot reset。
- DL_Inactive 是 PCIe 复位(仅包含 PCI Express Hot, Warm, or Cold Reset )后的初始状态,
- 一旦进入 DL_inactive,则复位 DL 层状态为初始值
- 在 DL_Inactive 状态:
DL_Feature:
- 成功完成 Data Link Feature Exchange,并且物理层继续表示 Physical LinkUp = 1b,或者
- Data Link Feature Exchange 过程判断远端的数据链路层不支持 Data Link Feature Exchange protocol,并且物理层继续表示 Physical LinkUp = 1b
- 通过 Data Link Feature DLLP 执行 Data Link Feature Exchange 协议,完成 Scaled Flow Control 等信息交换
- 汇报 DL_Down 状态
- DL_Down 的端口,其数据链路层允许丢弃任意收到的 TLP,因为没有 ACK DLLP 用于确认 TLP 的接收。
- 在 DL_Feature 状态:
- 满足如下要求进入 DL_Init 状态
- 一旦物理层继续表示 Physical LinkUp = 0b,则终止 Data Link Feature Exchange 过程,进入 DL_Inactive
DL_Init
- 成功完成流控初始化,并且物理层持续支持 Physical LinkUp = 1b
- 为 VC0 完成流控初始化
- 在 FC_INIT1 阶段输出 DL_Down 状态,在 FC_INIT2 状态输出 DL_Up 状态
- DL_Down 状态的链路层允许丢弃任意收到的 TLP
- 满足如下要求进入 DL_Active 状态
- 一旦物理层指示 Physical LinkUp = 0b,则终止 VC0 的流控初始化,且进入 DL_Inactive
DL_Active
- DL_Active 是链路正常工作状态
- 链路层能够正常接收来自物理层的 TLP,能够发送来自事务层的 TLP
- 能够产生和发送 DLLP
- 给事务层和链路层其他模块输出 DL_Up 状态
- 一旦物理层指示 Physical LinkUp = 0b,则进入 DL_Inactive
2.Data LinkFeature Exchange
数据链路特性交换协议的操作就是通过 DLLP 将 local port 支持的特性传递给 remote port,并且捕获 remote port 传递过来的特性信息,并且记录更新到 Data Link Feature Status Register
支持 16.0 GT/s 以及更高速率的 port 必须支持 Data Link Feature 交换协议。实现此协议的 Downstream Ports 必须实现了 Data Link Feature Extended Capability,而实现此协议的 Upstream Ports 是可选择实现 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 表示对端 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 表示当前 port 在 DL_Feature 阶段至少收到一个 Data Link Feature DLLP,表示 Remote Data Link Feature Supported 字段包含有效数据
- Data Link Feature Exchange is Enabled 允许系统关闭 Data Link Feature Exchange.这个功能可以用于对接无法正确处理 Data Link Feature DLLP 的传统旧设备。
数据链路特性交换协议需要遵守的规则:
- 一旦进入 DL_Feature,允许将 Remote Data Link Feature Supported and Remote Data Link Feature Supported Valid fields 清零
在 DL_Feature 状态
- 如果 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.
- 事务层必须停止传输 TLPs
- 数据链路层发送 the Data Link Feature DLLP
- 处理接收到的 Data Link Feature DLLPs:
满足如下情况则退出 DL_Feature
- 已经收到了 InitFC1 DLLP,或者
- 至少收到一个 Feature Ack bit 置 1 的 Data Link Feature DLLP
Data Link Feature 处于 activated 状态的条件
- 在 Local Data Link Feature Supported and Remote Data Link Feature Supported fields 中对应的 Feature Supported bit 为 1 且 Remote Data Link Feature Supported Valid 为 1
END
作者:IC小鸽
文章来源:IC小鸽
推荐阅读
- 芯片设计全流程工程师的崛起:国产化背景下的“全能型人才”需求解析
- 搞芯片不懂 cell 别乱用!看看 Vt cell 都是啥?
- 从 GPU 芯片到智算集群,英伟达不给中间商赚差价
- 智算下半场生死战:DeepSeek开源正在淘汰哪些"伪AI玩家"?
- AXI3与AXI4区别及互联
更多 IC 设计干货请关注IC设计专栏。欢迎添加极术小姐姐微信(id:aijishu20)加入技术交流群,请备注研究方向。