Changeset 107242 in vbox
- Timestamp:
- Dec 6, 2024 2:11:11 PM (6 weeks ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/log.h
r107113 r107242 808 808 LOG_GROUP_USB_DRV, 809 809 /** USB Ethernet device group. */ 810 LOG_GROUP_USB_ ETH,810 LOG_GROUP_USB_NET, 811 811 /** USBFilter group. */ 812 812 LOG_GROUP_USB_FILTER, -
trunk/src/VBox/Devices/Network/UsbEth.cpp
r106348 r107242 1 1 /* $Id$ */ 2 2 /** @file 3 * Usb MSD - USB Mass StorageDevice Emulation.3 * UsbNet - USB NCM Ethernet Device Emulation. 4 4 */ 5 5 … … 30 30 * Header Files * 31 31 *********************************************************************************************************************************/ 32 #define LOG_GROUP LOG_GROUP_USB_ ETH32 #define LOG_GROUP LOG_GROUP_USB_NET 33 33 #include <VBox/vmm/pdmusb.h> 34 34 #include <VBox/vmm/pdmnetifs.h> … … 51 51 /** @name USB Ethernet string IDs 52 52 * @{ */ 53 #define USB ETH_STR_ID_MANUFACTURER 154 #define USB ETH_STR_ID_PRODUCT 255 #define USB ETH_STR_ID_MAC_ADDRESS 353 #define USBNET_STR_ID_MANUFACTURER 1 54 #define USBNET_STR_ID_PRODUCT 2 55 #define USBNET_STR_ID_MAC_ADDRESS 3 56 56 /** @} */ 57 57 58 /** @name USB MSDvendor and product IDs58 /** @name USB Ethernet vendor and product IDs 59 59 * @{ */ 60 60 #define VBOX_USB_VENDOR 0x80EE 61 #define USB ETH_PID 0x004061 #define USBNET_PID 0x0040 62 62 /** @} */ 63 63 … … 315 315 * Endpoint status data. 316 316 */ 317 typedef struct USB ETHEP317 typedef struct USBNETEP 318 318 { 319 319 bool fHalted; 320 } USB ETHEP;320 } USBNETEP; 321 321 /** Pointer to the endpoint status. */ 322 typedef USB ETHEP *PUSBETHEP;322 typedef USBNETEP *PUSBNETEP; 323 323 324 324 … … 326 326 * A URB queue. 327 327 */ 328 typedef struct USB ETHURBQUEUE328 typedef struct USBNETURBQUEUE 329 329 { 330 330 /** The head pointer. */ … … 332 332 /** Where to insert the next entry. */ 333 333 PVUSBURB *ppTail; 334 } USB ETHURBQUEUE;334 } USBNETURBQUEUE; 335 335 /** Pointer to a URB queue. */ 336 typedef USB ETHURBQUEUE *PUSBETHURBQUEUE;336 typedef USBNETURBQUEUE *PUSBNETURBQUEUE; 337 337 /** Pointer to a const URB queue. */ 338 typedef USB ETHURBQUEUE const *PCUSBETHURBQUEUE;338 typedef USBNETURBQUEUE const *PCUSBNETURBQUEUE; 339 339 340 340 … … 342 342 * The USB Ethernet instance data. 343 343 */ 344 typedef struct USB ETH344 typedef struct USBNET 345 345 { 346 346 /** Pointer back to the PDM USB Device instance structure. */ … … 359 359 /** Endpoint 0 is the default control pipe, 1 is the host->dev bulk pipe and 2 360 360 * is the dev->host one, and 3 is the interrupt dev -> host one. */ 361 USB ETHEP aEps[4];361 USBNETEP aEps[4]; 362 362 363 363 /** The "hardware" MAC address. */ … … 385 385 * data or status to become available. 386 386 */ 387 USB ETHURBQUEUE ToHostQueue;387 USBNETURBQUEUE ToHostQueue; 388 388 /** Pending to-host interrupt queue. 389 389 * The URBs waiting here are pending the completion of the current request and 390 390 * data or status to become available. 391 391 */ 392 USB ETHURBQUEUE ToHostIntrQueue;392 USBNETURBQUEUE ToHostIntrQueue; 393 393 /** Done queue 394 394 * The URBs stashed here are waiting to be reaped. */ 395 USB ETHURBQUEUE DoneQueue;395 USBNETURBQUEUE DoneQueue; 396 396 /** Signalled when adding an URB to the done queue and fHaveDoneQueueWaiter 397 397 * is set. */ … … 407 407 /** Whether to signal the reset semaphore when the current request completes. */ 408 408 bool fSignalResetSem; 409 /** Semaphore usb MsdUsbReset waits on when a request is executing at reset409 /** Semaphore usbNetUsbReset waits on when a request is executing at reset 410 410 * time. Only signalled when fSignalResetSem is set. */ 411 411 RTSEMEVENTMULTI hEvtReset; … … 432 432 } Lun0; 433 433 434 } USB ETH;434 } USBNET; 435 435 /** Pointer to the USB Ethernet instance data. */ 436 typedef USB ETH *PUSBETH;436 typedef USBNET *PUSBNET; 437 437 438 438 … … 440 440 * Global Variables * 441 441 *********************************************************************************************************************************/ 442 static const USBNCMFUNCDESC g_Usb EthFuncDesc =442 static const USBNCMFUNCDESC g_UsbNetFuncDesc = 443 443 { 444 444 { … … 453 453 { 454 454 { 13, USB_CDC_DESCRIPTOR_TYPE_INTERFACE, USB_CDC_DESCRIPTOR_SUB_TYPE_ETHERNET_NETWORKING }, 455 USB ETH_STR_ID_MAC_ADDRESS,455 USBNET_STR_ID_MAC_ADDRESS, 456 456 0, 457 457 1514, … … 467 467 468 468 469 static const VUSBDESCIAD g_Usb EthInterfaceIad =469 static const VUSBDESCIAD g_UsbNetInterfaceIad = 470 470 { 471 471 sizeof(VUSBDESCIAD), // bLength; … … 480 480 481 481 482 static const VUSBDESCENDPOINTEX g_aUsb EthEndpointDescsAlt1FS[3] =482 static const VUSBDESCENDPOINTEX g_aUsbNetEndpointDescsAlt1FS[3] = 483 483 { 484 484 { … … 527 527 }; 528 528 529 static const VUSBDESCENDPOINTEX g_aUsb EthEndpointDescsAlt1HS[3] =529 static const VUSBDESCENDPOINTEX g_aUsbNetEndpointDescsAlt1HS[3] = 530 530 { 531 531 { … … 574 574 }; 575 575 576 static const VUSBDESCSSEPCOMPANION g_aUsb EthEpCompanionSS =576 static const VUSBDESCSSEPCOMPANION g_aUsbNetEpCompanionSS = 577 577 { 578 578 /* .bLength = */ sizeof(VUSBDESCSSEPCOMPANION), … … 583 583 }; 584 584 585 static const VUSBDESCENDPOINTEX g_aUsb EthEndpointDescsAlt1SS[3] =585 static const VUSBDESCENDPOINTEX g_aUsbNetEndpointDescsAlt1SS[3] = 586 586 { 587 587 { … … 597 597 /* .pvClass = */ NULL, 598 598 /* .cbClass = */ 0, 599 /* .pvSsepc = */ &g_aUsb EthEpCompanionSS,600 /* .cbSsepc = */ sizeof(g_aUsb EthEpCompanionSS)599 /* .pvSsepc = */ &g_aUsbNetEpCompanionSS, 600 /* .cbSsepc = */ sizeof(g_aUsbNetEpCompanionSS) 601 601 }, 602 602 { … … 612 612 /* .pvClass = */ NULL, 613 613 /* .cbClass = */ 0, 614 /* .pvSsepc = */ &g_aUsb EthEpCompanionSS,615 /* .cbSsepc = */ sizeof(g_aUsb EthEpCompanionSS)614 /* .pvSsepc = */ &g_aUsbNetEpCompanionSS, 615 /* .cbSsepc = */ sizeof(g_aUsbNetEpCompanionSS) 616 616 }, 617 617 { … … 627 627 /* .pvClass = */ NULL, 628 628 /* .cbClass = */ 0, 629 /* .pvSsepc = */ &g_aUsb EthEpCompanionSS,630 /* .cbSsepc = */ sizeof(g_aUsb EthEpCompanionSS)629 /* .pvSsepc = */ &g_aUsbNetEpCompanionSS, 630 /* .cbSsepc = */ sizeof(g_aUsbNetEpCompanionSS) 631 631 }, 632 632 }; 633 633 634 634 635 static const VUSBDESCINTERFACEEX g_aUsb EthInterfaceDescFS_0[] =635 static const VUSBDESCINTERFACEEX g_aUsbNetInterfaceDescFS_0[] = 636 636 { 637 637 { … … 648 648 }, 649 649 /* .pvMore = */ NULL, 650 /* .pvClass = */ &g_Usb EthFuncDesc,651 /* .cbClass = */ sizeof(g_Usb EthFuncDesc),652 /* .paEndpoints = */ &g_aUsb EthEndpointDescsAlt1FS[2],653 /* .pIAD = */ &g_Usb EthInterfaceIad,654 /* .cbIAD = */ sizeof(g_Usb EthInterfaceIad)650 /* .pvClass = */ &g_UsbNetFuncDesc, 651 /* .cbClass = */ sizeof(g_UsbNetFuncDesc), 652 /* .paEndpoints = */ &g_aUsbNetEndpointDescsAlt1FS[2], 653 /* .pIAD = */ &g_UsbNetInterfaceIad, 654 /* .cbIAD = */ sizeof(g_UsbNetInterfaceIad) 655 655 } 656 656 }; 657 657 658 static const VUSBDESCINTERFACEEX g_aUsb EthInterfaceDescFS_1[] =658 static const VUSBDESCINTERFACEEX g_aUsbNetInterfaceDescFS_1[] = 659 659 { 660 660 { … … 692 692 /* .pvClass = */ NULL, 693 693 /* .cbClass = */ 0, 694 &g_aUsb EthEndpointDescsAlt1FS[0],695 /* .pIAD = */ NULL, //&g_Usb EthInterfaceIad,696 /* .cbIAD = */ 0, //sizeof(g_Usb EthInterfaceIad)694 &g_aUsbNetEndpointDescsAlt1FS[0], 695 /* .pIAD = */ NULL, //&g_UsbNetInterfaceIad, 696 /* .cbIAD = */ 0, //sizeof(g_UsbNetInterfaceIad) 697 697 } 698 698 }; 699 699 700 700 701 static const VUSBDESCINTERFACEEX g_aUsb EthInterfaceDescHS_0[] =701 static const VUSBDESCINTERFACEEX g_aUsbNetInterfaceDescHS_0[] = 702 702 { 703 703 { … … 714 714 }, 715 715 /* .pvMore = */ NULL, 716 /* .pvClass = */ &g_Usb EthFuncDesc,717 /* .cbClass = */ sizeof(g_Usb EthFuncDesc),718 /* .paEndpoints = */ &g_aUsb EthEndpointDescsAlt1HS[2],719 /* .pIAD = */ &g_Usb EthInterfaceIad,720 /* .cbIAD = */ sizeof(g_Usb EthInterfaceIad)716 /* .pvClass = */ &g_UsbNetFuncDesc, 717 /* .cbClass = */ sizeof(g_UsbNetFuncDesc), 718 /* .paEndpoints = */ &g_aUsbNetEndpointDescsAlt1HS[2], 719 /* .pIAD = */ &g_UsbNetInterfaceIad, 720 /* .cbIAD = */ sizeof(g_UsbNetInterfaceIad) 721 721 } 722 722 }; 723 723 724 static const VUSBDESCINTERFACEEX g_aUsb EthInterfaceDescHS_1[] =724 static const VUSBDESCINTERFACEEX g_aUsbNetInterfaceDescHS_1[] = 725 725 { 726 726 { … … 758 758 /* .pvClass = */ NULL, 759 759 /* .cbClass = */ 0, 760 &g_aUsb EthEndpointDescsAlt1HS[0],761 /* .pIAD = */ NULL, //&g_Usb EthInterfaceIad,762 /* .cbIAD = */ 0, //sizeof(g_Usb EthInterfaceIad)760 &g_aUsbNetEndpointDescsAlt1HS[0], 761 /* .pIAD = */ NULL, //&g_UsbNetInterfaceIad, 762 /* .cbIAD = */ 0, //sizeof(g_UsbNetInterfaceIad) 763 763 } 764 764 }; 765 765 766 766 767 static const VUSBDESCINTERFACEEX g_aUsb EthInterfaceDescSS_0[] =767 static const VUSBDESCINTERFACEEX g_aUsbNetInterfaceDescSS_0[] = 768 768 { 769 769 { … … 780 780 }, 781 781 /* .pvMore = */ NULL, 782 /* .pvClass = */ &g_Usb EthFuncDesc,783 /* .cbClass = */ sizeof(g_Usb EthFuncDesc),784 /* .paEndpoints = */ &g_aUsb EthEndpointDescsAlt1SS[2],785 /* .pIAD = */ &g_Usb EthInterfaceIad,786 /* .cbIAD = */ sizeof(g_Usb EthInterfaceIad)782 /* .pvClass = */ &g_UsbNetFuncDesc, 783 /* .cbClass = */ sizeof(g_UsbNetFuncDesc), 784 /* .paEndpoints = */ &g_aUsbNetEndpointDescsAlt1SS[2], 785 /* .pIAD = */ &g_UsbNetInterfaceIad, 786 /* .cbIAD = */ sizeof(g_UsbNetInterfaceIad) 787 787 } 788 788 }; 789 789 790 static const VUSBDESCINTERFACEEX g_aUsb EthInterfaceDescSS_1[] =790 static const VUSBDESCINTERFACEEX g_aUsbNetInterfaceDescSS_1[] = 791 791 { 792 792 { … … 824 824 /* .pvClass = */ NULL, 825 825 /* .cbClass = */ 0, 826 &g_aUsb EthEndpointDescsAlt1SS[0],827 /* .pIAD = */ NULL, //&g_Usb EthInterfaceIad,828 /* .cbIAD = */ 0, //sizeof(g_Usb EthInterfaceIad)826 &g_aUsbNetEndpointDescsAlt1SS[0], 827 /* .pIAD = */ NULL, //&g_UsbNetInterfaceIad, 828 /* .cbIAD = */ 0, //sizeof(g_UsbNetInterfaceIad) 829 829 } 830 830 }; 831 831 832 static const VUSBINTERFACE g_aUsb EthInterfacesFS[] =833 { 834 { g_aUsb EthInterfaceDescFS_0, /* .cSettings = */ RT_ELEMENTS(g_aUsbEthInterfaceDescFS_0) },835 { g_aUsb EthInterfaceDescFS_1, /* .cSettings = */ RT_ELEMENTS(g_aUsbEthInterfaceDescFS_1) },832 static const VUSBINTERFACE g_aUsbNetInterfacesFS[] = 833 { 834 { g_aUsbNetInterfaceDescFS_0, /* .cSettings = */ RT_ELEMENTS(g_aUsbNetInterfaceDescFS_0) }, 835 { g_aUsbNetInterfaceDescFS_1, /* .cSettings = */ RT_ELEMENTS(g_aUsbNetInterfaceDescFS_1) }, 836 836 }; 837 837 838 static const VUSBINTERFACE g_aUsb EthInterfacesHS[] =839 { 840 { g_aUsb EthInterfaceDescHS_0, /* .cSettings = */ RT_ELEMENTS(g_aUsbEthInterfaceDescHS_0) },841 { g_aUsb EthInterfaceDescHS_1, /* .cSettings = */ RT_ELEMENTS(g_aUsbEthInterfaceDescHS_1) },838 static const VUSBINTERFACE g_aUsbNetInterfacesHS[] = 839 { 840 { g_aUsbNetInterfaceDescHS_0, /* .cSettings = */ RT_ELEMENTS(g_aUsbNetInterfaceDescHS_0) }, 841 { g_aUsbNetInterfaceDescHS_1, /* .cSettings = */ RT_ELEMENTS(g_aUsbNetInterfaceDescHS_1) }, 842 842 }; 843 843 844 static const VUSBINTERFACE g_aUsb EthInterfacesSS[] =845 { 846 { g_aUsb EthInterfaceDescSS_0, /* .cSettings = */ RT_ELEMENTS(g_aUsbEthInterfaceDescSS_0) },847 { g_aUsb EthInterfaceDescSS_1, /* .cSettings = */ RT_ELEMENTS(g_aUsbEthInterfaceDescSS_1) },844 static const VUSBINTERFACE g_aUsbNetInterfacesSS[] = 845 { 846 { g_aUsbNetInterfaceDescSS_0, /* .cSettings = */ RT_ELEMENTS(g_aUsbNetInterfaceDescSS_0) }, 847 { g_aUsbNetInterfaceDescSS_1, /* .cSettings = */ RT_ELEMENTS(g_aUsbNetInterfaceDescSS_1) }, 848 848 }; 849 849 850 static const VUSBDESCCONFIGEX g_Usb EthConfigDescFS =850 static const VUSBDESCCONFIGEX g_UsbNetConfigDescFS = 851 851 { 852 852 { … … 854 854 /* .bDescriptorType = */ VUSB_DT_CONFIG, 855 855 /* .wTotalLength = */ 0 /* recalculated on read */, 856 /* .bNumInterfaces = */ RT_ELEMENTS(g_aUsb EthInterfacesFS),856 /* .bNumInterfaces = */ RT_ELEMENTS(g_aUsbNetInterfacesFS), 857 857 /* .bConfigurationValue =*/ 1, 858 858 /* .iConfiguration = */ 0, … … 863 863 NULL, /* pvClass */ 864 864 0, /* cbClass */ 865 &g_aUsb EthInterfacesFS[0],865 &g_aUsbNetInterfacesFS[0], 866 866 NULL /* pvOriginal */ 867 867 }; 868 868 869 static const VUSBDESCCONFIGEX g_Usb EthConfigDescHS =869 static const VUSBDESCCONFIGEX g_UsbNetConfigDescHS = 870 870 { 871 871 { … … 873 873 /* .bDescriptorType = */ VUSB_DT_CONFIG, 874 874 /* .wTotalLength = */ 0 /* recalculated on read */, 875 /* .bNumInterfaces = */ RT_ELEMENTS(g_aUsb EthInterfacesHS),875 /* .bNumInterfaces = */ RT_ELEMENTS(g_aUsbNetInterfacesHS), 876 876 /* .bConfigurationValue =*/ 1, 877 877 /* .iConfiguration = */ 0, … … 882 882 NULL, /* pvClass */ 883 883 0, /* cbClass */ 884 &g_aUsb EthInterfacesHS[0],884 &g_aUsbNetInterfacesHS[0], 885 885 NULL /* pvOriginal */ 886 886 }; 887 887 888 static const VUSBDESCCONFIGEX g_Usb EthConfigDescSS =888 static const VUSBDESCCONFIGEX g_UsbNetConfigDescSS = 889 889 { 890 890 { … … 901 901 NULL, /* pvClass */ 902 902 0, /* cbClass */ 903 &g_aUsb EthInterfacesSS[0],903 &g_aUsbNetInterfacesSS[0], 904 904 NULL /* pvOriginal */ 905 905 }; 906 906 907 static const VUSBDESCDEVICE g_Usb EthDeviceDesc20 =908 { 909 /* .bLength = */ sizeof(g_Usb EthDeviceDesc20),907 static const VUSBDESCDEVICE g_UsbNetDeviceDesc20 = 908 { 909 /* .bLength = */ sizeof(g_UsbNetDeviceDesc20), 910 910 /* .bDescriptorType = */ VUSB_DT_DEVICE, 911 911 /* .bcdUsb = */ 0x200, /* USB 2.0 */ … … 915 915 /* .bMaxPacketSize0 = */ 64, 916 916 /* .idVendor = */ VBOX_USB_VENDOR, 917 /* .idProduct = */ USB ETH_PID,917 /* .idProduct = */ USBNET_PID, 918 918 /* .bcdDevice = */ 0x0100, /* 1.0 */ 919 /* .iManufacturer = */ USB ETH_STR_ID_MANUFACTURER,920 /* .iProduct = */ USB ETH_STR_ID_PRODUCT,919 /* .iManufacturer = */ USBNET_STR_ID_MANUFACTURER, 920 /* .iProduct = */ USBNET_STR_ID_PRODUCT, 921 921 /* .iSerialNumber = */ 0, 922 922 /* .bNumConfigurations = */ 1 923 923 }; 924 924 925 static const VUSBDESCDEVICE g_Usb EthDeviceDesc30 =926 { 927 /* .bLength = */ sizeof(g_Usb EthDeviceDesc30),925 static const VUSBDESCDEVICE g_UsbNetDeviceDesc30 = 926 { 927 /* .bLength = */ sizeof(g_UsbNetDeviceDesc30), 928 928 /* .bDescriptorType = */ VUSB_DT_DEVICE, 929 929 /* .bcdUsb = */ 0x300, /* USB 2.0 */ … … 933 933 /* .bMaxPacketSize0 = */ 9 /* 512, the only option for USB3. */, 934 934 /* .idVendor = */ VBOX_USB_VENDOR, 935 /* .idProduct = */ USB ETH_PID,935 /* .idProduct = */ USBNET_PID, 936 936 /* .bcdDevice = */ 0x0110, /* 1.10 */ 937 /* .iManufacturer = */ USB ETH_STR_ID_MANUFACTURER,938 /* .iProduct = */ USB ETH_STR_ID_PRODUCT,937 /* .iManufacturer = */ USBNET_STR_ID_MANUFACTURER, 938 /* .iProduct = */ USBNET_STR_ID_PRODUCT, 939 939 /* .iSerialNumber = */ 0, 940 940 /* .bNumConfigurations = */ 1 941 941 }; 942 942 943 static const VUSBDEVICEQUALIFIER g_Usb EthDeviceQualifier =944 { 945 /* .bLength = */ sizeof(g_Usb EthDeviceQualifier),943 static const VUSBDEVICEQUALIFIER g_UsbNetDeviceQualifier = 944 { 945 /* .bLength = */ sizeof(g_UsbNetDeviceQualifier), 946 946 /* .bDescriptorType = */ VUSB_DT_DEVICE_QUALIFIER, 947 947 /* .bcdUsb = */ 0x200, /* USB 2.0 */ … … 957 957 VUSBDESCBOS bos; 958 958 VUSBDESCSSDEVCAP sscap; 959 } g_Usb EthBOS =960 { 961 { 962 /* .bLength = */ sizeof(g_Usb EthBOS.bos),959 } g_UsbNetBOS = 960 { 961 { 962 /* .bLength = */ sizeof(g_UsbNetBOS.bos), 963 963 /* .bDescriptorType = */ VUSB_DT_BOS, 964 /* .wTotalLength = */ sizeof(g_Usb EthBOS),964 /* .wTotalLength = */ sizeof(g_UsbNetBOS), 965 965 /* .bNumDeviceCaps = */ 1 966 966 }, … … 981 981 * Internal Functions * 982 982 *********************************************************************************************************************************/ 983 static int usb EthHandleBulkDevToHost(PUSBETH pThis, PUSBETHEP pEp, PVUSBURB pUrb);983 static int usbNetHandleBulkDevToHost(PUSBNET pThis, PUSBNETEP pEp, PVUSBURB pUrb); 984 984 985 985 … … 989 989 * @param pQueue The URB queue. 990 990 */ 991 static void usb EthQueueInit(PUSBETHURBQUEUE pQueue)991 static void usbNetQueueInit(PUSBNETURBQUEUE pQueue) 992 992 { 993 993 pQueue->pHead = NULL; … … 1003 1003 * @param pUrb The URB to insert. 1004 1004 */ 1005 DECLINLINE(void) usb EthQueueAddTail(PUSBETHURBQUEUE pQueue, PVUSBURB pUrb)1005 DECLINLINE(void) usbNetQueueAddTail(PUSBNETURBQUEUE pQueue, PVUSBURB pUrb) 1006 1006 { 1007 1007 pUrb->Dev.pNext = NULL; … … 1017 1017 * @param pQueue The URB queue. 1018 1018 */ 1019 DECLINLINE(PVUSBURB) usb EthQueueRemoveHead(PUSBETHURBQUEUE pQueue)1019 DECLINLINE(PVUSBURB) usbNetQueueRemoveHead(PUSBNETURBQUEUE pQueue) 1020 1020 { 1021 1021 PVUSBURB pUrb = pQueue->pHead; … … 1040 1040 * @param pUrb The URB to remove. 1041 1041 */ 1042 DECLINLINE(bool) usb EthQueueRemove(PUSBETHURBQUEUE pQueue, PVUSBURB pUrb)1042 DECLINLINE(bool) usbNetQueueRemove(PUSBNETURBQUEUE pQueue, PVUSBURB pUrb) 1043 1043 { 1044 1044 PVUSBURB pCur = pQueue->pHead; … … 1071 1071 * @param pQueue The URB queue. 1072 1072 */ 1073 DECLINLINE(bool) usb EthQueueIsEmpty(PCUSBETHURBQUEUE pQueue)1073 DECLINLINE(bool) usbNetQueueIsEmpty(PCUSBNETURBQUEUE pQueue) 1074 1074 { 1075 1075 return pQueue->pHead == NULL; … … 1080 1080 * Links an URB into the done queue. 1081 1081 * 1082 * @param pThis The ETHinstance.1082 * @param pThis The USBNET instance. 1083 1083 * @param pUrb The URB. 1084 1084 */ 1085 static void usb EthLinkDone(PUSBETHpThis, PVUSBURB pUrb)1086 { 1087 usb EthQueueAddTail(&pThis->DoneQueue, pUrb);1085 static void usbNetLinkDone(PUSBNET pThis, PVUSBURB pUrb) 1086 { 1087 usbNetQueueAddTail(&pThis->DoneQueue, pUrb); 1088 1088 1089 1089 if (pThis->fHaveDoneQueueWaiter) … … 1098 1098 * Completes the URB with a stalled state, halting the pipe. 1099 1099 */ 1100 static int usb EthCompleteStall(PUSBETH pThis, PUSBETHEP pEp, PVUSBURB pUrb, const char *pszWhy)1100 static int usbNetCompleteStall(PUSBNET pThis, PUSBNETEP pEp, PVUSBURB pUrb, const char *pszWhy) 1101 1101 { 1102 1102 RT_NOREF(pszWhy); 1103 Log(("usb EthCompleteStall/#%u: pUrb=%p:%s: %s\n", pThis->pUsbIns->iInstance, pUrb, pUrb->pszDesc, pszWhy));1103 Log(("usbNetCompleteStall/#%u: pUrb=%p:%s: %s\n", pThis->pUsbIns->iInstance, pUrb, pUrb->pszDesc, pszWhy)); 1104 1104 1105 1105 pUrb->enmStatus = VUSBSTATUS_STALL; … … 1115 1115 } 1116 1116 1117 usb EthLinkDone(pThis, pUrb);1117 usbNetLinkDone(pThis, pUrb); 1118 1118 return VINF_SUCCESS; 1119 1119 } … … 1123 1123 * Completes the URB with a OK state. 1124 1124 */ 1125 static int usb EthCompleteOk(PUSBETHpThis, PVUSBURB pUrb, size_t cbData)1126 { 1127 Log(("usb EthCompleteOk/#%u: pUrb=%p:%s cbData=%#zx\n", pThis->pUsbIns->iInstance, pUrb, pUrb->pszDesc, cbData));1125 static int usbNetCompleteOk(PUSBNET pThis, PVUSBURB pUrb, size_t cbData) 1126 { 1127 Log(("usbNetCompleteOk/#%u: pUrb=%p:%s cbData=%#zx\n", pThis->pUsbIns->iInstance, pUrb, pUrb->pszDesc, cbData)); 1128 1128 1129 1129 pUrb->enmStatus = VUSBSTATUS_OK; 1130 1130 pUrb->cbData = (uint32_t)cbData; 1131 1131 1132 usb EthLinkDone(pThis, pUrb);1132 usbNetLinkDone(pThis, pUrb); 1133 1133 return VINF_SUCCESS; 1134 1134 } … … 1139 1139 * into the URB. May still generate an error if the URB is not big enough. 1140 1140 */ 1141 static void usb EthCompleteNotificationOk(PUSBETHpThis, PVUSBURB pUrb, const void *pSrc, size_t cbSrc)1142 { 1143 Log(("usb EthCompleteNotificationOk/#%u: pUrb=%p:%s (cbData=%#x) cbSrc=%#zx\n", pThis->pUsbIns->iInstance, pUrb, pUrb->pszDesc, pUrb->cbData, cbSrc));1141 static void usbNetCompleteNotificationOk(PUSBNET pThis, PVUSBURB pUrb, const void *pSrc, size_t cbSrc) 1142 { 1143 Log(("usbNetCompleteNotificationOk/#%u: pUrb=%p:%s (cbData=%#x) cbSrc=%#zx\n", pThis->pUsbIns->iInstance, pUrb, pUrb->pszDesc, pUrb->cbData, cbSrc)); 1144 1144 1145 1145 pUrb->enmStatus = VUSBSTATUS_OK; … … 1170 1170 Assert(cbSrc == 0); /* Make up your mind, caller! */ 1171 1171 1172 usb EthLinkDone(pThis, pUrb);1173 } 1174 1175 1176 /** 1177 * Reset worker for usb MsdUsbReset, usbMsdUsbSetConfiguration and1178 * usb MsdUrbHandleDefaultPipe.1172 usbNetLinkDone(pThis, pUrb); 1173 } 1174 1175 1176 /** 1177 * Reset worker for usbNetUsbReset, usbNetUsbSetConfiguration and 1178 * usbNetUrbHandleDefaultPipe. 1179 1179 * 1180 1180 * @returns VBox status code. 1181 1181 * @param pThis The MSD instance. 1182 * @param pUrb Set when usb MsdUrbHandleDefaultPipe is the1182 * @param pUrb Set when usbNetUrbHandleDefaultPipe is the 1183 1183 * caller. 1184 * @param fSetConfig Set when usb MsdUsbSetConfiguration is the1184 * @param fSetConfig Set when usbNetUsbSetConfiguration is the 1185 1185 * caller. 1186 1186 */ 1187 static int usb EthResetWorker(PUSBETHpThis, PVUSBURB pUrb, bool fSetConfig)1187 static int usbNetResetWorker(PUSBNET pThis, PVUSBURB pUrb, bool fSetConfig) 1188 1188 { 1189 1189 for (unsigned i = 0; i < RT_ELEMENTS(pThis->aEps); i++) … … 1199 1199 */ 1200 1200 PVUSBURB pCurUrb; 1201 while ((pCurUrb = usb EthQueueRemoveHead(&pThis->ToHostQueue)) != NULL)1201 while ((pCurUrb = usbNetQueueRemoveHead(&pThis->ToHostQueue)) != NULL) 1202 1202 { 1203 1203 pCurUrb->enmStatus = VUSBSTATUS_CRC; 1204 usb EthLinkDone(pThis, pCurUrb);1205 } 1206 1207 while ((pCurUrb = usb EthQueueRemoveHead(&pThis->ToHostIntrQueue)) != NULL)1204 usbNetLinkDone(pThis, pCurUrb); 1205 } 1206 1207 while ((pCurUrb = usbNetQueueRemoveHead(&pThis->ToHostIntrQueue)) != NULL) 1208 1208 { 1209 1209 pCurUrb->enmStatus = VUSBSTATUS_CRC; 1210 usb EthLinkDone(pThis, pCurUrb);1210 usbNetLinkDone(pThis, pCurUrb); 1211 1211 } 1212 1212 … … 1216 1216 pThis->pResetUrb = NULL; 1217 1217 pCurUrb->enmStatus = VUSBSTATUS_CRC; 1218 usb EthLinkDone(pThis, pCurUrb);1218 usbNetLinkDone(pThis, pCurUrb); 1219 1219 } 1220 1220 1221 1221 if (pUrb) 1222 return usb EthCompleteOk(pThis, pUrb, 0);1222 return usbNetCompleteOk(pThis, pUrb, 0); 1223 1223 return VINF_SUCCESS; 1224 1224 } … … 1228 1228 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 1229 1229 */ 1230 static DECLCALLBACK(void *) usb EthLun0QueryInterface(PPDMIBASE pInterface, const char *pszIID)1231 { 1232 PUSB ETH pThis = RT_FROM_MEMBER(pInterface, USBETH, Lun0.IBase);1230 static DECLCALLBACK(void *) usbNetLun0QueryInterface(PPDMIBASE pInterface, const char *pszIID) 1231 { 1232 PUSBNET pThis = RT_FROM_MEMBER(pInterface, USBNET, Lun0.IBase); 1233 1233 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->Lun0.IBase); 1234 1234 PDMIBASE_RETURN_INTERFACE(pszIID, PDMINETWORKCONFIG, &pThis->Lun0.INetworkConfig); … … 1238 1238 1239 1239 1240 static DECLCALLBACK(int) usb EthNetworkDown_WaitReceiveAvail(PPDMINETWORKDOWN pInterface, RTMSINTERVAL cMillies)1241 { 1242 PUSB ETH pThis = RT_FROM_MEMBER(pInterface, USBETH, Lun0.INetworkDown);1240 static DECLCALLBACK(int) usbNetNetworkDown_WaitReceiveAvail(PPDMINETWORKDOWN pInterface, RTMSINTERVAL cMillies) 1241 { 1242 PUSBNET pThis = RT_FROM_MEMBER(pInterface, USBNET, Lun0.INetworkDown); 1243 1243 1244 1244 RTCritSectEnter(&pThis->CritSect); 1245 if (!usb EthQueueIsEmpty(&pThis->ToHostQueue))1245 if (!usbNetQueueIsEmpty(&pThis->ToHostQueue)) 1246 1246 { 1247 1247 RTCritSectLeave(&pThis->CritSect); … … 1265 1265 * @param cb Frame size. 1266 1266 */ 1267 static DECLCALLBACK(int) usb EthNetworkDown_Receive(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb)1268 { 1269 PUSB ETH pThis = RT_FROM_MEMBER(pInterface, USBETH, Lun0.INetworkDown);1267 static DECLCALLBACK(int) usbNetNetworkDown_Receive(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb) 1268 { 1269 PUSBNET pThis = RT_FROM_MEMBER(pInterface, USBNET, Lun0.INetworkDown); 1270 1270 1271 1271 RTCritSectEnter(&pThis->CritSect); 1272 1272 1273 if (usb EthQueueIsEmpty(&pThis->ToHostQueue))1273 if (usbNetQueueIsEmpty(&pThis->ToHostQueue)) 1274 1274 { 1275 1275 RTCritSectLeave(&pThis->CritSect); … … 1277 1277 } 1278 1278 1279 PVUSBURB pUrb = usb EthQueueRemoveHead(&pThis->ToHostQueue);1280 PUSB ETHEP pEp = &pThis->aEps[2];1279 PVUSBURB pUrb = usbNetQueueRemoveHead(&pThis->ToHostQueue); 1280 PUSBNETEP pEp = &pThis->aEps[2]; 1281 1281 1282 1282 if (RT_UNLIKELY(pEp->fHalted)) 1283 1283 { 1284 usb EthCompleteStall(pThis, NULL, pUrb, "Halted pipe");1284 usbNetCompleteStall(pThis, NULL, pUrb, "Halted pipe"); 1285 1285 RTCritSectLeave(&pThis->CritSect); 1286 1286 return VINF_SUCCESS; … … 1289 1289 if (pUrb->cbData < sizeof(USBNCMNTH16) + sizeof(USBNCMNDP16) + cb) 1290 1290 { 1291 Log(("Usb Eth: Receive URB too small (%#x vs %#x)\n", pUrb->cbData, sizeof(USBNCMNTH16) + sizeof(USBNCMNDP16) + cb));1291 Log(("UsbNet: Receive URB too small (%#x vs %#x)\n", pUrb->cbData, sizeof(USBNCMNTH16) + sizeof(USBNCMNDP16) + cb)); 1292 1292 pUrb->enmStatus = VUSBSTATUS_DATA_OVERRUN; 1293 usb EthLinkDone(pThis, pUrb);1293 usbNetLinkDone(pThis, pUrb); 1294 1294 RTCritSectLeave(&pThis->CritSect); 1295 1295 return VINF_SUCCESS; … … 1319 1319 1320 1320 pUrb->cbData = (uint32_t)(sizeof(*pNth16) + sizeof(*pNdp16) + cb); 1321 usb EthLinkDone(pThis, pUrb);1321 usbNetLinkDone(pThis, pUrb); 1322 1322 RTCritSectLeave(&pThis->CritSect); 1323 1323 … … 1329 1329 * @interface_method_impl{PDMINETWORKDOWN,pfnXmitPending} 1330 1330 */ 1331 static DECLCALLBACK(void) usb EthNetworkDown_XmitPending(PPDMINETWORKDOWN pInterface)1331 static DECLCALLBACK(void) usbNetNetworkDown_XmitPending(PPDMINETWORKDOWN pInterface) 1332 1332 { 1333 1333 RT_NOREF(pInterface); … … 1335 1335 1336 1336 1337 /* -=-=-=-=-=- USB ETH::INetworkConfig -=-=-=-=-=- */1337 /* -=-=-=-=-=- USBNET::INetworkConfig -=-=-=-=-=- */ 1338 1338 1339 1339 /** 1340 1340 * @interface_method_impl{PDMINETWORKCONFIG,pfnGetMac} 1341 1341 */ 1342 static DECLCALLBACK(int) usb EthGetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac)1343 { 1344 PUSB ETH pThis = RT_FROM_MEMBER(pInterface, USBETH, Lun0.INetworkConfig);1342 static DECLCALLBACK(int) usbNetGetMac(PPDMINETWORKCONFIG pInterface, PRTMAC pMac) 1343 { 1344 PUSBNET pThis = RT_FROM_MEMBER(pInterface, USBNET, Lun0.INetworkConfig); 1345 1345 1346 1346 LogFlowFunc(("#%d\n", pThis->pUsbIns->iInstance)); … … 1353 1353 * @interface_method_impl{PDMINETWORKCONFIG,pfnGetLinkState} 1354 1354 */ 1355 static DECLCALLBACK(PDMNETWORKLINKSTATE) usb EthGetLinkState(PPDMINETWORKCONFIG pInterface)1356 { 1357 PUSB ETH pThis = RT_FROM_MEMBER(pInterface, USBETH, Lun0.INetworkConfig);1355 static DECLCALLBACK(PDMNETWORKLINKSTATE) usbNetGetLinkState(PPDMINETWORKCONFIG pInterface) 1356 { 1357 PUSBNET pThis = RT_FROM_MEMBER(pInterface, USBNET, Lun0.INetworkConfig); 1358 1358 1359 1359 if (pThis->fLinkUp && !pThis->fLinkTempDown) … … 1371 1371 * @interface_method_impl{PDMINETWORKCONFIG,pfnSetLinkState} 1372 1372 */ 1373 static DECLCALLBACK(int) usb EthSetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState)1374 { 1375 PUSB ETH pThis = RT_FROM_MEMBER(pInterface, USBETH, Lun0.INetworkConfig);1373 static DECLCALLBACK(int) usbNetSetLinkState(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState) 1374 { 1375 PUSBNET pThis = RT_FROM_MEMBER(pInterface, USBNET, Lun0.INetworkConfig); 1376 1376 1377 1377 //bool fLinkUp; … … 1428 1428 * @interface_method_impl{PDMUSBREG,pfnUrbReap} 1429 1429 */ 1430 static DECLCALLBACK(PVUSBURB) usb EthUrbReap(PPDMUSBINS pUsbIns, RTMSINTERVAL cMillies)1431 { 1432 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);1433 LogFlow(("usb EthUrbReap/#%u: cMillies=%u\n", pUsbIns->iInstance, cMillies));1430 static DECLCALLBACK(PVUSBURB) usbNetUrbReap(PPDMUSBINS pUsbIns, RTMSINTERVAL cMillies) 1431 { 1432 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 1433 LogFlow(("usbNetUrbReap/#%u: cMillies=%u\n", pUsbIns->iInstance, cMillies)); 1434 1434 1435 1435 RTCritSectEnter(&pThis->CritSect); 1436 1436 1437 PVUSBURB pUrb = usb EthQueueRemoveHead(&pThis->DoneQueue);1437 PVUSBURB pUrb = usbNetQueueRemoveHead(&pThis->DoneQueue); 1438 1438 if (!pUrb && cMillies) 1439 1439 { … … 1447 1447 pThis->fHaveDoneQueueWaiter = false; 1448 1448 1449 pUrb = usb EthQueueRemoveHead(&pThis->DoneQueue);1449 pUrb = usbNetQueueRemoveHead(&pThis->DoneQueue); 1450 1450 } 1451 1451 … … 1453 1453 1454 1454 if (pUrb) 1455 Log(("usb EthUrbReap/#%u: pUrb=%p:%s\n", pUsbIns->iInstance, pUrb, pUrb->pszDesc));1455 Log(("usbNetUrbReap/#%u: pUrb=%p:%s\n", pUsbIns->iInstance, pUrb, pUrb->pszDesc)); 1456 1456 return pUrb; 1457 1457 } … … 1461 1461 * @interface_method_impl{PDMUSBREG,pfnWakeup} 1462 1462 */ 1463 static DECLCALLBACK(int) usb EthWakeup(PPDMUSBINS pUsbIns)1464 { 1465 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);1466 LogFlow(("usb MsdUrbReap/#%u:\n", pUsbIns->iInstance));1463 static DECLCALLBACK(int) usbNetWakeup(PPDMUSBINS pUsbIns) 1464 { 1465 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 1466 LogFlow(("usbNetUrbReap/#%u:\n", pUsbIns->iInstance)); 1467 1467 1468 1468 return RTSemEventSignal(pThis->hEvtDoneQueue); … … 1473 1473 * @interface_method_impl{PDMUSBREG,pfnUrbCancel} 1474 1474 */ 1475 static DECLCALLBACK(int) usb EthUrbCancel(PPDMUSBINS pUsbIns, PVUSBURB pUrb)1476 { 1477 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);1478 LogFlow(("usb MsdUrbCancel/#%u: pUrb=%p:%s\n", pUsbIns->iInstance, pUrb, pUrb->pszDesc));1475 static DECLCALLBACK(int) usbNetUrbCancel(PPDMUSBINS pUsbIns, PVUSBURB pUrb) 1476 { 1477 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 1478 LogFlow(("usbNetUrbCancel/#%u: pUrb=%p:%s\n", pUsbIns->iInstance, pUrb, pUrb->pszDesc)); 1479 1479 RTCritSectEnter(&pThis->CritSect); 1480 1480 … … 1482 1482 * Remove the URB from the to-host queue and move it onto the done queue. 1483 1483 */ 1484 if (usb EthQueueRemove(&pThis->ToHostQueue, pUrb))1485 usb EthLinkDone(pThis, pUrb);1486 1487 if (usb EthQueueRemove(&pThis->ToHostIntrQueue, pUrb))1488 usb EthLinkDone(pThis, pUrb);1484 if (usbNetQueueRemove(&pThis->ToHostQueue, pUrb)) 1485 usbNetLinkDone(pThis, pUrb); 1486 1487 if (usbNetQueueRemove(&pThis->ToHostIntrQueue, pUrb)) 1488 usbNetLinkDone(pThis, pUrb); 1489 1489 1490 1490 RTCritSectLeave(&pThis->CritSect); … … 1496 1496 * Handle requests sent to the outbound (to device) bulk pipe. 1497 1497 */ 1498 static int usb EthHandleBulkHostToDev(PUSBETH pThis, PUSBETHEP pEp, PVUSBURB pUrb)1498 static int usbNetHandleBulkHostToDev(PUSBNET pThis, PUSBNETEP pEp, PVUSBURB pUrb) 1499 1499 { 1500 1500 /* … … 1502 1502 */ 1503 1503 if (RT_UNLIKELY(pEp->fHalted)) 1504 return usb EthCompleteStall(pThis, NULL, pUrb, "Halted pipe");1504 return usbNetCompleteStall(pThis, NULL, pUrb, "Halted pipe"); 1505 1505 1506 1506 /* … … 1510 1510 if (pUrb->cbData < sizeof(*pNth16)) 1511 1511 { 1512 Log(("Usb Eth: Bad NTH16: cbData=%#x < min=%#x\n", pUrb->cbData, sizeof(*pNth16) ));1513 return usb EthCompleteStall(pThis, NULL, pUrb, "BAD NTH16");1512 Log(("UsbNet: Bad NTH16: cbData=%#x < min=%#x\n", pUrb->cbData, sizeof(*pNth16) )); 1513 return usbNetCompleteStall(pThis, NULL, pUrb, "BAD NTH16"); 1514 1514 } 1515 1515 if (pNth16->dwSignature != USBNCMNTH16_SIGNATURE) 1516 1516 { 1517 Log(("Usb Eth: NTH16: Invalid dwSignature value: %#x\n", pNth16->dwSignature));1518 return usb EthCompleteStall(pThis, NULL, pUrb, "Bad NTH16");1519 } 1520 Log(("Usb Eth: NTH16: wHeaderLength=%#x wSequence=%#x wBlockLength=%#x wNdpIndex=%#x cbData=%#x fShortNotOk=%RTbool\n",1517 Log(("UsbNet: NTH16: Invalid dwSignature value: %#x\n", pNth16->dwSignature)); 1518 return usbNetCompleteStall(pThis, NULL, pUrb, "Bad NTH16"); 1519 } 1520 Log(("UsbNet: NTH16: wHeaderLength=%#x wSequence=%#x wBlockLength=%#x wNdpIndex=%#x cbData=%#x fShortNotOk=%RTbool\n", 1521 1521 pNth16->wHeaderLength, pNth16->wSequence, pNth16->wBlockLength, pNth16->wNdpIndex, pUrb->cbData, pUrb->fShortNotOk)); 1522 1522 if (pNth16->wHeaderLength != sizeof(*pNth16)) 1523 1523 { 1524 Log(("Usb Eth: NTH16: Bad wHeaderLength value: %#x\n", pNth16->wHeaderLength));1525 return usb EthCompleteStall(pThis, NULL, pUrb, "Bad NTH16");1524 Log(("UsbNet: NTH16: Bad wHeaderLength value: %#x\n", pNth16->wHeaderLength)); 1525 return usbNetCompleteStall(pThis, NULL, pUrb, "Bad NTH16"); 1526 1526 1527 1527 } 1528 1528 if (pNth16->wBlockLength > pUrb->cbData) 1529 1529 { 1530 Log(("Usb Eth: NTH16: Bad wBlockLength value: %#x\n", pNth16->wBlockLength));1531 return usb EthCompleteStall(pThis, NULL, pUrb, "Bad NTH16");1530 Log(("UsbNet: NTH16: Bad wBlockLength value: %#x\n", pNth16->wBlockLength)); 1531 return usbNetCompleteStall(pThis, NULL, pUrb, "Bad NTH16"); 1532 1532 } 1533 1533 1534 1534 if (pNth16->wNdpIndex < sizeof(*pNth16)) 1535 1535 { 1536 Log(("Usb Eth: NTH16: wNdpIndex is too small: %#x (%u), at least required %#x\n",1536 Log(("UsbNet: NTH16: wNdpIndex is too small: %#x (%u), at least required %#x\n", 1537 1537 pNth16->wNdpIndex, pNth16->wNdpIndex, sizeof(*pNth16) )); 1538 return usb EthCompleteStall(pThis, NULL, pUrb, "Bad NTH16");1538 return usbNetCompleteStall(pThis, NULL, pUrb, "Bad NTH16"); 1539 1539 } 1540 1540 … … 1545 1545 if (offNdp16Next >= pUrb->cbData) 1546 1546 { 1547 Log(("Usb Eth: Bad NDP16: offNdp16Next=%#x >= cbData=%#x\n", offNdp16Next, pUrb->cbData));1548 return usb EthCompleteStall(pThis, NULL, pUrb, "BAD NDP16");1547 Log(("UsbNet: Bad NDP16: offNdp16Next=%#x >= cbData=%#x\n", offNdp16Next, pUrb->cbData)); 1548 return usbNetCompleteStall(pThis, NULL, pUrb, "BAD NDP16"); 1549 1549 } 1550 1550 … … 1553 1553 if (cbNdpMax < sizeof(*pNdp16)) 1554 1554 { 1555 Log(("Usb Eth: Bad NDP16: cbNdpMax=%#x < min=%#x\n", cbNdpMax, sizeof(*pNdp16) ));1556 return usb EthCompleteStall(pThis, NULL, pUrb, "BAD NDP16");1555 Log(("UsbNet: Bad NDP16: cbNdpMax=%#x < min=%#x\n", cbNdpMax, sizeof(*pNdp16) )); 1556 return usbNetCompleteStall(pThis, NULL, pUrb, "BAD NDP16"); 1557 1557 } 1558 1558 … … 1560 1560 && pNdp16->dwSignature != USBNCMNDP16_SIGNATURE_NCM1) 1561 1561 { 1562 Log(("Usb Eth: NDP16: Invalid dwSignature value: %#x\n", pNdp16->dwSignature));1563 return usb EthCompleteStall(pThis, NULL, pUrb, "Bad NDP16");1562 Log(("UsbNet: NDP16: Invalid dwSignature value: %#x\n", pNdp16->dwSignature)); 1563 return usbNetCompleteStall(pThis, NULL, pUrb, "Bad NDP16"); 1564 1564 } 1565 1565 … … 1568 1568 || pNdp16->wLength > cbNdpMax) 1569 1569 { 1570 Log(("Usb Eth: NDP16: Invalid size value: %#x, req. (min %#x max %#x)\n",1570 Log(("UsbNet: NDP16: Invalid size value: %#x, req. (min %#x max %#x)\n", 1571 1571 pNdp16->wLength, sizeof(*pNdp16), cbNdpMax)); 1572 return usb EthCompleteStall(pThis, NULL, pUrb, "Bad NDP16");1572 return usbNetCompleteStall(pThis, NULL, pUrb, "Bad NDP16"); 1573 1573 } 1574 1574 … … 1580 1580 int rc = pThis->Lun0.pINetwork->pfnBeginXmit(pThis->Lun0.pINetwork, true /* fOnWorkerThread */); 1581 1581 if (RT_FAILURE(rc)) 1582 return usb EthCompleteStall(pThis, NULL, pUrb, "BeginXmit failed");1582 return usbNetCompleteStall(pThis, NULL, pUrb, "BeginXmit failed"); 1583 1583 1584 1584 for (uint32_t i = 0; i < cEntries; i++) … … 1592 1592 || pDGram->wDatagramIndex >= pUrb->cbData) 1593 1593 { 1594 Log(("Usb Eth: DGRAM16: Invalid wDatagramIndex value: %#x\n", pDGram->wDatagramIndex));1595 return usb EthCompleteStall(pThis, NULL, pUrb, "Bad DGRAM16");1594 Log(("UsbNet: DGRAM16: Invalid wDatagramIndex value: %#x\n", pDGram->wDatagramIndex)); 1595 return usbNetCompleteStall(pThis, NULL, pUrb, "Bad DGRAM16"); 1596 1596 } 1597 1597 1598 1598 if (pUrb->cbData - pDGram->wDatagramIndex < pDGram->wDatagramLength) 1599 1599 { 1600 Log(("Usb Eth: DGRAM16: Invalid wDatagramLength value: %#x (max %#x)\n",1600 Log(("UsbNet: DGRAM16: Invalid wDatagramLength value: %#x (max %#x)\n", 1601 1601 pDGram->wDatagramLength, pUrb->cbData - pDGram->wDatagramIndex)); 1602 return usb EthCompleteStall(pThis, NULL, pUrb, "Bad DGRAM16");1602 return usbNetCompleteStall(pThis, NULL, pUrb, "Bad DGRAM16"); 1603 1603 } 1604 1604 … … 1612 1612 rc = pThis->Lun0.pINetwork->pfnSendBuf(pThis->Lun0.pINetwork, pSgBuf, true /* fOnWorkerThread */); 1613 1613 if (RT_FAILURE(rc)) 1614 return usb EthCompleteStall(pThis, NULL, pUrb, "SendBuf failed");1614 return usbNetCompleteStall(pThis, NULL, pUrb, "SendBuf failed"); 1615 1615 } 1616 1616 else 1617 return usb EthCompleteStall(pThis, NULL, pUrb, "AllocBuf failed");1617 return usbNetCompleteStall(pThis, NULL, pUrb, "AllocBuf failed"); 1618 1618 1619 1619 pDGram++; … … 1624 1624 else 1625 1625 { 1626 Log(("Usb Eth: NDP16: Not implemented\n"));1627 return usb EthCompleteStall(pThis, NULL, pUrb, "Bad NDP16");1626 Log(("UsbNet: NDP16: Not implemented\n")); 1627 return usbNetCompleteStall(pThis, NULL, pUrb, "Bad NDP16"); 1628 1628 } 1629 1629 … … 1631 1631 } 1632 1632 1633 return usb EthCompleteOk(pThis, pUrb, pUrb->cbData);1633 return usbNetCompleteOk(pThis, pUrb, pUrb->cbData); 1634 1634 } 1635 1635 … … 1638 1638 * Handle requests sent to the inbound (to host) bulk pipe. 1639 1639 */ 1640 static int usb EthHandleBulkDevToHost(PUSBETH pThis, PUSBETHEP pEp, PVUSBURB pUrb)1640 static int usbNetHandleBulkDevToHost(PUSBNET pThis, PUSBNETEP pEp, PVUSBURB pUrb) 1641 1641 { 1642 1642 /* … … 1645 1645 */ 1646 1646 if (RT_UNLIKELY(pEp->fHalted)) 1647 return usb EthCompleteStall(pThis, NULL, pUrb, pEp->fHalted ? "Halted pipe" : "No request");1648 1649 usb EthQueueAddTail(&pThis->ToHostQueue, pUrb);1647 return usbNetCompleteStall(pThis, NULL, pUrb, pEp->fHalted ? "Halted pipe" : "No request"); 1648 1649 usbNetQueueAddTail(&pThis->ToHostQueue, pUrb); 1650 1650 if (pThis->fHaveToHostQueueWaiter) 1651 1651 RTSemEventSignal(pThis->hEvtToHostQueue); 1652 1652 1653 LogFlow(("usb EthHandleBulkDevToHost: Added %p:%s to the to-host queue\n", pUrb, pUrb->pszDesc));1653 LogFlow(("usbNetHandleBulkDevToHost: Added %p:%s to the to-host queue\n", pUrb, pUrb->pszDesc)); 1654 1654 return VINF_SUCCESS; 1655 1655 } … … 1659 1659 * Handle requests sent to the inbound (to host) interrupt pipe. 1660 1660 */ 1661 static int usb EthHandleIntrDevToHost(PUSBETH pThis, PUSBETHEP pEp, PVUSBURB pUrb)1661 static int usbNetHandleIntrDevToHost(PUSBNET pThis, PUSBNETEP pEp, PVUSBURB pUrb) 1662 1662 { 1663 1663 /* Stall the request if the pipe is halted. */ 1664 1664 if (RT_UNLIKELY(pEp->fHalted)) 1665 return usb EthCompleteStall(pThis, NULL, pUrb, pEp->fHalted ? "Halted pipe" : "No request");1665 return usbNetCompleteStall(pThis, NULL, pUrb, pEp->fHalted ? "Halted pipe" : "No request"); 1666 1666 1667 1667 if (!pThis->fInitialLinkStatusSent) … … 1673 1673 LinkNotification.wIndex = 0; 1674 1674 LinkNotification.wLength = 0; 1675 usb EthCompleteNotificationOk(pThis, pUrb, &LinkNotification, sizeof(LinkNotification));1675 usbNetCompleteNotificationOk(pThis, pUrb, &LinkNotification, sizeof(LinkNotification)); 1676 1676 pThis->fInitialLinkStatusSent = true; 1677 1677 } … … 1686 1686 SpeedChange.DLBitRate = UINT32_MAX; 1687 1687 SpeedChange.ULBitRate = UINT32_MAX; 1688 usb EthCompleteNotificationOk(pThis, pUrb, &SpeedChange, sizeof(SpeedChange));1688 usbNetCompleteNotificationOk(pThis, pUrb, &SpeedChange, sizeof(SpeedChange)); 1689 1689 pThis->fInitialSpeedChangeSent = true; 1690 1690 } 1691 1691 else 1692 usb EthQueueAddTail(&pThis->ToHostIntrQueue, pUrb);1693 1694 LogFlow(("usb EthHandleIntrDevToHost: Added %p:%s to the to-host interrupt queue\n", pUrb, pUrb->pszDesc));1692 usbNetQueueAddTail(&pThis->ToHostIntrQueue, pUrb); 1693 1694 LogFlow(("usbNetHandleIntrDevToHost: Added %p:%s to the to-host interrupt queue\n", pUrb, pUrb->pszDesc)); 1695 1695 return VINF_SUCCESS; 1696 1696 } … … 1700 1700 * Handles request send to the default control pipe. 1701 1701 */ 1702 static int usb EthHandleDefaultPipe(PUSBETH pThis, PUSBETHEP pEp, PVUSBURB pUrb)1702 static int usbNetHandleDefaultPipe(PUSBNET pThis, PUSBNETEP pEp, PVUSBURB pUrb) 1703 1703 { 1704 1704 PVUSBSETUP pSetup = (PVUSBSETUP)&pUrb->abData[0]; … … 1713 1713 if (pSetup->bmRequestType != (VUSB_TO_DEVICE | VUSB_REQ_STANDARD | VUSB_DIR_TO_HOST)) 1714 1714 { 1715 Log(("Usb Eth: Bad GET_DESCRIPTOR req: bmRequestType=%#x\n", pSetup->bmRequestType));1716 return usb EthCompleteStall(pThis, pEp, pUrb, "Bad GET_DESCRIPTOR");1715 Log(("UsbNet: Bad GET_DESCRIPTOR req: bmRequestType=%#x\n", pSetup->bmRequestType)); 1716 return usbNetCompleteStall(pThis, pEp, pUrb, "Bad GET_DESCRIPTOR"); 1717 1717 } 1718 1718 … … 1722 1722 1723 1723 case VUSB_DT_STRING: 1724 Log(("Usb Eth: GET_DESCRIPTOR DT_STRING wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex));1724 Log(("UsbNet: GET_DESCRIPTOR DT_STRING wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex)); 1725 1725 break; 1726 1726 case VUSB_DT_DEVICE_QUALIFIER: 1727 Log(("Usb Eth: GET_DESCRIPTOR DT_DEVICE_QUALIFIER wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex));1727 Log(("UsbNet: GET_DESCRIPTOR DT_DEVICE_QUALIFIER wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex)); 1728 1728 /* Returned data is written after the setup message. */ 1729 1729 cbCopy = pUrb->cbData - sizeof(*pSetup); 1730 cbCopy = RT_MIN(cbCopy, sizeof(g_Usb EthDeviceQualifier));1731 memcpy(&pUrb->abData[sizeof(*pSetup)], &g_Usb EthDeviceQualifier, cbCopy);1732 return usb EthCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));1730 cbCopy = RT_MIN(cbCopy, sizeof(g_UsbNetDeviceQualifier)); 1731 memcpy(&pUrb->abData[sizeof(*pSetup)], &g_UsbNetDeviceQualifier, cbCopy); 1732 return usbNetCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup)); 1733 1733 case VUSB_DT_BOS: 1734 Log(("Usb Eth: GET_DESCRIPTOR DT_BOS wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex));1734 Log(("UsbNet: GET_DESCRIPTOR DT_BOS wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex)); 1735 1735 /* Returned data is written after the setup message. */ 1736 1736 cbCopy = pUrb->cbData - sizeof(*pSetup); 1737 cbCopy = RT_MIN(cbCopy, sizeof(g_Usb EthBOS));1738 memcpy(&pUrb->abData[sizeof(*pSetup)], &g_Usb EthBOS, cbCopy);1739 return usb EthCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));1737 cbCopy = RT_MIN(cbCopy, sizeof(g_UsbNetBOS)); 1738 memcpy(&pUrb->abData[sizeof(*pSetup)], &g_UsbNetBOS, cbCopy); 1739 return usbNetCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup)); 1740 1740 default: 1741 Log(("Usb Eth: GET_DESCRIPTOR, huh? wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex));1741 Log(("UsbNet: GET_DESCRIPTOR, huh? wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex)); 1742 1742 break; 1743 1743 } … … 1752 1752 if (pSetup->wLength != 2) 1753 1753 { 1754 LogRelFlow(("Usb Eth: Bad GET_STATUS req: wLength=%#x\n",1754 LogRelFlow(("UsbNet: Bad GET_STATUS req: wLength=%#x\n", 1755 1755 pSetup->wLength)); 1756 1756 break; … … 1762 1762 { 1763 1763 Assert(pSetup->wIndex == 0); 1764 LogRelFlow(("Usb Eth: GET_STATUS (device)\n"));1764 LogRelFlow(("UsbNet: GET_STATUS (device)\n")); 1765 1765 wRet = 0; /* Not self-powered, no remote wakeup. */ 1766 1766 cbCopy = pUrb->cbData - sizeof(*pSetup); 1767 1767 cbCopy = RT_MIN(cbCopy, sizeof(wRet)); 1768 1768 memcpy(&pUrb->abData[sizeof(*pSetup)], &wRet, cbCopy); 1769 return usb EthCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));1769 return usbNetCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup)); 1770 1770 } 1771 1771 … … 1777 1777 cbCopy = RT_MIN(cbCopy, sizeof(wRet)); 1778 1778 memcpy(&pUrb->abData[sizeof(*pSetup)], &wRet, cbCopy); 1779 return usb EthCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));1779 return usbNetCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup)); 1780 1780 } 1781 LogRelFlow(("Usb Eth: GET_STATUS (interface) invalid, wIndex=%#x\n", pSetup->wIndex));1781 LogRelFlow(("UsbNet: GET_STATUS (interface) invalid, wIndex=%#x\n", pSetup->wIndex)); 1782 1782 break; 1783 1783 } … … 1791 1791 cbCopy = RT_MIN(cbCopy, sizeof(wRet)); 1792 1792 memcpy(&pUrb->abData[sizeof(*pSetup)], &wRet, cbCopy); 1793 return usb EthCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));1793 return usbNetCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup)); 1794 1794 } 1795 LogRelFlow(("Usb Eth: GET_STATUS (endpoint) invalid, wIndex=%#x\n", pSetup->wIndex));1795 LogRelFlow(("UsbNet: GET_STATUS (endpoint) invalid, wIndex=%#x\n", pSetup->wIndex)); 1796 1796 break; 1797 1797 } 1798 1798 1799 1799 default: 1800 LogRelFlow(("Usb Eth: Bad GET_STATUS req: bmRequestType=%#x\n",1800 LogRelFlow(("UsbNet: Bad GET_STATUS req: bmRequestType=%#x\n", 1801 1801 pSetup->bmRequestType)); 1802 return usb EthCompleteStall(pThis, pEp, pUrb, "Bad GET_STATUS");1802 return usbNetCompleteStall(pThis, pEp, pUrb, "Bad GET_STATUS"); 1803 1803 } 1804 1804 break; … … 1813 1813 1814 1814 /** @todo implement this. */ 1815 Log(("Usb Eth: Implement standard request: bmRequestType=%#x bRequest=%#x wValue=%#x wIndex=%#x wLength=%#x\n",1815 Log(("UsbNet: Implement standard request: bmRequestType=%#x bRequest=%#x wValue=%#x wIndex=%#x wLength=%#x\n", 1816 1816 pSetup->bmRequestType, pSetup->bRequest, pSetup->wValue, pSetup->wIndex, pSetup->wLength)); 1817 1817 1818 usb EthCompleteStall(pThis, pEp, pUrb, "TODO: standard request stuff");1818 usbNetCompleteStall(pThis, pEp, pUrb, "TODO: standard request stuff"); 1819 1819 } 1820 1820 else if ((pSetup->bmRequestType & VUSB_REQ_MASK) == VUSB_REQ_CLASS) … … 1826 1826 if (pSetup->bmRequestType != (VUSB_TO_INTERFACE | VUSB_REQ_CLASS | VUSB_DIR_TO_HOST)) 1827 1827 { 1828 Log(("Usb Eth: Bad GET_NTB_PARAMETERS req: bmRequestType=%#x\n", pSetup->bmRequestType));1829 return usb EthCompleteStall(pThis, pEp, pUrb, "Bad GET_NTB_PARAMETERS");1828 Log(("UsbNet: Bad GET_NTB_PARAMETERS req: bmRequestType=%#x\n", pSetup->bmRequestType)); 1829 return usbNetCompleteStall(pThis, pEp, pUrb, "Bad GET_NTB_PARAMETERS"); 1830 1830 } 1831 1831 … … 1848 1848 cbCopy = RT_MIN(cbCopy, sizeof(NtbParams)); 1849 1849 memcpy(&pUrb->abData[sizeof(*pSetup)], &NtbParams, cbCopy); 1850 return usb EthCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));1850 return usbNetCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup)); 1851 1851 } 1852 1852 … … 1855 1855 } 1856 1856 1857 usb EthCompleteStall(pThis, pEp, pUrb, "CLASS_REQ");1857 usbNetCompleteStall(pThis, pEp, pUrb, "CLASS_REQ"); 1858 1858 } 1859 1859 else 1860 1860 { 1861 Log(("Usb Eth: Unknown control msg: bmRequestType=%#x bRequest=%#x wValue=%#x wIndex=%#x wLength=%#x\n",1861 Log(("UsbNet: Unknown control msg: bmRequestType=%#x bRequest=%#x wValue=%#x wIndex=%#x wLength=%#x\n", 1862 1862 pSetup->bmRequestType, pSetup->bRequest, pSetup->wValue, pSetup->wIndex, pSetup->wLength)); 1863 return usb EthCompleteStall(pThis, pEp, pUrb, "Unknown control msg");1863 return usbNetCompleteStall(pThis, pEp, pUrb, "Unknown control msg"); 1864 1864 } 1865 1865 … … 1871 1871 * @interface_method_impl{PDMUSBREG,pfnUrbQueue} 1872 1872 */ 1873 static DECLCALLBACK(int) usb EthQueue(PPDMUSBINS pUsbIns, PVUSBURB pUrb)1874 { 1875 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);1876 LogFlow(("usb EthQueue/#%u: pUrb=%p:%s EndPt=%#x\n", pUsbIns->iInstance, pUrb, pUrb->pszDesc, pUrb->EndPt));1873 static DECLCALLBACK(int) usbNetQueue(PPDMUSBINS pUsbIns, PVUSBURB pUrb) 1874 { 1875 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 1876 LogFlow(("usbNetQueue/#%u: pUrb=%p:%s EndPt=%#x\n", pUsbIns->iInstance, pUrb, pUrb->pszDesc, pUrb->EndPt)); 1877 1877 RTCritSectEnter(&pThis->CritSect); 1878 1878 … … 1884 1884 { 1885 1885 case 0: 1886 rc = usb EthHandleDefaultPipe(pThis, &pThis->aEps[0], pUrb);1886 rc = usbNetHandleDefaultPipe(pThis, &pThis->aEps[0], pUrb); 1887 1887 break; 1888 1888 … … 1891 1891 RT_FALL_THRU(); 1892 1892 case 0x01: 1893 rc = usb EthHandleBulkDevToHost(pThis, &pThis->aEps[1], pUrb);1893 rc = usbNetHandleBulkDevToHost(pThis, &pThis->aEps[1], pUrb); 1894 1894 break; 1895 1895 1896 1896 case 0x02: 1897 rc = usb EthHandleBulkHostToDev(pThis, &pThis->aEps[2], pUrb);1897 rc = usbNetHandleBulkHostToDev(pThis, &pThis->aEps[2], pUrb); 1898 1898 break; 1899 1899 1900 1900 case 0x03: 1901 rc = usb EthHandleIntrDevToHost(pThis, &pThis->aEps[3], pUrb);1901 rc = usbNetHandleIntrDevToHost(pThis, &pThis->aEps[3], pUrb); 1902 1902 break; 1903 1903 … … 1916 1916 * @interface_method_impl{PDMUSBREG,pfnUsbClearHaltedEndpoint} 1917 1917 */ 1918 static DECLCALLBACK(int) usb EthUsbClearHaltedEndpoint(PPDMUSBINS pUsbIns, unsigned uEndpoint)1919 { 1920 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);1921 LogFlow(("usb EthUsbClearHaltedEndpoint/#%u: uEndpoint=%#x\n", pUsbIns->iInstance, uEndpoint));1918 static DECLCALLBACK(int) usbNetUsbClearHaltedEndpoint(PPDMUSBINS pUsbIns, unsigned uEndpoint) 1919 { 1920 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 1921 LogFlow(("usbNetUsbClearHaltedEndpoint/#%u: uEndpoint=%#x\n", pUsbIns->iInstance, uEndpoint)); 1922 1922 1923 1923 if ((uEndpoint & ~0x80) < RT_ELEMENTS(pThis->aEps)) … … 1935 1935 * @interface_method_impl{PDMUSBREG,pfnUsbSetInterface} 1936 1936 */ 1937 static DECLCALLBACK(int) usb EthUsbSetInterface(PPDMUSBINS pUsbIns, uint8_t bInterfaceNumber, uint8_t bAlternateSetting)1937 static DECLCALLBACK(int) usbNetUsbSetInterface(PPDMUSBINS pUsbIns, uint8_t bInterfaceNumber, uint8_t bAlternateSetting) 1938 1938 { 1939 1939 RT_NOREF(bInterfaceNumber); 1940 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);1941 LogFlow(("usb EthUsbSetInterface/#%u: bInterfaceNumber=%u bAlternateSetting=%u\n", pUsbIns->iInstance, bInterfaceNumber, bAlternateSetting));1940 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 1941 LogFlow(("usbNetUsbSetInterface/#%u: bInterfaceNumber=%u bAlternateSetting=%u\n", pUsbIns->iInstance, bInterfaceNumber, bAlternateSetting)); 1942 1942 Assert(bAlternateSetting == 0 || bAlternateSetting == 1); 1943 1943 if (pThis->bAlternateSetting != bAlternateSetting) … … 1946 1946 { 1947 1947 /* This is some kind of reset. */ 1948 usb EthResetWorker(pThis, NULL, true /*fSetConfig*/);1948 usbNetResetWorker(pThis, NULL, true /*fSetConfig*/); 1949 1949 } 1950 1950 else … … 1964 1964 * @interface_method_impl{PDMUSBREG,pfnUsbSetConfiguration} 1965 1965 */ 1966 static DECLCALLBACK(int) usb EthUsbSetConfiguration(PPDMUSBINS pUsbIns, uint8_t bConfigurationValue,1966 static DECLCALLBACK(int) usbNetUsbSetConfiguration(PPDMUSBINS pUsbIns, uint8_t bConfigurationValue, 1967 1967 const void *pvOldCfgDesc, const void *pvOldIfState, const void *pvNewCfgDesc) 1968 1968 { 1969 1969 RT_NOREF(pvOldCfgDesc, pvOldIfState, pvNewCfgDesc); 1970 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);1971 LogFlow(("usb EthUsbSetConfiguration/#%u: bConfigurationValue=%u\n", pUsbIns->iInstance, bConfigurationValue));1970 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 1971 LogFlow(("usbNetUsbSetConfiguration/#%u: bConfigurationValue=%u\n", pUsbIns->iInstance, bConfigurationValue)); 1972 1972 Assert(bConfigurationValue == 1); 1973 1973 RTCritSectEnter(&pThis->CritSect); … … 1977 1977 */ 1978 1978 if (pThis->bConfigurationValue == bConfigurationValue) 1979 usb EthResetWorker(pThis, NULL, true /*fSetConfig*/); /** @todo figure out the exact difference */1979 usbNetResetWorker(pThis, NULL, true /*fSetConfig*/); /** @todo figure out the exact difference */ 1980 1980 pThis->bConfigurationValue = bConfigurationValue; 1981 1981 … … 1988 1988 * @interface_method_impl{PDMUSBREG,pfnUsbGetDescriptorCache} 1989 1989 */ 1990 static DECLCALLBACK(PCPDMUSBDESCCACHE) usb EthUsbGetDescriptorCache(PPDMUSBINS pUsbIns)1991 { 1992 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);1993 LogFlow(("usb EthUsbGetDescriptorCache/#%u:\n", pUsbIns->iInstance));1990 static DECLCALLBACK(PCPDMUSBDESCCACHE) usbNetUsbGetDescriptorCache(PPDMUSBINS pUsbIns) 1991 { 1992 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 1993 LogFlow(("usbNetUsbGetDescriptorCache/#%u:\n", pUsbIns->iInstance)); 1994 1994 return &pThis->UsbDescCache; 1995 1995 } … … 1999 1999 * @interface_method_impl{PDMUSBREG,pfnUsbReset} 2000 2000 */ 2001 static DECLCALLBACK(int) usb EthUsbReset(PPDMUSBINS pUsbIns, bool fResetOnLinux)2001 static DECLCALLBACK(int) usbNetUsbReset(PPDMUSBINS pUsbIns, bool fResetOnLinux) 2002 2002 { 2003 2003 RT_NOREF(fResetOnLinux); 2004 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);2005 LogFlow(("usb EthUsbReset/#%u:\n", pUsbIns->iInstance));2004 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 2005 LogFlow(("usbNetUsbReset/#%u:\n", pUsbIns->iInstance)); 2006 2006 RTCritSectEnter(&pThis->CritSect); 2007 2007 2008 int rc = usb EthResetWorker(pThis, NULL, false /*fSetConfig*/);2008 int rc = usbNetResetWorker(pThis, NULL, false /*fSetConfig*/); 2009 2009 2010 2010 RTCritSectLeave(&pThis->CritSect); … … 2016 2016 * @interface_method_impl{PDMUSBREG,pfnDriverAttach} 2017 2017 */ 2018 static DECLCALLBACK(int) usb EthDriverAttach(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags)2018 static DECLCALLBACK(int) usbNetDriverAttach(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags) 2019 2019 { 2020 2020 RT_NOREF(fFlags); 2021 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);2022 2023 LogFlow(("usb EthDriverAttach/#%u:\n", pUsbIns->iInstance));2024 2025 AssertMsg(iLUN == 0, ("Usb Eth: No other LUN than 0 is supported\n"));2021 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 2022 2023 LogFlow(("usbNetDriverAttach/#%u:\n", pUsbIns->iInstance)); 2024 2025 AssertMsg(iLUN == 0, ("UsbNet: No other LUN than 0 is supported\n")); 2026 2026 AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG, 2027 ("Usb Eth: Device does not support hotplugging\n"));2027 ("UsbNet: Device does not support hotplugging\n")); 2028 2028 2029 2029 /* the usual paranoia */ … … 2057 2057 * @interface_method_impl{PDMUSBREG,pfnDriverDetach} 2058 2058 */ 2059 static DECLCALLBACK(void) usb EthDriverDetach(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags)2059 static DECLCALLBACK(void) usbNetDriverDetach(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags) 2060 2060 { 2061 2061 RT_NOREF(iLUN, fFlags); 2062 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);2063 2064 LogFlow(("usb EthDriverDetach/#%u:\n", pUsbIns->iInstance));2065 2066 AssertMsg(iLUN == 0, ("Usb Eth: No other LUN than 0 is supported\n"));2062 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 2063 2064 LogFlow(("usbNetDriverDetach/#%u:\n", pUsbIns->iInstance)); 2065 2066 AssertMsg(iLUN == 0, ("UsbNet: No other LUN than 0 is supported\n")); 2067 2067 AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG, 2068 ("Usb Eth: Device does not support hotplugging\n"));2068 ("UsbNet: Device does not support hotplugging\n")); 2069 2069 2070 2070 /* … … 2079 2079 * @interface_method_impl{PDMUSBREG,pfnVMReset} 2080 2080 */ 2081 static DECLCALLBACK(void) usb EthVMReset(PPDMUSBINS pUsbIns)2082 { 2083 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);2084 2085 int rc = usb EthResetWorker(pThis, NULL, false /*fSetConfig*/);2081 static DECLCALLBACK(void) usbNetVMReset(PPDMUSBINS pUsbIns) 2082 { 2083 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 2084 2085 int rc = usbNetResetWorker(pThis, NULL, false /*fSetConfig*/); 2086 2086 AssertRC(rc); 2087 2087 } … … 2091 2091 * @interface_method_impl{PDMUSBREG,pfnDestruct} 2092 2092 */ 2093 static DECLCALLBACK(void) usb EthDestruct(PPDMUSBINS pUsbIns)2093 static DECLCALLBACK(void) usbNetDestruct(PPDMUSBINS pUsbIns) 2094 2094 { 2095 2095 PDMUSB_CHECK_VERSIONS_RETURN_VOID(pUsbIns); 2096 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);2097 LogFlow(("usb EthDestruct/#%u:\n", pUsbIns->iInstance));2096 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 2097 LogFlow(("usbNetDestruct/#%u:\n", pUsbIns->iInstance)); 2098 2098 2099 2099 if (RTCritSectIsInitialized(&pThis->CritSect)) … … 2127 2127 * @interface_method_impl{PDMUSBREG,pfnConstruct} 2128 2128 */ 2129 static DECLCALLBACK(int) usb EthConstruct(PPDMUSBINS pUsbIns, int iInstance, PCFGMNODE pCfg, PCFGMNODE pCfgGlobal)2129 static DECLCALLBACK(int) usbNetConstruct(PPDMUSBINS pUsbIns, int iInstance, PCFGMNODE pCfg, PCFGMNODE pCfgGlobal) 2130 2130 { 2131 2131 RT_NOREF(pCfgGlobal); 2132 2132 PDMUSB_CHECK_VERSIONS_RETURN(pUsbIns); 2133 PUSB ETH pThis = PDMINS_2_DATA(pUsbIns, PUSBETH);2133 PUSBNET pThis = PDMINS_2_DATA(pUsbIns, PUSBNET); 2134 2134 PCPDMUSBHLP pHlp = pUsbIns->pHlpR3; 2135 2135 2136 Log(("usb MsdConstruct/#%u:\n", iInstance));2136 Log(("usbNetConstruct/#%u:\n", iInstance)); 2137 2137 2138 2138 /* … … 2145 2145 pThis->hEvtReset = NIL_RTSEMEVENTMULTI; 2146 2146 /* IBase */ 2147 pThis->Lun0.IBase.pfnQueryInterface = usb EthLun0QueryInterface;2147 pThis->Lun0.IBase.pfnQueryInterface = usbNetLun0QueryInterface; 2148 2148 /* INetworkPort */ 2149 pThis->Lun0.INetworkDown.pfnWaitReceiveAvail = usb EthNetworkDown_WaitReceiveAvail;2150 pThis->Lun0.INetworkDown.pfnReceive = usb EthNetworkDown_Receive;2151 pThis->Lun0.INetworkDown.pfnXmitPending = usb EthNetworkDown_XmitPending;2149 pThis->Lun0.INetworkDown.pfnWaitReceiveAvail = usbNetNetworkDown_WaitReceiveAvail; 2150 pThis->Lun0.INetworkDown.pfnReceive = usbNetNetworkDown_Receive; 2151 pThis->Lun0.INetworkDown.pfnXmitPending = usbNetNetworkDown_XmitPending; 2152 2152 /* INetworkConfig */ 2153 pThis->Lun0.INetworkConfig.pfnGetMac = usb EthGetMac;2154 pThis->Lun0.INetworkConfig.pfnGetLinkState = usb EthGetLinkState;2155 pThis->Lun0.INetworkConfig.pfnSetLinkState = usb EthSetLinkState;2156 2157 usb EthQueueInit(&pThis->ToHostQueue);2158 usb EthQueueInit(&pThis->ToHostIntrQueue);2159 usb EthQueueInit(&pThis->DoneQueue);2153 pThis->Lun0.INetworkConfig.pfnGetMac = usbNetGetMac; 2154 pThis->Lun0.INetworkConfig.pfnGetLinkState = usbNetGetLinkState; 2155 pThis->Lun0.INetworkConfig.pfnSetLinkState = usbNetSetLinkState; 2156 2157 usbNetQueueInit(&pThis->ToHostQueue); 2158 usbNetQueueInit(&pThis->ToHostIntrQueue); 2159 usbNetQueueInit(&pThis->DoneQueue); 2160 2160 2161 2161 int rc = RTCritSectInit(&pThis->CritSect); … … 2178 2178 "CableConnected|" 2179 2179 "LinkUpDelay|" 2180 , "Config", "Usb Eth", iInstance);2180 , "Config", "UsbNet", iInstance); 2181 2181 if (RT_FAILURE(rc)) 2182 2182 return rc; … … 2199 2199 rc = PDMUsbHlpDriverAttach(pUsbIns, 0 /*iLun*/, &pThis->Lun0.IBase, &pThis->Lun0.pIBase, "Network Port"); 2200 2200 if (RT_FAILURE(rc)) 2201 return PDMUsbHlpVMSetError(pUsbIns, rc, RT_SRC_POS, N_("USB ETHfailed to attach network driver"));2201 return PDMUsbHlpVMSetError(pUsbIns, rc, RT_SRC_POS, N_("USBNET failed to attach network driver")); 2202 2202 pThis->Lun0.pINetwork = PDMIBASE_QUERY_INTERFACE(pThis->Lun0.pIBase, PDMINETWORKUP); 2203 2203 if (!pThis->Lun0.pINetwork) 2204 2204 return PDMUsbHlpVMSetError(pUsbIns, VERR_PDM_MISSING_INTERFACE_BELOW, RT_SRC_POS, 2205 N_("USB ETHfailed to query the PDMINETWORKUP from the driver below it"));2205 N_("USBNET failed to query the PDMINETWORKUP from the driver below it")); 2206 2206 2207 2207 /* 2208 2208 * Build the USB descriptors. 2209 2209 */ 2210 pThis->aUsbStringsEnUs[0].idx = USB ETH_STR_ID_MANUFACTURER;2210 pThis->aUsbStringsEnUs[0].idx = USBNET_STR_ID_MANUFACTURER; 2211 2211 pThis->aUsbStringsEnUs[0].psz = "VirtualBox"; 2212 2212 2213 pThis->aUsbStringsEnUs[1].idx = USB ETH_STR_ID_PRODUCT;2213 pThis->aUsbStringsEnUs[1].idx = USBNET_STR_ID_PRODUCT; 2214 2214 pThis->aUsbStringsEnUs[1].psz = "USB Ethernet"; 2215 2215 … … 2218 2218 AssertReturn(cch + 1 == sizeof(pThis->aszMac), VERR_INTERNAL_ERROR_4); 2219 2219 2220 pThis->aUsbStringsEnUs[2].idx = USB ETH_STR_ID_MAC_ADDRESS;2220 pThis->aUsbStringsEnUs[2].idx = USBNET_STR_ID_MAC_ADDRESS; 2221 2221 pThis->aUsbStringsEnUs[2].psz = &pThis->aszMac[0]; 2222 2222 … … 2235 2235 case VUSB_SPEED_SUPERPLUS: 2236 2236 { 2237 pThis->UsbDescCache.pDevice = &g_Usb EthDeviceDesc30;2238 pThis->UsbDescCache.paConfigs = &g_Usb EthConfigDescSS;2237 pThis->UsbDescCache.pDevice = &g_UsbNetDeviceDesc30; 2238 pThis->UsbDescCache.paConfigs = &g_UsbNetConfigDescSS; 2239 2239 break; 2240 2240 } 2241 2241 case VUSB_SPEED_HIGH: 2242 2242 { 2243 pThis->UsbDescCache.pDevice = &g_Usb EthDeviceDesc20;2244 pThis->UsbDescCache.paConfigs = &g_Usb EthConfigDescHS;2243 pThis->UsbDescCache.pDevice = &g_UsbNetDeviceDesc20; 2244 pThis->UsbDescCache.paConfigs = &g_UsbNetConfigDescHS; 2245 2245 break; 2246 2246 } … … 2248 2248 case VUSB_SPEED_LOW: 2249 2249 { 2250 pThis->UsbDescCache.pDevice = &g_Usb EthDeviceDesc20;2251 pThis->UsbDescCache.paConfigs = &g_Usb EthConfigDescFS;2250 pThis->UsbDescCache.pDevice = &g_UsbNetDeviceDesc20; 2251 pThis->UsbDescCache.paConfigs = &g_UsbNetConfigDescFS; 2252 2252 break; 2253 2253 } … … 2263 2263 * The USB Communications Device Class, Network Control Model (CDC NCM) registration record. 2264 2264 */ 2265 const PDMUSBREG g_Usb Eth=2265 const PDMUSBREG g_UsbNet = 2266 2266 { 2267 2267 /* u32Version */ 2268 2268 PDM_USBREG_VERSION, 2269 2269 /* szName */ 2270 "Usb Eth",2270 "UsbNet", 2271 2271 /* pszDescription */ 2272 2272 "USB Communications Device Class, one LUN.", … … 2276 2276 ~0U, 2277 2277 /* cbInstance */ 2278 sizeof(USB ETH),2278 sizeof(USBNET), 2279 2279 /* pfnConstruct */ 2280 usb EthConstruct,2280 usbNetConstruct, 2281 2281 /* pfnDestruct */ 2282 usb EthDestruct,2282 usbNetDestruct, 2283 2283 /* pfnVMInitComplete */ 2284 2284 NULL, … … 2286 2286 NULL, 2287 2287 /* pfnVMReset */ 2288 usb EthVMReset,2288 usbNetVMReset, 2289 2289 /* pfnVMSuspend */ 2290 2290 NULL, … … 2298 2298 NULL, 2299 2299 /* pfnDriverAttach */ 2300 usb EthDriverAttach,2300 usbNetDriverAttach, 2301 2301 /* pfnDriverDetach */ 2302 usb EthDriverDetach,2302 usbNetDriverDetach, 2303 2303 /* pfnQueryInterface */ 2304 2304 NULL, 2305 2305 /* pfnUsbReset */ 2306 usb EthUsbReset,2307 /* pfnUsbGet CachedDescriptors*/2308 usb EthUsbGetDescriptorCache,2306 usbNetUsbReset, 2307 /* pfnUsbGetDescriptorCache */ 2308 usbNetUsbGetDescriptorCache, 2309 2309 /* pfnUsbSetConfiguration */ 2310 usb EthUsbSetConfiguration,2310 usbNetUsbSetConfiguration, 2311 2311 /* pfnUsbSetInterface */ 2312 usb EthUsbSetInterface,2312 usbNetUsbSetInterface, 2313 2313 /* pfnUsbClearHaltedEndpoint */ 2314 usb EthUsbClearHaltedEndpoint,2314 usbNetUsbClearHaltedEndpoint, 2315 2315 /* pfnUrbNew */ 2316 NULL/*usb EthUrbNew*/,2316 NULL/*usbNetUrbNew*/, 2317 2317 /* pfnQueue */ 2318 usb EthQueue,2318 usbNetQueue, 2319 2319 /* pfnUrbCancel */ 2320 usb EthUrbCancel,2320 usbNetUrbCancel, 2321 2321 /* pfnUrbReap */ 2322 usb EthUrbReap,2322 usbNetUrbReap, 2323 2323 /* pfnWakeup */ 2324 usb EthWakeup,2324 usbNetWakeup, 2325 2325 /* u32TheEnd */ 2326 2326 PDM_USBREG_VERSION -
trunk/src/VBox/Devices/build/VBoxDD.cpp
r106345 r107242 534 534 if (RT_FAILURE(rc)) 535 535 return rc; 536 rc = pCallbacks->pfnRegister(pCallbacks, &g_Usb Eth);536 rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbNet); 537 537 if (RT_FAILURE(rc)) 538 538 return rc; -
trunk/src/VBox/Devices/build/VBoxDD.h
r106521 r107242 205 205 extern const PDMUSBREG g_UsbHidKbd; 206 206 extern const PDMUSBREG g_UsbHidMou; 207 extern const PDMUSBREG g_Usb Eth;207 extern const PDMUSBREG g_UsbNet; 208 208 #endif 209 209 #ifdef VBOX_WITH_USB_VIDEO_IMPL
Note:
See TracChangeset
for help on using the changeset viewer.