質問

Have a single PCI device which contains three NICs, courtesy of Altera Ethernet cores. Must implement for WinXPe thus NDIS 5.1. MVPs have suggested implementing a WDM driver for each core, then a single NDIS driver that talks to the individual WDM drivers, which I do not understand, given that a single NDIS driver does not appear to have any concept of multiple ports or channels.

What if at DriverEntry the NDIS driver called NdisMInitializeWrapper once for each ethernet core? It would need to call each time with the same DriverObject, but would presumably get back a different NdisWrapperHandle with each call. That unique NdisWrapperHandle could be used as a context specifier for calls to all other NDIS driver functions.

役に立ちましたか?

解決

That won't work; NdisMInitializeWrapper can only be called once per driver.

The rule is: you need to have one device node per network interface. Therefore, if you want 3 Ethernet interfaces, you'll need 3 device nodes in the system. There are a couple ways to get there:

  1. The PCI bus will create a device node for each PCI function number. If your PCI device exposes 3 functions to the bus, then Windows will enumerate 3 miniport device objects. This makes the driver super simple. But, obviously, you have to be able to rejigger the hardware to do this.

  2. Alternatively, if you are stuck with only one PCI device with one PCI function, then you need to multiplex the PCI-enumerated device node yourself. This means you should create your own Virtual Bus Driver (VBD). The PCI bus enumerates one device node, which is associated with the driver for your VBD. Then your VBD turns around and enumerates 3 child nodes, each of which is associated with a miniport.

    This approach takes considerably more work, since now you need to write two drivers. Fortunately, WDF makes writing a bus driver possible for mere mortals. Your VBD needs to implement code to share resources (interrupts, config space) among the child network miniports.

The big-name vendors are split on whether they chose option #1 or option #2, so both can work. From your description, it sounds like you've already been given advice to implement a VBD.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top