Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 45 additions & 5 deletions Documentation/core-api/vmxnet3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,66 @@ VMXNET3 网络驱动

驱动选择 VMXNET3 revision 1 和 UPT 1,使用一条发送队列和一条接收
队列,不启用校验和、分段、VLAN 剥离、RSS 或 LRO 等硬件卸载。接口
使用 1500 字节 MTU、软件协议校验和及轮询完成队列;中断保持屏蔽。
使用 1500 字节 MTU 和软件协议校验和。
目的地址过滤允许本站单播、广播和所有多播,以支持 IPv6 邻居发现。

中断与收发调度
==============

驱动查询设备的中断偏好,优先使用一个 MSI-X 表项,其次使用 MSI;设备
明确要求 MSI 时直接尝试 MSI。不支持消息中断、分配失败或设备要求 INTx
时保留轮询回退,并保持设备中断屏蔽,不猜测共享 INTx 路由。消息中断
路由到 BSP,发送、接收和控制事件共用一个向量。MSI 与 MSI-X 共用
16 个向量,每个向量在一次启动内不复用;耗尽时新设备回退到轮询。

IRQ 回调仅屏蔽设备中断、刷新 posted write 并通知核心,不解析协议包。
核心以不复用的 ifindex 合并通知,不在排队期间保存模块回调或设备指针。
任务上下文每轮最多检查 32 个接收描述符,每张网卡连续最多检查 8 个,
满预算时重新排队;空队列才重新打开中断,并在打开后复查代际位,避免
丢失检查空队列期间到达的数据。原有协议维护心跳和同步轮询路径继续保留。

任务上下文消费并确认设备事件,包括 carrier 变化和队列错误。通知路径
不以旧 carrier 状态阻挡设备回调,否则链路恢复事件本身无法被处理。
行政关闭的接口仍排空和重新启用中断,但不把收到的数据投递到协议层。
中断模式使用事件更新的 carrier 缓存,轮询模式继续查询设备;接收服务
也回收发送完成。补充接收描述符时,仅在设备设置 ``updateRxProd`` 时
写 producer doorbell,减少每个包的 MMIO;初次投递仍显式通知设备。

资源与错误处理
==============

共享配置和环采用设备约定的 DMA 地址及代际位,发送完成须对应最早
尚未回收的描述符;接收完成须指向本队列预期的缓冲区。异常索引或
完成类型使该设备停止接收新的报文,避免复用不可信的 DMA 缓冲区。
QEMU 的 VMXNET3 模型将接收完成类型字段保留为零,驱动同时兼容
该取值与设备协议的接收完成类型。驱动不接受分片报文,并在错误或
长度超出缓冲区时丢弃对应完成。

设备停止时先同步 quiesce 和 reset,再关闭 PCI bus master 并回读;
每次回调均保留实际设备 owner。设备停止时先关闭接入、屏蔽并排空 IRQ,
再同步 quiesce 和 reset,关闭 PCI bus master 并回读;
未能证明停止时保留 DMA/MMIO 和模块所有权,以便管理器重试,而不
释放仍可能被访问的内存。设备命令是同步 MMIO 操作,队列满时发送
返回 ``EAGAIN``,不会无限等待硬件进度。

验证
====

``tools/test_vmxnet3.py`` 编译真实驱动主体并模拟 PCI、MMIO 与 DMA
边界,覆盖版本协商、链路、收发环回绕、错误完成、资源回滚、失败
STOP 保留和多设备隔离。QEMU/KVM 测试使用两张 VMXNET3 和一张
e1000e,验证 DHCP、IPv4/IPv6、并发 TCP/UDP 数据和模块卸载、重载。
宿主模型和 QEMU 不能代替 VMware 实际环境验证;物理硬件也未验证。
STOP 保留和多设备隔离,以及 MSI-X/MSI/轮询选择、中断重新打开竞态、
carrier 事件和 producer doorbell 条件。``tools/test_pci_msix.py`` 检查
MSI-X 表与 PBA 的 BAR 边界、重叠、映射失败、表项屏蔽和旧向量隔离;
``tools/test_net_rx_budget.py`` 检查描述符预算与网卡之间的公平调度。

ReliefOS 的 ``tools/test_vmxnet3_qemu.py`` 使用两张 VMXNET3 和一张
e1000e,验证 DHCP、IPv4/IPv6、并发 TCP/UDP、真实 MSI-X 计数及模块
卸载、重载。``tools/tests/vmxnet3_perf_guest.c`` 通过标准 socket 验证
全部 TCP 回显字节和 UDP 数据,供父仓性能编排比较耗时、CPU 统计和
往返延迟。吞吐按单方向的回显有效载荷计算,不是双向加总或网卡线速。

