Changeset 28147 in vbox
- Timestamp:
- Apr 9, 2010 2:24:34 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r28146 r28147 196 196 volatile uint32_t cUrgPkt; 197 197 volatile uint32_t cPkt; 198 PTMTIMERR3 pTmrSlow;199 PTMTIMERR3 pTmrFast;200 198 } DRVNAT; 201 199 AssertCompileMemberAlignment(DRVNAT, StatNATRecvWakeups, 8); … … 832 830 #endif /* VBOX_WITH_SLIRP_MT */ 833 831 834 835 /**836 * The callback for the fast (2 ms) NAT timer.837 *838 * @param pDrvIns The driver instance.839 * @param pTimer The timer handle.840 * @param pvUser The NAT instance data.841 */842 static DECLCALLBACK(void) drvNATFastTimer(PPDMDRVINS pDrvIns, PTMTIMER pTimer, void *pvUser)843 {844 PDRVNAT pThis = (PDRVNAT)pvUser;845 drvNATNotifyNATThread(pThis, "drvNATFastTimer");846 }847 848 void slirp_arm_fast_timer(void *pvUser)849 {850 #if 0851 PDRVNAT pThis = (PDRVNAT)pvUser;852 AssertPtr(pThis);853 TMTimerSetMillies(pThis->pTmrFast, 2);854 #endif855 }856 857 /**858 * The callback for the slow (500 ms) NAT timer.859 *860 * @param pDrvIns The driver instance.861 * @param pTimer The timer handle.862 * @param pvUser The NAT instance data.863 */864 static DECLCALLBACK(void) drvNATSlowTimer(PPDMDRVINS pDrvIns, PTMTIMER pTimer, void *pvUser)865 {866 PDRVNAT pThis = (PDRVNAT)pvUser;867 drvNATNotifyNATThread(pThis, "drvNATSlowTimer");868 }869 870 void slirp_arm_slow_timer(void *pvUser)871 {872 #if 0873 PDRVNAT pThis = (PDRVNAT)pvUser;874 AssertPtr(pThis);875 876 TMTimerSetMillies(pThis->pTmrSlow, 500);877 #endif878 }879 880 832 /** 881 833 * Function called by slirp to check if it's possible to feed incoming data to the network port. … … 1276 1228 rc = RTSemEventCreate(&pThis->EventUrgRecv); 1277 1229 rc = RTCritSectInit(&pThis->csDevAccess); 1278 rc = PDMDrvHlpTMTimerCreate(pThis->pDrvIns, TMCLOCK_REAL/*enmClock*/, drvNATSlowTimer,1279 pThis, TMTIMER_FLAGS_NO_CRIT_SECT/*flags*/, "NATSlowTmr", &pThis->pTmrSlow);1280 rc = PDMDrvHlpTMTimerCreate(pThis->pDrvIns, TMCLOCK_REAL/*enmClock*/, drvNATFastTimer,1281 pThis, TMTIMER_FLAGS_NO_CRIT_SECT/*flags*/, "NATFastTmr", &pThis->pTmrFast);1282 1230 1283 1231 #ifndef RT_OS_WINDOWS -
trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
r27976 r28147 423 423 icmp_error(pData, m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); 424 424 } 425 else 426 slirp_arm_fast_timer(pData->pvUser); 425 else if (!time_fasttimo) 426 { 427 time_fasttimo = curtime; /* Flag when we want a fasttimo */ 428 } 427 429 428 430 } -
trunk/src/VBox/Devices/Network/slirp/libslirp.h
r27848 r28147 54 54 /* you must provide the following functions: */ 55 55 void slirp_arm_fast_timer(void *pvUser); 56 void slirp_arm_slow_timer(void *pvUser);57 56 int slirp_can_output(void * pvUser); 58 57 void slirp_output(void * pvUser, struct mbuf *m, const uint8_t *pkt, int pkt_len); -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r28146 r28147 836 836 { 837 837 do_slowtimo = 1; 838 slirp_arm_slow_timer(pData->pvUser);839 838 break; 840 839 } … … 875 874 { 876 875 time_fasttimo = curtime; /* Flag when we want a fasttimo */ 877 slirp_arm_fast_timer(pData->pvUser);878 876 } 879 877 … … 977 975 { 978 976 do_slowtimo = 1; /* Let socket expire */ 979 slirp_arm_slow_timer(pData->pvUser);980 977 } 981 978 } -
trunk/src/VBox/NetworkServices/NAT/VBoxNetNAT.cpp
r28146 r28147 108 108 volatile uint32_t cUrgPkt; 109 109 volatile uint32_t cPkt; 110 111 PRTTIMER pTmrSlow; 112 PRTTIMER pTmrFast; 113 bool fIsRunning; 110 bool fIsRunning; 114 111 }; 115 112 … … 126 123 static void SendWorker(struct mbuf *m, size_t cb); 127 124 static void IntNetSendWorker(bool urg, const void *pvFrame, size_t cbFrame, struct mbuf *m); 128 static void natNotifyNATThread(); 129 130 void slirp_arm_fast_timer(void *pvUser) 131 { 132 RTTimerStart(g_pNAT->pTmrFast, 2); 133 } 134 135 void slirp_arm_slow_timer(void *pvUser) 136 { 137 RTTimerStart(g_pNAT->pTmrSlow, 500); 138 } 139 140 static DECLCALLBACK(void) natSlowTimer(PRTTIMER ppTimer, void *pvUser, uint64_t iTick) 141 { 142 natNotifyNATThread(); 143 } 144 145 static DECLCALLBACK(void) natFastTimer(PRTTIMER ppTimer, void *pvUser, uint64_t iTick) 146 { 147 natNotifyNATThread(); 148 } 149 150 static void natNotifyNATThread() 125 126 127 static void natNotifyNATThread(void) 151 128 { 152 129 int rc; … … 222 199 rc = RTThreadCreate(&m_ThrSndNAT, natSndThread, this, 128 * _1K, RTTHREADTYPE_DEFAULT, 0, "SndNAT"); 223 200 rc = RTThreadCreate(&m_ThrUrgSndNAT, natUrgSndThread, this, 128 * _1K, RTTHREADTYPE_DEFAULT, 0, "UrgSndNAT"); 224 rc = RTTimerCreate(&pTmrSlow, 0 /* one-shot */, natSlowTimer, this);225 rc = RTTimerCreate(&pTmrFast, 0 /* one-shot */ , natFastTimer, this);226 201 rc = RTSemEventCreate(&m_EventSend); 227 202 rc = RTSemEventCreate(&m_EventUrgSend);
Note:
See TracChangeset
for help on using the changeset viewer.