Changeset 88490 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Apr 13, 2021 10:55:07 AM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevE1000.cpp
r88426 r88490 2890 2890 2891 2891 /** 2892 * A helper function to detect the link state to the other side of "the wire". 2893 * 2894 * When deciding to bring up the link we need to take into account both if the 2895 * cable is connected and if our device is actually connected to the outside 2896 * world. If no driver is attached we won't be able to allocate TX buffers, 2897 * which will prevent us from TX descriptor processing, which will result in 2898 * "TX unit hang" in the guest. 2899 * 2900 * @returns true if the device is connected to something. 2901 * 2902 * @param pDevIns The device instance. 2903 */ 2904 DECLINLINE(bool) e1kIsConnected(PPDMDEVINS pDevIns) 2905 { 2906 PE1KSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PE1KSTATE); 2907 PE1KSTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PE1KSTATECC); 2908 return pThis->fCableConnected && pThisCC->CTX_SUFF(pDrv); 2909 } 2910 2911 /** 2892 2912 * A callback used by PHY to indicate that the link needs to be updated due to 2893 2913 * reset of PHY. … … 2901 2921 2902 2922 /* Make sure we have cable connected and MAC can talk to PHY */ 2903 if ( pThis->fCableConnected&& (CTRL & CTRL_SLU))2923 if (e1kIsConnected(pDevIns) && (CTRL & CTRL_SLU)) 2904 2924 e1kArmTimer(pDevIns, pThis, pThis->hLUTimer, E1K_INIT_LINKUP_DELAY_US); 2905 2925 } … … 2948 2968 if ( (value & CTRL_SLU) 2949 2969 && !(CTRL & CTRL_SLU) 2950 && pThis->fCableConnected2970 && e1kIsConnected(pDevIns) 2951 2971 && !PDMDevHlpTimerIsActive(pDevIns, pThis->hLUTimer)) 2952 2972 { … … 3654 3674 * on reset even if the cable is unplugged (see @bugref{8942}). 3655 3675 */ 3656 if ( pThis->fCableConnected)3676 if (e1kIsConnected(pDevIns)) 3657 3677 { 3658 3678 /* 82543GC does not have an internal PHY */ -
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r87773 r88490 3292 3292 | 0x0004 /* Link up. */ 3293 3293 | 0x0001; /* Extended Capability, i.e. registers 4+ valid. */ 3294 if (!p This->fLinkUp || pThis->fLinkTempDown|| isolate) {3294 if (!pcnetIsLinkUp(pThis) || isolate) { 3295 3295 val &= ~(0x0020 | 0x0004); 3296 3296 pThis->cLinkDownReported++; … … 3338 3338 case 5: 3339 3339 /* Link partner ability register. */ 3340 if (p This->fLinkUp && !pThis->fLinkTempDown&& !isolate)3340 if (pcnetIsLinkUp(pThis) && !isolate) 3341 3341 val = 0x8000 /* Next page bit. */ 3342 3342 | 0x4000 /* Link partner acked us. */ … … 3353 3353 case 6: 3354 3354 /* Auto negotiation expansion register. */ 3355 if (p This->fLinkUp && !pThis->fLinkTempDown&& !isolate)3355 if (pcnetIsLinkUp(pThis) && !isolate) 3356 3356 val = 0x0008 /* Link partner supports npage. */ 3357 3357 | 0x0004 /* Enable npage words. */ … … 3366 3366 case 18: 3367 3367 /* Diagnostic Register (FreeBSD pcn/ac101 driver reads this). */ 3368 if (p This->fLinkUp && !pThis->fLinkTempDown&& !isolate)3368 if (pcnetIsLinkUp(pThis) && !isolate) 3369 3369 { 3370 3370 val = 0x0100 /* Receive PLL locked. */ -
trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
r87773 r88490 359 359 360 360 #ifdef IN_RING3 361 /** 362 * A helper function to detect the link state to the other side of "the wire". 363 * 364 * When deciding to bring up the link we need to take into account both if the 365 * cable is connected and if our device is actually connected to the outside 366 * world. If no driver is attached we won't start the TX thread nor we will 367 * initialize the TX semaphore, which is a problem for the TX queue handler. 368 * 369 * @returns true if the device is connected to something. 370 * 371 * @param pDevIns The device instance. 372 */ 373 DECLINLINE(bool) vnetR3IsConnected(PPDMDEVINS pDevIns) 374 { 375 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 376 PVNETSTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVNETSTATECC); 377 return pThis->fCableConnected && pThisCC->pDrv; 378 } 379 361 380 /** 362 381 * Dump a packet to debug log. … … 524 543 static DECLCALLBACK(int) vnetIoCb_Reset(PPDMDEVINS pDevIns) 525 544 { 545 #ifndef IN_RING3 546 RT_NOREF(pDevIns); 547 return VINF_IOM_R3_IOPORT_WRITE; 548 #else 526 549 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 527 #ifdef IN_RING3528 550 PVNETSTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVNETSTATECC); 529 #endif 551 530 552 Log(("%s Reset triggered\n", INSTANCE(pThis))); 531 553 … … 540 562 541 563 /// @todo Implement reset 542 if ( pThis->fCableConnected)564 if (vnetR3IsConnected(pDevIns)) 543 565 pThis->config.uStatus = VNET_S_LINK_UP; 544 566 else 545 567 pThis->config.uStatus = 0; 546 Log(("%s vnetIoCb_Reset: Link is %s\n", INSTANCE(pThis), pThis->fCableConnected? "up" : "down"));568 Log(("%s vnetIoCb_Reset: Link is %s\n", INSTANCE(pThis), vnetR3IsConnected(pDevIns) ? "up" : "down")); 547 569 548 570 /* … … 556 578 memset(pThis->aVlanFilter, 0, sizeof(pThis->aVlanFilter)); 557 579 pThis->uIsTransmitting = 0; 558 #ifndef IN_RING3559 return VINF_IOM_R3_IOPORT_WRITE;560 #else561 580 if (pThisCC->pDrv) 562 581 pThisCC->pDrv->pfnSetPromiscuousMode(pThisCC->pDrv, true); … … 1131 1150 if (fNewUp) 1132 1151 { 1133 Log(("%s Link is up\n", INSTANCE(pThis)));1134 1152 pThis->fCableConnected = true; 1135 pThis->config.uStatus |= VNET_S_LINK_UP; 1136 vnetR3RaiseInterrupt(pDevIns, pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG); 1153 /* The link state depends both on the cable connected and device attached. */ 1154 if (vnetR3IsConnected(pDevIns)) 1155 { 1156 Log(("%s Link is up\n", INSTANCE(pThis))); 1157 pThis->config.uStatus |= VNET_S_LINK_UP; 1158 vnetR3RaiseInterrupt(pDevIns, pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG); 1159 } 1137 1160 } 1138 1161 else … … 1344 1367 } 1345 1368 1346 if (! pThis->fCableConnected)1369 if (!vnetR3IsConnected(pDevIns)) 1347 1370 { 1348 1371 Log(("%s Ignoring transmit requests while cable is disconnected.\n", INSTANCE(pThis)));
Note:
See TracChangeset
for help on using the changeset viewer.