How NDIS set 802.1P and 802.1Q tag information inside a packet ?

I am trying to learn NDIS 802.11 priority setting in driver . Actually i am testing a Virtual miniport driver . It has filter driver which will bind over all the available physical NIC .

Actually this 802.11p behavior i found when Virtual miniport driver test for 2c_priority test in HLK . This test checks the miniport driver’s ability to send 802.1p priority packets with DIRECTED filter .

Now i read lot of useful documents related to 802.11 P and 802.11 Q from Microsoft . Briefly I need to set followings :

For send path :

If the VLAN tag or priority tag is present, the miniport driv= er should insert the 802.1Q header into the packet with the specified VLAN = ID.

For receive path :

Miniport drivers should strip the 802.1Q header from the packet. Do not indicate packets with the= 802.1Q header in the packet payload data stream.

I think my understanding is correct .

But my Virtual miniport driver doesn’t support 802.1 P property . So i need to add this in my driver code . I added the NDIS_MAC_OPTION_8021P_PRIORITY and NDIS_MAC_OPTION_8021Q_VLAN in mac_option OID . Also i added some values in this miniport for registry .

; PriorityVLANTag

HKR, Ndi\Params*PriorityVLANTag, ParamDesc, , %*PriorityVLANTag%
HKR, Ndi\Params*PriorityVLANTag, default, , “3”
HKR, Ndi\Params*PriorityVLANTag, type, , “enum”
HKR, Ndi\Params*PriorityVLANTag\enum, 0, , %PriorityVLANDisabled%
HKR, Ndi\Params*PriorityVLANTag\enum, 1, , %PriorityEnabled%
HKR, Ndi\Params*PriorityVLANTag\enum, 2, , %VLANEnabled%
HKR, Ndi\Params*PriorityVLANTag\enum, 3, , %PriorityVLANEnabled%

;-- VlanID used

HKR, Ndi\params\VlanID, ParamDesc, 0, %VlanID%
HKR, Ndi\params\VlanID, default, 0, “0”
HKR, Ndi\params\VlanID, type, 0, “long”
HKR, Ndi\params\VlanID, min, 0, “0”
HKR, Ndi\params\VlanID, max, 0, “4095”
HKR, Ndi\params\VlanID, step, 0, “1”
HKR, Ndi\params\VlanID, ParamDesc, 0, %VlanID%

So this is exactly what i done for supporting 802.11P Hardware . I didn’t add any adding or stripping 802.1 P sen/receive code till now . When HLK run test , i can see following logs :

============================================
NdisRequest

  • OpenID = 0x01010001
  • OID = OID_GEN_CURRENT_PACKET_FILTER

StartPriority

-OpenID = 0x01010001

  • PriorityServer OpenId = 0x02010001
  • DestinationAddress = mac_address
  • PacketCount = 100
  • PacketSize = 64
  • Delay = 4
  • Mode = 2

Packet Received with Wrong priority = 100
No packet were received with correct Priority !!!

Now i have some doubts . I am trying to study this property Now :

  1. If HLK send 802.1 P packets , can i able to see priority and VLAN values using
    ================================================
    NDIS_NET_BUFFER_LIST_8021Q_INFO NdisPacket8021qInfo;
    NdisPacket8021qInfo.Value = NET_BUFFER_LIST_INFO(NetBufferList, Ieee8021QNetBufferListInfo);

I tried to print NdisPacket8021qInfo.TagHeader.VlanId and NdisPacket8021qInfo.TagHeader.UserPriority .

But i am getting NdisPacket8021qInfo.TagHeader.VlanId = 0 and NdisPacket8021qInfo.TagHeader.UserPriority = 0 . From logs , HLK will test with Non-zero values . isn’t ? I print these values inside miniport sendNetbufferList function and also in Filter ReceiveNetbufferList function . Always i am getting zero values .

2 ) Next i don’t want to add 802.11 p Support in my driver . But HLK is listing this Test . Any way to avoid this test or this is mandatory for NDIS 6.2 ?

  1. virtual driver act as dummy only . if it’s connect , the filter driver will receive/send packets through the Real physical NIC . I am not return and receive any packets in Virtual driver . I am using for only Send packets at the intial time .This is a VPN kind of code . So will this test work on such kind of Miniport driver ?

Any suggestions ? Thanks