Changeset 93652 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Feb 8, 2022 11:26:14 AM (3 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r93115 r93652 53 53 * Defined Constants And Macros * 54 54 *********************************************************************************************************************************/ 55 #if 0 55 56 /** Enables the ring-0 part. */ 56 57 #define VBOX_WITH_DRVINTNET_IN_R0 58 #endif 57 59 58 60 … … 93 95 /** Pointer to the communication buffer (ring-3). */ 94 96 R3PTRTYPE(PINTNETBUF) pBufR3; 97 #ifdef VBOX_WITH_DRVINTNET_IN_R0 95 98 /** Ring-3 base interface for the ring-0 context. */ 96 99 PDMIBASER0 IBaseR0; … … 111 114 PPDMDRVINSRC pDrvInsRC; 112 115 RTRCPTR RCPtrAlignment; 116 #endif 113 117 114 118 /** The transmit lock. */ … … 925 929 926 930 931 #ifdef VBOX_WITH_DRVINTNET_IN_R0 932 927 933 /* -=-=-=-=- PDMIBASERC -=-=-=-=- */ 928 934 … … 933 939 { 934 940 PDRVINTNET pThis = RT_FROM_MEMBER(pInterface, DRVINTNET, IBaseRC); 935 936 941 #if 0 937 942 PDMIBASERC_RETURN_INTERFACE(pThis->pDrvInsR3, pszIID, PDMINETWORKUP, &pThis->INetworkUpRC); … … 951 956 { 952 957 PDRVINTNET pThis = RT_FROM_MEMBER(pInterface, DRVINTNET, IBaseR0); 953 #ifdef VBOX_WITH_DRVINTNET_IN_R0954 958 PDMIBASER0_RETURN_INTERFACE(pThis->pDrvInsR3, pszIID, PDMINETWORKUP, &pThis->INetworkUpR0); 955 #endif956 959 return NIL_RTR0PTR; 957 960 } 958 961 962 #endif /* VBOX_WITH_DRVINTNET_IN_R0 */ 959 963 960 964 /* -=-=-=-=- PDMIBASE -=-=-=-=- */ 965 961 966 962 967 /** … … 969 974 970 975 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase); 976 #ifdef VBOX_WITH_DRVINTNET_IN_R0 971 977 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASER0, &pThis->IBaseR0); 972 978 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASERC, &pThis->IBaseRC); 979 #endif 973 980 PDMIBASE_RETURN_INTERFACE(pszIID, PDMINETWORKUP, &pThis->INetworkUpR3); 974 981 return NULL; … … 1378 1385 /* IBase* */ 1379 1386 pDrvIns->IBase.pfnQueryInterface = drvR3IntNetIBase_QueryInterface; 1387 #ifdef VBOX_WITH_DRVINTNET_IN_R0 1380 1388 pThis->IBaseR0.pfnQueryInterface = drvR3IntNetIBaseR0_QueryInterface; 1381 1389 pThis->IBaseRC.pfnQueryInterface = drvR3IntNetIBaseRC_QueryInterface; 1390 #endif 1382 1391 /* INetworkUp */ 1383 1392 pThis->INetworkUpR3.pfnBeginXmit = drvIntNetUp_BeginXmit; … … 1792 1801 AssertRelease(RT_VALID_PTR(GetBufferPtrsReq.pRing3Buf)); 1793 1802 pThis->pBufR3 = GetBufferPtrsReq.pRing3Buf; 1803 #ifdef VBOX_WITH_DRVINTNET_IN_R0 1794 1804 pThis->pBufR0 = GetBufferPtrsReq.pRing0Buf; 1805 #endif 1795 1806 1796 1807 /* -
trunk/src/VBox/Devices/Network/DrvNetShaper.cpp
r93628 r93652 36 36 37 37 /********************************************************************************************************************************* 38 * Defined Constants And Macros * 39 *********************************************************************************************************************************/ 40 #if 0 41 #define VBOX_WITH_DRVNETSHAPER_IN_R0 42 #endif 43 44 45 /********************************************************************************************************************************* 38 46 * Structures and Typedefs * 39 47 *********************************************************************************************************************************/ … … 54 62 PPDMINETWORKUP pIBelowNetR3; 55 63 64 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 56 65 /** Pointer to the driver instance. */ 57 66 PPDMDRVINSR0 pDrvInsR0; … … 65 74 /** Ring-3 base interface for the raw-mode context. */ 66 75 PDMIBASERC IBaseRC; 76 #endif 67 77 68 78 /** For when we're the leaf driver. */ … … 292 302 293 303 304 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 305 294 306 /** 295 307 * @interface_method_impl{PDMIBASER0,pfnQueryInterface} … … 317 329 } 318 330 331 #endif 332 319 333 /** 320 334 * @interface_method_impl{PDMIBASE,pfnQueryInterface} … … 325 339 PDRVNETSHAPER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSHAPER); 326 340 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase); 341 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 327 342 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASER0, &pThis->IBaseR0); 328 343 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASERC, &pThis->IBaseRC); 344 #endif 329 345 PDMIBASE_RETURN_INTERFACE(pszIID, PDMINETWORKUP, &pThis->INetworkUpR3); 330 346 PDMIBASE_RETURN_INTERFACE(pszIID, PDMINETWORKDOWN, &pThis->INetworkDown); … … 345 361 PDMDrvHlpCritSectEnter(pDrvIns, &pThis->XmitLock, VERR_IGNORED); 346 362 pThis->pIBelowNetR3 = NULL; 363 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 347 364 pThis->pIBelowNetR0 = NIL_RTR0PTR; 365 #endif 348 366 PDMDrvHlpCritSectLeave(pDrvIns, &pThis->XmitLock); 349 367 } … … 368 386 { 369 387 pThis->pIBelowNetR3 = NULL; 388 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 370 389 pThis->pIBelowNetR0 = NIL_RTR0PTR; 390 #endif 371 391 rc = VINF_SUCCESS; 372 392 } … … 376 396 if (pThis->pIBelowNetR3) 377 397 { 398 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 378 399 PPDMIBASER0 pBaseR0 = PDMIBASE_QUERY_INTERFACE(pBaseDown, PDMIBASER0); 379 400 pThis->pIBelowNetR0 = pBaseR0 ? pBaseR0->pfnQueryInterface(pBaseR0, PDMINETWORKUP_IID) : NIL_RTR0PTR; 401 #endif 380 402 rc = VINF_SUCCESS; 381 403 } … … 425 447 */ 426 448 pThis->pDrvInsR3 = pDrvIns; 449 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 427 450 pThis->pDrvInsR0 = PDMDRVINS_2_R0PTR(pDrvIns); 451 #endif 428 452 /* IBase */ 429 453 pDrvIns->IBase.pfnQueryInterface = drvR3NetShaperIBase_QueryInterface; 454 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 430 455 pThis->IBaseR0.pfnQueryInterface = drvR3NetShaperIBaseR0_QueryInterface; 431 456 pThis->IBaseRC.pfnQueryInterface = drvR3NetShaperIBaseRC_QueryInterface; 457 #endif 432 458 /* INetworkUp */ 433 459 pThis->INetworkUpR3.pfnBeginXmit = drvNetShaperUp_BeginXmit; … … 438 464 pThis->INetworkUpR3.pfnSetPromiscuousMode = drvNetShaperUp_SetPromiscuousMode; 439 465 pThis->INetworkUpR3.pfnNotifyLinkChanged = drvR3NetShaperUp_NotifyLinkChanged; 466 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 440 467 /* Resolve the ring-0 context interface addresses. */ 441 int rc = pDrvIns->pHlpR3->pfnLdrGetR0InterfaceSymbols(pDrvIns, &pThis->INetworkUpR0, 442 sizeof(pThis->INetworkUpR0), 443 "drvNetShaperUp_", PDMINETWORKUP_SYM_LIST); 444 AssertLogRelRCReturn(rc, rc); 468 if (true) 469 { 470 int rc = pDrvIns->pHlpR3->pfnLdrGetR0InterfaceSymbols(pDrvIns, &pThis->INetworkUpR0, sizeof(pThis->INetworkUpR0), 471 "drvNetShaperUp_", PDMINETWORKUP_SYM_LIST); 472 AssertLogRelRCReturn(rc, rc); 473 } 474 #endif 445 475 /* INetworkDown */ 446 476 pThis->INetworkDown.pfnWaitReceiveAvail = drvR3NetShaperDown_WaitReceiveAvail; … … 456 486 * Create the locks. 457 487 */ 458 rc = PDMDrvHlpCritSectInit(pDrvIns, &pThis->XmitLock, RT_SRC_POS, "NetShaper");488 int rc = PDMDrvHlpCritSectInit(pDrvIns, &pThis->XmitLock, RT_SRC_POS, "NetShaper"); 459 489 AssertRCReturn(rc, rc); 460 490 … … 469 499 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "BwGroup", &pThis->pszBwGroup); 470 500 if (RT_FAILURE(rc) && rc != VERR_CFGM_VALUE_NOT_FOUND) 471 { 472 rc = PDMDRV_SET_ERROR(pDrvIns, rc, 473 N_("DrvNetShaper: Configuration error: Querying \"BwGroup\" as string failed")); 474 return rc; 475 } 476 else 477 rc = VINF_SUCCESS; 501 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("DrvNetShaper: Configuration error: Querying \"BwGroup\" as string failed")); 478 502 479 503 pThis->Filter.pIDrvNetR3 = &pThis->INetworkDown; 480 504 rc = PDMDrvHlpNetShaperAttach(pDrvIns, pThis->pszBwGroup, &pThis->Filter); 481 505 if (RT_FAILURE(rc)) 482 { 483 rc = PDMDRV_SET_ERROR(pDrvIns, rc, 484 N_("DrvNetShaper: Configuration error: Failed to attach to bandwidth group")); 485 return rc; 486 } 506 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("DrvNetShaper: Configuration error: Failed to attach to bandwidth group")); 487 507 488 508 /* … … 509 529 * Query the network connector interface. 510 530 */ 511 PPDMIBASE pBaseDown;531 PPDMIBASE pBaseDown = NULL; 512 532 rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pBaseDown); 513 533 if ( rc == VERR_PDM_NO_ATTACHED_DRIVER … … 515 535 { 516 536 pThis->pIBelowNetR3 = NULL; 537 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 517 538 pThis->pIBelowNetR0 = NIL_RTR0PTR; 539 #endif 518 540 } 519 541 else if (RT_SUCCESS(rc)) … … 525 547 return VERR_PDM_MISSING_INTERFACE_BELOW; 526 548 } 549 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 527 550 PPDMIBASER0 pBaseR0 = PDMIBASE_QUERY_INTERFACE(pBaseDown, PDMIBASER0); 528 551 pThis->pIBelowNetR0 = pBaseR0 ? pBaseR0->pfnQueryInterface(pBaseR0, PDMINETWORKUP_IID) : NIL_RTR0PTR; 552 #endif 529 553 } 530 554 else … … 567 591 "Network Shaper Filter Driver", 568 592 /* fFlags */ 593 #ifdef VBOX_WITH_DRVNETSHAPER_IN_R0 569 594 PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT | PDM_DRVREG_FLAGS_R0, 595 #else 596 PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT, 597 #endif 570 598 /* fClass. */ 571 599 PDM_DRVREG_CLASS_NETWORK,
Note:
See TracChangeset
for help on using the changeset viewer.