DrvTAPOs2.cpp revision 7e74e5d9c5956c67a23435fe7d401a56c31c5ab5
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/** $Id$ */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/** @file
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * VBox network devices: OS/2 TAP network transport driver.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/*
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * available from http://www.virtualbox.org. This file is free software;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * General Public License (GPL) as published by the Free Software
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * additional information or have any questions.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/*******************************************************************************
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync* Header Files *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync*******************************************************************************/
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#define LOG_GROUP LOG_GROUP_DRV_TUN
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include <VBox/pdmdrv.h>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include <iprt/assert.h>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include <iprt/file.h>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include <iprt/string.h>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include <iprt/thread.h>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include <iprt/alloca.h>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include <iprt/asm.h>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include <iprt/semaphore.h>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include "Builtins.h"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#define INCL_BASE
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include <os2.h>
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#include "DrvTAPOs2.h"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/*******************************************************************************
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync* Structures and Typedefs *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync*******************************************************************************/
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/**
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Block driver instance data.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsynctypedef struct DRVTAPOS2
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync{
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** The network interface. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync PDMINETWORKCONNECTOR INetworkConnector;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** The network interface. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync PPDMINETWORKPORT pPort;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** Pointer to the driver instance. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync PPDMDRVINS pDrvIns;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** TAP device file handle. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync RTFILE hDevice;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** Out LAN number. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync int32_t iLan;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** The LAN number we're connected to. -1 if not connected. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync int32_t iConnectedTo;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** Receiver thread. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync PPDMTHREAD pThread;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** Set if the link is down.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * When the link is down all incoming packets will be dropped. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync bool volatile fLinkDown;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** The log and thread name. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync char szName[16];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** The \DEV\TAP$ device name. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync char szDevice[32];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#ifdef VBOX_WITH_STATISTICS
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** Number of sent packets. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAMCOUNTER StatPktSent;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** Number of sent bytes. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAMCOUNTER StatPktSentBytes;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** Number of received packets. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAMCOUNTER StatPktRecv;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** Number of received bytes. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAMCOUNTER StatPktRecvBytes;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** Profiling packet transmit runs. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAMPROFILE StatTransmit;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** Profiling packet receive runs. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAMPROFILEADV StatReceive;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#endif /* VBOX_WITH_STATISTICS */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#ifdef LOG_ENABLED
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** The nano ts of the last transfer. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync uint64_t u64LastTransferTS;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** The nano ts of the last receive. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync uint64_t u64LastReceiveTS;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#endif
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync} DRVTAPOS2, *PDRVTAPOS2;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/** Converts a pointer to TAP::INetworkConnector to a PRDVTAP. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#define PDMINETWORKCONNECTOR_2_DRVTAPOS2(pInterface) ( (PDRVTAPOS2)((uintptr_t)pInterface - RT_OFFSETOF(DRVTAPOS2, INetworkConnector)) )
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/**
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Send data to the network.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @returns VBox status code.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param pInterface Pointer to the interface structure containing the called function pointer.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param pvBuf Data to send.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param cb Number of bytes to send.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @thread EMT
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic DECLCALLBACK(int) drvTAPOs2Send(PPDMINETWORKCONNECTOR pInterface, const void *pvBuf, size_t cb)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync{
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync PDRVTAPOS2 pThis = PDMINETWORKCONNECTOR_2_DRVTAPOS2(pInterface);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAM_COUNTER_INC(&pThis->StatPktSent);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAM_COUNTER_ADD(&pThis->StatPktSentBytes, cb);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAM_PROFILE_START(&pThis->StatTransmit, a);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /*
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * If the pvBuf is a high address, we'll have to copy it onto a
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * stack buffer of the tap driver will trap.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if ((uintptr_t)pvBuf >= _1M*512)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync void *pvBufCopy = alloca(cb);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync memcpy(pvBufCopy, pvBuf, cb);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync pvBuf = pvBufCopy;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#ifdef LOG_ENABLED
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync uint64_t u64Now = RTTimeProgramNanoTS();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync LogFlow(("%s: Send: %-4d bytes at %RU64 ns deltas: recv=%RU64 xmit=%RU64\n", pThis->szName,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync cb, u64Now, u64Now - pThis->u64LastReceiveTS, u64Now - pThis->u64LastTransferTS));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync pThis->u64LastTransferTS = u64Now;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Log2(("%s Send: pvBuf=%p cb=%#zx\n"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync "%.*Vhxd\n",
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync pThis->szName, pvBuf, cb, cb, pvBuf));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#endif
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ULONG Parm[2] = { ~0UL, ~0UL }; /* mysterious output */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ULONG cbParm = sizeof(Parm);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ULONG cbData = cb;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync int rc = DosDevIOCtl(pThis->hDevice, PROT_CATEGORY, TAP_WRITE_PACKET,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync &Parm[0], cbParm, &cbParm,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync (void *)pvBuf, cbData, &cbData);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (RT_UNLIKELY(rc || Parm[0]))
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync static unsigned cComplaints = 0;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (cComplaints++ < 256)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync LogRel(("%s: send failed. rc=%d Parm={%ld,%ld} cb=%d\n",
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync pThis->szName, rc, Parm[0], Parm[1], cb));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (rc)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync rc = RTErrConvertFromOS2(rc);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync rc = VERR_IO_GEN_FAILURE;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Log3(("%s: Send completed %d ns\n", pThis->szName, RTTimeProgramNanoTS() - pThis->u64LastTransferTS));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAM_PROFILE_STOP(&pThis->StatTransmit, a);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync AssertRC(rc);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return rc;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync}
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/**
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Set promiscuous mode.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * This is called when the promiscuous mode is set. This means that there doesn't have
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * to be a mode change when it's called.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param pInterface Pointer to the interface structure containing the called function pointer.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param fPromiscuous Set if the adaptor is now in promiscuous mode. Clear if it is not.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @thread EMT
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic DECLCALLBACK(void) drvTAPOs2SetPromiscuousMode(PPDMINETWORKCONNECTOR pInterface, bool fPromiscuous)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync{
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync PDRVTAPOS2 pThis = PDMINETWORKCONNECTOR_2_DRVTAPOS2(pInterface);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync LogFlow(("%s: SetPromiscuousMode: fPromiscuous=%d\n", pThis->szName, fPromiscuous));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync NOREF(pThis);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /** @todo is it always in promiscuous mode? */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync}
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/**
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Notification on link status changes.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param pInterface Pointer to the interface structure containing the called function pointer.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param enmLinkState The new link state.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @thread EMT
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic DECLCALLBACK(void) drvTAPOs2NotifyLinkChanged(PPDMINETWORKCONNECTOR pInterface, PDMNETWORKLINKSTATE enmLinkState)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync{
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync PDRVTAPOS2 pThis = PDMINETWORKCONNECTOR_2_DRVTAPOS2(pInterface);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync bool fLinkDown;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync switch (enmLinkState)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync case PDMNETWORKLINKSTATE_DOWN:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync case PDMNETWORKLINKSTATE_DOWN_RESUME:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fLinkDown = true;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync break;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync default:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync AssertMsgFailed(("enmLinkState=%d\n", enmLinkState));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync case PDMNETWORKLINKSTATE_UP:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fLinkDown = false;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync break;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync LogFlow(("%s: NotifyLinkChanged: enmLinkState=%d %d->%d\n", pThis->szName, pThis->fLinkDown, fLinkDown));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ASMAtomicXchgBool(&pThis->fLinkDown, fLinkDown);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync}
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/**
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Receiver thread.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @returns VBox status code. Returning failure will naturally terminate the thread.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param pDrvIns The pcnet device instance.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param pThread The thread.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic DECLCALLBACK(int) drvTAPOs2ReceiveThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync{
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync PDRVTAPOS2 pThis = PDMINS2DATA(pDrvIns, PDRVTAPOS2);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /*
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * No initialization work to do, just return immediately.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (pThread->enmState == PDMTHREADSTATE_INITIALIZING)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return VINF_SUCCESS;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Assert(pThread->enmState == PDMTHREADSTATE_RUNNING);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /*
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Loop while the thread is running, quit immediately when
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * we're supposed to suspend or terminate.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync while (pThread->enmState == PDMTHREADSTATE_RUNNING)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /*
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Read a frame, this will block for a while if nothing to read.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync char abBuf[4096];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ULONG Parm[2] = { ~0UL, ~0UL }; /* mysterious output */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ULONG cbParm = sizeof(Parm); /* this one is actually ignored... */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ULONG cbBuf = sizeof(abBuf);
f5f22d30238f9adf5a42a510ff1683bca461600cvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync int rc = DosDevIOCtl(pThis->hDevice, PROT_CATEGORY, TAP_READ_PACKET,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync &Parm[0], cbParm, &cbParm,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync &abBuf[0], cbBuf, &cbBuf);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (pThread->enmState != PDMTHREADSTATE_RUNNING)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync break;
3f8c00daa9a41eeb005842cd21f9edbe0ed61193vboxsync const size_t cbRead = Parm[1];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if ( !rc
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync && !Parm[0]
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync && cbRead > 0 /* cbRead */)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync AssertMsg(cbRead <= 1536, ("cbRead=%d\n", cbRead));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /*
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Wait for the device to have some room. A return code != VINF_SUCCESS
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * means that we were woken up during a VM state transition. Drop the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * current packet and wait for the next one.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync rc = pThis->pPort->pfnWaitReceiveAvail(pThis->pPort, RT_INDEFINITE_WAIT);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (RT_FAILURE(rc))
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync continue;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /*
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Pass the data up.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#ifdef LOG_ENABLED
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync uint64_t u64Now = RTTimeProgramNanoTS();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync LogFlow(("%s: ReceiveThread: %-4d bytes at %RU64 ns deltas: recv=%RU64 xmit=%RU64\n", pThis->szName,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync cbRead, u64Now, u64Now - pThis->u64LastReceiveTS, u64Now - pThis->u64LastTransferTS));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync pThis->u64LastReceiveTS = u64Now;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#endif
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Log2(("%s: ReceiveThread: cbRead=%#x\n"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync "%.*Vhxd\n",
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync pThis->szName, cbRead, cbRead, abBuf));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAM_COUNTER_INC(&pThis->StatPktRecv);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync STAM_COUNTER_ADD(&pThis->StatPktRecvBytes, cbRead);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync rc = pThis->pPort->pfnReceive(pThis->pPort, abBuf, cbRead);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync AssertRC(rc);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /* we'll be returning ~1 per second with no data; rc=0 Parm[0] = 1, Parm[1] = 0. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync else if (rc)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync LogFlow(("%s: ReceiveThread: DoDevIOCtl -> %s Parm={%ld, %ld}\n",
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync pThis->szName, rc, Parm[0], Parm[1]));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync rc = RTErrConvertFromOS2(rc);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (rc == VERR_INVALID_HANDLE)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return rc;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync RTThreadYield();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /* The thread is being suspended or terminated. */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return VINF_SUCCESS;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync}
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/**
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Unblock the send thread so it can respond to a state change.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @returns VBox status code.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param pDrvIns The pcnet device instance.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param pThread The send thread.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncstatic DECLCALLBACK(int) drvTAPOs2WakeupReceiveThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync{
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync PDRVTAPOS2 pThis = PDMINS2DATA(pDrvIns, PDRVTAPOS2);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync LogFlow(("%s: WakeupReceiveThread\n", pThis->szName));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /* cancel any pending reads */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ULONG Parm[2] = { ~0UL, ~0UL }; /* mysterious output */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ULONG cbParm = sizeof(Parm);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ULONG Data = pThis->iLan; /* right? */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ULONG cbData = sizeof(Data);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync int orc = DosDevIOCtl(pThis->hDevice, PROT_CATEGORY, TAP_CANCEL_READ,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync &Parm[0], cbParm, &cbParm,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync &Data, cbData, &cbData);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync AssertMsg(orc == 0, ("%d\n", orc)); NOREF(orc);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return VINF_SUCCESS;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync}
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/**
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Queries an interface to the driver.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @returns Pointer to interface.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @returns NULL if the interface was not supported by the driver.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param pInterface Pointer to this interface structure.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * @param enmInterface The requested interface identification.
* @thread Any thread.
*/
static DECLCALLBACK(void *) drvTAPOs2QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
{
PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
PDRVTAPOS2 pThis = PDMINS2DATA(pDrvIns, PDRVTAPOS2);
switch (enmInterface)
{
case PDMINTERFACE_BASE:
return &pDrvIns->IBase;
case PDMINTERFACE_NETWORK_CONNECTOR:
return &pThis->INetworkConnector;
default:
return NULL;
}
}
/**
* Destruct a driver instance.
*
* Most VM resources are freed by the VM. This callback is provided so that any non-VM
* resources can be freed correctly.
*
* @param pDrvIns The driver instance data.
*/
static DECLCALLBACK(void) drvTAPOs2Destruct(PPDMDRVINS pDrvIns)
{
PDRVTAPOS2 pThis = PDMINS2DATA(pDrvIns, PDRVTAPOS2);
LogFlow(("%s: Destruct\n", pThis->szName));
/* PDM will destroy the thread for us, it's suspended right now. */
/*
* Disconnect from the lan if we made a connection and close it.
*/
if (pThis->iConnectedTo != -1)
{
ULONG Parm[2] = { ~0UL, ~0UL }; /* mysterious output */
ULONG cbParm = sizeof(Parm);
ULONG Data = pThis->iConnectedTo;
ULONG cbData = sizeof(Data);
int orc = DosDevIOCtl(pThis->hDevice, PROT_CATEGORY, TAP_DISCONNECT_NIC,
&Parm, cbParm, &cbParm,
&Data, cbData, &cbData);
if ( orc
|| Parm[0])
LogRel(("%s: Failed to disconnect %d from %d! orc=%d Parm={%ld,%ld}\n",
pThis->szName, pThis->iLan, pThis->iConnectedTo, orc, Parm[0], Parm[1]));
pThis->iConnectedTo = -1;
}
if (pThis->hDevice != NIL_RTFILE)
{
int rc = RTFileClose(pThis->hDevice);
AssertRC(rc);
pThis->hDevice = NIL_RTFILE;
}
}
/**
* Construct a TAP network transport driver instance.
*
* @returns VBox status.
* @param pDrvIns The driver instance data.
* If the registration structure is needed, pDrvIns->pDrvReg points to it.
* @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration
* of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
* iInstance it's expected to be used a bit in this function.
*/
static DECLCALLBACK(int) drvTAPOs2Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
{
PDRVTAPOS2 pThis = PDMINS2DATA(pDrvIns, PDRVTAPOS2);
/*
* Init the static parts.
*/
pThis->pDrvIns = pDrvIns;
pThis->hDevice = NIL_RTFILE;
pThis->iLan = -1;
pThis->iConnectedTo = -1;
pThis->pThread = NULL;
RTStrPrintf(pThis->szName, sizeof(pThis->szName), "TAP%d", pDrvIns->iInstance);
/* IBase */
pDrvIns->IBase.pfnQueryInterface = drvTAPOs2QueryInterface;
/* INetwork */
pThis->INetworkConnector.pfnSend = drvTAPOs2Send;
pThis->INetworkConnector.pfnSetPromiscuousMode = drvTAPOs2SetPromiscuousMode;
pThis->INetworkConnector.pfnNotifyLinkChanged = drvTAPOs2NotifyLinkChanged;
/*
* Validate the config.
*/
if (!CFGMR3AreValuesValid(pCfgHandle, "Device\0ConnectTo\0"))
return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, "");
/*
* Check that no-one is attached to us.
*/
int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, NULL);
if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_NO_ATTACH,
N_("Configuration error: Cannot attach drivers to the TAP driver"));
/*
* Query the network port interface.
*/
pThis->pPort = (PPDMINETWORKPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_NETWORK_PORT);
if (!pThis->pPort)
return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE,
N_("Configuration error: The above device/driver didn't export the network port interface"));
/*
* Read the configuration.
*/
rc = CFGMR3QueryString(pCfgHandle, "Device", &pThis->szDevice[0], sizeof(pThis->szDevice));
if (rc == VERR_CFGM_VALUE_NOT_FOUND)
strcpy(pThis->szDevice, "\\DEV\\TAP$");
else if (VBOX_FAILURE(rc))
return PDMDRV_SET_ERROR(pDrvIns, rc,
N_("Configuration error: Query for \"Device\" failed"));
int32_t iConnectTo;
rc = CFGMR3QueryS32(pCfgHandle, "ConnectTo", &iConnectTo);
if (rc == VERR_CFGM_VALUE_NOT_FOUND)
iConnectTo = -1;
else if (VBOX_FAILURE(rc))
return PDMDRV_SET_ERROR(pDrvIns, rc,
N_("Configuration error: Query for \"ConnectTo\" failed"));
/*
* Open the device.
* Keep in mind that the destructor is always called!
*/
rc = RTFileOpen(&pThis->hDevice, pThis->szDevice, RTFILE_O_DENY_NONE | RTFILE_O_READ);
if (VBOX_FAILURE(rc))
return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
N_("Failed to open tap device '%s'"), pThis->szDevice);
ULONG Parm[2] = { ~0UL, ~0UL }; /* mysterious output */
ULONG cbParm = sizeof(Parm);
ULONG Data = ~0UL;
ULONG cbData = sizeof(Data);
int orc = DosDevIOCtl(pThis->hDevice, PROT_CATEGORY, TAP_GET_LAN_NUMBER,
&Parm, cbParm, &cbParm,
&Data, cbData, &cbData);
if (orc)
rc = RTErrConvertFromOS2(orc);
else if (Parm[0])
rc = VERR_GENERAL_FAILURE;
if (VBOX_FAILURE(rc))
return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
N_("Failed to query LanNumber! orc=%d Parm={%ld,%ld}"),
orc, Parm[0], Parm[1]);
pThis->iLan = (int32_t)Data;
Log(("%s: iLan=%d Parm[1]=%ld\n", pThis->szName, pThis->iLan, Parm[1]));
/*
* Connect it requested.
*/
if (iConnectTo != -1)
{
if (iConnectTo == pThis->iLan)
return PDMDrvHlpVMSetError(pDrvIns, VERR_INVALID_PARAMETER, RT_SRC_POS,
N_("Cannot connect to ourself (%d)"), iConnectTo);
Parm[0] = Parm[1] = ~0UL; /* mysterious output */
cbParm = sizeof(Parm);
Data = iConnectTo;
cbData = sizeof(Data);
int orc = DosDevIOCtl(pThis->hDevice, PROT_CATEGORY, TAP_CONNECT_NIC,
&Parm, cbParm, &cbParm,
&Data, cbData, &cbData);
if (orc)
rc = RTErrConvertFromOS2(orc);
else if (Parm[0])
rc = VERR_GENERAL_FAILURE;
if (VBOX_FAILURE(rc))
return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
N_("Failed to connect %d to %d! orc=%d Parm={%ld,%ld}"),
pThis->iLan, iConnectTo, orc, Parm[0], Parm[1]);
Log(("%s: Connected to %d\n", pThis->szName, iConnectTo));
pThis->iConnectedTo = iConnectTo;
}
/*
* Log the config.
*/
Parm[0] = Parm[1] = ~0UL; /* mysterious output */
RTMAC Mac;
cbParm = sizeof(Parm);
cbData = sizeof(Mac);
orc = DosDevIOCtl(pThis->hDevice, PROT_CATEGORY, TAP_READ_MAC_ADDRESS,
&Parm[0], cbParm, &cbParm,
&Mac, cbData, &cbData);
if ( !orc
&& !Parm[0]
/*&& !Parm[1]?*/)
LogRel(("%s: iLan=%d iConnectedTo=%d Mac=%02x:%02x:%02x:%02x:%02x:%02x\n",
pThis->szName, pThis->iLan, pThis->iConnectedTo,
Mac.au8[0], Mac.au8[1], Mac.au8[2], Mac.au8[3], Mac.au8[4], Mac.au8[5]));
else
LogRel(("%s: iLan=%d iConnectedTo Mac=failed - orc=%d Parm={%ld,%ld}\n",
pThis->szName, pThis->iLan, pThis->iConnectedTo, Parm[0], Parm[1]));
rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pThis->pThread, pThis, drvTAPOs2ReceiveThread, drvTAPOs2WakeupReceiveThread,
0, RTTHREADTYPE_IO, pThis->szName);
AssertRCReturn(rc, rc);
#ifdef VBOX_WITH_STATISTICS
/*
* Statistics.
*/
PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatPktSent, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of sent packets.", "/Drivers/TAP%d/Packets/Sent", pDrvIns->iInstance);
PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatPktSentBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Number of sent bytes.", "/Drivers/TAP%d/Bytes/Sent", pDrvIns->iInstance);
PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatPktRecv, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of received packets.", "/Drivers/TAP%d/Packets/Received", pDrvIns->iInstance);
PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatPktRecvBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Number of received bytes.", "/Drivers/TAP%d/Bytes/Received", pDrvIns->iInstance);
PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatTransmit, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling packet transmit runs.", "/Drivers/TAP%d/Transmit", pDrvIns->iInstance);
PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReceive, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling packet receive runs.", "/Drivers/TAP%d/Receive", pDrvIns->iInstance);
#endif /* VBOX_WITH_STATISTICS */
return rc;
}
/**
* TAP network transport driver registration record.
*/
const PDMDRVREG g_DrvHostInterface =
{
/* u32Version */
PDM_DRVREG_VERSION,
/* szDriverName */
"HostInterface",
/* pszDescription */
"TAP Network Transport Driver",
/* fFlags */
PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
/* fClass. */
PDM_DRVREG_CLASS_NETWORK,
/* cMaxInstances */
~0,
/* cbInstance */
sizeof(DRVTAPOS2),
/* pfnConstruct */
drvTAPOs2Construct,
/* pfnDestruct */
drvTAPOs2Destruct,
/* pfnIOCtl */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
NULL,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnDetach */
NULL,
/* pfnPowerOff */
NULL
};