NDIS6.0发送以太网包需要遵守的规则

来源:互联网 发布:潍坊学院淘宝地址 编辑:程序博客网 时间:2024/05/03 07:22

自己翻译的微软关于NDIS发送以太网包时要遵守的规则文档。记录下来自己看着方便,也方便苦苦寻找资料的你! 

转载本文时请带上出处,谢了!


Sending Ethernet Frames

发送以太网帧

The Windows TCP/IP transport supports a set of requirements for sending Ethernet frames. Any driver (for example, a MUX intermediate driver or filter driver) that originates send requests or modifies the send requests of overlying drivers must support the requirements that the TCP/IP transport implements.

驱动程序发起发送请求或修改上层驱动的发送请求时必须要遵守以下要求:

Note If any driver in a driver stack does not follow these requirements, underlying miniport drivers, MUX intermediate drivers, and filter drivers might behave unpredictably.

提示: 如果驱动栈中的驱动不遵守这些要求,将会发生不可预知的问题。

For Ethernet send requests, drivers must support these requirements:

发送以太网请求时,驱动程序必须遵守下列要求:

  • If a driver originates a send request, the driver should allocate a NET_BUFFER_LIST structure for the Ethernet frames. The NetBufferListInfo member in each NET_BUFFER_LIST structure must include the out-of-band (OOB) data that is required for the particular use. The OOB data applies to all of the NET_BUFFER structures that are associated with a NET_BUFFER_LIST structure.

  • 当驱动程序发起一个发送请求时,可以为这些要发送的以太网帧分配一个NET_BUFFER_LIST结构体。每个 NET_BUFFER_LIST 结构体的 NetBufferListInfo 成员必须包含有特定用途OOB数据。OOB数据适用于和这个NET_BUFFER_LIST关联的所有的NET_BUFFER。

  • If a driver originates a send request, the driver should allocate one or more NET_BUFFER structures for the Ethernet frames and link these structures to the NET_BUFFER_LIST structure. Each NET_BUFFER structure that is linked to a NET_BUFFER_LIST structure describes a single Ethernet frame.

  • 当驱动程序发起一个发送请求时,可以为这些要发送的以太网帧分配一个或多个NET_BUFFER,并且链接这些NET_BUFFER到NET_BUFFER_LIST中。每个链接到NET_BUFFER_LIST的NET_BUFFER代表一个单一的以太网帧。

  • All NET_BUFFER structures that are associated with a NET_BUFFER_LIST structure must have the same Ethernet frame type and IP protocol version (IPv4 or IPv6).

  • 所有关联到同一个NET_BUFFER_LIST的NET_BUFFER必须有相同的以太网帧类型和IP协议版本号(IPv4 或 IPv6)。

  • All NET_BUFFER structures that are associated with a NET_BUFFER_LIST structure must have the same source and destination MAC addresses.

  • 所有关联到同一个NET_BUFFER_LIST的NET_BUFFER必须具有相同的源MAC地址和目标MAC地址。

  • If a driver is sending TCP or UDP frames, all of the NET_BUFFER structures that are associated with a NET_BUFFER_LIST structure must be associated with same TCP or UDP connection. 

  • 驱动程序发送TCP或UDP帧时,所有关联到同一个NET_BUFFER_LIST的NET_BUFFER必须是相同的TCP或UDP连接。

Note Subject to the following requirements, transmitted Ethernet frames can be split. That is, multiple memory descriptor lists (MDLs) can be associated with a NET_BUFFER structure in a send request.


提示: 遵守如下要求,发送的以太网帧可以分割。也就是说,在发送请求中,多个MDL可以关联到一个NET_BUFFER中。
  • Do not split the MAC header of the transmit Ethernet frame across multiple MDLs. Treat the Virtual LAN (VLAN) (or Priority) flag, if present, as part of the MAC header. Therefore, this flag must be in the same MDL as the rest of the MAC header.

  • 不要分割以太网帧的MAC头到多个MDL中,对于VLAN(或 Priority)标志,如果有的话,就视为MAC头的一部分。因此,这个标志必须和MAC头在同一个MDL中。

  • If a driver changes the links in the MDL chain in a NET_BUFFER structure or the NET_BUFFER chain in a NET_BUFFER_LIST structure, the driver must restore the links to the original configuration before it returns ownership of the NET_BUFFER_LIST to an overlying driver. However, drivers are not required to restore the links between NET_BUFFER_LIST structures.

  • 如果驱动修改了一个NET_BUFFER中的MDL链,或者修改了一个NET_BUFFER_LIST中的NET_BUFFER链,那么在交还NET_BUFFER_LIST 的控制权给上层驱动之前,必须恢复修改了的链到原始状态(译注:因为上层驱动要负责释放这些空间)。但是不要求恢复NET_BUFFER_LIST之间的链接。


英文原文地址: https://docs.microsoft.com/zh-cn/windows-hardware/drivers/network/sending-ethernet-frames

0 0
原创粉丝点击