次の方法で共有


Receiving 802.1Q-Marked Packets (NDIS 5.1)

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

A miniport driver that supports 802.1Q can receive packets that contain priority and VLAN identifier (VLAN ID) values in their tag header. Before indicating up such packets, the miniport driver should:

  1. Remove the priority and VLAN ID values from such packets.

  2. Set the priority and VLAN ID values in the per-packet information.

    The miniport driver should set these values to the values of the priority and VLAN ID that it removed from the original packet.

To insert priority and VLAN ID values into a packet descriptor, a miniport driver calls the NDIS_PER_PACKET_INFO_FROM_PACKETmacro. In this call, the miniport driver passes:

  • A pointer to the NDIS_PACKET structure that describes the packet.

  • The Ieee8021QInfo NDIS_PER_PACKET_INFO value. This value indicates that NDIS should insert the priority and VLAN ID values into the packet.

In the following code example, the pPacketDesc variable points to a packet, and the UserPriority and VlanID variables hold the priority and VLAN ID values, respectively, to insert into the packet.

NDIS_PACKET_8021Q_INFO VVlanPriInfo;
UINT32 UserPriority = 1;
UINT32 VlanID = 777;         // Change this variable to the  correct value
VlanPriInfo.Value =          // Get the current value
      NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, Ieee8021QInfo); 
VlanPriInfo.TagHeader.UserPriority = UserPriority; // Set the priority
VlanPriInfo.TagHeader.VlanId = VlanID; // Set the VLAN ID
VlanPriInfo.TagHeader.CanonicalFormatId = 0; // Should be zero.
VlanPriInfo.TagHeader.Reserved = 0; // Should be zero.
NDIS_PER_PACKET_INFO_FROM_PACKET(pPacketDesc, Ieee8021QInfo) = 
                                            VlanPriInfo.Value; 

 

 

Send comments about this topic to Microsoft