DrvDedicatedNic.cpp revision c58f1213e628a545081c70e26c6b67a841cff880
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * DrvDedicatedNic - Experimental network driver for using a dedicated (V)NIC.
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * Copyright (C) 2012 Oracle Corporation
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * This file is part of VirtualBox Open Source Edition (OSE), as
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * available from http://www.virtualbox.org. This file is free software;
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * you can redistribute it and/or modify it under the terms of the GNU
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * General Public License (GPL) as published by the Free Software
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov * Foundation, in version 2 as it comes in the "COPYING" file of the
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov/*******************************************************************************
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov* Header Files *
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore*******************************************************************************/
#include "VBoxDD.h"
typedef struct DRVDEDICATEDNIC
bool fLinkDown;
bool fXmitOnXmitThread;
typedef enum DRVDEDICATEDNICR0OP
#ifdef IN_RING0
PDMBOTHCBDECL(int) drvR0DedicatedNicReqHandler(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg)
case DRVDEDICATEDNICR0OP_INIT:
case DRVDEDICATEDNICR0OP_TERM:
case DRVDEDICATEDNICR0OP_RECV:
case DRVDEDICATEDNICR0OP_SEND:
case DRVDEDICATEDNICR0OP_END:
return VERR_INVALID_FUNCTION;
return VINF_SUCCESS;
return rc;
return VERR_NET_DOWN;
#ifdef IN_RING0
return VERR_TRY_AGAIN;
if (RT_UNLIKELY((pThis->XmitSg.fFlags & PDMSCATTERGATHER_FLAGS_MAGIC_MASK) == PDMSCATTERGATHER_FLAGS_MAGIC))
return VERR_TRY_AGAIN;
return VERR_NO_MEMORY;
if (!pGso)
return VINF_SUCCESS;
if (pSgBuf)
#ifdef IN_RING0
return VINF_SUCCESS;
PDMBOTHCBDECL(int) drvDedicatedNicUp_SendBuf(PPDMINETWORKUP pInterface, PPDMSCATTERGATHER pSgBuf, bool fOnWorkerThread)
#ifdef IN_RING0
#ifdef IN_RING0
return VERR_INTERNAL_ERROR_4;
return rc;
PDMBOTHCBDECL(void) drvDedicatedNicUp_SetPromiscuousMode(PPDMINETWORKUP pInterface, bool fPromiscuous)
#ifdef IN_RING3
static DECLCALLBACK(void) drvR3DedicatedNicUp_NotifyLinkChanged(PPDMINETWORKUP pInterface, PDMNETWORKLINKSTATE enmLinkState)
bool fLinkDown;
switch (enmLinkState)
case PDMNETWORKLINKSTATE_DOWN:
fLinkDown = true;
case PDMNETWORKLINKSTATE_UP:
fLinkDown = false;
LogFlow(("drvR3DedicatedNicUp_NotifyLinkChanged: enmLinkState=%d %d->%d\n", enmLinkState, pThis->fLinkDown, fLinkDown));
static DECLCALLBACK(RTR0PTR) drvR3DedicatedNicIBaseR0_QueryInterface(PPDMIBASER0 pInterface, const char *pszIID)
return NIL_RTR0PTR;
static DECLCALLBACK(void *) drvR3DedicatedNicIBase_QueryInterface(PPDMIBASE pInterface, const char *pszIID)
return NULL;
static DECLCALLBACK(int) drvR3DedicatedNicConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
return VERR_NOT_IMPLEMENTED;
sizeof(DRVDEDICATEDNIC),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,