QEMU 性能、VMware 基础联网、模块生命周期和长时间负载须分别记录,
不能互相代替。宿主模型和 QEMU 不能代替 VMware 实际环境验证;
物理硬件也未验证。此内部驱动与调度接口不扩展 Linux/POSIX 用户态 ABI。

协议字段根据 VMware Linux 驱动定义及 QEMU 的 VMXNET3 设备实现
核对:`Linux vmxnet3_defs.h <https://github.com/torvalds/linux/blob/master/drivers/net/vmxnet3/vmxnet3_defs.h>`_、
Expand Down
164 changes: 123 additions & 41 deletions Documentation/locale/en/LC_MESSAGES/core-api/vmxnet3.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: ReliefNT 5.3.2\n"
"Report-Msgid-Bugs-To:\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-14 23:58+0800\n"
"PO-Revision-Date: 2026-11-14 00:00+0800\n"
"Last-Translator: ReliefOS contributors\n"
Expand Down Expand Up @@ -34,18 +34,6 @@ msgstr ""
"interface; the interfaces use the existing network-device API and "
"IPv4/IPv6 stack."

msgid ""
"驱动选择 VMXNET3 revision 1 和 UPT 1,使用一条发送队列和一条接收 队列,不启用校验和、分段、VLAN 剥离、RSS 或 "
"LRO 等硬件卸载。接口 使用 1500 字节 MTU、软件协议校验和及轮询完成队列;中断保持屏蔽。 "
"目的地址过滤允许本站单播、广播和所有多播,以支持 IPv6 邻居发现。"
msgstr ""
"The driver selects VMXNET3 revision 1 and UPT 1 and uses one transmit "
"queue and one receive queue, without hardware offloads such as checksums,"
" segmentation, VLAN stripping, RSS, or LRO. The interface uses a "
"1500-byte MTU, software protocol checksums, and polled completion queues;"
" interrupts remain masked. Destination-address filtering accepts local "
"unicast, broadcast, and all multicast to support IPv6 neighbor discovery."

msgid ""
"共享配置和环采用设备约定的 DMA 地址及代际位,发送完成须对应最早 尚未回收的描述符;接收完成须指向本队列预期的缓冲区。异常索引或 "
"完成类型使该设备停止接收新的报文,避免复用不可信的 DMA 缓冲区。 QEMU 的 VMXNET3 模型将接收完成类型字段保留为零,驱动同时兼容 "
Expand All @@ -61,34 +49,6 @@ msgstr ""
"receive-completion type. The driver does not accept fragmented packets "
"and discards completions with errors or lengths exceeding the buffer."

msgid ""
"设备停止时先同步 quiesce 和 reset,再关闭 PCI bus master 并回读; 未能证明停止时保留 DMA/MMIO "
"和模块所有权,以便管理器重试,而不 释放仍可能被访问的内存。设备命令是同步 MMIO 操作,队列满时发送 返回 "
"``EAGAIN``,不会无限等待硬件进度。"
msgstr ""
"When stopping a device, the driver first synchronously quiesces and "
"resets it, then disables PCI bus mastering and reads it back. If it "
"cannot prove that the device stopped, it retains DMA/MMIO resources and "
"module ownership for a manager retry rather than freeing memory that may "
"still be accessed. Device commands are synchronous MMIO operations; "
"transmission returns ``EAGAIN`` when the queue is full instead of waiting"
" indefinitely for hardware progress."

msgid ""
"``tools/test_vmxnet3.py`` 编译真实驱动主体并模拟 PCI、MMIO 与 DMA "
"边界,覆盖版本协商、链路、收发环回绕、错误完成、资源回滚、失败 STOP 保留和多设备隔离。QEMU/KVM 测试使用两张 VMXNET3 和一张"
" e1000e,验证 DHCP、IPv4/IPv6、并发 TCP/UDP 数据和模块卸载、重载。 宿主模型和 QEMU 不能代替 VMware "
"实际环境验证;物理硬件也未验证。"
msgstr ""
"``tools/test_vmxnet3.py`` compiles the real driver and simulates the PCI,"
" MMIO, and DMA boundaries, covering version negotiation, link state, "
"transmit and receive ring wraparound, erroneous completions, resource "
"rollback, retained resources after a failed STOP, and isolation between "
"devices. A QEMU/KVM test with two VMXNET3 adapters and one e1000e checks "
"DHCP, IPv4/IPv6, concurrent TCP/UDP traffic, and module unload and "
"reload. Host models and QEMU do not replace validation in an actual "
"VMware environment; physical hardware has not been validated either."

