wirelessboy
驱动牛犊
驱动牛犊
  • 注册日期2002-04-21
  • 最后登录2003-12-17
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1172回复:1

问一个小问题

楼主#
更多 发布于:2002-10-07 01:38
这两天郁闷得很,不知道为什么自己的程序设置成加密模式后就极大地降低了效率,所以就开始无聊的翻看DDK文档。刚刚在NDIS_PACKET_OOB_DATA中看到这样一段话:

Status
Specifies the current status of the packet descriptor and the ownership of all driver-allocated resources specified with the packet descriptor.
Only lower-level drivers and NDIS set this member.

In the Receive Path

A miniport can set this member before it calls NdisMIndicateReceivePacket to indicate how soon it needs to regain ownership of its allocated resources specified in the associated packet descriptor(s). A serialized can retrieve this value on return from NdisMIndicateReceivePacket to determine whether the resources specified with the packet descriptor for its indication can be prepared for reuse immediately. A deserialized or connection-oriented miniport, however, does not have to check this value on return from NdisMCoIndicateReceivePacket.

......


这是对该结构中Status成员的描述,联系前些日子看得关于NdisMIndicateReceivedPackets(...)中的一段文档(如下)

A deserialized miniport does not have to examine the status of indicated packets on return of NdisMIndicateReceivePacket:

If the miniport set the packet\'s Status to NDIS_STATUS_SUCCESS before indicating up the packet descriptor, the packet\'s Status is always NDIS_STATUS_PENDING on return of NdisMIndicateReceivePacket. NDIS subsequently returns the packet descriptor to the miniport\'s MiniportReturnPacket function with the packet\'s Status set to NDIS_STATUS_SUCCESS.
If the miniport set the packet\'s Status to NDIS_STATUS_RESOURCES before indicating up the packet descriptor, the packet\'s Status is always NDIS_STATUS_SUCCESS on return of NdisMIndicateReceivePacket.
......


我不禁想问两个问题:
(1)在Passthru中PtReceive函数中NdisMIndicateRecievePacket调用之后的那句

ASSERT( NDIS_GET_PACKET_STATUS(Packet) == NDIS_STATUS_RESOURCES );

有用吗?(根据上面的说明,好像没有必要吧?)
(2)NdisMIndicateReceivePacket返回的值也与文档中描述的不一样。
我做过试验,好像在这个ASSERT中把NDIS_STATUS_RESOURCE改成NDIS_STATUS_SUCCESS,程序就会出错,这和前面的在NdisMIndicateReceivePacket中描述的不一样呀!?
HuYuguang
论坛版主
论坛版主
  • 注册日期2001-04-25
  • 最后登录2013-04-29
  • 粉丝3
  • 关注1
  • 积分92分
  • 威望11点
  • 贡献值0点
  • 好评度9点
  • 原创分1分
  • 专家分0分
沙发#
发布于:2002-10-07 02:47
这两天郁闷得很,不知道为什么自己的程序设置成加密模式后就极大地降低了效率,所以就开始无聊的翻看DDK文档。刚刚在NDIS_PACKET_OOB_DATA中看到这样一段话:
[quote]
Status
Specifies the current status of the packet descriptor and the ownership of all driver-allocated resources specified with the packet descriptor.
Only lower-level drivers and NDIS set this member.

In the Receive Path

A miniport can set this member before it calls NdisMIndicateReceivePacket to indicate how soon it needs to regain ownership of its allocated resources specified in the associated packet descriptor(s). A serialized can retrieve this value on return from NdisMIndicateReceivePacket to determine whether the resources specified with the packet descriptor for its indication can be prepared for reuse immediately. A deserialized or connection-oriented miniport, however, does not have to check this value on return from NdisMCoIndicateReceivePacket.

......


这是对该结构中Status成员的描述,联系前些日子看得关于NdisMIndicateReceivedPackets(...)中的一段文档(如下)

A deserialized miniport does not have to examine the status of indicated packets on return of NdisMIndicateReceivePacket:

If the miniport set the packet\'s Status to NDIS_STATUS_SUCCESS before indicating up the packet descriptor, the packet\'s Status is always NDIS_STATUS_PENDING on return of NdisMIndicateReceivePacket. NDIS subsequently returns the packet descriptor to the miniport\'s MiniportReturnPacket function with the packet\'s Status set to NDIS_STATUS_SUCCESS.
If the miniport set the packet\'s Status to NDIS_STATUS_RESOURCES before indicating up the packet descriptor, the packet\'s Status is always NDIS_STATUS_SUCCESS on return of NdisMIndicateReceivePacket.
......


我不禁想问两个问题:
(1)在Passthru中PtReceive函数中NdisMIndicateRecievePacket调用之后的那句

ASSERT( NDIS_GET_PACKET_STATUS(Packet) == NDIS_STATUS_RESOURCES );

有用吗?(根据上面的说明,好像没有必要吧?)
(2)NdisMIndicateReceivePacket返回的值也与文档中描述的不一样。
我做过试验,好像在这个ASSERT中把NDIS_STATUS_RESOURCE改成NDIS_STATUS_SUCCESS,程序就会出错,这和前面的在NdisMIndicateReceivePacket中描述的不一样呀!? [/quote]

那个assert有意义。
关于为什么这个assert有意义,请参看我前面的贴子,我
曾经非常详尽的解释了这个问题(一个关于何时调用receive
何时调用receivepacket的问题,和这个ndis_resource有
非常密切的关系)
不再回忆从前,我已经生活在幸福当中。
游客

返回顶部