Changeset 28320 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Apr 14, 2010 6:26:24 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 60079
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r28277 r28320 31 31 */ 32 32 33 #define VBOX_WITH_TX_THREAD_IN_NET_DEVICES 1 //debug, bird, remove34 33 #define LOG_GROUP LOG_GROUP_DEV_E1000 35 34 … … 907 906 PDMILEDPORTS ILeds; /**< LED interface */ 908 907 R3PTRTYPE(PPDMIBASE) pDrvBase; /**< Attached network driver. */ 909 R3PTRTYPE(PPDMINETWORKUP) pDrv; /**< Connector of attached network driver. */910 908 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; 911 #if HC_ARCH_BITS == 32912 uint32_t u32Padding;913 #endif914 909 915 910 PPDMDEVINSR3 pDevInsR3; /**< Device instance - R3. */ 916 911 R3PTRTYPE(PPDMQUEUE) pTxQueueR3; /**< Transmit queue - R3. */ 917 912 R3PTRTYPE(PPDMQUEUE) pCanRxQueueR3; /**< Rx wakeup signaller - R3. */ 913 PPDMINETWORKUPR3 pDrvR3; /**< Attached network driver - R3. */ 918 914 PTMTIMERR3 pRIDTimerR3; /**< Receive Interrupt Delay Timer - R3. */ 919 915 PTMTIMERR3 pRADTimerR3; /**< Receive Absolute Delay Timer - R3. */ … … 922 918 PTMTIMERR3 pIntTimerR3; /**< Late Interrupt Timer - R3. */ 923 919 PTMTIMERR3 pLUTimerR3; /**< Link Up(/Restore) Timer. */ 920 /** The scatter / gather buffer used for the current outgoing packet - R3. */ 921 R3PTRTYPE(PPDMSCATTERGATHER) pTxSgR3; 924 922 925 923 PPDMDEVINSR0 pDevInsR0; /**< Device instance - R0. */ 926 924 R0PTRTYPE(PPDMQUEUE) pTxQueueR0; /**< Transmit queue - R0. */ 927 925 R0PTRTYPE(PPDMQUEUE) pCanRxQueueR0; /**< Rx wakeup signaller - R0. */ 926 PPDMINETWORKUPR0 pDrvR0; /**< Attached network driver - R0. */ 928 927 PTMTIMERR0 pRIDTimerR0; /**< Receive Interrupt Delay Timer - R0. */ 929 928 PTMTIMERR0 pRADTimerR0; /**< Receive Absolute Delay Timer - R0. */ … … 932 931 PTMTIMERR0 pIntTimerR0; /**< Late Interrupt Timer - R0. */ 933 932 PTMTIMERR0 pLUTimerR0; /**< Link Up(/Restore) Timer - R0. */ 933 /** The scatter / gather buffer used for the current outgoing packet - R0. */ 934 R0PTRTYPE(PPDMSCATTERGATHER) pTxSgR0; 934 935 935 936 PPDMDEVINSRC pDevInsRC; /**< Device instance - RC. */ 936 937 RCPTRTYPE(PPDMQUEUE) pTxQueueRC; /**< Transmit queue - RC. */ 937 938 RCPTRTYPE(PPDMQUEUE) pCanRxQueueRC; /**< Rx wakeup signaller - RC. */ 939 PPDMINETWORKUPRC pDrvRC; /**< Attached network driver - RC. */ 938 940 PTMTIMERRC pRIDTimerRC; /**< Receive Interrupt Delay Timer - RC. */ 939 941 PTMTIMERRC pRADTimerRC; /**< Receive Absolute Delay Timer - RC. */ … … 942 944 PTMTIMERRC pIntTimerRC; /**< Late Interrupt Timer - RC. */ 943 945 PTMTIMERRC pLUTimerRC; /**< Link Up(/Restore) Timer - RC. */ 944 945 #if HC_ARCH_BITS != 32 946 uint32_t u32Padding2; 947 #endif 948 949 #ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 950 PPDMTHREAD pTxThread; /**< Transmit thread. */ 951 #endif 946 /** The scatter / gather buffer used for the current outgoing packet - RC. */ 947 RCPTRTYPE(PPDMSCATTERGATHER) pTxSgRC; 948 RTRCPTR RCPtrAlignment; 949 952 950 PDMCRITSECT cs; /**< Critical section - what is it protecting? */ 953 951 #ifndef E1K_GLOBAL_MUTEX … … 955 953 // PDMCRITSECT csTx; /**< TX Critical section. */ 956 954 #endif 955 #ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 957 956 /** Transmit thread blocker. */ 958 # ifdef E1K_USE_SUPLIB_SEMEVENT957 # ifdef E1K_USE_SUPLIB_SEMEVENT 959 958 SUPSEMEVENT hTxSem; 960 # else959 # else 961 960 RTSEMEVENT hTxSem; 961 # endif 962 #endif 963 #ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 964 PPDMTHREAD pTxThread; /**< Transmit thread. */ 962 965 #endif 963 966 /** Base address of memory-mapped registers. */ … … 1016 1019 * applicable to the current TSE mode. */ 1017 1020 PDMNETWORKGSO GsoCtx; 1018 /** The scatter / gather buffer used for the current outgoing packet. */1019 R3PTRTYPE(PPDMSCATTERGATHER) pTxSgR3;1020 1021 /** Scratch space for holding the loopback / fallback scatter / gather 1021 1022 * descriptor. */ … … 1134 1135 PDMBOTHCBDECL(int) e1kIOPortOut(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT port, uint32_t u32, unsigned cb); 1135 1136 RT_C_DECLS_END 1137 1138 static int e1kXmitPending(E1KSTATE *pState, bool fOnWorkerThread); 1136 1139 1137 1140 static int e1kRegReadUnimplemented (E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t *pu32Value); … … 1329 1332 1330 1333 #ifdef DEBUG 1334 1331 1335 /** 1332 1336 * Convert U32 value to hex string. Masked bytes are replaced with dots. … … 1375 1379 return "unknown"; 1376 1380 } 1381 1377 1382 #endif /* DEBUG */ 1378 1383 … … 1424 1429 1425 1430 #define e1kCsRxEnter(ps, rc) VINF_SUCCESS 1426 #define e1kCsRxLeave(ps) 1431 #define e1kCsRxLeave(ps) do { } while (0) 1427 1432 1428 1433 #define e1kCsTxEnter(ps, rc) VINF_SUCCESS 1429 #define e1kCsTxLeave(ps) 1434 #define e1kCsTxLeave(ps) do { } while (0) 1430 1435 1431 1436 … … 1462 1467 1463 1468 #define e1kCsTxEnter(ps, rc) VINF_SUCCESS 1464 #define e1kCsTxLeave(ps) 1469 #define e1kCsTxLeave(ps) do { } while (0) 1465 1470 //#define e1kCsTxEnter(ps, rc) PDMCritSectEnter(&ps->csTx, rc) 1466 1471 //#define e1kCsTxLeave(ps) PDMCritSectLeave(&ps->csTx) … … 1516 1521 } 1517 1522 } 1523 #endif 1518 1524 1519 1525 /** … … 1699 1705 } 1700 1706 } 1701 #endif /* IN_RING3 */1702 1707 1703 1708 /** … … 1810 1815 } 1811 1816 1812 #ifdef IN_RING31813 1817 /** 1814 1818 * Compute the physical address of the descriptor. … … 2118 2122 } 2119 2123 2120 #endif /* IN_RING3 */2121 2124 2122 2125 #if 0 /* unused */ … … 2622 2625 if (RT_SUCCESS(rc)) 2623 2626 { 2624 #ifdef IN_RING3 2627 #ifdef IN_RING3 /** @todo bird: Use SUPSem* for this so we can signal it in ring-0 as well. (reduces latency) */ 2625 2628 /* Signal that we have more receive descriptors avalable. */ 2626 2629 e1kWakeupReceive(pState->CTX_SUFF(pDevIns)); … … 2674 2677 #ifdef IN_RING3 2675 2678 #ifdef E1K_USE_TX_TIMERS 2679 2676 2680 /** 2677 2681 * Transmit Interrupt Delay Timer handler. … … 2723 2727 } 2724 2728 } 2729 2725 2730 #endif /* E1K_USE_TX_TIMERS */ 2726 2727 2731 #ifdef E1K_USE_RX_TIMERS 2732 2728 2733 /** 2729 2734 * Receive Interrupt Delay Timer handler. … … 2773 2778 } 2774 2779 } 2780 2775 2781 #endif /* E1K_USE_RX_TIMERS */ 2776 2782 … … 2823 2829 } 2824 2830 2825 2831 #endif /* IN_RING3 */ 2826 2832 2827 2833 /** … … 2990 2996 static void e1kXmitFreeBuf(E1KSTATE *pState) 2991 2997 { 2992 PPDMSCATTERGATHER pSg = pState-> pTxSgR3;2998 PPDMSCATTERGATHER pSg = pState->CTX_SUFF(pTxSg); 2993 2999 if (pSg) 2994 3000 { 2995 pState-> pTxSgR3= NULL;3001 pState->CTX_SUFF(pTxSg) = NULL; 2996 3002 2997 3003 if (pSg->pvAllocator != pState) 2998 3004 { 2999 PPDMINETWORKUP pDrv = pState-> pDrv;3005 PPDMINETWORKUP pDrv = pState->CTX_SUFF(pDrv); 3000 3006 if (pDrv) 3001 3007 pDrv->pfnFreeBuf(pDrv, pSg); … … 3033 3039 3034 3040 /* Deal with existing buffer (descriptor screw up, reset, etc). */ 3035 if (RT_UNLIKELY(pState-> pTxSgR3))3041 if (RT_UNLIKELY(pState->CTX_SUFF(pTxSg))) 3036 3042 e1kXmitFreeBuf(pState); 3037 Assert(pState-> pTxSgR3== NULL);3043 Assert(pState->CTX_SUFF(pTxSg) == NULL); 3038 3044 3039 3045 /* … … 3043 3049 if (RT_LIKELY(GET_BITS(RCTL, LBM) != RCTL_LBM_TCVR)) 3044 3050 { 3045 PPDMINETWORKUP pDrv = pState-> pDrv;3051 PPDMINETWORKUP pDrv = pState->CTX_SUFF(pDrv); 3046 3052 if (RT_UNLIKELY(!pDrv)) 3047 3053 return VERR_NET_DOWN; … … 3065 3071 } 3066 3072 3067 pState-> pTxSgR3= pSg;3073 pState->CTX_SUFF(pTxSg) = pSg; 3068 3074 return VINF_SUCCESS; 3069 3075 } … … 3126 3132 static void e1kTransmitFrame(E1KSTATE* pState, bool fOnWorkerThread) 3127 3133 { 3128 PPDMSCATTERGATHER pSg = pState-> pTxSgR3;3134 PPDMSCATTERGATHER pSg = pState->CTX_SUFF(pTxSg); 3129 3135 uint32_t const cbFrame = pSg ? (size_t)pSg->cbUsed : 0; 3130 3136 Assert(!pSg || pSg->cSegs == 1); … … 3148 3154 /* Update octet transmit counter */ 3149 3155 E1K_ADD_CNT64(GOTCL, GOTCH, cbFrame); 3150 if (pState-> pDrv)3156 if (pState->CTX_SUFF(pDrv)) 3151 3157 STAM_REL_COUNTER_ADD(&pState->StatTransmitBytes, cbFrame); 3152 3158 if (cbFrame == 64) … … 3173 3179 e1kPacketDump(pState, (uint8_t const *)pSg->aSegs[0].pvSeg, cbFrame, "--> Outgoing"); 3174 3180 3175 pState-> pTxSgR3= NULL;3176 PPDMINETWORKUP pDrv = pState-> pDrv;3181 pState->CTX_SUFF(pTxSg) = NULL; 3182 PPDMINETWORKUP pDrv = pState->CTX_SUFF(pDrv); 3177 3183 if (pDrv) 3178 3184 { … … 3342 3348 * we copy of the data. 3343 3349 */ 3344 if (!pState-> pTxSgR3)3350 if (!pState->CTX_SUFF(pTxSg)) 3345 3351 e1kXmitAllocBuf(pState, pState->u16TxPktLen, true /*fExactSize*/, false /*fGso*/); 3346 if (pState-> pTxSgR3)3352 if (pState->CTX_SUFF(pTxSg)) 3347 3353 { 3348 Assert(pState->u16TxPktLen <= pState-> pTxSgR3->cbAvailable);3349 Assert(pState-> pTxSgR3->cSegs == 1);3350 if (pState-> pTxSgR3->aSegs[0].pvSeg != pState->aTxPacketFallback)3351 memcpy(pState-> pTxSgR3->aSegs[0].pvSeg, pState->aTxPacketFallback, pState->u16TxPktLen);3352 pState-> pTxSgR3->cbUsed = pState->u16TxPktLen;3353 pState-> pTxSgR3->aSegs[0].cbSeg = pState->u16TxPktLen;3354 Assert(pState->u16TxPktLen <= pState->CTX_SUFF(pTxSg)->cbAvailable); 3355 Assert(pState->CTX_SUFF(pTxSg)->cSegs == 1); 3356 if (pState->CTX_SUFF(pTxSg)->aSegs[0].pvSeg != pState->aTxPacketFallback) 3357 memcpy(pState->CTX_SUFF(pTxSg)->aSegs[0].pvSeg, pState->aTxPacketFallback, pState->u16TxPktLen); 3358 pState->CTX_SUFF(pTxSg)->cbUsed = pState->u16TxPktLen; 3359 pState->CTX_SUFF(pTxSg)->aSegs[0].cbSeg = pState->u16TxPktLen; 3354 3360 } 3355 3361 e1kTransmitFrame(pState, fOnWorkerThread); … … 3380 3386 static bool e1kFallbackAddToFrame(E1KSTATE* pState, E1KTXDESC* pDesc, uint32_t cbFragment, bool fOnWorkerThread) 3381 3387 { 3382 PPDMSCATTERGATHER pTxSg = pState-> pTxSgR3;3388 PPDMSCATTERGATHER pTxSg = pState->CTX_SUFF(pTxSg); 3383 3389 Assert(e1kGetDescType(pDesc) == E1K_DTYP_DATA); 3384 3390 Assert(pDesc->data.cmd.fTSE); … … 3444 3450 static bool e1kAddToFrame(E1KSTATE *pThis, RTGCPHYS PhysAddr, uint32_t cbFragment) 3445 3451 { 3446 PPDMSCATTERGATHER pTxSg = pThis-> pTxSgR3;3452 PPDMSCATTERGATHER pTxSg = pThis->CTX_SUFF(pTxSg); 3447 3453 bool const fGso = e1kXmitIsGsoBuf(pTxSg); 3448 3454 uint32_t const cbNewPkt = cbFragment + pThis->u16TxPktLen; … … 3628 3634 * transmit it and reset the u16TxPktLen field. 3629 3635 */ 3630 if (e1kXmitIsGsoBuf(pState-> pTxSgR3))3636 if (e1kXmitIsGsoBuf(pState->CTX_SUFF(pTxSg))) 3631 3637 { 3632 3638 STAM_COUNTER_INC(&pState->StatTxPathGSO); … … 3635 3641 { 3636 3642 if ( fRc 3637 && pState-> pTxSgR33638 && pState-> pTxSgR3->cbUsed == (size_t)pState->contextTSE.dw3.u8HDRLEN + pState->contextTSE.dw2.u20PAYLEN)3643 && pState->CTX_SUFF(pTxSg) 3644 && pState->CTX_SUFF(pTxSg)->cbUsed == (size_t)pState->contextTSE.dw3.u8HDRLEN + pState->contextTSE.dw2.u20PAYLEN) 3639 3645 { 3640 3646 e1kTransmitFrame(pState, fOnWorkerThread); … … 3645 3651 if (fRc) 3646 3652 E1kLog(("%s bad GSO/TSE %p or %u < %u\n" , INSTANCE(pState), 3647 pState-> pTxSgR3, pState->pTxSgR3 ? pState->pTxSgR3->cbUsed : 0,3653 pState->CTX_SUFF(pTxSg), pState->CTX_SUFF(pTxSg) ? pState->CTX_SUFF(pTxSg)->cbUsed : 0, 3648 3654 pState->contextTSE.dw3.u8HDRLEN + pState->contextTSE.dw2.u20PAYLEN)); 3649 3655 e1kXmitFreeBuf(pState); … … 3659 3665 if (pDesc->data.cmd.fEOP) 3660 3666 { 3661 if (fRc && pState-> pTxSgR3)3667 if (fRc && pState->CTX_SUFF(pTxSg)) 3662 3668 { 3663 Assert(pState-> pTxSgR3->cSegs == 1);3669 Assert(pState->CTX_SUFF(pTxSg)->cSegs == 1); 3664 3670 if (pState->fIPcsum) 3665 e1kInsertChecksum(pState, (uint8_t *)pState-> pTxSgR3->aSegs[0].pvSeg, pState->u16TxPktLen,3671 e1kInsertChecksum(pState, (uint8_t *)pState->CTX_SUFF(pTxSg)->aSegs[0].pvSeg, pState->u16TxPktLen, 3666 3672 pState->contextNormal.ip.u8CSO, 3667 3673 pState->contextNormal.ip.u8CSS, 3668 3674 pState->contextNormal.ip.u16CSE); 3669 3675 if (pState->fTCPcsum) 3670 e1kInsertChecksum(pState, (uint8_t *)pState-> pTxSgR3->aSegs[0].pvSeg, pState->u16TxPktLen,3676 e1kInsertChecksum(pState, (uint8_t *)pState->CTX_SUFF(pTxSg)->aSegs[0].pvSeg, pState->u16TxPktLen, 3671 3677 pState->contextNormal.tu.u8CSO, 3672 3678 pState->contextNormal.tu.u8CSS, … … 3754 3760 * Grab the xmit lock of the driver as well as the E1K device state. 3755 3761 */ 3756 PPDMINETWORKUP pDrv = pState-> pDrv;3762 PPDMINETWORKUP pDrv = pState->CTX_SUFF(pDrv); 3757 3763 if (pDrv) 3758 3764 { … … 3801 3807 return rc; 3802 3808 } 3809 3810 #ifdef IN_RING3 3803 3811 3804 3812 /** … … 3882 3890 E1KSTATE *pState = PDMINS_2_DATA(pDevIns, E1KSTATE *); 3883 3891 E1kLog2(("%s e1kTxQueueConsumer: Waking up TX thread...\n", INSTANCE(pState))); 3884 #ifdef E1K_USE_SUPLIB_SEMEVENT 3892 3893 #ifndef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 3894 int rc = e1kXmitPending(pState, false /*fOnWorkerThread*/); 3895 AssertMsg(RT_SUCCESS(rc) || rc == VERR_TRY_AGAIN, ("%Rrc\n", rc)); 3896 #else 3897 # ifdef E1K_USE_SUPLIB_SEMEVENT 3885 3898 int rc = SUPSemEventSignal(PDMDevHlpGetVM(pDevIns)->pSession, pState->hTxSem); 3886 # else3899 # else 3887 3900 int rc = RTSemEventSignal(pState->hTxSem); 3901 # endif 3902 AssertRC(rc); 3888 3903 #endif 3889 AssertRC(rc); 3904 3890 3905 return true; 3891 3906 } … … 3914 3929 static int e1kRegWriteTDT(E1KSTATE* pState, uint32_t offset, uint32_t index, uint32_t value) 3915 3930 { 3916 #ifndef IN_RING33917 // return VINF_IOM_HC_MMIO_WRITE;3918 #endif3919 3931 int rc = e1kCsTxEnter(pState, VINF_IOM_HC_MMIO_WRITE); 3920 3932 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 3921 3933 return rc; 3922 3934 rc = e1kRegWriteDefault(pState, offset, index, value); 3935 3923 3936 /* All descriptors starting with head and not including tail belong to us. */ 3924 3937 /* Process them. */ 3925 3938 E1kLog2(("%s e1kRegWriteTDT: TDBAL=%08x, TDBAH=%08x, TDLEN=%08x, TDH=%08x, TDT=%08x\n", 3926 3939 INSTANCE(pState), TDBAL, TDBAH, TDLEN, TDH, TDT)); 3940 3927 3941 /* Ignore TDT writes when the link is down. */ 3928 3942 if (TDH != TDT && (STATUS & STATUS_LU)) … … 3931 3945 E1kLog(("%s e1kRegWriteTDT: %d descriptors to process, waking up E1000_TX thread\n", 3932 3946 INSTANCE(pState), e1kGetTxLen(pState))); 3933 #if (defined(IN_RING3) || defined(IN_RING0)) && defined(E1K_USE_SUPLIB_SEMEVENT) 3947 #ifndef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 3948 e1kCsTxLeave(pState); 3949 3950 /* Transmit pending packets if possible, defere it if we cannot do it 3951 in the current context. */ 3952 # if defined(IN_RING0) || defined(IN_RC) 3953 if (!pState->CTX_SUFF(pDrv)) 3954 { 3955 PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pState->CTX_SUFF(pTxQueue)); 3956 if (RT_UNLIKELY(pItem)) 3957 PDMQueueInsert(pState->CTX_SUFF(pTxQueue), pItem); 3958 } 3959 else 3960 # endif 3961 { 3962 rc = e1kXmitPending(pState, false /*fOnWorkerThread*/); 3963 if (rc == VERR_TRY_AGAIN) 3964 rc = VINF_SUCCESS; 3965 AssertRC(rc); 3966 } 3967 #else 3968 # if (defined(IN_RING3) || defined(IN_RING0)) && defined(E1K_USE_SUPLIB_SEMEVENT) 3934 3969 rc = SUPSemEventSignal(PDMDevHlpGetVM(pState->CTX_SUFF(pDevIns))->pSession, pState->hTxSem); 3935 3970 AssertRC(rc); 3936 # elif defined(IN_RING3)3971 # elif defined(IN_RING3) 3937 3972 rc = RTSemEventSignal(pState->hTxSem); 3938 3973 AssertRC(rc); 3939 # else3974 # else 3940 3975 PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pState->CTX_SUFF(pTxQueue)); 3941 3976 if (RT_UNLIKELY(pItem)) 3942 3977 PDMQueueInsert(pState->CTX_SUFF(pTxQueue), pItem); 3943 #endif /* !IN_RING3 */ 3944 3945 } 3946 e1kCsTxLeave(pState); 3978 # endif /* !IN_RING3 */ 3979 #endif 3980 3981 } 3982 else 3983 e1kCsTxLeave(pState); 3947 3984 3948 3985 return rc; … … 5024 5061 e1kRaiseInterrupt(pState, VERR_SEM_BUSY, ICR_LSC); 5025 5062 } 5026 if (pState->pDrv )5027 pState->pDrv ->pfnNotifyLinkChanged(pState->pDrv, enmState);5063 if (pState->pDrvR3) 5064 pState->pDrvR3->pfnNotifyLinkChanged(pState->pDrvR3, enmState); 5028 5065 } 5029 5066 return VINF_SUCCESS; … … 5332 5369 */ 5333 5370 pState->pDrvBase = NULL; 5334 pState->pDrv = NULL; 5371 pState->pDrvR3 = NULL; 5372 pState->pDrvR0 = NIL_RTR0PTR; 5373 pState->pDrvRC = NIL_RTRCPTR; 5335 5374 5336 5375 PDMCritSectLeave(&pState->cs); … … 5375 5414 #endif 5376 5415 } 5377 pState->pDrv = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKUP);5378 AssertMsgStmt(pState->pDrv , ("Failed to obtain the PDMINETWORKUP interface!\n"),5416 pState->pDrvR3 = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKUP); 5417 AssertMsgStmt(pState->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"), 5379 5418 rc = VERR_PDM_MISSING_INTERFACE_BELOW); 5419 if (RT_SUCCESS(rc)) 5420 { 5421 PPDMIBASER0 pBaseR0 = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASER0); 5422 pState->pDrvR0 = pBaseR0 ? pBaseR0->pfnQueryInterface(pBaseR0, PDMINETWORKUP_IID) : NIL_RTR0PTR; 5423 5424 PPDMIBASERC pBaseRC = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASERC); 5425 pState->pDrvRC = pBaseRC ? pBaseRC->pfnQueryInterface(pBaseRC, PDMINETWORKUP_IID) : NIL_RTR0PTR; 5426 } 5380 5427 } 5381 5428 else if ( rc == VERR_PDM_NO_ATTACHED_DRIVER … … 5486 5533 pState->hEventMoreRxDescAvail = NIL_RTSEMEVENT; 5487 5534 } 5488 #ifdef E1K_USE_SUPLIB_SEMEVENT 5535 #ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 5536 # ifdef E1K_USE_SUPLIB_SEMEVENT 5489 5537 if (pState->hTxSem != NIL_SUPSEMEVENT) 5490 5538 { … … 5492 5540 pState->hTxSem = NIL_SUPSEMEVENT; 5493 5541 } 5494 # else5542 # else 5495 5543 if (pState->hTxSem != NIL_RTSEMEVENT) 5496 5544 { … … 5498 5546 pState->hTxSem = NIL_RTSEMEVENT; 5499 5547 } 5548 # endif 5500 5549 #endif 5501 5550 #ifndef E1K_GLOBAL_MUTEX … … 5625 5674 RTStrPrintf(pState->szInstance, sizeof(pState->szInstance), "E1000#%d", iInstance); 5626 5675 E1kLog(("%s Constructing new instance sizeof(E1KRXDESC)=%d\n", INSTANCE(pState), sizeof(E1KRXDESC))); 5627 #ifdef E1K_USE_SUPLIB_SEMEVENT 5676 #ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 5677 # ifdef E1K_USE_SUPLIB_SEMEVENT 5628 5678 pState->hTxSem = NIL_SUPSEMEVENT; 5629 # else5679 # else 5630 5680 pState->hTxSem = NIL_RTSEMEVENT; 5681 # endif 5631 5682 #endif 5632 5683 pState->hEventMoreRxDescAvail = NIL_RTSEMEVENT; … … 5853 5904 N_("A Domain Name Server (DNS) for NAT networking could not be determined. Ensure that your host is correctly connected to an ISP. If you ignore this warning the guest will not be able to perform nameserver lookups and it will probably observe delays if trying so")); 5854 5905 } 5855 pState->pDrv = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKUP);5856 AssertMsgReturn(pState->pDrv , ("Failed to obtain the PDMINETWORKUP interface!\n"),5906 pState->pDrvR3 = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKUP); 5907 AssertMsgReturn(pState->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"), 5857 5908 VERR_PDM_MISSING_INTERFACE_BELOW); 5909 5910 pState->pDrvR0 = PDMIBASER0_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASER0), PDMINETWORKUP); 5911 pState->pDrvRC = PDMIBASERC_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASERC), PDMINETWORKUP); 5858 5912 } 5859 5913 else if ( rc == VERR_PDM_NO_ATTACHED_DRIVER … … 5866 5920 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the network LUN")); 5867 5921 5868 #ifdef E1K_USE_SUPLIB_SEMEVENT 5922 #ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 5923 # ifdef E1K_USE_SUPLIB_SEMEVENT 5869 5924 rc = SUPSemEventCreate(PDMDevHlpGetVM(pDevIns)->pSession, &pState->hTxSem); 5870 # else5925 # else 5871 5926 rc = RTSemEventCreate(&pState->hTxSem); 5872 # endif5927 # endif 5873 5928 if (RT_FAILURE(rc)) 5874 5929 return rc; 5930 #endif 5875 5931 rc = RTSemEventCreate(&pState->hEventMoreRxDescAvail); 5876 5932 if (RT_FAILURE(rc)) -
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r28277 r28320 50 50 * THE SOFTWARE. 51 51 */ 52 #define VBOX_WITH_TX_THREAD_IN_NET_DEVICES 1 //debug, bird, remove 52 53 53 54 54 /******************************************************************************* … … 120 120 { 121 121 PCIDEVICE PciDev; 122 123 /** Pointer to the device instance - R3. */ 124 PPDMDEVINSR3 pDevInsR3; 125 /** Transmit signaller - R3. */ 126 R3PTRTYPE(PPDMQUEUE) pXmitQueueR3; 127 /** Receive signaller - R3. */ 128 R3PTRTYPE(PPDMQUEUE) pCanRxQueueR3; 129 /** Pointer to the connector of the attached network driver - R3. */ 130 PPDMINETWORKUPR3 pDrvR3; 131 /** Pointer to the attached network driver. */ 132 R3PTRTYPE(PPDMIBASE) pDrvBase; 133 /** LUN\#0 + status LUN: The base interface. */ 134 PDMIBASE IBase; 135 /** LUN\#0: The network port interface. */ 136 PDMINETWORKDOWN INetworkDown; 137 /** LUN\#0: The network config port interface. */ 138 PDMINETWORKCONFIG INetworkConfig; 139 /** The shared memory used for the private interface - R3. */ 140 R3PTRTYPE(PPCNETGUESTSHAREDMEMORY) pSharedMMIOR3; 141 /** Software Interrupt timer - R3. */ 142 PTMTIMERR3 pTimerSoftIntR3; 122 143 #ifndef PCNET_NO_POLLING 123 144 /** Poll timer - R3. */ 124 145 PTMTIMERR3 pTimerPollR3; 146 #endif 147 /** Restore timer. 148 * This is used to disconnect and reconnect the link after a restore. */ 149 PTMTIMERR3 pTimerRestore; 150 151 /** Pointer to the device instance - R0. */ 152 PPDMDEVINSR0 pDevInsR0; 153 /** Receive signaller - R0. */ 154 R0PTRTYPE(PPDMQUEUE) pCanRxQueueR0; 155 /** Transmit signaller - R0. */ 156 R0PTRTYPE(PPDMQUEUE) pXmitQueueR0; 157 /** Pointer to the connector of the attached network driver - R0. */ 158 PPDMINETWORKUPR0 pDrvR0; 159 /** The shared memory used for the private interface - R0. */ 160 R0PTRTYPE(PPCNETGUESTSHAREDMEMORY) pSharedMMIOR0; 161 /** Software Interrupt timer - R0. */ 162 PTMTIMERR0 pTimerSoftIntR0; 163 #ifndef PCNET_NO_POLLING 125 164 /** Poll timer - R0. */ 126 165 PTMTIMERR0 pTimerPollR0; 166 #endif 167 168 /** Pointer to the device instance - RC. */ 169 PPDMDEVINSRC pDevInsRC; 170 /** Receive signaller - RC. */ 171 RCPTRTYPE(PPDMQUEUE) pCanRxQueueRC; 172 /** Transmit signaller - RC. */ 173 RCPTRTYPE(PPDMQUEUE) pXmitQueueRC; 174 /** Pointer to the connector of the attached network driver - RC. */ 175 PPDMINETWORKUPRC pDrvRC; 176 /** The shared memory used for the private interface - RC. */ 177 RCPTRTYPE(PPCNETGUESTSHAREDMEMORY) pSharedMMIORC; 178 /** Software Interrupt timer - RC. */ 179 PTMTIMERRC pTimerSoftIntRC; 180 #ifndef PCNET_NO_POLLING 127 181 /** Poll timer - RC. */ 128 182 PTMTIMERRC pTimerPollRC; … … 132 186 uint32_t Alignment1; 133 187 #endif 134 135 /** Software Interrupt timer - R3. */136 PTMTIMERR3 pTimerSoftIntR3;137 /** Software Interrupt timer - R0. */138 PTMTIMERR0 pTimerSoftIntR0;139 /** Software Interrupt timer - RC. */140 PTMTIMERRC pTimerSoftIntRC;141 188 142 189 /** Register Address Pointer */ … … 155 202 uint16_t aMII[MII_MAX_REG]; 156 203 uint16_t u16CSR0LastSeenByGuest; 157 uint16_t Alignment2[HC_ARCH_BITS == 32 ? 2 : 4];204 uint16_t Alignment2[HC_ARCH_BITS == 32 ? 2 : 2]; 158 205 /** Last time we polled the queues */ 159 206 uint64_t u64LastPoll; … … 172 219 RTGCPHYS32 GCUpperPhys; 173 220 174 /** Transmit signaller - RC. */175 RCPTRTYPE(PPDMQUEUE) pXmitQueueRC;176 /** Transmit signaller - R3. */177 R3PTRTYPE(PPDMQUEUE) pXmitQueueR3;178 /** Transmit signaller - R0. */179 R0PTRTYPE(PPDMQUEUE) pXmitQueueR0;180 181 /** Receive signaller - R3. */182 R3PTRTYPE(PPDMQUEUE) pCanRxQueueR3;183 /** Receive signaller - R0. */184 R0PTRTYPE(PPDMQUEUE) pCanRxQueueR0;185 /** Receive signaller - RC. */186 RCPTRTYPE(PPDMQUEUE) pCanRxQueueRC;187 /** Pointer to the device instance - RC. */188 PPDMDEVINSRC pDevInsRC;189 /** Pointer to the device instance - R3. */190 PPDMDEVINSR3 pDevInsR3;191 /** Pointer to the device instance - R0. */192 PPDMDEVINSR0 pDevInsR0;193 /** Restore timer.194 * This is used to disconnect and reconnect the link after a restore. */195 PTMTIMERR3 pTimerRestore;196 /** Pointer to the connector of the attached network driver. */197 R3PTRTYPE(PPDMINETWORKUP) pDrvR3;198 /** Pointer to the attached network driver. */199 R3PTRTYPE(PPDMIBASE) pDrvBase;200 /** LUN\#0 + status LUN: The base interface. */201 PDMIBASE IBase;202 /** LUN\#0: The network port interface. */203 PDMINETWORKDOWN INetworkDown;204 /** LUN\#0: The network config port interface. */205 PDMINETWORKCONFIG INetworkConfig;206 221 /** Base address of the MMIO region. */ 207 222 RTGCPHYS32 MMIOBase; … … 218 233 RTMAC MacConfigured; 219 234 /** Alignment padding. */ 220 uint8_t Alignment4[HC_ARCH_BITS == 64 ? 6 : 6];235 uint8_t Alignment4[HC_ARCH_BITS == 64 ? 2 : 2]; 221 236 222 237 /** The LED. */ … … 242 257 /** True if we signal the guest that RX packets are missing. */ 243 258 bool fSignalRxMiss; 244 uint8_t Alignment5[HC_ARCH_BITS == 64 ? 6 : 2];259 uint8_t Alignment5[HC_ARCH_BITS == 64 ? 2 : 6]; 245 260 246 261 #ifdef PCNET_NO_POLLING … … 254 269 DECLR0CALLBACKMEMBER(int, pfnEMInterpretInstructionR0, (PVM pVM, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)); 255 270 #endif 256 257 /** The shared memory used for the private interface - R3. */258 R3PTRTYPE(PPCNETGUESTSHAREDMEMORY) pSharedMMIOR3;259 /** The shared memory used for the private interface - R0. */260 R0PTRTYPE(PPCNETGUESTSHAREDMEMORY) pSharedMMIOR0;261 /** The shared memory used for the private interface - RC. */262 RCPTRTYPE(PPCNETGUESTSHAREDMEMORY) pSharedMMIORC;263 271 264 272 /** Error counter for bad receive descriptors. */ … … 322 330 #endif /* VBOX_WITH_STATISTICS */ 323 331 }; 324 AssertCompileMemberAlignment(PCNetState, StatReceiveBytes, 8);332 //AssertCompileMemberAlignment(PCNetState, StatReceiveBytes, 8); 325 333 326 334 #define PCNETSTATE_2_DEVINS(pPCNet) ((pPCNet)->CTX_SUFF(pDevIns)) … … 607 615 608 616 static void pcnetPollTimerStart(PCNetState *pThis); 617 static int pcnetXmitPending(PCNetState *pThis, bool fOnWorkerThread); 618 619 609 620 610 621 /** … … 804 815 } 805 816 806 #ifdef IN_RING3807 817 808 818 /** … … 855 865 } 856 866 867 #ifdef IN_RING3 857 868 /** 858 869 * Read+Write a TX/RX descriptor to prevent PDMDevHlpPhysWrite() allocating … … 875 886 } 876 887 } 877 878 888 #endif /* IN_RING3 */ 879 889 … … 917 927 918 928 #ifdef IN_RING3 919 920 929 /** 921 930 * Initialize the shared memory for the private guest interface. … … 961 970 pThis->pSharedMMIOR3->cbUsed = off; 962 971 } 972 #endif /* IN_RING3 */ 963 973 964 974 #define MULTICAST_FILTER_LEN 8 … … 1121 1131 } 1122 1132 1123 #endif /* IN_RING3 */1124 1133 1125 1134 /** … … 1826 1835 1827 1836 1828 #ifdef IN_RING31829 1830 1837 /** 1831 1838 * Write data into guest receive buffers. … … 2107 2114 else 2108 2115 { 2109 PPDMINETWORKUP pDrv = pThis-> pDrvR3;2116 PPDMINETWORKUP pDrv = pThis->CTX_SUFF(pDrv); 2110 2117 if (RT_LIKELY(pDrv)) 2111 2118 { … … 2140 2147 else 2141 2148 { 2142 PPDMINETWORKUP pDrv = pThis-> pDrvR3;2149 PPDMINETWORKUP pDrv = pThis->CTX_SUFF(pDrv); 2143 2150 if (RT_LIKELY(pDrv)) 2144 2151 pDrv->pfnFreeBuf(pDrv, pSgBuf); … … 2185 2192 pThis->Led.Asserted.s.fWriting = pThis->Led.Actual.s.fWriting = 1; 2186 2193 2187 PPDMINETWORKUP pDrv = pThis-> pDrvR3;2194 PPDMINETWORKUP pDrv = pThis->CTX_SUFF(pDrv); 2188 2195 if (RT_LIKELY(pDrv)) 2189 2196 { … … 2343 2350 2344 2351 /** 2345 * Flushes queued frames.2346 */2347 DECLINLINE(void) pcnetXmitFlushFrames(PCNetState *pThis)2348 {2349 pcnetXmitQueueConsumer(pThis->CTX_SUFF(pDevIns), NULL);2350 }2351 2352 #endif /* IN_RING3 */2353 2354 2355 2356 /**2357 2352 * Try to transmit frames 2358 2353 */ … … 2377 2372 pThis->aCSR[0] &= ~0x0008; 2378 2373 2374 #ifndef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 2375 /* 2376 * Transmit pending packets if possible, defere it if we cannot do it 2377 * in the current context. 2378 */ 2379 # if defined(IN_RING0) || defined(IN_RC) 2380 if (!pThis->CTX_SUFF(pDrv)) 2381 { 2382 PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pXmitQueue)); 2383 if (RT_UNLIKELY(pItem)) 2384 PDMQueueInsert(pThis->CTX_SUFF(pXmitQueue), pItem); 2385 } 2386 else 2387 # endif 2388 { 2389 int rc = pcnetXmitPending(pThis, false /*fOnWorkerThread*/); 2390 if (rc == VERR_TRY_AGAIN) 2391 rc = VINF_SUCCESS; 2392 AssertRC(rc); 2393 } 2394 #else /* VBOX_WITH_TX_THREAD_IN_NET_DEVICES */ 2379 2395 /* 2380 2396 * If we're in Ring-3 we should flush the queue now, in GC/R0 we'll queue a flush job. 2381 2397 */ 2382 #ifdef IN_RING3 2383 pcnetXmitFlushFrames(pThis); 2384 #else 2398 # ifdef IN_RING3 2399 int rc = RTSemEventSignal(pThis->hSendEventSem); 2400 AssertRC(rc); 2401 # else 2385 2402 PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pXmitQueue)); 2386 2403 if (RT_UNLIKELY(pItem)) 2387 2404 PDMQueueInsert(pThis->CTX_SUFF(pXmitQueue), pItem); 2388 # endif2389 } 2390 2391 #ifdef IN_RING3 2405 # endif 2406 #endif /* VBOX_WITH_TX_THREAD_IN_NET_DEVICES */ 2407 } 2408 2392 2409 2393 2410 /** … … 2664 2681 * Grab the xmit lock of the driver as well as the E1K device state. 2665 2682 */ 2666 PPDMINETWORKUP pDrv = pThis-> pDrvR3;2683 PPDMINETWORKUP pDrv = pThis->CTX_SUFF(pDrv); 2667 2684 if (pDrv) 2668 2685 { … … 2694 2711 } 2695 2712 2713 #ifdef IN_RING3 2696 2714 #ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 2697 2715 … … 4923 4941 pThis->pDrvBase = NULL; 4924 4942 pThis->pDrvR3 = NULL; 4943 pThis->pDrvR0 = NULL; 4944 pThis->pDrvRC = NULL; 4925 4945 4926 4946 PDMCritSectLeave(&pThis->CritSect); … … 4968 4988 AssertMsgStmt(pThis->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"), 4969 4989 rc = VERR_PDM_MISSING_INTERFACE_BELOW); 4990 pThis->pDrvR0 = PDMIBASER0_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASER0), PDMINETWORKUP); 4991 pThis->pDrvRC = PDMIBASERC_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASERC), PDMINETWORKUP); 4970 4992 } 4971 4993 else if ( rc == VERR_PDM_NO_ATTACHED_DRIVER … … 5059 5081 if (PDMCritSectIsInitialized(&pThis->CritSect)) 5060 5082 { 5083 #ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 5061 5084 /* 5062 5085 * At this point the send thread is suspended and will not enter … … 5066 5089 RTSemEventDestroy(pThis->hSendEventSem); 5067 5090 pThis->hSendEventSem = NIL_RTSEMEVENT; 5091 #endif 5068 5092 RTSemEventSignal(pThis->hEventOutOfRxSpace); 5069 5093 RTSemEventDestroy(pThis->hEventOutOfRxSpace); … … 5097 5121 */ 5098 5122 pThis->hEventOutOfRxSpace = NIL_RTSEMEVENT; 5123 #ifdef VBOX_WITH_TX_THREAD_IN_NET_DEVICES 5099 5124 pThis->hSendEventSem = NIL_RTSEMEVENT; 5125 #endif 5100 5126 5101 5127 /* … … 5351 5377 AssertMsgReturn(pThis->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"), 5352 5378 VERR_PDM_MISSING_INTERFACE_BELOW); 5379 pThis->pDrvR0 = PDMIBASER0_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASER0), PDMINETWORKUP); 5380 pThis->pDrvRC = PDMIBASERC_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASERC), PDMINETWORKUP); 5353 5381 } 5354 5382 else if ( rc == VERR_PDM_NO_ATTACHED_DRIVER -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r28275 r28320 85 85 /** Pointer to the communication buffer. */ 86 86 R3PTRTYPE(PINTNETBUF) pBufR3; 87 /** Ring-3 base interface for the ring-0 context. */ 88 PDMIBASER0 IBaseR0; 89 /** Ring-3 base interface for the raw-mode context. */ 90 PDMIBASERC IBaseRC; 91 RTR3PTR R3PtrAlignment; 92 93 /** The network interface for the ring-0 context. */ 94 PDMINETWORKUPR0 INetworkUpR0; 95 /** Pointer to the driver instance. */ 96 PPDMDRVINSR0 pDrvInsR0; 97 RTR0PTR R0PtrAlignment; 98 99 /** The network interface for the raw-mode context. */ 100 PDMINETWORKUPRC INetworkUpRC; 101 /** Pointer to the driver instance. */ 102 PPDMDRVINSRC pDrvInsRC; 103 RTRCPTR RCPtrAlignment; 104 105 /** The transmit lock. */ 106 PDMCRITSECT XmitLock; 87 107 /** Interface handle. */ 88 108 INTNETIFHANDLE hIf; 89 90 109 /** The thread state. */ 91 110 ASYNCSTATE volatile enmState; 92 111 /** Reader thread. */ 93 RTTHREAD Thread;112 RTTHREAD hRxThread; 94 113 /** Event semaphore the Thread waits on while the VM is suspended. */ 95 114 RTSEMEVENT hEvtSuspended; … … 103 122 bool fActivateEarlyDeactivateLate; 104 123 /** Padding. */ 105 bool afReserved[2 ];124 bool afReserved[2+4]; 106 125 /** The network name. */ 107 126 char szNetwork[INTNET_MAX_NETWORK_NAME]; 108 127 109 /** Base interface for ring-0. */ 110 PDMIBASER0 IBaseR0; 111 /** Base interface for ring-0. */ 112 PDMIBASERC IBaseRC; 113 114 /** The transmit lock. */ 115 PDMCRITSECT XmitLock; 116 128 /** Number of GSO packets sent. */ 129 STAMCOUNTER StatSentGso; 130 /** Number of GSO packets recevied. */ 131 STAMCOUNTER StatReceivedGso; 132 #ifdef VBOX_WITH_STATISTICS 133 /** Profiling packet transmit runs. */ 134 STAMPROFILE StatTransmit; 135 /** Profiling packet receive runs. */ 136 STAMPROFILEADV StatReceive; 137 #endif /* VBOX_WITH_STATISTICS */ 117 138 #ifdef LOG_ENABLED 118 139 /** The nano ts of the last transfer. */ … … 121 142 uint64_t u64LastReceiveTS; 122 143 #endif 123 #ifdef VBOX_WITH_STATISTICS124 /** Profiling packet transmit runs. */125 STAMPROFILE StatTransmit;126 /** Profiling packet receive runs. */127 STAMPROFILEADV StatReceive;128 #endif /* VBOX_WITH_STATISTICS */129 /** Number of GSO packets sent. */130 STAMCOUNTER StatSentGso;131 /** Number of GSO packets recevied. */132 STAMCOUNTER StatReceivedGso;133 144 } DRVINTNET; 145 AssertCompileMemberAlignment(DRVINTNET, XmitLock, 8); 146 AssertCompileMemberAlignment(DRVINTNET, StatSentGso, 8); 134 147 /** Pointer to instance data of the internal networking driver. */ 135 148 typedef DRVINTNET *PDRVINTNET; … … 668 681 PDRVINTNET pThis = RT_FROM_MEMBER(pInterface, DRVINTNET, IBaseRC); 669 682 670 PDMIBASERC_RETURN_INTERFACE(pThis->pDrvInsR3, pszIID, PDMIBASERC, &pThis->IBaseRC); 683 #ifdef VBOX_WITH_R0_AND_RC_DRIVERS 684 PDMIBASERC_RETURN_INTERFACE(pThis->pDrvInsR3, pszIID, PDMINETWORKUP, &pThis->INetworkUpRC); 685 #endif 671 686 return NIL_RTRCPTR; 672 687 } … … 680 695 { 681 696 PDRVINTNET pThis = RT_FROM_MEMBER(pInterface, DRVINTNET, IBaseR0); 682 683 PDMIBASER0_RETURN_INTERFACE(pThis->pDrvInsR3, pszIID, PDMIBASER0, &pThis->IBaseR0); 697 #ifdef VBOX_WITH_R0_AND_RC_DRIVERS 698 PDMIBASER0_RETURN_INTERFACE(pThis->pDrvInsR3, pszIID, PDMINETWORKUP, &pThis->INetworkUpR0); 699 #endif 684 700 return NIL_RTR0PTR; 685 701 } … … 888 904 * Wait for the thread to terminate. 889 905 */ 890 if (pThis-> Thread != NIL_RTTHREAD)906 if (pThis->hRxThread != NIL_RTTHREAD) 891 907 { 892 908 if (hEvtSuspended != NIL_RTSEMEVENT) 893 909 RTSemEventSignal(hEvtSuspended); 894 int rc = RTThreadWait(pThis-> Thread, 5000, NULL);910 int rc = RTThreadWait(pThis->hRxThread, 5000, NULL); 895 911 AssertRC(rc); 896 pThis-> Thread = NIL_RTTHREAD;912 pThis->hRxThread = NIL_RTTHREAD; 897 913 } 898 914 … … 950 966 pThis->pDrvInsR3 = pDrvIns; 951 967 pThis->hIf = INTNET_HANDLE_INVALID; 952 pThis-> Thread= NIL_RTTHREAD;968 pThis->hRxThread = NIL_RTTHREAD; 953 969 pThis->hEvtSuspended = NIL_RTSEMEVENT; 954 970 pThis->hSgCache = NIL_RTMEMCACHE; … … 1276 1292 * Note! Using a PDM thread here doesn't fit with the IsService=true operation. 1277 1293 */ 1278 rc = RTThreadCreate(&pThis-> Thread, drvR3IntNetAsyncIoThread, pThis, _128K, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "INTNET");1294 rc = RTThreadCreate(&pThis->hRxThread, drvR3IntNetAsyncIoThread, pThis, _128K, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "INTNET"); 1279 1295 if (RT_FAILURE(rc)) 1280 1296 {
Note:
See TracChangeset
for help on using the changeset viewer.