msgid ""
"协议字段根据 VMware Linux 驱动定义及 QEMU 的 VMXNET3 设备实现 核对:`Linux vmxnet3_defs.h "
"<https://github.com/torvalds/linux/blob/master/drivers/net/vmxnet3/vmxnet3_defs.h>`_、"
Expand All @@ -104,3 +64,125 @@ msgstr ""
"implementation in this directory is original ReliefNT code under "
"Apache-2.0 and does not contain implementation code from those GPL source"
" files."

msgid ""
"驱动选择 VMXNET3 revision 1 和 UPT 1,使用一条发送队列和一条接收 队列,不启用校验和、分段、VLAN 剥离、RSS 或 "
"LRO 等硬件卸载。接口 使用 1500 字节 MTU 和软件协议校验和。 目的地址过滤允许本站单播、广播和所有多播,以支持 IPv6 邻居发现。"
msgstr ""
"The driver selects VMXNET3 revision 1 and UPT 1 and uses one transmit "
"queue and one receive queue, without hardware offloads such as checksums,"
" segmentation, VLAN stripping, RSS, or LRO. The interface uses a "
"1500-byte MTU and software protocol checksums. Destination-address "
"filtering accepts local unicast, broadcast, and all multicast to support "
"IPv6 neighbor discovery."

msgid "中断与收发调度"
msgstr "Interrupts and packet scheduling"

msgid ""
"驱动查询设备的中断偏好,优先使用一个 MSI-X 表项,其次使用 MSI;设备 明确要求 MSI 时直接尝试 "
"MSI。不支持消息中断、分配失败或设备要求 INTx 时保留轮询回退,并保持设备中断屏蔽,不猜测共享 INTx 路由。消息中断 路由到 "
"BSP,发送、接收和控制事件共用一个向量。MSI 与 MSI-X 共用 16 个向量,每个向量在一次启动内不复用;耗尽时新设备回退到轮询。"
msgstr ""
"The driver queries the device interrupt preference, trying one MSI-X "
"entry first and then MSI; an explicit MSI preference skips MSI-X. If "
"message interrupts are unavailable, allocation fails, or the device "
"requests INTx, it retains a polling fallback with device interrupts "
"masked rather than guessing shared INTx routing. Messages target the BSP,"
" with transmit, receive, and control events sharing one vector. MSI and "
"MSI-X share 16 vectors, each used only once per boot; new devices fall "
"back to polling when this pool is exhausted."

msgid ""
"IRQ 回调仅屏蔽设备中断、刷新 posted write 并通知核心,不解析协议包。 核心以不复用的 ifindex "
"合并通知,不在排队期间保存模块回调或设备指针。 任务上下文每轮最多检查 32 个接收描述符,每张网卡连续最多检查 8 个, "
"满预算时重新排队;空队列才重新打开中断,并在打开后复查代际位,避免 丢失检查空队列期间到达的数据。原有协议维护心跳和同步轮询路径继续保留。"
msgstr ""
"The IRQ callback only masks the device interrupt, flushes the posted "
"write, and notifies the core; it does not parse packets. The core "
"coalesces notifications by never-reused ifindex, without storing module "
"callbacks or device pointers while queued. Task context checks at most 32"
" receive descriptors per turn and at most 8 consecutively per NIC, "
"requeuing when the budget is used. It rearms interrupts only after "
"observing an empty queue and rechecks generation bits after rearming to "
"avoid losing packets arriving during the empty check. Existing protocol "
"maintenance heartbeats and synchronous polling remain available."

msgid ""
"任务上下文消费并确认设备事件,包括 carrier 变化和队列错误。通知路径 不以旧 carrier "
"状态阻挡设备回调,否则链路恢复事件本身无法被处理。 行政关闭的接口仍排空和重新启用中断,但不把收到的数据投递到协议层。 中断模式使用事件更新的 "
"carrier 缓存,轮询模式继续查询设备;接收服务 也回收发送完成。补充接收描述符时,仅在设备设置 ``updateRxProd`` 时 写 "
"producer doorbell,减少每个包的 MMIO;初次投递仍显式通知设备。"
msgstr ""
"Task context consumes and acknowledges device events, including carrier "
"changes and queue faults. Notification processing does not gate callbacks"
" on stale carrier state, since a link-up event itself needs service. "
"Administratively down interfaces still drain and rearm interrupts but do "
"not deliver received packets to the protocol stack. Interrupt mode uses "
"an event-updated carrier cache; polling mode continues querying the "
"device. Receive service also reclaims transmit completions. Refilled "
"receive descriptors ring the producer doorbell only when the device sets "
"``updateRxProd``, reducing per-packet MMIO; initial posting still "
"explicitly notifies the device."

