Changeset 81696 in vbox
- Timestamp:
- Nov 6, 2019 1:48:57 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
r81591 r81696 50 50 #ifdef IN_RING3 51 51 52 # define VNET_PCI_CLASS0x020053 # define VNET_N_QUEUES354 # define VNET_NAME_FMT"VNet%d"55 56 # if 052 # define VNET_PCI_CLASS 0x0200 53 # define VNET_N_QUEUES 3 54 # define VNET_NAME_FMT "VNet%d" 55 56 # if 0 57 57 /* Virtio Block Device */ 58 # define VNET_PCI_CLASS0x018059 # define VNET_N_QUEUES260 # define VNET_NAME_FMT"VBlk%d"61 # endif58 # define VNET_PCI_CLASS 0x0180 59 # define VNET_N_QUEUES 2 60 # define VNET_NAME_FMT "VBlk%d" 61 # endif 62 62 63 63 #endif /* IN_RING3 */ … … 213 213 STAMCOUNTER StatTransmitGSO; 214 214 STAMCOUNTER StatTransmitCSum; 215 #if defined(VBOX_WITH_STATISTICS)215 #ifdef VBOX_WITH_STATISTICS 216 216 STAMPROFILE StatReceive; 217 217 STAMPROFILE StatReceiveStore; … … 222 222 STAMCOUNTER StatTransmitByNetwork; 223 223 STAMCOUNTER StatTransmitByThread; 224 #endif /* VBOX_WITH_STATISTICS */224 #endif 225 225 /** @} */ 226 226 } VNETSTATE; … … 278 278 279 279 280 struct VNetCtlHdr280 typedef struct VNetCtlHdr 281 281 { 282 282 uint8_t u8Class; 283 283 uint8_t u8Command; 284 } ;285 typedef struct VNetCtlHdr VNETCTLHDR;284 } VNETCTLHDR; 285 AssertCompileSize(VNETCTLHDR, 2); 286 286 typedef VNETCTLHDR *PVNETCTLHDR; 287 AssertCompileSize(VNETCTLHDR, 2); 287 288 288 289 289 290 #ifdef IN_RING3 290 291 291 292 /** Returns true if large packets are written into several RX buffers. */ 292 DECLINLINE(bool) vnet MergeableRxBuffers(PVNETSTATE pThis)293 DECLINLINE(bool) vnetR3MergeableRxBuffers(PVNETSTATE pThis) 293 294 { 294 295 return !!(pThis->VPCI.uGuestFeatures & VNET_F_MRG_RXBUF); 295 296 } 296 297 297 DECLINLINE(int) vnet CsEnter(PVNETSTATE pThis, int rcBusy)298 DECLINLINE(int) vnetR3CsEnter(PVNETSTATE pThis, int rcBusy) 298 299 { 299 300 return vpciCsEnter(&pThis->VPCI, rcBusy); 300 301 } 301 302 302 DECLINLINE(void) vnet CsLeave(PVNETSTATE pThis)303 DECLINLINE(void) vnetR3CsLeave(PVNETSTATE pThis) 303 304 { 304 305 vpciCsLeave(&pThis->VPCI); … … 333 334 * @param pszText A string denoting direction of packet transfer. 334 335 */ 335 DECLINLINE(void) vnet PacketDump(PVNETSTATE pThis, const uint8_t *pbPacket, size_t cb, const char *pszText)336 DECLINLINE(void) vnetR3PacketDump(PVNETSTATE pThis, const uint8_t *pbPacket, size_t cb, const char *pszText) 336 337 { 337 338 # ifdef DEBUG … … 358 359 DECLINLINE(void) vnetPrintFeatures(PVNETSTATE pThis, uint32_t fFeatures, const char *pcszText) 359 360 { 360 #ifdef DEBUG361 #ifdef LOG_ENABLED 361 362 static struct 362 363 { 363 uint32_t uMask;364 uint32_t fMask; 364 365 const char *pcszDesc; 365 366 } const s_aFeatures[] = … … 387 388 for (unsigned i = 0; i < RT_ELEMENTS(s_aFeatures); ++i) 388 389 { 389 if (s_aFeatures[i]. uMask & fFeatures)390 if (s_aFeatures[i].fMask & fFeatures) 390 391 Log3(("%s --> %s\n", INSTANCE(pThis), s_aFeatures[i].pcszDesc)); 391 392 } 392 #else /* ! DEBUG*/393 #else /* !LOG_ENABLED */ 393 394 RT_NOREF3(pThis, fFeatures, pcszText); 394 #endif /* ! DEBUG*/395 #endif /* !LOG_ENABLED */ 395 396 } 396 397 … … 408 409 */ 409 410 return VNET_F_MAC 410 | VNET_F_STATUS411 | VNET_F_CTRL_VQ412 | VNET_F_CTRL_RX413 | VNET_F_CTRL_VLAN411 | VNET_F_STATUS 412 | VNET_F_CTRL_VQ 413 | VNET_F_CTRL_RX 414 | VNET_F_CTRL_VLAN 414 415 #ifdef VNET_WITH_GSO 415 | VNET_F_CSUM416 | VNET_F_HOST_TSO4417 | VNET_F_HOST_TSO6418 | VNET_F_HOST_UFO419 | VNET_F_GUEST_CSUM /* We expect the guest to accept partial TCP checksums (see @bugref{4796}) */420 | VNET_F_GUEST_TSO4421 | VNET_F_GUEST_TSO6422 | VNET_F_GUEST_UFO416 | VNET_F_CSUM 417 | VNET_F_HOST_TSO4 418 | VNET_F_HOST_TSO6 419 | VNET_F_HOST_UFO 420 | VNET_F_GUEST_CSUM /* We expect the guest to accept partial TCP checksums (see @bugref{4796}) */ 421 | VNET_F_GUEST_TSO4 422 | VNET_F_GUEST_TSO6 423 | VNET_F_GUEST_UFO 423 424 #endif 424 425 #ifdef VNET_WITH_MERGEABLE_RX_BUFS 425 | VNET_F_MRG_RXBUF426 | VNET_F_MRG_RXBUF 426 427 #endif 427 ;428 ; 428 429 } 429 430 … … 519 520 * Wakeup the RX thread. 520 521 */ 521 static void vnet WakeupReceive(PPDMDEVINS pDevIns)522 static void vnetR3WakeupReceive(PPDMDEVINS pDevIns) 522 523 { 523 524 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); … … 542 543 * Helper function that raises an interrupt if the guest is ready to receive it. 543 544 */ 544 int vnetRaiseInterrupt(PVNETSTATE pThis, int rcBusy, uint8_t u8IntCause)545 static int vnetR3RaiseInterrupt(PVNETSTATE pThis, int rcBusy, uint8_t u8IntCause) 545 546 { 546 547 if (pThis->VPCI.uStatus & VPCI_STATUS_DRV_OK) … … 561 562 * @param pThis The Virtual I/O network device state. 562 563 */ 563 static void vnet TempLinkDown(PVNETSTATE pThis)564 static void vnetR3TempLinkDown(PVNETSTATE pThis) 564 565 { 565 566 if (STATUS & VNET_S_LINK_UP) 566 567 { 567 568 STATUS &= ~VNET_S_LINK_UP; 568 vnetR aiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);569 vnetR3RaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG); 569 570 /* Restore the link back in 5 seconds. */ 570 571 int rc = TMTimerSetMillies(pThis->pLinkUpTimer, pThis->cMsLinkUpDelay); 571 572 AssertRC(rc); 572 Log(("%s vnet TempLinkDown: Link is down temporarily\n", INSTANCE(pThis)));573 Log(("%s vnetR3TempLinkDown: Link is down temporarily\n", INSTANCE(pThis))); 573 574 } 574 575 } … … 578 579 * @callback_method_impl{FNTMTIMERDEV, Link Up Timer handler.} 579 580 */ 580 static DECLCALLBACK(void) vnet LinkUpTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)581 static DECLCALLBACK(void) vnetR3LinkUpTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 581 582 { 582 583 RT_NOREF(pTimer); 583 584 PVNETSTATE pThis = (PVNETSTATE)pvUser; 584 585 585 int rc = vnet CsEnter(pThis, VERR_SEM_BUSY);586 int rc = vnetR3CsEnter(pThis, VERR_SEM_BUSY); 586 587 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 587 588 return; 588 589 STATUS |= VNET_S_LINK_UP; 589 vnetR aiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);590 vnet WakeupReceive(pDevIns);591 vnet CsLeave(pThis);592 Log(("%s vnet LinkUpTimer: Link is up\n", INSTANCE(pThis)));590 vnetR3RaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG); 591 vnetR3WakeupReceive(pDevIns); 592 vnetR3CsLeave(pThis); 593 Log(("%s vnetR3LinkUpTimer: Link is up\n", INSTANCE(pThis))); 593 594 if (pThis->pDrv) 594 595 pThis->pDrv->pfnNotifyLinkChanged(pThis->pDrv, PDMNETWORKLINKSTATE_UP); … … 599 600 * @callback_method_impl{FNPDMQUEUEDEV, Handler for the wakeup signaller queue.} 600 601 */ 601 static DECLCALLBACK(bool) vnet CanRxQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem)602 static DECLCALLBACK(bool) vnetR3CanRxQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem) 602 603 { 603 604 RT_NOREF(pItem); 604 vnet WakeupReceive(pDevIns);605 vnetR3WakeupReceive(pDevIns); 605 606 return true; 606 607 } … … 625 626 */ 626 627 #ifdef IN_RING3 627 vnet WakeupReceive(pThis->VPCI.CTX_SUFF(pDevIns));628 vnetR3WakeupReceive(pThis->VPCI.CTX_SUFF(pDevIns)); 628 629 #else 629 630 PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pThis->CTX_SUFF(pCanRxQueue)); … … 681 682 * @thread RX 682 683 */ 683 static int vnet CanReceive(PVNETSTATE pThis)684 static int vnetR3CanReceive(PVNETSTATE pThis) 684 685 { 685 686 int rc = vnetCsRxEnter(pThis, VERR_SEM_BUSY); 686 687 AssertRCReturn(rc, rc); 687 688 688 LogFlow(("%s vnet CanReceive\n", INSTANCE(pThis)));689 LogFlow(("%s vnetR3CanReceive\n", INSTANCE(pThis))); 689 690 if (!(pThis->VPCI.uStatus & VPCI_STATUS_DRV_OK)) 690 691 rc = VERR_NET_NO_BUFFER_SPACE; … … 702 703 } 703 704 704 LogFlow(("%s vnet CanReceive -> %Rrc\n", INSTANCE(pThis), rc));705 LogFlow(("%s vnetR3CanReceive -> %Rrc\n", INSTANCE(pThis), rc)); 705 706 vnetCsRxLeave(pThis); 706 707 return rc; … … 710 711 * @interface_method_impl{PDMINETWORKDOWN,pfnWaitReceiveAvail} 711 712 */ 712 static DECLCALLBACK(int) vnet NetworkDown_WaitReceiveAvail(PPDMINETWORKDOWN pInterface, RTMSINTERVAL cMillies)713 static DECLCALLBACK(int) vnetR3NetworkDown_WaitReceiveAvail(PPDMINETWORKDOWN pInterface, RTMSINTERVAL cMillies) 713 714 { 714 715 PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkDown); 715 LogFlow(("%s vnet NetworkDown_WaitReceiveAvail(cMillies=%u)\n", INSTANCE(pThis), cMillies));716 int rc = vnet CanReceive(pThis);716 LogFlow(("%s vnetR3NetworkDown_WaitReceiveAvail(cMillies=%u)\n", INSTANCE(pThis), cMillies)); 717 int rc = vnetR3CanReceive(pThis); 717 718 718 719 if (RT_SUCCESS(rc)) … … 729 730 || enmVMState == VMSTATE_RUNNING_LS)) 730 731 { 731 int rc2 = vnet CanReceive(pThis);732 int rc2 = vnetR3CanReceive(pThis); 732 733 if (RT_SUCCESS(rc2)) 733 734 { … … 735 736 break; 736 737 } 737 Log(("%s vnet NetworkDown_WaitReceiveAvail: waiting cMillies=%u...\n", INSTANCE(pThis), cMillies));738 Log(("%s vnetR3NetworkDown_WaitReceiveAvail: waiting cMillies=%u...\n", INSTANCE(pThis), cMillies)); 738 739 RTSemEventWait(pThis->hEventMoreRxDescAvail, cMillies); 739 740 } … … 741 742 ASMAtomicXchgBool(&pThis->fMaybeOutOfSpace, false); 742 743 743 LogFlow(("%s vnet NetworkDown_WaitReceiveAvail -> %d\n", INSTANCE(pThis), rc));744 LogFlow(("%s vnetR3NetworkDown_WaitReceiveAvail -> %d\n", INSTANCE(pThis), rc)); 744 745 return rc; 745 746 } … … 765 766 * @param pvBuf The ethernet packet. 766 767 */ 767 DECLINLINE(bool) vnet IsBroadcast(const void *pvBuf)768 DECLINLINE(bool) vnetR3IsBroadcast(const void *pvBuf) 768 769 { 769 770 static const uint8_t s_abBcastAddr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; … … 778 779 * @param pvBuf The ethernet packet. 779 780 */ 780 DECLINLINE(bool) vnet IsMulticast(const void *pvBuf)781 DECLINLINE(bool) vnetR3IsMulticast(const void *pvBuf) 781 782 { 782 783 return (*(char*)pvBuf) & 1; … … 791 792 * @param cb Number of bytes available in the packet. 792 793 */ 793 static bool vnet AddressFilter(PVNETSTATE pThis, const void *pvBuf, size_t cb)794 static bool vnetR3AddressFilter(PVNETSTATE pThis, const void *pvBuf, size_t cb) 794 795 { 795 796 if (pThis->fPromiscuous) … … 802 803 && !ASMBitTest(pThis->aVlanFilter, RT_BE2H_U16(u16Ptr[7]) & 0xFFF)) 803 804 { 804 Log4(("%s vnet AddressFilter: not our VLAN, returning false\n", INSTANCE(pThis)));805 Log4(("%s vnetR3AddressFilter: not our VLAN, returning false\n", INSTANCE(pThis))); 805 806 return false; 806 807 } 807 808 808 if (vnet IsBroadcast(pvBuf))809 if (vnetR3IsBroadcast(pvBuf)) 809 810 return true; 810 811 811 if (pThis->fAllMulti && vnet IsMulticast(pvBuf))812 if (pThis->fAllMulti && vnetR3IsMulticast(pvBuf)) 812 813 return true; 813 814 814 815 if (!memcmp(pThis->config.mac.au8, pvBuf, sizeof(RTMAC))) 815 816 return true; 816 Log4(("%s vnet AddressFilter: %RTmac (conf) != %RTmac (dest)\n", INSTANCE(pThis), pThis->config.mac.au8, pvBuf));817 Log4(("%s vnetR3AddressFilter: %RTmac (conf) != %RTmac (dest)\n", INSTANCE(pThis), pThis->config.mac.au8, pvBuf)); 817 818 818 819 for (unsigned i = 0; i < pThis->nMacFilterEntries; i++) … … 820 821 return true; 821 822 822 Log2(("%s vnet AddressFilter: failed all tests, returning false, packet dump follows:\n", INSTANCE(pThis)));823 vnet PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");823 Log2(("%s vnetR3AddressFilter: failed all tests, returning false, packet dump follows:\n", INSTANCE(pThis))); 824 vnetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming"); 824 825 825 826 return false; … … 838 839 * @thread RX 839 840 */ 840 static int vnetHandleRxPacket(PVNETSTATE pThis, const void *pvBuf, size_t cb, 841 PCPDMNETWORKGSO pGso) 842 { 843 VNETHDRMRX Hdr; 844 unsigned uHdrLen; 845 RTGCPHYS addrHdrMrx = 0; 841 static int vnetR3HandleRxPacket(PVNETSTATE pThis, const void *pvBuf, size_t cb, PCPDMNETWORKGSO pGso) 842 { 843 VNETHDRMRX Hdr; 844 unsigned cbHdr; 845 RTGCPHYS addrHdrMrx = 0; 846 846 847 847 if (pGso) 848 848 { 849 Log2(("%s vnet HandleRxPacket: gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n",849 Log2(("%s vnetR3HandleRxPacket: gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n", 850 850 INSTANCE(pThis), pGso->u8Type, pGso->cbHdrsTotal, pGso->cbHdrsSeg, pGso->cbMaxSeg, pGso->offHdr1, pGso->offHdr2)); 851 851 Hdr.Hdr.u8Flags = VNETHDR_F_NEEDS_CSUM; … … 878 878 } 879 879 880 if (vnet MergeableRxBuffers(pThis))881 uHdrLen= sizeof(VNETHDRMRX);880 if (vnetR3MergeableRxBuffers(pThis)) 881 cbHdr = sizeof(VNETHDRMRX); 882 882 else 883 uHdrLen= sizeof(VNETHDR);884 885 vnet PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming");883 cbHdr = sizeof(VNETHDR); 884 885 vnetR3PacketDump(pThis, (const uint8_t *)pvBuf, cb, "<-- Incoming"); 886 886 887 887 unsigned int uOffset = 0; … … 898 898 * were added and we received a big packet. 899 899 */ 900 Log(("%s vnet HandleRxPacket: Suddenly there is no space in receive queue!\n", INSTANCE(pThis)));900 Log(("%s vnetR3HandleRxPacket: Suddenly there is no space in receive queue!\n", INSTANCE(pThis))); 901 901 return VERR_INTERNAL_ERROR; 902 902 } … … 904 904 if (elem.nIn < 1) 905 905 { 906 Log(("%s vnet HandleRxPacket: No writable descriptors in receive queue!\n", INSTANCE(pThis)));906 Log(("%s vnetR3HandleRxPacket: No writable descriptors in receive queue!\n", INSTANCE(pThis))); 907 907 return VERR_INTERNAL_ERROR; 908 908 } … … 910 910 if (nElem == 0) 911 911 { 912 if (vnet MergeableRxBuffers(pThis))912 if (vnetR3MergeableRxBuffers(pThis)) 913 913 { 914 914 addrHdrMrx = elem.aSegsIn[nSeg].addr; 915 cbReserved = uHdrLen;915 cbReserved = cbHdr; 916 916 } 917 917 else … … 920 920 if (elem.aSegsIn[nSeg].cb != sizeof(VNETHDR)) 921 921 { 922 Log(("%s vnet HandleRxPacket: The first descriptor does match the header size!\n", INSTANCE(pThis)));922 Log(("%s vnetR3HandleRxPacket: The first descriptor does match the header size!\n", INSTANCE(pThis))); 923 923 return VERR_INTERNAL_ERROR; 924 924 } 925 925 elem.aSegsIn[nSeg++].pv = &Hdr; 926 926 } 927 uElemSize += uHdrLen;927 uElemSize += cbHdr; 928 928 } 929 929 while (nSeg < elem.nIn && uOffset < cb) … … 938 938 vqueuePut(&pThis->VPCI, pThis->pRxQueue, &elem, uElemSize, cbReserved); 939 939 STAM_PROFILE_STOP(&pThis->StatReceiveStore, a); 940 if (!vnet MergeableRxBuffers(pThis))940 if (!vnetR3MergeableRxBuffers(pThis)) 941 941 break; 942 942 cbReserved = 0; 943 943 } 944 if (vnet MergeableRxBuffers(pThis))944 if (vnetR3MergeableRxBuffers(pThis)) 945 945 { 946 946 Hdr.u16NumBufs = nElem; … … 949 949 if (RT_FAILURE(rc)) 950 950 { 951 Log(("%s vnet HandleRxPacket: Failed to write merged RX buf header: %Rrc\n", INSTANCE(pThis), rc));951 Log(("%s vnetR3HandleRxPacket: Failed to write merged RX buf header: %Rrc\n", INSTANCE(pThis), rc)); 952 952 return rc; 953 953 } … … 956 956 if (uOffset < cb) 957 957 { 958 Log(("%s vnet HandleRxPacket: Packet did not fit into RX queue (packet size=%u)!\n", INSTANCE(pThis), cb));958 Log(("%s vnetR3HandleRxPacket: Packet did not fit into RX queue (packet size=%u)!\n", INSTANCE(pThis), cb)); 959 959 return VERR_TOO_MUCH_DATA; 960 960 } … … 966 966 * @interface_method_impl{PDMINETWORKDOWN,pfnReceiveGso} 967 967 */ 968 static DECLCALLBACK(int) vnet NetworkDown_ReceiveGso(PPDMINETWORKDOWN pInterface,968 static DECLCALLBACK(int) vnetR3NetworkDown_ReceiveGso(PPDMINETWORKDOWN pInterface, 969 969 const void *pvBuf, size_t cb, 970 970 PCPDMNETWORKGSO pGso) … … 994 994 if (!uFeatures) 995 995 { 996 Log2(("%s vnet NetworkDown_ReceiveGso: GSO type (0x%x) not supported\n", INSTANCE(pThis), pGso->u8Type));996 Log2(("%s vnetR3NetworkDown_ReceiveGso: GSO type (0x%x) not supported\n", INSTANCE(pThis), pGso->u8Type)); 997 997 return VERR_NOT_SUPPORTED; 998 998 } 999 999 } 1000 1000 1001 Log2(("%s vnet NetworkDown_ReceiveGso: pvBuf=%p cb=%u pGso=%p\n", INSTANCE(pThis), pvBuf, cb, pGso));1002 int rc = vnet CanReceive(pThis);1001 Log2(("%s vnetR3NetworkDown_ReceiveGso: pvBuf=%p cb=%u pGso=%p\n", INSTANCE(pThis), pvBuf, cb, pGso)); 1002 int rc = vnetR3CanReceive(pThis); 1003 1003 if (RT_FAILURE(rc)) 1004 1004 return rc; … … 1013 1013 STAM_PROFILE_START(&pThis->StatReceive, a); 1014 1014 vpciSetReadLed(&pThis->VPCI, true); 1015 if (vnet AddressFilter(pThis, pvBuf, cb))1015 if (vnetR3AddressFilter(pThis, pvBuf, cb)) 1016 1016 { 1017 1017 rc = vnetCsRxEnter(pThis, VERR_SEM_BUSY); 1018 1018 if (RT_SUCCESS(rc)) 1019 1019 { 1020 rc = vnet HandleRxPacket(pThis, pvBuf, cb, pGso);1020 rc = vnetR3HandleRxPacket(pThis, pvBuf, cb, pGso); 1021 1021 STAM_REL_COUNTER_ADD(&pThis->StatReceiveBytes, cb); 1022 1022 vnetCsRxLeave(pThis); … … 1031 1031 * @interface_method_impl{PDMINETWORKDOWN,pfnReceive} 1032 1032 */ 1033 static DECLCALLBACK(int) vnet NetworkDown_Receive(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb)1034 { 1035 return vnet NetworkDown_ReceiveGso(pInterface, pvBuf, cb, NULL);1033 static DECLCALLBACK(int) vnetR3NetworkDown_Receive(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb) 1034 { 1035 return vnetR3NetworkDown_ReceiveGso(pInterface, pvBuf, cb, NULL); 1036 1036 } 1037 1037 … … 1044 1044 * @thread EMT 1045 1045 */ 1046 static DECLCALLBACK(int) vnet GetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac)1046 static DECLCALLBACK(int) vnetR3NetworkConfig_GetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac) 1047 1047 { 1048 1048 PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkConfig); … … 1058 1058 * @thread EMT 1059 1059 */ 1060 static DECLCALLBACK(PDMNETWORKLINKSTATE) vnet GetLinkState(PPDMINETWORKCONFIG pInterface)1060 static DECLCALLBACK(PDMNETWORKLINKSTATE) vnetR3NetworkConfig_GetLinkState(PPDMINETWORKCONFIG pInterface) 1061 1061 { 1062 1062 PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkConfig); … … 1074 1074 * @param enmState The new link state 1075 1075 */ 1076 static DECLCALLBACK(int) vnet SetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState)1076 static DECLCALLBACK(int) vnetR3NetworkConfig_SetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState) 1077 1077 { 1078 1078 PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkConfig); … … 1080 1080 bool fNewUp = enmState == PDMNETWORKLINKSTATE_UP; 1081 1081 1082 Log(("%s vnet SetLinkState: enmState=%d\n", INSTANCE(pThis), enmState));1082 Log(("%s vnetR3NetworkConfig_SetLinkState: enmState=%d\n", INSTANCE(pThis), enmState)); 1083 1083 if (enmState == PDMNETWORKLINKSTATE_DOWN_RESUME) 1084 1084 { … … 1087 1087 /* 1088 1088 * We bother to bring the link down only if it was up previously. The UP link state 1089 * notification will be sent when the link actually goes up in vnet LinkUpTimer().1089 * notification will be sent when the link actually goes up in vnetR3LinkUpTimer(). 1090 1090 */ 1091 vnet TempLinkDown(pThis);1091 vnetR3TempLinkDown(pThis); 1092 1092 if (pThis->pDrv) 1093 1093 pThis->pDrv->pfnNotifyLinkChanged(pThis->pDrv, enmState); … … 1101 1101 pThis->fCableConnected = true; 1102 1102 STATUS |= VNET_S_LINK_UP; 1103 vnetR aiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);1103 vnetR3RaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG); 1104 1104 } 1105 1105 else … … 1110 1110 pThis->fCableConnected = false; 1111 1111 STATUS &= ~VNET_S_LINK_UP; 1112 vnetR aiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG);1112 vnetR3RaiseInterrupt(pThis, VERR_SEM_BUSY, VPCI_ISR_CONFIG); 1113 1113 } 1114 1114 if (pThis->pDrv) … … 1118 1118 } 1119 1119 1120 static DECLCALLBACK(void) vnet QueueReceive(void *pvState, PVQUEUE pQueue)1120 static DECLCALLBACK(void) vnetR3QueueReceive(void *pvState, PVQUEUE pQueue) 1121 1121 { 1122 1122 RT_NOREF(pQueue); 1123 1123 PVNETSTATE pThis = (PVNETSTATE)pvState; 1124 1124 Log(("%s Receive buffers has been added, waking up receive thread.\n", INSTANCE(pThis))); 1125 vnet WakeupReceive(pThis->VPCI.CTX_SUFF(pDevIns));1125 vnetR3WakeupReceive(pThis->VPCI.CTX_SUFF(pDevIns)); 1126 1126 } 1127 1127 … … 1132 1132 * @param pCtx The context descriptor. 1133 1133 */ 1134 DECLINLINE(PPDMNETWORKGSO) vnet SetupGsoCtx(PPDMNETWORKGSO pGso, VNETHDR const *pHdr)1134 DECLINLINE(PPDMNETWORKGSO) vnetR3SetupGsoCtx(PPDMNETWORKGSO pGso, VNETHDR const *pHdr) 1135 1135 { 1136 1136 pGso->u8Type = PDMNETWORKGSOTYPE_INVALID; … … 1171 1171 } 1172 1172 1173 DECLINLINE(uint16_t) vnet CSum16(const void *pvBuf, size_t cb)1173 DECLINLINE(uint16_t) vnetR3CSum16(const void *pvBuf, size_t cb) 1174 1174 { 1175 1175 uint32_t csum = 0; … … 1188 1188 } 1189 1189 1190 DECLINLINE(void) vnet CompleteChecksum(uint8_t *pBuf, size_t cbSize, uint16_t uStart, uint16_t uOffset)1190 DECLINLINE(void) vnetR3CompleteChecksum(uint8_t *pBuf, size_t cbSize, uint16_t uStart, uint16_t uOffset) 1191 1191 { 1192 1192 AssertReturnVoid(uStart < cbSize); 1193 1193 AssertReturnVoid(uStart + uOffset + sizeof(uint16_t) <= cbSize); 1194 *(uint16_t*)(pBuf + uStart + uOffset) = vnet CSum16(pBuf + uStart, cbSize - uStart);1195 } 1196 1197 static bool vnetR eadHeader(PVNETSTATE pThis, RTGCPHYS GCPhys, PVNETHDR pHdr, uint32_t cbMax)1198 { 1199 int rc = PDMDevHlpPhysRead(pThis->VPCI.CTX_SUFF(pDevIns), GCPhys, pHdr, sizeof(*pHdr)); 1194 *(uint16_t*)(pBuf + uStart + uOffset) = vnetR3CSum16(pBuf + uStart, cbSize - uStart); 1195 } 1196 1197 static bool vnetR3ReadHeader(PVNETSTATE pThis, RTGCPHYS GCPhys, PVNETHDR pHdr, uint32_t cbMax) 1198 { 1199 int rc = PDMDevHlpPhysRead(pThis->VPCI.CTX_SUFF(pDevIns), GCPhys, pHdr, sizeof(*pHdr)); /** @todo r=bird: Why not PDMDevHlpPCIPhysRead? */ 1200 1200 if (RT_FAILURE(rc)) 1201 1201 return false; … … 1238 1238 } 1239 1239 1240 static int vnet TransmitFrame(PVNETSTATE pThis, PPDMSCATTERGATHER pSgBuf, PPDMNETWORKGSO pGso, PVNETHDR pHdr)1241 { 1242 vnet PacketDump(pThis, (uint8_t *)pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, "--> Outgoing");1240 static int vnetR3TransmitFrame(PVNETSTATE pThis, PPDMSCATTERGATHER pSgBuf, PPDMNETWORKGSO pGso, PVNETHDR pHdr) 1241 { 1242 vnetR3PacketDump(pThis, (uint8_t *)pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, "--> Outgoing"); 1243 1243 if (pGso) 1244 1244 { … … 1250 1250 //if (pGso->cbHdrs < pHdr->u16CSumStart + pHdr->u16CSumOffset + 2) 1251 1251 { 1252 Log4(("%s vnet TransmitPendingPackets: HdrLen before adjustment %d.\n",1252 Log4(("%s vnetR3TransmitPendingPackets: HdrLen before adjustment %d.\n", 1253 1253 INSTANCE(pThis), pGso->cbHdrsTotal)); 1254 1254 switch (pGso->u8Type) … … 1268 1268 ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsTotal = pGso->cbHdrsTotal; 1269 1269 ((PPDMNETWORKGSO)pSgBuf->pvUser)->cbHdrsSeg = pGso->cbHdrsSeg; 1270 Log4(("%s vnet TransmitPendingPackets: adjusted HdrLen to %d.\n",1270 Log4(("%s vnetR3TransmitPendingPackets: adjusted HdrLen to %d.\n", 1271 1271 INSTANCE(pThis), pGso->cbHdrsTotal)); 1272 1272 } 1273 Log2(("%s vnet TransmitPendingPackets: gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n",1273 Log2(("%s vnetR3TransmitPendingPackets: gso type=%x cbHdrsTotal=%u cbHdrsSeg=%u mss=%u off1=0x%x off2=0x%x\n", 1274 1274 INSTANCE(pThis), pGso->u8Type, pGso->cbHdrsTotal, pGso->cbHdrsSeg, pGso->cbMaxSeg, pGso->offHdr1, pGso->offHdr2)); 1275 1275 STAM_REL_COUNTER_INC(&pThis->StatTransmitGSO); … … 1281 1281 * This is not GSO frame but checksum offloading is requested. 1282 1282 */ 1283 vnet CompleteChecksum((uint8_t*)pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed,1283 vnetR3CompleteChecksum((uint8_t*)pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, 1284 1284 pHdr->u16CSumStart, pHdr->u16CSumOffset); 1285 1285 } … … 1288 1288 } 1289 1289 1290 static void vnet TransmitPendingPackets(PVNETSTATE pThis, PVQUEUE pQueue, bool fOnWorkerThread)1290 static void vnetR3TransmitPendingPackets(PVNETSTATE pThis, PVQUEUE pQueue, bool fOnWorkerThread) 1291 1291 { 1292 1292 /* … … 1322 1322 } 1323 1323 1324 unsigned int uHdrLen;1325 if (vnet MergeableRxBuffers(pThis))1326 uHdrLen= sizeof(VNETHDRMRX);1324 unsigned int cbHdr; 1325 if (vnetR3MergeableRxBuffers(pThis)) 1326 cbHdr = sizeof(VNETHDRMRX); 1327 1327 else 1328 uHdrLen= sizeof(VNETHDR);1329 1330 Log3(("%s vnet TransmitPendingPackets: About to transmit %d pending packets\n",1328 cbHdr = sizeof(VNETHDR); 1329 1330 Log3(("%s vnetR3TransmitPendingPackets: About to transmit %d pending packets\n", 1331 1331 INSTANCE(pThis), vringReadAvailIndex(&pThis->VPCI, &pThis->pTxQueue->VRing) - pThis->pTxQueue->uNextAvailIndex)); 1332 1332 … … 1341 1341 { 1342 1342 unsigned int uOffset = 0; 1343 if (elem.nOut < 2 || elem.aSegsOut[0].cb != uHdrLen)1344 { 1345 Log(("%s vnet QueueTransmit: The first segment is not the header! (%u < 2 || %u != %u).\n",1346 INSTANCE(pThis), elem.nOut, elem.aSegsOut[0].cb, uHdrLen));1343 if (elem.nOut < 2 || elem.aSegsOut[0].cb != cbHdr) 1344 { 1345 Log(("%s vnetR3QueueTransmit: The first segment is not the header! (%u < 2 || %u != %u).\n", 1346 INSTANCE(pThis), elem.nOut, elem.aSegsOut[0].cb, cbHdr)); 1347 1347 break; /* For now we simply ignore the header, but it must be there anyway! */ 1348 1348 } … … 1356 1356 for (unsigned int i = 1; i < elem.nOut && uSize < VNET_MAX_FRAME_SIZE; i++) 1357 1357 uSize += elem.aSegsOut[i].cb; 1358 Log5(("%s vnet TransmitPendingPackets: complete frame is %u bytes.\n", INSTANCE(pThis), uSize));1358 Log5(("%s vnetR3TransmitPendingPackets: complete frame is %u bytes.\n", INSTANCE(pThis), uSize)); 1359 1359 Assert(uSize <= VNET_MAX_FRAME_SIZE); 1360 1360 … … 1362 1362 if (uSize > VNET_MAX_FRAME_SIZE) 1363 1363 uSize = VNET_MAX_FRAME_SIZE; 1364 if (pThis->pDrv && vnetR eadHeader(pThis, elem.aSegsOut[0].addr, &Hdr, uSize))1364 if (pThis->pDrv && vnetR3ReadHeader(pThis, elem.aSegsOut[0].addr, &Hdr, uSize)) 1365 1365 { 1366 1366 RT_UNTRUSTED_VALIDATED_FENCE(); … … 1369 1369 1370 1370 PDMNETWORKGSO Gso; 1371 PDMNETWORKGSO *pGso = vnet SetupGsoCtx(&Gso, &Hdr);1371 PDMNETWORKGSO *pGso = vnetR3SetupGsoCtx(&Gso, &Hdr); 1372 1372 1373 1373 /** @todo Optimize away the extra copying! (lazy bird) */ … … 1389 1389 uSize -= cbSegment; 1390 1390 } 1391 rc = vnet TransmitFrame(pThis, pSgBuf, pGso, &Hdr);1391 rc = vnetR3TransmitFrame(pThis, pSgBuf, pGso, &Hdr); 1392 1392 } 1393 1393 else … … 1420 1420 * @interface_method_impl{PDMINETWORKDOWN,pfnXmitPending} 1421 1421 */ 1422 static DECLCALLBACK(void) vnet NetworkDown_XmitPending(PPDMINETWORKDOWN pInterface)1422 static DECLCALLBACK(void) vnetR3NetworkDown_XmitPending(PPDMINETWORKDOWN pInterface) 1423 1423 { 1424 1424 PVNETSTATE pThis = RT_FROM_MEMBER(pInterface, VNETSTATE, INetworkDown); 1425 #if defined(VBOX_WITH_STATISTICS) 1426 STAM_REL_COUNTER_INC(&pThis->StatTransmitByNetwork); 1427 #endif /* VBOX_WITH_STATISTICS */ 1428 vnetTransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/); 1429 } 1430 1431 #ifdef VNET_TX_DELAY 1432 1433 static DECLCALLBACK(void) vnetQueueTransmit(void *pvState, PVQUEUE pQueue) 1425 STAM_COUNTER_INC(&pThis->StatTransmitByNetwork); 1426 vnetR3TransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/); 1427 } 1428 1429 # ifdef VNET_TX_DELAY 1430 1431 static DECLCALLBACK(void) vnetR3QueueTransmit(void *pvState, PVQUEUE pQueue) 1434 1432 { 1435 1433 PVNETSTATE pThis = (PVNETSTATE)pvState; … … 1438 1436 { 1439 1437 TMTimerStop(pThis->CTX_SUFF(pTxTimer)); 1440 Log3(("%s vnet QueueTransmit: Got kicked with notification disabled, re-enable notification and flush TX queue\n", INSTANCE(pThis)));1441 vnet TransmitPendingPackets(pThis, pQueue, false /*fOnWorkerThread*/);1442 if (RT_FAILURE(vnet CsEnter(pThis, VERR_SEM_BUSY)))1443 LogRel(("vnet QueueTransmit: Failed to enter critical section!/n"));1438 Log3(("%s vnetR3QueueTransmit: Got kicked with notification disabled, re-enable notification and flush TX queue\n", INSTANCE(pThis))); 1439 vnetR3TransmitPendingPackets(pThis, pQueue, false /*fOnWorkerThread*/); 1440 if (RT_FAILURE(vnetR3CsEnter(pThis, VERR_SEM_BUSY))) 1441 LogRel(("vnetR3QueueTransmit: Failed to enter critical section!/n")); 1444 1442 else 1445 1443 { 1446 1444 vringSetNotification(&pThis->VPCI, &pThis->pTxQueue->VRing, true); 1447 vnet CsLeave(pThis);1445 vnetR3CsLeave(pThis); 1448 1446 } 1449 1447 } 1450 1448 else 1451 1449 { 1452 if (RT_FAILURE(vnet CsEnter(pThis, VERR_SEM_BUSY)))1453 LogRel(("vnet QueueTransmit: Failed to enter critical section!/n"));1450 if (RT_FAILURE(vnetR3CsEnter(pThis, VERR_SEM_BUSY))) 1451 LogRel(("vnetR3QueueTransmit: Failed to enter critical section!/n")); 1454 1452 else 1455 1453 { … … 1457 1455 TMTimerSetMicro(pThis->CTX_SUFF(pTxTimer), VNET_TX_DELAY); 1458 1456 pThis->u64NanoTS = RTTimeNanoTS(); 1459 vnet CsLeave(pThis);1457 vnetR3CsLeave(pThis); 1460 1458 } 1461 1459 } … … 1465 1463 * @callback_method_impl{FNTMTIMERDEV, Transmit Delay Timer handler.} 1466 1464 */ 1467 static DECLCALLBACK(void) vnet TxTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)1465 static DECLCALLBACK(void) vnetR3TxTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 1468 1466 { 1469 1467 RT_NOREF(pDevIns, pTimer); … … 1477 1475 pThis->u32AvgDiff = (pThis->u32AvgDiff * pThis->u32i + u32MicroDiff) / (pThis->u32i + 1); 1478 1476 pThis->u32i++; 1479 Log3(("vnet TxTimer: Expired, diff %9d usec, avg %9d usec, min %9d usec, max %9d usec\n",1477 Log3(("vnetR3TxTimer: Expired, diff %9d usec, avg %9d usec, min %9d usec, max %9d usec\n", 1480 1478 u32MicroDiff, pThis->u32AvgDiff, pThis->u32MinDiff, pThis->u32MaxDiff)); 1481 1479 1482 // Log3(("%s vnet TxTimer: Expired\n", INSTANCE(pThis)));1483 vnet TransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/);1484 if (RT_FAILURE(vnet CsEnter(pThis, VERR_SEM_BUSY)))1485 { 1486 LogRel(("vnet TxTimer: Failed to enter critical section!/n"));1480 // Log3(("%s vnetR3TxTimer: Expired\n", INSTANCE(pThis))); 1481 vnetR3TransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/); 1482 if (RT_FAILURE(vnetR3CsEnter(pThis, VERR_SEM_BUSY))) 1483 { 1484 LogRel(("vnetR3TxTimer: Failed to enter critical section!/n")); 1487 1485 return; 1488 1486 } 1489 1487 vringSetNotification(&pThis->VPCI, &pThis->pTxQueue->VRing, true); 1490 vnet CsLeave(pThis);1491 } 1492 1493 inline int vnetCreateTxThreadAndEvent(PPDMDEVINS pDevIns, PVNETSTATE pThis)1488 vnetR3CsLeave(pThis); 1489 } 1490 1491 DECLINLINE(int) vnetR3CreateTxThreadAndEvent(PPDMDEVINS pDevIns, PVNETSTATE pThis) 1494 1492 { 1495 1493 RT_NOREF(pDevIns, pThis); … … 1497 1495 } 1498 1496 1499 inline void vnetDestroyTxThreadAndEvent(PVNETSTATE pThis)1497 DECLINLINE(void) vnetR3DestroyTxThreadAndEvent(PVNETSTATE pThis) 1500 1498 { 1501 1499 RT_NOREF(pThis); 1502 1500 } 1503 #else /* !VNET_TX_DELAY */ 1504 1505 static DECLCALLBACK(int) vnetTxThread(PPDMDEVINS pDevIns, PPDMTHREAD pThread) 1501 1502 # else /* !VNET_TX_DELAY */ 1503 1504 static DECLCALLBACK(int) vnetR3TxThread(PPDMDEVINS pDevIns, PPDMTHREAD pThread) 1506 1505 { 1507 1506 RT_NOREF(pDevIns); … … 1517 1516 if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING)) 1518 1517 break; 1519 #if defined(VBOX_WITH_STATISTICS) 1520 STAM_REL_COUNTER_INC(&pThis->StatTransmitByThread); 1521 #endif /* VBOX_WITH_STATISTICS */ 1518 STAM_COUNTER_INC(&pThis->StatTransmitByThread); 1522 1519 while (true) 1523 1520 { 1524 vnet TransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/); /// @todo shouldn't it be true instead?1525 Log(("vnet TxThread: enable kicking and get to sleep\n"));1521 vnetR3TransmitPendingPackets(pThis, pThis->pTxQueue, false /*fOnWorkerThread*/); /// @todo shouldn't it be true instead? 1522 Log(("vnetR3TxThread: enable kicking and get to sleep\n")); 1526 1523 vringSetNotification(&pThis->VPCI, &pThis->pTxQueue->VRing, true); 1527 1524 if (vqueueIsEmpty(&pThis->VPCI, pThis->pTxQueue)) … … 1548 1545 } 1549 1546 1550 static int vnet CreateTxThreadAndEvent(PPDMDEVINS pDevIns, PVNETSTATE pThis)1547 static int vnetR3CreateTxThreadAndEvent(PPDMDEVINS pDevIns, PVNETSTATE pThis) 1551 1548 { 1552 1549 int rc = SUPSemEventCreate(pThis->pSupDrvSession, &pThis->hTxEvent); … … 1554 1551 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 1555 1552 N_("VNET: Failed to create SUP event semaphore")); 1556 rc = PDMDevHlpThreadCreate(pDevIns, &pThis->pTxThread, pThis, vnet TxThread,1553 rc = PDMDevHlpThreadCreate(pDevIns, &pThis->pTxThread, pThis, vnetR3TxThread, 1557 1554 vnetTxThreadWakeUp, 0, RTTHREADTYPE_IO, INSTANCE(pThis)); 1558 1555 if (RT_FAILURE(rc)) … … 1562 1559 } 1563 1560 1564 static void vnet DestroyTxThreadAndEvent(PVNETSTATE pThis)1561 static void vnetR3DestroyTxThreadAndEvent(PVNETSTATE pThis) 1565 1562 { 1566 1563 if (pThis->pTxThread) … … 1580 1577 } 1581 1578 1582 static DECLCALLBACK(void) vnet QueueTransmit(void *pvState, PVQUEUE pQueue)1579 static DECLCALLBACK(void) vnetR3QueueTransmit(void *pvState, PVQUEUE pQueue) 1583 1580 { 1584 1581 PVNETSTATE pThis = (PVNETSTATE)pvState; 1585 1582 1586 Log(("vnet QueueTransmit: disable kicking and wake up TX thread\n"));1583 Log(("vnetR3QueueTransmit: disable kicking and wake up TX thread\n")); 1587 1584 vringSetNotification(&pThis->VPCI, &pQueue->VRing, false); 1588 1585 SUPSemEventSignal(pThis->pSupDrvSession, pThis->hTxEvent); 1589 1586 } 1590 1587 1591 # endif /* !VNET_TX_DELAY */1592 1593 static uint8_t vnet ControlRx(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem)1588 # endif /* !VNET_TX_DELAY */ 1589 1590 static uint8_t vnetR3ControlRx(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem) 1594 1591 { 1595 1592 uint8_t u8Ack = VNET_OK; … … 1598 1595 pElem->aSegsOut[1].addr, 1599 1596 &fOn, sizeof(fOn)); 1600 Log(("%s vnet ControlRx: uCommand=%u fOn=%u\n", INSTANCE(pThis), pCtlHdr->u8Command, fOn));1597 Log(("%s vnetR3ControlRx: uCommand=%u fOn=%u\n", INSTANCE(pThis), pCtlHdr->u8Command, fOn)); 1601 1598 switch (pCtlHdr->u8Command) 1602 1599 { … … 1617 1614 } 1618 1615 1619 static uint8_t vnet ControlMac(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem)1616 static uint8_t vnetR3ControlMac(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem) 1620 1617 { 1621 1618 uint32_t nMacs = 0; … … 1626 1623 || pElem->aSegsOut[2].cb < sizeof(nMacs)) 1627 1624 { 1628 Log(("%s vnet ControlMac: Segment layout is wrong (u8Command=%u nOut=%u cb1=%u cb2=%u)\n",1625 Log(("%s vnetR3ControlMac: Segment layout is wrong (u8Command=%u nOut=%u cb1=%u cb2=%u)\n", 1629 1626 INSTANCE(pThis), pCtlHdr->u8Command, pElem->nOut, pElem->aSegsOut[1].cb, pElem->aSegsOut[2].cb)); 1630 1627 return VNET_ERROR; … … 1638 1635 if (pElem->aSegsOut[1].cb < nMacs * sizeof(RTMAC) + sizeof(nMacs)) 1639 1636 { 1640 Log(("%s vnet ControlMac: The unicast mac segment is too small (nMacs=%u cb=%u)\n",1637 Log(("%s vnetR3ControlMac: The unicast mac segment is too small (nMacs=%u cb=%u)\n", 1641 1638 INSTANCE(pThis), nMacs, pElem->aSegsOut[1].cb)); 1642 1639 return VNET_ERROR; … … 1645 1642 if (nMacs > VNET_MAC_FILTER_LEN) 1646 1643 { 1647 Log(("%s vnet ControlMac: MAC table is too big, have to use promiscuous mode (nMacs=%u)\n", INSTANCE(pThis), nMacs));1644 Log(("%s vnetR3ControlMac: MAC table is too big, have to use promiscuous mode (nMacs=%u)\n", INSTANCE(pThis), nMacs)); 1648 1645 pThis->fPromiscuous = true; 1649 1646 } … … 1656 1653 pThis->nMacFilterEntries = nMacs; 1657 1654 #ifdef DEBUG 1658 Log(("%s vnet ControlMac: unicast macs:\n", INSTANCE(pThis)));1655 Log(("%s vnetR3ControlMac: unicast macs:\n", INSTANCE(pThis))); 1659 1656 for(unsigned i = 0; i < nMacs; i++) 1660 1657 Log((" %RTmac\n", &pThis->aMacFilter[i])); … … 1669 1666 if (pElem->aSegsOut[2].cb < nMacs * sizeof(RTMAC) + sizeof(nMacs)) 1670 1667 { 1671 Log(("%s vnet ControlMac: The multicast mac segment is too small (nMacs=%u cb=%u)\n",1668 Log(("%s vnetR3ControlMac: The multicast mac segment is too small (nMacs=%u cb=%u)\n", 1672 1669 INSTANCE(pThis), nMacs, pElem->aSegsOut[2].cb)); 1673 1670 return VNET_ERROR; … … 1676 1673 if (nMacs > VNET_MAC_FILTER_LEN - pThis->nMacFilterEntries) 1677 1674 { 1678 Log(("%s vnet ControlMac: MAC table is too big, have to use allmulti mode (nMacs=%u)\n", INSTANCE(pThis), nMacs));1675 Log(("%s vnetR3ControlMac: MAC table is too big, have to use allmulti mode (nMacs=%u)\n", INSTANCE(pThis), nMacs)); 1679 1676 pThis->fAllMulti = true; 1680 1677 } … … 1687 1684 nMacs * sizeof(RTMAC)); 1688 1685 #ifdef DEBUG 1689 Log(("%s vnet ControlMac: multicast macs:\n", INSTANCE(pThis)));1686 Log(("%s vnetR3ControlMac: multicast macs:\n", INSTANCE(pThis))); 1690 1687 for(unsigned i = 0; i < nMacs; i++) 1691 1688 Log((" %RTmac\n", … … 1698 1695 } 1699 1696 1700 static uint8_t vnet ControlVlan(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem)1697 static uint8_t vnetR3ControlVlan(PVNETSTATE pThis, PVNETCTLHDR pCtlHdr, PVQUEUEELEM pElem) 1701 1698 { 1702 1699 uint8_t u8Ack = VNET_OK; … … 1705 1702 if (pElem->nOut != 2 || pElem->aSegsOut[1].cb != sizeof(u16Vid)) 1706 1703 { 1707 Log(("%s vnet ControlVlan: Segment layout is wrong (u8Command=%u nOut=%u cb=%u)\n",1704 Log(("%s vnetR3ControlVlan: Segment layout is wrong (u8Command=%u nOut=%u cb=%u)\n", 1708 1705 INSTANCE(pThis), pCtlHdr->u8Command, pElem->nOut, pElem->aSegsOut[1].cb)); 1709 1706 return VNET_ERROR; … … 1716 1713 if (u16Vid >= VNET_MAX_VID) 1717 1714 { 1718 Log(("%s vnet ControlVlan: VLAN ID is out of range (VID=%u)\n", INSTANCE(pThis), u16Vid));1715 Log(("%s vnetR3ControlVlan: VLAN ID is out of range (VID=%u)\n", INSTANCE(pThis), u16Vid)); 1719 1716 return VNET_ERROR; 1720 1717 } 1721 1718 1722 Log(("%s vnet ControlVlan: uCommand=%u VID=%u\n", INSTANCE(pThis), pCtlHdr->u8Command, u16Vid));1719 Log(("%s vnetR3ControlVlan: uCommand=%u VID=%u\n", INSTANCE(pThis), pCtlHdr->u8Command, u16Vid)); 1723 1720 1724 1721 switch (pCtlHdr->u8Command) … … 1738 1735 1739 1736 1740 static DECLCALLBACK(void) vnet QueueControl(void *pvState, PVQUEUE pQueue)1737 static DECLCALLBACK(void) vnetR3QueueControl(void *pvState, PVQUEUE pQueue) 1741 1738 { 1742 1739 PVNETSTATE pThis = (PVNETSTATE)pvState; … … 1747 1744 if (elem.nOut < 1 || elem.aSegsOut[0].cb < sizeof(VNETCTLHDR)) 1748 1745 { 1749 Log(("%s vnet QueueControl: The first 'out' segment is not the header! (%u < 1 || %u < %u).\n",1746 Log(("%s vnetR3QueueControl: The first 'out' segment is not the header! (%u < 1 || %u < %u).\n", 1750 1747 INSTANCE(pThis), elem.nOut, elem.aSegsOut[0].cb,sizeof(VNETCTLHDR))); 1751 1748 break; /* Skip the element and hope the next one is good. */ 1752 1749 } 1753 elseif ( elem.nIn < 11754 1755 { 1756 Log(("%s vnet QueueControl: The last 'in' segment is too small to hold the acknowledge! (%u < 1 || %u < %u).\n",1750 if ( elem.nIn < 1 1751 || elem.aSegsIn[elem.nIn - 1].cb < sizeof(VNETCTLACK)) 1752 { 1753 Log(("%s vnetR3QueueControl: The last 'in' segment is too small to hold the acknowledge! (%u < 1 || %u < %u).\n", 1757 1754 INSTANCE(pThis), elem.nIn, elem.aSegsIn[elem.nIn - 1].cb, sizeof(VNETCTLACK))); 1758 1755 break; /* Skip the element and hope the next one is good. */ 1759 1756 } 1760 else 1761 { 1762 VNETCTLHDR CtlHdr; 1763 PDMDevHlpPhysRead(pThis->VPCI.CTX_SUFF(pDevIns), 1764 elem.aSegsOut[0].addr, 1765 &CtlHdr, sizeof(CtlHdr)); 1766 switch (CtlHdr.u8Class) 1767 { 1768 case VNET_CTRL_CLS_RX_MODE: 1769 u8Ack = vnetControlRx(pThis, &CtlHdr, &elem); 1770 break; 1771 case VNET_CTRL_CLS_MAC: 1772 u8Ack = vnetControlMac(pThis, &CtlHdr, &elem); 1773 break; 1774 case VNET_CTRL_CLS_VLAN: 1775 u8Ack = vnetControlVlan(pThis, &CtlHdr, &elem); 1776 break; 1777 default: 1778 u8Ack = VNET_ERROR; 1779 } 1780 Log(("%s Processed control message %u, ack=%u.\n", INSTANCE(pThis), CtlHdr.u8Class, u8Ack)); 1781 PDMDevHlpPCIPhysWrite(pThis->VPCI.CTX_SUFF(pDevIns), 1782 elem.aSegsIn[elem.nIn - 1].addr, 1783 &u8Ack, sizeof(u8Ack)); 1784 } 1757 1758 VNETCTLHDR CtlHdr; 1759 PDMDevHlpPhysRead(pThis->VPCI.CTX_SUFF(pDevIns), 1760 elem.aSegsOut[0].addr, 1761 &CtlHdr, sizeof(CtlHdr)); 1762 switch (CtlHdr.u8Class) 1763 { 1764 case VNET_CTRL_CLS_RX_MODE: 1765 u8Ack = vnetR3ControlRx(pThis, &CtlHdr, &elem); 1766 break; 1767 case VNET_CTRL_CLS_MAC: 1768 u8Ack = vnetR3ControlMac(pThis, &CtlHdr, &elem); 1769 break; 1770 case VNET_CTRL_CLS_VLAN: 1771 u8Ack = vnetR3ControlVlan(pThis, &CtlHdr, &elem); 1772 break; 1773 default: 1774 u8Ack = VNET_ERROR; 1775 } 1776 Log(("%s Processed control message %u, ack=%u.\n", INSTANCE(pThis), CtlHdr.u8Class, u8Ack)); 1777 PDMDevHlpPCIPhysWrite(pThis->VPCI.CTX_SUFF(pDevIns), 1778 elem.aSegsIn[elem.nIn - 1].addr, 1779 &u8Ack, sizeof(u8Ack)); 1780 1785 1781 vqueuePut(&pThis->VPCI, pQueue, &elem, sizeof(u8Ack)); 1786 1782 vqueueSync(&pThis->VPCI, pQueue); … … 1794 1790 * Saves the configuration. 1795 1791 * 1796 * @param pThis The VNET state. 1792 * @param pDevIns The device instance. 1793 * @param pThis The VNET state. 1797 1794 * @param pSSM The handle to the saved state. 1798 1795 */ 1799 static void vnet SaveConfig(PVNETSTATE pThis, PSSMHANDLE pSSM)1800 { 1801 SSMR3PutMem(pSSM, &pThis->macConfigured, sizeof(pThis->macConfigured));1796 static void vnetR3SaveConfig(PPDMDEVINS pDevIns, PVNETSTATE pThis, PSSMHANDLE pSSM) 1797 { 1798 pDevIns->pHlpR3->pfnSSMPutMem(pSSM, &pThis->macConfigured, sizeof(pThis->macConfigured)); 1802 1799 } 1803 1800 … … 1806 1803 * @callback_method_impl{FNSSMDEVLIVEEXEC} 1807 1804 */ 1808 static DECLCALLBACK(int) vnetLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) 1809 { 1805 static DECLCALLBACK(int) vnetR3LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) 1806 { 1807 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 1810 1808 RT_NOREF(uPass); 1809 vnetR3SaveConfig(pDevIns, pThis, pSSM); 1810 return VINF_SSM_DONT_CALL_AGAIN; 1811 } 1812 1813 1814 /** 1815 * @callback_method_impl{FNSSMDEVSAVEPREP} 1816 */ 1817 static DECLCALLBACK(int) vnetR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1818 { 1811 1819 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 1812 vnetSaveConfig(pThis, pSSM);1813 return VINF_SSM_DONT_CALL_AGAIN;1814 }1815 1816 1817 /**1818 * @callback_method_impl{FNSSMDEVSAVEPREP}1819 */1820 static DECLCALLBACK(int) vnetSavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)1821 {1822 1820 RT_NOREF(pSSM); 1823 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);1824 1821 1825 1822 int rc = vnetCsRxEnter(pThis, VERR_SEM_BUSY); 1826 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 1827 return rc; 1828 vnetCsRxLeave(pThis); 1829 return VINF_SUCCESS; 1823 if (RT_SUCCESS(rc)) 1824 vnetCsRxLeave(pThis); 1825 return rc; 1830 1826 } 1831 1827 … … 1834 1830 * @callback_method_impl{FNSSMDEVSAVEEXEC} 1835 1831 */ 1836 static DECLCALLBACK(int) vnetSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1837 { 1838 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 1832 static DECLCALLBACK(int) vnetR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1833 { 1834 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 1835 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 1839 1836 1840 1837 /* Save config first */ 1841 vnet SaveConfig(pThis, pSSM);1838 vnetR3SaveConfig(pDevIns, pThis, pSSM); 1842 1839 1843 1840 /* Save the common part */ 1844 1841 int rc = vpciSaveExec(&pThis->VPCI, pSSM); 1845 1842 AssertRCReturn(rc, rc); 1843 1846 1844 /* Save device-specific part */ 1847 rc = SSMR3PutMem( pSSM, pThis->config.mac.au8, sizeof(pThis->config.mac)); 1845 pHlp->pfnSSMPutMem( pSSM, pThis->config.mac.au8, sizeof(pThis->config.mac)); 1846 pHlp->pfnSSMPutBool( pSSM, pThis->fPromiscuous); 1847 pHlp->pfnSSMPutBool( pSSM, pThis->fAllMulti); 1848 pHlp->pfnSSMPutU32( pSSM, pThis->nMacFilterEntries); 1849 pHlp->pfnSSMPutMem( pSSM, pThis->aMacFilter, pThis->nMacFilterEntries * sizeof(RTMAC)); 1850 rc = pHlp->pfnSSMPutMem(pSSM, pThis->aVlanFilter, sizeof(pThis->aVlanFilter)); 1848 1851 AssertRCReturn(rc, rc); 1849 rc = SSMR3PutBool(pSSM, pThis->fPromiscuous); 1850 AssertRCReturn(rc, rc); 1851 rc = SSMR3PutBool(pSSM, pThis->fAllMulti); 1852 AssertRCReturn(rc, rc); 1853 rc = SSMR3PutU32( pSSM, pThis->nMacFilterEntries); 1854 AssertRCReturn(rc, rc); 1855 rc = SSMR3PutMem( pSSM, pThis->aMacFilter, 1856 pThis->nMacFilterEntries * sizeof(RTMAC)); 1857 AssertRCReturn(rc, rc); 1858 rc = SSMR3PutMem( pSSM, pThis->aVlanFilter, sizeof(pThis->aVlanFilter)); 1859 AssertRCReturn(rc, rc); 1852 1860 1853 Log(("%s State has been saved\n", INSTANCE(pThis))); 1861 1854 return VINF_SUCCESS; … … 1864 1857 1865 1858 /** 1866 * @callback_method_impl{FNSSMDEVLOADPREP, Serializes the receive thread, it may 1867 * be working inside the critsect. } 1868 */ 1869 static DECLCALLBACK(int) vnetLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1870 { 1859 * @callback_method_impl{FNSSMDEVLOADPREP, 1860 * Serializes the receive thread - it may be working inside the critsect. } 1861 */ 1862 static DECLCALLBACK(int) vnetR3LoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1863 { 1864 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 1871 1865 RT_NOREF(pSSM); 1872 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);1873 1866 1874 1867 int rc = vnetCsRxEnter(pThis, VERR_SEM_BUSY); 1875 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 1876 return rc; 1877 vnetCsRxLeave(pThis); 1878 return VINF_SUCCESS; 1868 if (RT_SUCCESS(rc)) 1869 vnetCsRxLeave(pThis); 1870 return rc; 1879 1871 } 1880 1872 … … 1883 1875 * @callback_method_impl{FNSSMDEVLOADEXEC} 1884 1876 */ 1885 static DECLCALLBACK(int) vnet LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)1886 { 1887 PVNETSTATE pThis= PDMDEVINS_2_DATA(pDevIns, PVNETSTATE);1888 int rc;1877 static DECLCALLBACK(int) vnetR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 1878 { 1879 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 1880 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 1889 1881 1890 1882 /* config checks */ 1891 1883 RTMAC macConfigured; 1892 rc = SSMR3GetMem(pSSM, &macConfigured, sizeof(macConfigured));1884 int rc = pHlp->pfnSSMGetMem(pSSM, &macConfigured, sizeof(macConfigured)); 1893 1885 AssertRCReturn(rc, rc); 1894 1886 if (memcmp(&macConfigured, &pThis->macConfigured, sizeof(macConfigured)) … … 1901 1893 if (uPass == SSM_PASS_FINAL) 1902 1894 { 1903 rc = SSMR3GetMem( pSSM, pThis->config.mac.au8, 1904 sizeof(pThis->config.mac)); 1895 rc = pHlp->pfnSSMGetMem( pSSM, pThis->config.mac.au8, sizeof(pThis->config.mac)); 1905 1896 AssertRCReturn(rc, rc); 1906 1897 1907 1898 if (uVersion > VIRTIO_SAVEDSTATE_VERSION_3_1_BETA1) 1908 1899 { 1909 rc = SSMR3GetBool(pSSM, &pThis->fPromiscuous); 1910 AssertRCReturn(rc, rc); 1911 rc = SSMR3GetBool(pSSM, &pThis->fAllMulti); 1912 AssertRCReturn(rc, rc); 1913 rc = SSMR3GetU32(pSSM, &pThis->nMacFilterEntries); 1914 AssertRCReturn(rc, rc); 1915 rc = SSMR3GetMem(pSSM, pThis->aMacFilter, 1916 pThis->nMacFilterEntries * sizeof(RTMAC)); 1917 AssertRCReturn(rc, rc); 1900 pHlp->pfnSSMGetBool(pSSM, &pThis->fPromiscuous); 1901 pHlp->pfnSSMGetBool(pSSM, &pThis->fAllMulti); 1902 pHlp->pfnSSMGetU32(pSSM, &pThis->nMacFilterEntries); 1903 pHlp->pfnSSMGetMem(pSSM, pThis->aMacFilter, pThis->nMacFilterEntries * sizeof(RTMAC)); 1904 1918 1905 /* Clear the rest. */ 1919 1906 if (pThis->nMacFilterEntries < VNET_MAC_FILTER_LEN) 1920 1907 memset(&pThis->aMacFilter[pThis->nMacFilterEntries], 1921 1908 0, 1922 (VNET_MAC_FILTER_LEN - pThis->nMacFilterEntries) 1923 * sizeof(RTMAC)); 1924 rc = SSMR3GetMem(pSSM, pThis->aVlanFilter, 1925 sizeof(pThis->aVlanFilter)); 1909 (VNET_MAC_FILTER_LEN - pThis->nMacFilterEntries) * sizeof(RTMAC)); 1910 rc = pHlp->pfnSSMGetMem(pSSM, pThis->aVlanFilter, sizeof(pThis->aVlanFilter)); 1926 1911 AssertRCReturn(rc, rc); 1927 1912 } … … 1946 1931 * loading.} 1947 1932 */ 1948 static DECLCALLBACK(int) vnet LoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)1933 static DECLCALLBACK(int) vnetR3LoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1949 1934 { 1950 1935 RT_NOREF(pSSM); … … 1959 1944 */ 1960 1945 if (!PDMDevHlpVMTeleportedAndNotFullyResumedYet(pDevIns)) 1961 vnet TempLinkDown(pThis);1946 vnetR3TempLinkDown(pThis); 1962 1947 1963 1948 return VINF_SUCCESS; … … 1970 1955 * @callback_method_impl{FNPCIIOREGIONMAP} 1971 1956 */ 1972 static DECLCALLBACK(int) vnet Map(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,1973 RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)1957 static DECLCALLBACK(int) vnetR3Map(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, 1958 RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType) 1974 1959 { 1975 1960 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); … … 2005 1990 2006 1991 /** 2007 * @interface_method_impl{PDMDEVREG ,pfnDetach}2008 */ 2009 static DECLCALLBACK(void) vnet Detach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)1992 * @interface_method_impl{PDMDEVREGR3,pfnDetach} 1993 */ 1994 static DECLCALLBACK(void) vnetR3Detach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 2010 1995 { 2011 1996 RT_NOREF(fFlags); 2012 1997 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 2013 Log(("%s vnet Detach:\n", INSTANCE(pThis)));1998 Log(("%s vnetR3Detach:\n", INSTANCE(pThis))); 2014 1999 2015 2000 AssertLogRelReturnVoid(iLUN == 0); 2016 2001 2017 int rc = vnet CsEnter(pThis, VERR_SEM_BUSY);2002 int rc = vnetR3CsEnter(pThis, VERR_SEM_BUSY); 2018 2003 if (RT_FAILURE(rc)) 2019 2004 { 2020 LogRel(("vnet Detach failed to enter critical section!\n"));2005 LogRel(("vnetR3Detach failed to enter critical section!\n")); 2021 2006 return; 2022 2007 } 2023 2008 2024 vnet DestroyTxThreadAndEvent(pThis);2009 vnetR3DestroyTxThreadAndEvent(pThis); 2025 2010 /* 2026 2011 * Zero some important members. … … 2029 2014 pThis->pDrv = NULL; 2030 2015 2031 vnet CsLeave(pThis);2032 } 2033 2034 2035 /** 2036 * @interface_method_impl{PDMDEVREG ,pfnAttach}2037 */ 2038 static DECLCALLBACK(int) vnet Attach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)2016 vnetR3CsLeave(pThis); 2017 } 2018 2019 2020 /** 2021 * @interface_method_impl{PDMDEVREGR3,pfnAttach} 2022 */ 2023 static DECLCALLBACK(int) vnetR3Attach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 2039 2024 { 2040 2025 RT_NOREF(fFlags); 2041 2026 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 2042 LogFlow(("%s vnet Attach:\n", INSTANCE(pThis)));2027 LogFlow(("%s vnetR3Attach:\n", INSTANCE(pThis))); 2043 2028 2044 2029 AssertLogRelReturn(iLUN == 0, VERR_PDM_NO_SUCH_LUN); 2045 2030 2046 int rc = vnet CsEnter(pThis, VERR_SEM_BUSY);2031 int rc = vnetR3CsEnter(pThis, VERR_SEM_BUSY); 2047 2032 if (RT_FAILURE(rc)) 2048 2033 { 2049 LogRel(("vnet Attach failed to enter critical section!\n"));2034 LogRel(("vnetR3Attach failed to enter critical section!\n")); 2050 2035 return rc; 2051 2036 } … … 2071 2056 rc = VERR_PDM_MISSING_INTERFACE_BELOW); 2072 2057 2073 vnet CreateTxThreadAndEvent(pDevIns, pThis);2058 vnetR3CreateTxThreadAndEvent(pDevIns, pThis); 2074 2059 } 2075 2060 else if ( rc == VERR_PDM_NO_ATTACHED_DRIVER … … 2087 2072 */ 2088 2073 if (RT_SUCCESS(rc)) 2089 vnet TempLinkDown(pThis);2090 2091 vnet CsLeave(pThis);2074 vnetR3TempLinkDown(pThis); 2075 2076 vnetR3CsLeave(pThis); 2092 2077 return rc; 2093 2078 … … 2096 2081 2097 2082 /** 2098 * @interface_method_impl{PDMDEVREG ,pfnSuspend}2099 */ 2100 static DECLCALLBACK(void) vnet Suspend(PPDMDEVINS pDevIns)2083 * @interface_method_impl{PDMDEVREGR3,pfnSuspend} 2084 */ 2085 static DECLCALLBACK(void) vnetR3Suspend(PPDMDEVINS pDevIns) 2101 2086 { 2102 2087 /* Poke thread waiting for buffer space. */ 2103 vnet WakeupReceive(pDevIns);2104 } 2105 2106 2107 /** 2108 * @interface_method_impl{PDMDEVREG ,pfnPowerOff}2109 */ 2110 static DECLCALLBACK(void) vnet PowerOff(PPDMDEVINS pDevIns)2088 vnetR3WakeupReceive(pDevIns); 2089 } 2090 2091 2092 /** 2093 * @interface_method_impl{PDMDEVREGR3,pfnPowerOff} 2094 */ 2095 static DECLCALLBACK(void) vnetR3PowerOff(PPDMDEVINS pDevIns) 2111 2096 { 2112 2097 /* Poke thread waiting for buffer space. */ 2113 vnet WakeupReceive(pDevIns);2114 } 2115 2116 2117 /** 2118 * @interface_method_impl{PDMDEVREG ,pfnRelocate}2119 */ 2120 static DECLCALLBACK(void) vnetR elocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)2098 vnetR3WakeupReceive(pDevIns); 2099 } 2100 2101 2102 /** 2103 * @interface_method_impl{PDMDEVREGR3,pfnRelocate} 2104 */ 2105 static DECLCALLBACK(void) vnetR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 2121 2106 { 2122 2107 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); … … 2131 2116 2132 2117 /** 2133 * @interface_method_impl{PDMDEVREG ,pfnDestruct}2134 */ 2135 static DECLCALLBACK(int) vnet Destruct(PPDMDEVINS pDevIns)2118 * @interface_method_impl{PDMDEVREGR3,pfnDestruct} 2119 */ 2120 static DECLCALLBACK(int) vnetR3Destruct(PPDMDEVINS pDevIns) 2136 2121 { 2137 2122 PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns); … … 2158 2143 2159 2144 /** 2160 * @interface_method_impl{PDMDEVREG ,pfnConstruct}2161 */ 2162 static DECLCALLBACK(int) vnet Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)2145 * @interface_method_impl{PDMDEVREGR3,pfnConstruct} 2146 */ 2147 static DECLCALLBACK(int) vnetR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg) 2163 2148 { 2164 2149 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 2165 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 2166 int rc; 2167 2168 /* Initialize the instance data suffiencently for the destructor not to blow up. */ 2150 PVNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVNETSTATE); 2151 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 2152 int rc; 2153 2154 /* 2155 * Initialize the instance data suffiencently for the destructor not to blow up. 2156 */ 2169 2157 pThis->hEventMoreRxDescAvail = NIL_RTSEMEVENT; 2170 2158 … … 2175 2163 /* Initialize PCI part. */ 2176 2164 pThis->VPCI.IBase.pfnQueryInterface = vnetQueryInterface; 2177 rc = vpciConstruct(pDevIns, &pThis->VPCI, iInstance, 2178 VNET_NAME_FMT, VIRTIO_NET_ID, 2179 VNET_PCI_CLASS, VNET_N_QUEUES); 2180 pThis->pRxQueue = vpciAddQueue(&pThis->VPCI, 256, vnetQueueReceive, "RX "); 2181 pThis->pTxQueue = vpciAddQueue(&pThis->VPCI, 256, vnetQueueTransmit, "TX "); 2182 pThis->pCtlQueue = vpciAddQueue(&pThis->VPCI, 16, vnetQueueControl, "CTL"); 2165 2166 rc = vpciConstruct(pDevIns, &pThis->VPCI, iInstance, VNET_NAME_FMT, VIRTIO_NET_ID, VNET_PCI_CLASS, VNET_N_QUEUES); 2167 AssertRCReturn(rc, rc); 2168 2169 pThis->pRxQueue = vpciAddQueue(&pThis->VPCI, 256, vnetR3QueueReceive, "RX "); 2170 pThis->pTxQueue = vpciAddQueue(&pThis->VPCI, 256, vnetR3QueueTransmit, "TX "); 2171 pThis->pCtlQueue = vpciAddQueue(&pThis->VPCI, 16, vnetR3QueueControl, "CTL"); 2183 2172 2184 2173 Log(("%s Constructing new instance\n", INSTANCE(pThis))); … … 2187 2176 * Validate configuration. 2188 2177 */ 2189 if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "LineSpeed\0" "LinkUpDelay\0")) 2190 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, N_("Invalid configuration for VirtioNet device")); 2178 PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "MAC|CableConnected|LineSpeed|LinkUpDelay", ""); 2191 2179 2192 2180 /* Get config params */ 2193 rc = CFGMR3QueryBytes(pCfg, "MAC", pThis->macConfigured.au8, 2194 sizeof(pThis->macConfigured)); 2181 rc = pHlp->pfnCFGMQueryBytes(pCfg, "MAC", pThis->macConfigured.au8, sizeof(pThis->macConfigured)); 2195 2182 if (RT_FAILURE(rc)) 2196 return PDMDEV_SET_ERROR(pDevIns, rc, 2197 N_("Configuration error: Failed to get MAC address")); 2198 rc = CFGMR3QueryBool(pCfg, "CableConnected", &pThis->fCableConnected); 2183 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Failed to get MAC address")); 2184 rc = pHlp->pfnCFGMQueryBool(pCfg, "CableConnected", &pThis->fCableConnected); 2199 2185 if (RT_FAILURE(rc)) 2200 return PDMDEV_SET_ERROR(pDevIns, rc, 2201 N_("Configuration error: Failed to get the value of 'CableConnected'")); 2202 rc = CFGMR3QueryU32Def(pCfg, "LinkUpDelay", (uint32_t*)&pThis->cMsLinkUpDelay, 5000); /* ms */ 2186 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Failed to get the value of 'CableConnected'")); 2187 rc = pHlp->pfnCFGMQueryU32Def(pCfg, "LinkUpDelay", &pThis->cMsLinkUpDelay, 5000); /* ms */ 2203 2188 if (RT_FAILURE(rc)) 2204 return PDMDEV_SET_ERROR(pDevIns, rc, 2205 N_("Configuration error: Failed to get the value of 'LinkUpDelay'")); 2189 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Failed to get the value of 'LinkUpDelay'")); 2206 2190 Assert(pThis->cMsLinkUpDelay <= 300000); /* less than 5 minutes */ 2207 2191 if (pThis->cMsLinkUpDelay > 5000 || pThis->cMsLinkUpDelay < 100) 2208 {2209 2192 LogRel(("%s WARNING! Link up delay is set to %u seconds!\n", 2210 2193 INSTANCE(pThis), pThis->cMsLinkUpDelay / 1000)); 2211 }2212 2194 Log(("%s Link up delay is set to %u seconds\n", 2213 2195 INSTANCE(pThis), pThis->cMsLinkUpDelay / 1000)); 2214 2215 2196 2216 2197 vnetPrintFeatures(pThis, vnetIoCb_GetHostFeatures(pThis), "Device supports the following features"); … … 2224 2205 2225 2206 /* Interfaces */ 2226 pThis->INetworkDown.pfnWaitReceiveAvail = vnet NetworkDown_WaitReceiveAvail;2227 pThis->INetworkDown.pfnReceive = vnet NetworkDown_Receive;2228 pThis->INetworkDown.pfnReceiveGso = vnet NetworkDown_ReceiveGso;2229 pThis->INetworkDown.pfnXmitPending = vnet NetworkDown_XmitPending;2230 2231 pThis->INetworkConfig.pfnGetMac = vnet GetMac;2232 pThis->INetworkConfig.pfnGetLinkState = vnet GetLinkState;2233 pThis->INetworkConfig.pfnSetLinkState = vnet SetLinkState;2207 pThis->INetworkDown.pfnWaitReceiveAvail = vnetR3NetworkDown_WaitReceiveAvail; 2208 pThis->INetworkDown.pfnReceive = vnetR3NetworkDown_Receive; 2209 pThis->INetworkDown.pfnReceiveGso = vnetR3NetworkDown_ReceiveGso; 2210 pThis->INetworkDown.pfnXmitPending = vnetR3NetworkDown_XmitPending; 2211 2212 pThis->INetworkConfig.pfnGetMac = vnetR3NetworkConfig_GetMac; 2213 pThis->INetworkConfig.pfnGetLinkState = vnetR3NetworkConfig_GetLinkState; 2214 pThis->INetworkConfig.pfnSetLinkState = vnetR3NetworkConfig_SetLinkState; 2234 2215 2235 2216 /* Initialize critical section. */ … … 2241 2222 2242 2223 /* Map our ports to IO space. */ 2243 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, 2244 VPCI_CONFIG + sizeof(VNetPCIConfig), 2245 PCI_ADDRESS_SPACE_IO, vnetMap); 2246 if (RT_FAILURE(rc)) 2247 return rc; 2248 2224 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, VPCI_CONFIG + sizeof(VNetPCIConfig), PCI_ADDRESS_SPACE_IO, vnetR3Map); 2225 AssertRCReturn(rc, rc); 2249 2226 2250 2227 /* Register save/restore state handlers. */ 2251 2228 rc = PDMDevHlpSSMRegisterEx(pDevIns, VIRTIO_SAVEDSTATE_VERSION, sizeof(VNETSTATE), NULL, 2252 NULL, vnetLiveExec, NULL, 2253 vnetSavePrep, vnetSaveExec, NULL, 2254 vnetLoadPrep, vnetLoadExec, vnetLoadDone); 2255 if (RT_FAILURE(rc)) 2256 return rc; 2229 NULL, vnetR3LiveExec, NULL, 2230 vnetR3SavePrep, vnetR3SaveExec, NULL, 2231 vnetR3LoadPrep, vnetR3LoadExec, vnetR3LoadDone); 2232 AssertRCReturn(rc, rc); 2257 2233 2258 2234 /* Create the RX notifier signaller. */ 2259 2235 rc = PDMDevHlpQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 1, 0, 2260 vnetCanRxQueueConsumer, true, "VNet-Rcv", &pThis->pCanRxQueueR3); 2261 if (RT_FAILURE(rc)) 2262 return rc; 2236 vnetR3CanRxQueueConsumer, true, "VNet-Rcv", &pThis->pCanRxQueueR3); 2237 AssertRCReturn(rc, rc); 2263 2238 pThis->pCanRxQueueR0 = PDMQueueR0Ptr(pThis->pCanRxQueueR3); 2264 2239 pThis->pCanRxQueueRC = PDMQueueRCPtr(pThis->pCanRxQueueR3); 2265 2240 2266 2241 /* Create Link Up Timer */ 2267 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vnetLinkUpTimer, pThis, 2268 TMTIMER_FLAGS_NO_CRIT_SECT, 2242 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vnetR3LinkUpTimer, pThis, TMTIMER_FLAGS_NO_CRIT_SECT, 2269 2243 "VirtioNet Link Up Timer", &pThis->pLinkUpTimer); 2270 if (RT_FAILURE(rc)) 2271 return rc; 2244 AssertRCReturn(rc, rc); 2272 2245 2273 2246 #ifndef VNET_TX_DELAY … … 2277 2250 #else /* VNET_TX_DELAY */ 2278 2251 /* Create Transmit Delay Timer */ 2279 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vnetTxTimer, pThis, 2280 TMTIMER_FLAGS_NO_CRIT_SECT, 2252 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vnetR3TxTimer, pThis, TMTIMER_FLAGS_NO_CRIT_SECT, 2281 2253 "VirtioNet TX Delay Timer", &pThis->pTxTimerR3); 2282 if (RT_FAILURE(rc)) 2283 return rc; 2254 AssertRCReturn(rc, rc); 2284 2255 pThis->pTxTimerR0 = TMTimerR0Ptr(pThis->pTxTimerR3); 2285 2256 pThis->pTxTimerRC = TMTimerRCPtr(pThis->pTxTimerR3); … … 2301 2272 VERR_PDM_MISSING_INTERFACE_BELOW); 2302 2273 2303 vnet CreateTxThreadAndEvent(pDevIns, pThis);2274 vnetR3CreateTxThreadAndEvent(pDevIns, pThis); 2304 2275 } 2305 2276 else if ( rc == VERR_PDM_NO_ATTACHED_DRIVER … … 2313 2284 2314 2285 rc = RTSemEventCreate(&pThis->hEventMoreRxDescAvail); 2315 if (RT_FAILURE(rc)) 2316 return rc; 2286 AssertRCReturn(rc, rc); 2317 2287 2318 2288 rc = vnetIoCb_Reset(pThis); 2319 AssertRC (rc);2289 AssertRCReturn(rc, rc); 2320 2290 2321 2291 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatReceiveBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Amount of data received", "/Public/Net/VNet%u/BytesReceived", iInstance); 2322 2292 PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatTransmitBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Amount of data transmitted", "/Public/Net/VNet%u/BytesTransmitted", iInstance); 2323 2293 2324 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatReceiveBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Amount of data received", "/Devices/VNet%d/ReceiveBytes", iInstance);2325 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatTransmitBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Amount of data transmitted", "/Devices/VNet%d/TransmitBytes", iInstance);2326 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatReceiveGSO, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of received GSO packets", "/Devices/VNet%d/Packets/ReceiveGSO", iInstance);2327 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatTransmitPackets, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of sent packets", "/Devices/VNet%d/Packets/Transmit", iInstance);2328 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatTransmitGSO, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of sent GSO packets", "/Devices/VNet%d/Packets/Transmit-Gso", iInstance);2329 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatTransmitCSum, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of completed TX checksums", "/Devices/VNet%d/Packets/Transmit-Csum", iInstance);2330 # if defined(VBOX_WITH_STATISTICS)2331 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatReceive, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive", "/Devices/VNet%d/Receive/Total", iInstance);2332 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatReceiveStore, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling receive storing", "/Devices/VNet%d/Receive/Store", iInstance);2333 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatRxOverflow, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_OCCURENCE, "Profiling RX overflows", "/Devices/VNet%d/RxOverflow", iInstance);2334 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatRxOverflowWakeup, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Nr of RX overflow wakeups", "/Devices/VNet%d/RxOverflowWakeup", iInstance);2335 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatTransmit, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling transmits in HC", "/Devices/VNet%d/Transmit/Total", iInstance);2336 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatTransmitSend, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_CALL, "Profiling send transmit in HC", "/Devices/VNet%d/Transmit/Send", iInstance);2337 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatTransmitByNetwork, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Network-initiated transmissions", "/Devices/VNet%d/Transmit/ByNetwork", iInstance);2338 PDMDevHlpSTAMRegister F(pDevIns, &pThis->StatTransmitByThread, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Thread-initiated transmissions", "/Devices/VNet%d/Transmit/ByThread", iInstance);2339 # endif /* VBOX_WITH_STATISTICS */2294 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatReceiveBytes, STAMTYPE_COUNTER, "ReceiveBytes", STAMUNIT_BYTES, "Amount of data received"); 2295 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitBytes, STAMTYPE_COUNTER, "TransmitBytes", STAMUNIT_BYTES, "Amount of data transmitted"); 2296 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatReceiveGSO, STAMTYPE_COUNTER, "Packets/ReceiveGSO", STAMUNIT_COUNT, "Number of received GSO packets"); 2297 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitPackets, STAMTYPE_COUNTER, "Packets/Transmit", STAMUNIT_COUNT, "Number of sent packets"); 2298 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitGSO, STAMTYPE_COUNTER, "Packets/Transmit-Gso", STAMUNIT_COUNT, "Number of sent GSO packets"); 2299 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitCSum, STAMTYPE_COUNTER, "Packets/Transmit-Csum", STAMUNIT_COUNT, "Number of completed TX checksums"); 2300 # ifdef VBOX_WITH_STATISTICS 2301 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatReceive, STAMTYPE_PROFILE, "Receive/Total", STAMUNIT_TICKS_PER_CALL, "Profiling receive"); 2302 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatReceiveStore, STAMTYPE_PROFILE, "Receive/Store", STAMUNIT_TICKS_PER_CALL, "Profiling receive storing"); 2303 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatRxOverflow, STAMTYPE_PROFILE, "RxOverflow", STAMUNIT_TICKS_PER_OCCURENCE, "Profiling RX overflows"); 2304 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatRxOverflowWakeup, STAMTYPE_COUNTER, "RxOverflowWakeup", STAMUNIT_OCCURENCES, "Nr of RX overflow wakeups"); 2305 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmit, STAMTYPE_PROFILE, "Transmit/Total", STAMUNIT_TICKS_PER_CALL, "Profiling transmits in HC"); 2306 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitSend, STAMTYPE_PROFILE, "Transmit/Send", STAMUNIT_TICKS_PER_CALL, "Profiling send transmit in HC"); 2307 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitByNetwork, STAMTYPE_COUNTER, "Transmit/ByNetwork", STAMUNIT_COUNT, "Network-initiated transmissions"); 2308 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTransmitByThread, STAMTYPE_COUNTER, "Transmit/ByThread", STAMUNIT_COUNT, "Thread-initiated transmissions"); 2309 # endif 2340 2310 2341 2311 return VINF_SUCCESS; … … 2369 2339 /* .pszRCMod = */ "VBoxDDRC.rc", 2370 2340 /* .pszR0Mod = */ "VBoxDDR0.r0", 2371 /* .pfnConstruct = */ vnet Construct,2372 /* .pfnDestruct = */ vnet Destruct,2373 /* .pfnRelocate = */ vnetR elocate,2341 /* .pfnConstruct = */ vnetR3Construct, 2342 /* .pfnDestruct = */ vnetR3Destruct, 2343 /* .pfnRelocate = */ vnetR3Relocate, 2374 2344 /* .pfnMemSetup = */ NULL, 2375 2345 /* .pfnPowerOn = */ NULL, 2376 2346 /* .pfnReset = */ NULL, 2377 /* .pfnSuspend = */ vnet Suspend,2347 /* .pfnSuspend = */ vnetR3Suspend, 2378 2348 /* .pfnResume = */ NULL, 2379 /* .pfnAttach = */ vnet Attach,2380 /* .pfnDetach = */ vnet Detach,2349 /* .pfnAttach = */ vnetR3Attach, 2350 /* .pfnDetach = */ vnetR3Detach, 2381 2351 /* .pfnQueryInterface = */ NULL, 2382 2352 /* .pfnInitComplete = */ NULL, 2383 /* .pfnPowerOff = */ vnet PowerOff,2353 /* .pfnPowerOff = */ vnetR3PowerOff, 2384 2354 /* .pfnSoftReset = */ NULL, 2385 2355 /* .pfnReserved0 = */ NULL,
Note:
See TracChangeset
for help on using the changeset viewer.