msgid "资源与错误处理"
msgstr "Resources and error handling"

msgid ""
"每次回调均保留实际设备 owner。设备停止时先关闭接入、屏蔽并排空 IRQ, 再同步 quiesce 和 reset,关闭 PCI bus "
"master 并回读; 未能证明停止时保留 DMA/MMIO 和模块所有权,以便管理器重试,而不 释放仍可能被访问的内存。设备命令是同步 MMIO"
" 操作,队列满时发送 返回 ``EAGAIN``,不会无限等待硬件进度。"
msgstr ""
"Every callback pins the actual device owner. Stopping a device first "
"closes callback admission, masks interrupts, and drains IRQ callbacks, "
"then synchronously quiesces and resets it before disabling PCI bus "
"mastering and reading it back. If stopping cannot be proven, DMA/MMIO "
"resources and module ownership are retained for a manager retry rather "
"than freeing memory that may still be accessed. Device commands use "
"synchronous MMIO; a full transmit queue returns ``EAGAIN`` instead of "
"waiting indefinitely for hardware progress."

msgid "验证"
msgstr "Validation"

msgid ""
"``tools/test_vmxnet3.py`` 编译真实驱动主体并模拟 PCI、MMIO 与 DMA "
"边界,覆盖版本协商、链路、收发环回绕、错误完成、资源回滚、失败 STOP 保留和多设备隔离,以及 MSI-X/MSI/轮询选择、中断重新打开竞态、"
" carrier 事件和 producer doorbell 条件。``tools/test_pci_msix.py`` 检查 MSI-X 表与 "
"PBA 的 BAR 边界、重叠、映射失败、表项屏蔽和旧向量隔离; ``tools/test_net_rx_budget.py`` "
"检查描述符预算与网卡之间的公平调度。"
msgstr ""
"``tools/test_vmxnet3.py`` compiles the real driver against modeled PCI, "
"MMIO, and DMA boundaries. It covers negotiation, carrier, ring "
"wraparound, malformed completions, resource rollback, failed-STOP "
"retention, device isolation, MSI-X/MSI/polling selection, interrupt rearm"
" races, carrier events, and producer doorbell conditions. "
"``tools/test_pci_msix.py`` checks MSI-X table/PBA BAR bounds, overlap, "
"mapping failures, entry masks, and retired-vector isolation; "
"``tools/test_net_rx_budget.py`` checks descriptor budgets and fairness "
"between NICs."

msgid ""
"ReliefOS 的 ``tools/test_vmxnet3_qemu.py`` 使用两张 VMXNET3 和一张 e1000e,验证 "
"DHCP、IPv4/IPv6、并发 TCP/UDP、真实 MSI-X 计数及模块 "
"卸载、重载。``tools/tests/vmxnet3_perf_guest.c`` 通过标准 socket 验证 全部 TCP 回显字节和 "
"UDP 数据,供父仓性能编排比较耗时、CPU 统计和 往返延迟。吞吐按单方向的回显有效载荷计算,不是双向加总或网卡线速。"
msgstr ""
"ReliefOS uses ``tools/test_vmxnet3_qemu.py`` with two VMXNET3 adapters "
"and one e1000e to check DHCP, IPv4/IPv6, concurrent TCP/UDP, actual MSI-X"
" counts, and module unload/reload. ``tools/tests/vmxnet3_perf_guest.c`` "
"uses standard sockets to verify every echoed TCP byte and UDP payload for"
" the parent repository benchmark, comparing elapsed time, CPU accounting,"
" and round-trip latency. Throughput counts echo payload in one direction,"
" not the sum of both directions or NIC line rate."

msgid ""
"QEMU 性能、VMware 基础联网、模块生命周期和长时间负载须分别记录, 不能互相代替。宿主模型和 QEMU 不能代替 VMware "
"实际环境验证; 物理硬件也未验证。此内部驱动与调度接口不扩展 Linux/POSIX 用户态 ABI。"
msgstr ""
"QEMU performance, basic VMware networking, module lifecycle, and "
"sustained-load validation must be recorded separately; none substitutes "
"for another. Host models and QEMU do not replace an actual VMware "
"environment, and physical hardware has not been validated. These internal"
" driver and scheduling interfaces do not extend the Linux/POSIX userspace"
" ABI."
Loading
Loading